summaryrefslogtreecommitdiff
path: root/svx/source/svdraw
diff options
context:
space:
mode:
authorArmin Weiss <aw@openoffice.org>2000-10-30 10:20:51 +0000
committerArmin Weiss <aw@openoffice.org>2000-10-30 10:20:51 +0000
commitb0c2ec72ff171d8b4303d39f11f67497e88e2d8c (patch)
tree86b80ee5e7a267717757077f9873a79e96b4cdcd /svx/source/svdraw
parent2f420692d6201815297359380c7c7e840c2e1151 (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/svdraw')
-rw-r--r--svx/source/svdraw/svdattr.cxx171
-rw-r--r--svx/source/svdraw/svdcrtv.cxx55
-rw-r--r--svx/source/svdraw/svdedtv.cxx14
-rw-r--r--svx/source/svdraw/svdedtv1.cxx126
-rw-r--r--svx/source/svdraw/svdedtv2.cxx26
-rw-r--r--svx/source/svdraw/svdedxv.cxx32
-rw-r--r--svx/source/svdraw/svdfmtf.cxx28
-rw-r--r--svx/source/svdraw/svdfppt.cxx32
-rw-r--r--svx/source/svdraw/svdhdl.cxx25
-rw-r--r--svx/source/svdraw/svdmodel.cxx137
-rw-r--r--svx/source/svdraw/svdmrkv.cxx27
-rw-r--r--svx/source/svdraw/svdoattr.cxx2236
-rw-r--r--svx/source/svdraw/svdobj.cxx309
-rw-r--r--svx/source/svdraw/svdocapt.cxx314
-rw-r--r--svx/source/svdraw/svdocirc.cxx487
-rw-r--r--svx/source/svdraw/svdoedge.cxx556
-rw-r--r--svx/source/svdraw/svdograf.cxx333
-rw-r--r--svx/source/svdraw/svdogrp.cxx202
-rw-r--r--svx/source/svdraw/svdomeas.cxx606
-rw-r--r--svx/source/svdraw/svdopath.cxx41
-rw-r--r--svx/source/svdraw/svdorect.cxx107
-rw-r--r--svx/source/svdraw/svdotext.cxx313
-rw-r--r--svx/source/svdraw/svdotxat.cxx501
-rw-r--r--svx/source/svdraw/svdotxed.cxx18
-rw-r--r--svx/source/svdraw/svdotxtr.cxx21
-rw-r--r--svx/source/svdraw/svdouno.cxx21
-rw-r--r--svx/source/svdraw/svdovirt.cxx51
-rw-r--r--svx/source/svdraw/svdpage.cxx10
-rw-r--r--svx/source/svdraw/svdpagv.cxx22
-rw-r--r--svx/source/svdraw/svdtxhdl.cxx19
-rw-r--r--svx/source/svdraw/svdundo.cxx66
-rw-r--r--svx/source/svdraw/svdxcgv.cxx24
32 files changed, 4604 insertions, 2326 deletions
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
index 3b1a89343522..d4a12eef5a2c 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdattr.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: ka $ $Date: 2000-10-11 09:38:35 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -130,6 +130,10 @@
#include <xflclit.hxx>
#include <xlineit0.hxx>
+#ifndef _SVX3DITEMS_HXX
+#include <svx3ditems.hxx>
+#endif
+
using namespace ::rtl;
using namespace ::com::sun::star;
@@ -153,9 +157,9 @@ SdrItemPool::SdrItemPool(SfxItemPool* pMaster, USHORT nAttrStart, USHORT nAttrEn
void SdrItemPool::Ctor(SfxItemPool* pMaster, USHORT nAttrStart, USHORT nAttrEnd)
{
-#ifdef SDRDEFITEMCACHE
- pDefLineAttr=NULL;
-#endif SDRDEFITEMCACHE
+//-/#ifdef SDRDEFITEMCACHE
+//-/ pDefLineAttr=NULL;
+//-/#endif SDRDEFITEMCACHE
if (pMaster==NULL) {
pMaster=this;
@@ -341,9 +345,68 @@ void SdrItemPool::Ctor(SfxItemPool* pMaster, USHORT nAttrStart, USHORT nAttrEnd)
for( i = SDRATTR_GRAFRESERVE3; i <= SDRATTR_GRAFRESERVE6; i++ )
ppPoolDefaults[ i - SDRATTR_START ] = new SfxVoidItem( i );
ppPoolDefaults[ SDRATTRSET_GRAF - SDRATTR_START ] = new SdrGrafSetItem( pMaster );
-
pItemInfos[SDRATTR_GRAFCROP-SDRATTR_START]._nSID=SID_ATTR_GRAF_CROP;
+ // 3D Object Attr (28092000 AW)
+ ppPoolDefaults[ SDRATTR_3DOBJ_PERCENT_DIAGONAL - SDRATTR_START ] = new Svx3DPercentDiagonalItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_BACKSCALE - SDRATTR_START ] = new Svx3DBackscaleItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_DEPTH - SDRATTR_START ] = new Svx3DDepthItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_HORZ_SEGS - SDRATTR_START ] = new Svx3DHorizontalSegmentsItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_VERT_SEGS - SDRATTR_START ] = new Svx3DVerticalSegmentsItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_END_ANGLE - SDRATTR_START ] = new Svx3DEndAngleItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_DOUBLE_SIDED - SDRATTR_START ] = new Svx3DDoubleSidedItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_NORMALS_KIND - SDRATTR_START ] = new Svx3DNormalsKindItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_NORMALS_INVERT - SDRATTR_START ] = new Svx3DNormalsInvertItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_PROJ_X - SDRATTR_START ] = new Svx3DTextureProjectionXItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_PROJ_Y - SDRATTR_START ] = new Svx3DTextureProjectionYItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_SHADOW_3D - SDRATTR_START ] = new Svx3DShadow3DItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_MAT_COLOR - SDRATTR_START ] = new Svx3DMaterialColorItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_MAT_EMISSION - SDRATTR_START ] = new Svx3DMaterialEmissionItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_MAT_SPECULAR - SDRATTR_START ] = new Svx3DMaterialSpecularItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY - SDRATTR_START ] = new Svx3DMaterialSpecularIntensityItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_KIND - SDRATTR_START ] = new Svx3DTextureKindItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_MODE - SDRATTR_START ] = new Svx3DTextureModeItem;
+ ppPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_FILTER - SDRATTR_START ] = new Svx3DTextureFilterItem;
+
+ for( i = SDRATTR_3DOBJ_RESERVED_01; i <= SDRATTR_3DOBJ_RESERVED_20; i++ )
+ ppPoolDefaults[ i - SDRATTR_START ] = new SfxVoidItem( i );
+
+ // 3D Scene Attr (28092000 AW)
+ ppPoolDefaults[ SDRATTR_3DSCENE_PERSPECTIVE - SDRATTR_START ] = new Svx3DPerspectiveItem;
+ ppPoolDefaults[ SDRATTR_3DSCENE_DISTANCE - SDRATTR_START ] = new Svx3DDistanceItem;
+ ppPoolDefaults[ SDRATTR_3DSCENE_FOCAL_LENGTH - SDRATTR_START ] = new Svx3DFocalLengthItem;
+ ppPoolDefaults[ SDRATTR_3DSCENE_TWO_SIDED_LIGHTING - SDRATTR_START ] = new Svx3DTwoSidedLightingItem;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_1 - SDRATTR_START ] = new Svx3DLightcolor1Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_2 - SDRATTR_START ] = new Svx3DLightcolor2Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_3 - SDRATTR_START ] = new Svx3DLightcolor3Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_4 - SDRATTR_START ] = new Svx3DLightcolor4Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_5 - SDRATTR_START ] = new Svx3DLightcolor5Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_6 - SDRATTR_START ] = new Svx3DLightcolor6Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_7 - SDRATTR_START ] = new Svx3DLightcolor7Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_8 - SDRATTR_START ] = new Svx3DLightcolor8Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_AMBIENTCOLOR - SDRATTR_START ] = new Svx3DAmbientcolorItem;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_1 - SDRATTR_START ] = new Svx3DLightOnOff1Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_2 - SDRATTR_START ] = new Svx3DLightOnOff2Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_3 - SDRATTR_START ] = new Svx3DLightOnOff3Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_4 - SDRATTR_START ] = new Svx3DLightOnOff4Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_5 - SDRATTR_START ] = new Svx3DLightOnOff5Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_6 - SDRATTR_START ] = new Svx3DLightOnOff6Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_7 - SDRATTR_START ] = new Svx3DLightOnOff7Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_8 - SDRATTR_START ] = new Svx3DLightOnOff8Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_1 - SDRATTR_START ] = new Svx3DLightDirection1Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_2 - SDRATTR_START ] = new Svx3DLightDirection2Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_3 - SDRATTR_START ] = new Svx3DLightDirection3Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_4 - SDRATTR_START ] = new Svx3DLightDirection4Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_5 - SDRATTR_START ] = new Svx3DLightDirection5Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_6 - SDRATTR_START ] = new Svx3DLightDirection6Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_7 - SDRATTR_START ] = new Svx3DLightDirection7Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_8 - SDRATTR_START ] = new Svx3DLightDirection8Item;
+ ppPoolDefaults[ SDRATTR_3DSCENE_SHADOW_SLANT - SDRATTR_START ] = new Svx3DShadowSlantItem;
+ ppPoolDefaults[ SDRATTR_3DSCENE_SHADE_MODE - SDRATTR_START ] = new Svx3DShadeModeItem;
+
+ for( i = SDRATTR_3DSCENE_RESERVED_01; i <= SDRATTR_3DSCENE_RESERVED_20; i++ )
+ ppPoolDefaults[ i - SDRATTR_START ] = new SfxVoidItem( i );
+
////////////////////////////////
#ifdef DBG_UTIL
UINT16 nAnz(SDRATTR_END-SDRATTR_START + 1);
@@ -383,42 +446,42 @@ void SdrItemPool::Ctor(SfxItemPool* pMaster, USHORT nAttrStart, USHORT nAttrEnd)
}
}
-void SdrItemPool::ImpMakeDefItems()
-{
-#ifdef SDRDEFITEMCACHE
- if (pDefLineAttr==NULL) {
- XLineAttrSetItem aLineSetItem(this);
- pDefLineAttr=(XLineAttrSetItem*)&Put(aLineSetItem);
- aLineSetItem.GetItemSet().Put(XLineStyleItem(XLINE_NONE));
- pDefTextFrameLineAttr=(XLineAttrSetItem*)&Put(aLineSetItem);
-
- XFillAttrSetItem aFillSetItem(this);
- pDefFillAttr=(XFillAttrSetItem*)&Put(aFillSetItem);
- aFillSetItem.GetItemSet().Put(XFillColorItem(String(),Color(COL_WHITE))); // Falls einer auf Solid umschaltet
- aFillSetItem.GetItemSet().Put(XFillStyleItem(XFILL_NONE));
- pDefTextFrameFillAttr=(XFillAttrSetItem*)&Put(aFillSetItem);
-
- XTextAttrSetItem aTextSetItem(this);
- pDefTextAttr=(XTextAttrSetItem*)&Put(aTextSetItem);
- pDefTextFrameTextAttr=pDefTextAttr;
-
- SdrShadowSetItem aShadSetItem(this);
- pDefShadAttr=(SdrShadowSetItem*)&Put(aShadSetItem);
- pDefTextFrameShadAttr=pDefShadAttr;
-
- SdrOutlinerSetItem aOutlSetItem(this);
- pDefTextFrameOutlAttr=(SdrOutlinerSetItem*)&Put(aOutlSetItem);
- aOutlSetItem.GetItemSet().Put(SvxAdjustItem(SVX_ADJUST_CENTER));
- pDefOutlAttr=(SdrOutlinerSetItem*)&Put(aOutlSetItem);
-
- SdrMiscSetItem aMiscSetItem(this);
- pDefTextFrameMiscAttr=(SdrMiscSetItem*)&Put(aMiscSetItem);
- aMiscSetItem.GetItemSet().Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER));
- aMiscSetItem.GetItemSet().Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
- pDefMiscAttr=(SdrMiscSetItem*)&Put(aMiscSetItem);
- }
-#endif SDRDEFITEMCACHE
-}
+//-/void SdrItemPool::ImpMakeDefItems()
+//-/{
+//-/#ifdef SDRDEFITEMCACHE
+//-/ if (pDefLineAttr==NULL) {
+//-/ XLineAttrSetItem aLineSetItem(this);
+//-/ pDefLineAttr=(XLineAttrSetItem*)&Put(aLineSetItem);
+//-/ aLineSetItem.GetItemSet().Put(XLineStyleItem(XLINE_NONE));
+//-/ pDefTextFrameLineAttr=(XLineAttrSetItem*)&Put(aLineSetItem);
+//-/
+//-/ XFillAttrSetItem aFillSetItem(this);
+//-/ pDefFillAttr=(XFillAttrSetItem*)&Put(aFillSetItem);
+//-/ aFillSetItem.GetItemSet().Put(XFillColorItem(String(),Color(COL_WHITE))); // Falls einer auf Solid umschaltet
+//-/ aFillSetItem.GetItemSet().Put(XFillStyleItem(XFILL_NONE));
+//-/ pDefTextFrameFillAttr=(XFillAttrSetItem*)&Put(aFillSetItem);
+//-/
+//-/ XTextAttrSetItem aTextSetItem(this);
+//-/ pDefTextAttr=(XTextAttrSetItem*)&Put(aTextSetItem);
+//-/ pDefTextFrameTextAttr=pDefTextAttr;
+//-/
+//-/ SdrShadowSetItem aShadSetItem(this);
+//-/ pDefShadAttr=(SdrShadowSetItem*)&Put(aShadSetItem);
+//-/ pDefTextFrameShadAttr=pDefShadAttr;
+//-/
+//-/ SdrOutlinerSetItem aOutlSetItem(this);
+//-/ pDefTextFrameOutlAttr=(SdrOutlinerSetItem*)&Put(aOutlSetItem);
+//-/ aOutlSetItem.GetItemSet().Put(SvxAdjustItem(SVX_ADJUST_CENTER));
+//-/ pDefOutlAttr=(SdrOutlinerSetItem*)&Put(aOutlSetItem);
+//-/
+//-/ SdrMiscSetItem aMiscSetItem(this);
+//-/ pDefTextFrameMiscAttr=(SdrMiscSetItem*)&Put(aMiscSetItem);
+//-/ aMiscSetItem.GetItemSet().Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER));
+//-/ aMiscSetItem.GetItemSet().Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
+//-/ pDefMiscAttr=(SdrMiscSetItem*)&Put(aMiscSetItem);
+//-/ }
+//-/#endif SDRDEFITEMCACHE
+//-/}
/*************************************************************************
|*
@@ -1484,7 +1547,8 @@ SfxPoolItem* __EXPORT SdrShadowSetItem::Clone(SfxItemPool* pToPool) const
SfxPoolItem* __EXPORT SdrShadowSetItem::Create(SvStream& rStream, USHORT nVersion) const
{
- SfxItemSet *pSet=new SfxItemSet(*GetItemSet().GetPool(),SDRATTR_SHADOW_FIRST,SDRATTR_SHADOW_LAST);
+ SfxItemSet *pSet = new SfxItemSet(*GetItemSet().GetPool(),
+ SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST);
pSet->Load(rStream);
return new SdrShadowSetItem(pSet);
}
@@ -1560,7 +1624,8 @@ SfxPoolItem* __EXPORT SdrCaptionSetItem::Clone(SfxItemPool* pToPool) const
SfxPoolItem* __EXPORT SdrCaptionSetItem::Create(SvStream& rStream, USHORT nVersion) const
{
- SfxItemSet *pSet=new SfxItemSet(*GetItemSet().GetPool(),SDRATTR_CAPTION_FIRST,SDRATTR_CAPTION_LAST);
+ SfxItemSet *pSet = new SfxItemSet(*GetItemSet().GetPool(),
+ SDRATTR_CAPTION_FIRST, SDRATTR_CAPTION_LAST);
pSet->Load(rStream);
return new SdrCaptionSetItem(pSet);
}
@@ -1583,7 +1648,8 @@ SfxPoolItem* __EXPORT SdrOutlinerSetItem::Clone(SfxItemPool* pToPool) const
SfxPoolItem* __EXPORT SdrOutlinerSetItem::Create(SvStream& rStream, USHORT nVersion) const
{
- SfxItemSet *pSet=new SfxItemSet(*GetItemSet().GetPool(),EE_ITEMS_START,EE_ITEMS_END);
+ SfxItemSet *pSet = new SfxItemSet(*GetItemSet().GetPool(),
+ EE_ITEMS_START, EE_ITEMS_END);
pSet->Load(rStream);
return new SdrOutlinerSetItem(pSet);
}
@@ -2096,7 +2162,8 @@ SfxPoolItem* __EXPORT SdrMiscSetItem::Clone(SfxItemPool* pToPool) const
SfxPoolItem* __EXPORT SdrMiscSetItem::Create(SvStream& rStream, USHORT nVersion) const
{
- SfxItemSet *pSet=new SfxItemSet(*GetItemSet().GetPool(),SDRATTR_MISC_FIRST,SDRATTR_MISC_LAST);
+ SfxItemSet *pSet = new SfxItemSet(*GetItemSet().GetPool(),
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST);
pSet->Load(rStream);
return new SdrMiscSetItem(pSet);
}
@@ -2299,7 +2366,8 @@ SfxPoolItem* __EXPORT SdrEdgeSetItem::Clone(SfxItemPool* pToPool) const
SfxPoolItem* __EXPORT SdrEdgeSetItem::Create(SvStream& rStream, USHORT nVersion) const
{
- SfxItemSet *pSet=new SfxItemSet(*GetItemSet().GetPool(),SDRATTR_EDGE_FIRST,SDRATTR_EDGE_LAST);
+ SfxItemSet *pSet = new SfxItemSet(*GetItemSet().GetPool(),
+ SDRATTR_EDGE_FIRST, SDRATTR_EDGE_LAST);
pSet->Load(rStream);
return new SdrEdgeSetItem(pSet);
}
@@ -2506,7 +2574,8 @@ SfxPoolItem* __EXPORT SdrMeasureSetItem::Clone(SfxItemPool* pToPool) const
SfxPoolItem* __EXPORT SdrMeasureSetItem::Create(SvStream& rStream, USHORT nVersion) const
{
- SfxItemSet *pSet=new SfxItemSet(*GetItemSet().GetPool(),SDRATTR_MEASURE_FIRST,SDRATTR_MEASURE_LAST);
+ SfxItemSet *pSet = new SfxItemSet(*GetItemSet().GetPool(),
+ SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST);
pSet->Load(rStream);
return new SdrMeasureSetItem(pSet);
}
@@ -2572,7 +2641,8 @@ SfxPoolItem* __EXPORT SdrCircSetItem::Clone(SfxItemPool* pToPool) const
SfxPoolItem* __EXPORT SdrCircSetItem::Create(SvStream& rStream, USHORT nVersion) const
{
- SfxItemSet *pSet=new SfxItemSet(*GetItemSet().GetPool(),SDRATTR_CIRC_FIRST,SDRATTR_CIRC_LAST);
+ SfxItemSet *pSet = new SfxItemSet(*GetItemSet().GetPool(),
+ SDRATTR_CIRC_FIRST, SDRATTR_CIRC_LAST);
pSet->Load(rStream);
return new SdrCircSetItem(pSet);
}
@@ -2635,7 +2705,8 @@ SfxPoolItem* __EXPORT SdrGrafSetItem::Clone( SfxItemPool* pToPool ) const
SfxPoolItem* __EXPORT SdrGrafSetItem::Create( SvStream& rStream, USHORT nVersion ) const
{
- SfxItemSet* pSet = new SfxItemSet( *GetItemSet().GetPool(), SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST );
+ SfxItemSet* pSet = new SfxItemSet(*GetItemSet().GetPool(),
+ SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST );
pSet->Load( rStream );
return new SdrGrafSetItem( pSet );
}
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx
index 8737f6a31588..e8d80375f84a 100644
--- a/svx/source/svdraw/svdcrtv.cxx
+++ b/svx/source/svdraw/svdcrtv.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdcrtv.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:01:24 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -438,23 +438,34 @@ BOOL SdrCreateView::ImpBegCreateObj(UINT32 nInvent, UINT16 nIdent, const Point&
if (pAktCreate!=NULL) {
BOOL bStartEdit=FALSE; // nach Ende von Create automatisch TextEdit starten
if (pDefaultStyleSheet!=NULL) pAktCreate->NbcSetStyleSheet(pDefaultStyleSheet,FALSE);
- pAktCreate->NbcSetAttributes(aDefaultAttr,FALSE);
- if (HAS_BASE(SdrCaptionObj,pAktCreate)) {
+
+//-/ pAktCreate->NbcSetAttributes(aDefaultAttr,FALSE);
+ pAktCreate->SetItemSet(aDefaultAttr);
+
+ if (HAS_BASE(SdrCaptionObj,pAktCreate))
+ {
SfxItemSet aSet(pMod->GetItemPool());
aSet.Put(XFillColorItem(String(),Color(COL_WHITE))); // Falls einer auf Solid umschaltet
aSet.Put(XFillStyleItem(XFILL_NONE));
- pAktCreate->NbcSetAttributes(aSet,FALSE);
+
+//-/ pAktCreate->NbcSetAttributes(aSet,FALSE);
+ pAktCreate->SetItemSet(aSet);
+
bStartEdit=TRUE;
}
if (nInvent==SdrInventor && (nIdent==OBJ_TEXT || nIdent==OBJ_TEXTEXT ||
- nIdent==OBJ_TITLETEXT || nIdent==OBJ_OUTLINETEXT)) {
+ nIdent==OBJ_TITLETEXT || nIdent==OBJ_OUTLINETEXT))
+ {
// Fuer alle Textrahmen default keinen Hintergrund und keine Umrandung
SfxItemSet aSet(pMod->GetItemPool());
aSet.Put(XFillColorItem(String(),Color(COL_WHITE))); // Falls einer auf Solid umschaltet
aSet.Put(XFillStyleItem(XFILL_NONE));
aSet.Put(XLineColorItem(String(),Color(COL_BLACK))); // Falls einer auf Solid umschaltet
aSet.Put(XLineStyleItem(XLINE_NONE));
- pAktCreate->NbcSetAttributes(aSet,FALSE);
+
+//-/ pAktCreate->NbcSetAttributes(aSet,FALSE);
+ pAktCreate->SetItemSet(aSet);
+
bStartEdit=TRUE;
}
if (!rLogRect.IsEmpty()) pAktCreate->NbcSetLogicRect(rLogRect);
@@ -511,7 +522,9 @@ BOOL SdrCreateView::BegCreateLibObj(const Point& rPnt, SdrObject* pObj, BOOL bMo
pObj->SetModel(pMod);
if (bSetDefAttr) {
if (pDefaultStyleSheet!=NULL) pObj->NbcSetStyleSheet(pDefaultStyleSheet,FALSE);
- pObj->NbcSetAttributes(aDefaultAttr,FALSE);
+
+//-/ pObj->NbcSetAttributes(aDefaultAttr,FALSE);
+ pObj->SetItemSet(aDefaultAttr);
}
if (bSetDefLayer) {
SdrLayerID nLayer=pCreatePV->GetPage()->GetLayerAdmin().GetLayerID(aAktLayer,TRUE);
@@ -552,10 +565,11 @@ void SdrCreateView::MovCreateObj(const Point& rPnt)
if (IsSolidDraggingNow() && !IsSolidDraggingCheck()) {
// Z.B. fuer Fill+Linelose Textrahmen bei SolidDragging
SetSolidDraggingCheck(TRUE);
- SfxItemSet aSet(pMod->GetItemPool());
- pAktCreate->TakeAttributes(aSet,FALSE,FALSE);
- XFillStyle eFill=((XFillStyleItem&)(aSet.Get(XATTR_FILLSTYLE))).GetValue();
- XLineStyle eLine=((XLineStyleItem&)(aSet.Get(XATTR_LINESTYLE))).GetValue();
+//-/ SfxItemSet aSet(pMod->GetItemPool());
+//-/ pAktCreate->TakeAttributes(aSet,FALSE,FALSE);
+ const SfxItemSet& rSet = pAktCreate->GetItemSet();
+ XFillStyle eFill=((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue();
+ XLineStyle eLine=((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
if (eLine==XLINE_NONE && eFill==XFILL_NONE) {
SetSolidDraggingNow(FALSE);
}
@@ -919,7 +933,8 @@ BOOL SdrCreateView::GetAttributes(SfxItemSet& rTargetSet, BOOL bOnlyHardAttr) co
{
if(pAktCreate)
{
- pAktCreate->TakeAttributes(rTargetSet, FALSE, bOnlyHardAttr);
+//-/ pAktCreate->TakeAttributes(rTargetSet, FALSE, bOnlyHardAttr);
+ rTargetSet.Put(pAktCreate->GetItemSet());
return TRUE;
}
else
@@ -930,10 +945,18 @@ BOOL SdrCreateView::GetAttributes(SfxItemSet& rTargetSet, BOOL bOnlyHardAttr) co
BOOL SdrCreateView::SetAttributes(const SfxItemSet& rSet, BOOL bReplaceAll)
{
- if (pAktCreate!=NULL) {
- pAktCreate->SetAttributes(rSet,bReplaceAll);
+ if(pAktCreate)
+ {
+//-/ pAktCreate->SetAttributes(rSet,bReplaceAll);
+ SdrBroadcastItemChange aItemChange(*pAktCreate);
+ if(bReplaceAll)
+ pAktCreate->ClearItem();
+ pAktCreate->SetItemSet(rSet);
+ pAktCreate->BroadcastItemChange(aItemChange);
return TRUE;
- } else {
+ }
+ else
+ {
return SdrDragView::SetAttributes(rSet,bReplaceAll);
}
}
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
index 251db06a15cf..bdb91cc08c07 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdedtv.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:01:24 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -465,11 +465,12 @@ void SdrEditView::CheckPossibilities()
// gradient depends on fillstyle
const SdrMark* pM = aMark.GetMark(0);
const SdrObject* pObj = pM->GetObj();
- SfxItemSet aSet(GetModel()->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, 0, 0);
- pObj->TakeAttributes(aSet, FALSE, TRUE);
+//-/ SfxItemSet aSet(GetModel()->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, 0, 0);
+//-/
+//-/ pObj->TakeAttributes(aSet, FALSE, TRUE);
- XFillStyle eFillStyle = ((XFillStyleItem&)(aSet.Get(XATTR_FILLSTYLE))).GetValue();
+ XFillStyle eFillStyle = ((XFillStyleItem&)(pObj->GetItem(XATTR_FILLSTYLE))).GetValue();
if(eFillStyle != XFILL_GRADIENT)
{
@@ -791,7 +792,8 @@ BOOL SdrEditView::InsertObject(SdrObject* pObj, SdrPageView& rPV, ULONG nOptions
}
if ((nOptions & SDRINSERT_SETDEFATTR)!=0) {
if (pDefaultStyleSheet!=NULL) pObj->NbcSetStyleSheet(pDefaultStyleSheet,FALSE);
- pObj->NbcSetAttributes(aDefaultAttr,FALSE);
+//-/ pObj->NbcSetAttributes(aDefaultAttr,FALSE);
+ pObj->SetItemSet(aDefaultAttr);
}
if (!pObj->IsInserted()) {
SdrInsertReason aReason(SDRREASON_VIEWCALL);
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 83d4cdf3b165..8f5a772902de 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdedtv1.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:01:24 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -696,11 +696,118 @@ SfxItemSet SdrEditView::GetAttrFromMarked(BOOL bOnlyHardAttr) const
void SdrEditView::MergeAttrFromMarked(SfxItemSet& rAttr, BOOL bOnlyHardAttr) const
{
- ULONG nMarkAnz=aMark.GetMarkCount();
- for (ULONG nm=0; nm<nMarkAnz; nm++) {
- SdrMark* pM=aMark.GetMark(nm);
- pM->GetObj()->TakeAttributes(rAttr,TRUE,bOnlyHardAttr);
+ sal_uInt32 nMarkAnz(aMark.GetMarkCount());
+
+ for(sal_uInt32 a(0); a < nMarkAnz; a++)
+ {
+ const SfxItemSet& rSet = aMark.GetMark(a)->GetObj()->GetItemSet();
+//-/ rAttr.MergeValues(rSet, TRUE);
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+
+ while(nWhich)
+ {
+ const SfxPoolItem* pItem = NULL;
+ rSet.GetItemState(nWhich, TRUE, &pItem);
+
+ if(pItem)
+ {
+ if(pItem == (SfxPoolItem *)-1)
+ rAttr.InvalidateItem(nWhich);
+ else
+ rAttr.MergeValue(*pItem, TRUE);
+ }
+ nWhich = aIter.NextWhich();
+ }
}
+
+
+
+//-/ ULONG nMarkAnz=aMark.GetMarkCount();
+//-/ for (ULONG nm=0; nm<nMarkAnz; nm++) {
+//-/ SdrMark* pM=aMark.GetMark(nm);
+//-///-/ pM->GetObj()->TakeAttributes(rAttr,TRUE,bOnlyHardAttr);
+//-///-/ rAttr.Put(pM->GetObj()->GetItemSet());
+//-/ const SfxItemSet& rSet = pM->GetObj()->GetItemSet();
+//-/
+//-/
+//-/
+//-/
+//-/
+//-/ static BOOL bTestOwnLoop(FALSE);
+//-/ if(bTestOwnLoop)
+//-/ {
+//-/
+//-/ SfxWhichIter aIter(rSet);
+//-/ sal_uInt16 nWhich(aIter.FirstWhich());
+//-/
+//-/ while(nWhich)
+//-/ {
+//-/ rAttr.MergeValue(rSet.Get(nWhich), TRUE);
+//-/ nWhich = aIter.NextWhich();
+//-/ }
+//-/
+//-/ }
+//-/ else
+//-/ {
+//-/
+//-/ rAttr.MergeValues(rSet, TRUE);
+//-/
+//-/ }
+
+//-/ SfxWhichIter aIter(rIS);
+//-/ USHORT nWhich=aIter.FirstWhich();
+//-/ while (nWhich!=0) {
+//-/ if ((bHasLEnd || nWhich<XATTR_LINESTART || nWhich>XATTR_LINEENDCENTER) &&
+//-/ (bHasEckRad || nWhich!=SDRATTR_ECKENRADIUS) &&
+//-/ (bHasText || nWhich<SDRATTR_TEXT_MINFRAMEHEIGHT || nWhich>SDRATTR_TEXT_CONTOURFRAME) &&
+//-/ (bTextFrame || (nWhich!=SDRATTR_TEXT_AUTOGROWHEIGHT && nWhich!=SDRATTR_TEXT_MINFRAMEHEIGHT && nWhich!=SDRATTR_TEXT_MAXFRAMEHEIGHT &&
+//-/ nWhich!=SDRATTR_TEXT_AUTOGROWWIDTH && nWhich!=SDRATTR_TEXT_MINFRAMEWIDTH && nWhich!=SDRATTR_TEXT_MAXFRAMEWIDTH)) &&
+//-/ (bCanContourFrame || nWhich!=SDRATTR_TEXT_CONTOURFRAME) &&
+//-/ (!bIsContourFrame || nWhich<SDRATTR_TEXT_MINFRAMEHEIGHT || nWhich>SDRATTR_TEXT_HORZADJUST) &&
+//-/ (nWhich<EE_FEATURE_START || nWhich>EE_FEATURE_END) )
+//-/ {
+//-/ if (!bOnlyHardAttr || rIS.GetItemState(nWhich,FALSE)==SFX_ITEM_SET) {
+//-/ const SfxPoolItem& rItem=rIS.Get(nWhich);
+//-/ if (bMerge) rAttr.MergeValue(rItem,TRUE);
+//-/ else rAttr.Put(rItem);
+//-/ }
+//-/ }
+//-/ nWhich=aIter.NextWhich();
+//-/ }
+
+
+
+//-/ SfxItemIter aIter(rSet);
+//-/ const SfxPoolItem* pItem = aIter.FirstItem();
+//-/
+//-/ // merge items to destination rAttr
+//-/ while(pItem)
+//-/ {
+//-/ sal_uInt16 nWhich = pItem->Which();
+//-/ SfxItemState eState = rSet.GetItemState(nWhich);
+//-/
+//-/ if(SFX_ITEM_SET == eState)
+//-/ {
+//-/ // Ist gesetzt
+//-/ if(*rAttr.GetItem(nWhich) != *pItem)
+//-/ {
+//-/ // SfxPoolItem muss invalidiert werden
+//-/ rAttr.InvalidateItem(nWhich);
+//-/ }
+//-/ }
+//-/ else
+//-/ {
+//-/ if(SFX_ITEM_DONTCARE != eState)
+//-/ {
+//-/ // Item gab es noch nicht, setze es
+//-/ rAttr.Put(*pItem);
+//-/ }
+//-/ }
+//-/
+//-/ pItem = aIter.NextItem();
+//-/ }
+//-/ }
}
void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, BOOL bReplaceAll)
@@ -762,7 +869,12 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, BOOL bReplaceAll)
// add attribute undo
AddUndo(new SdrUndoAttrObj(*pM->GetObj(),FALSE,bHasEEItems || bPossibleGeomChange));
- pM->GetObj()->SetAttributes(rAttr,bReplaceAll);
+//-/ pM->GetObj()->SetAttributes(rAttr,bReplaceAll);
+ SdrBroadcastItemChange aItemChange(*pM->GetObj());
+ if(bReplaceAll)
+ pM->GetObj()->ClearItem();
+ pM->GetObj()->SetItemSet(rAttr);
+ pM->GetObj()->BroadcastItemChange(aItemChange);
}
// besser vorher checken, was gemacht werden soll:
// pObj->SetAttr() oder SetNotPersistAttr()
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index 1cfe83a026c5..a777bc05b52c 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdedtv2.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2000-09-26 13:12:15 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -560,14 +560,22 @@ void SdrEditView::ImpCopyAttributes(const SdrObject* pSource, SdrObject* pDest)
pSource=aIter.Next();
}
}
- if (pSource!=NULL && pDest!=NULL) {
+
+ if(pSource && pDest)
+ {
SfxItemSet aSet(pMod->GetItemPool(),
- SDRATTR_START,SDRATTR_NOTPERSIST_FIRST-1,
- SDRATTR_NOTPERSIST_LAST+1, SDRATTR_END,
- EE_ITEMS_START,EE_ITEMS_END,
- 0,0); // #52757#, #52762#
- pSource->TakeAttributes(aSet,FALSE,FALSE);
- pDest->NbcSetAttributes(aSet,TRUE);
+ SDRATTR_START, SDRATTR_NOTPERSIST_FIRST-1,
+ SDRATTR_NOTPERSIST_LAST+1, SDRATTR_END,
+ EE_ITEMS_START, EE_ITEMS_END,
+ 0, 0); // #52757#, #52762#
+
+//-/ pSource->TakeAttributes(aSet,FALSE,FALSE);
+ aSet.Put(pSource->GetItemSet());
+
+//-/ pDest->NbcSetAttributes(aSet,TRUE);
+ pDest->ClearItem();
+ pDest->SetItemSet(aSet);
+
pDest->NbcSetLayer(pSource->GetLayer());
pDest->NbcSetStyleSheet(pSource->GetStyleSheet(),TRUE);
}
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index d026a1b98ad7..2e0097ae4dd7 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdedxv.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:01:24 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -405,9 +405,9 @@ Color SdrObjEditView::ImpGetTextEditBackgroundColor() const
SdrTextObj* pText=PTR_CAST(SdrTextObj,pTextEditObj);
if (pText!=NULL && pText->IsClosedObj())
{
- SfxItemSet aSet(pMod->GetItemPool());
- pText->TakeAttributes(aSet,FALSE,FALSE);
- bFound=GetDraftFillColor(aSet,aBackground);
+//-/ SfxItemSet aSet(pMod->GetItemPool());
+//-/ pText->TakeAttributes(aSet,FALSE,FALSE);
+ bFound=GetDraftFillColor(pText->GetItemSet(),aBackground);
}
if (!bFound && pTextEditPV!=NULL && pTextEditObj!=NULL)
{
@@ -1279,7 +1279,9 @@ BOOL SdrObjEditView::GetAttributes(SfxItemSet& rTargetSet, BOOL bOnlyHardAttr) c
{
DBG_ASSERT(pTextEditOutlinerView!=NULL,"SdrObjEditView::GetAttributes(): pTextEditOutlinerView=NULL");
DBG_ASSERT(pTextEditOutliner!=NULL,"SdrObjEditView::GetAttributes(): pTextEditOutliner=NULL");
- pTextEditObj->TakeAttributes(rTargetSet, TRUE, bOnlyHardAttr);
+
+//-/ pTextEditObj->TakeAttributes(rTargetSet, TRUE, bOnlyHardAttr);
+ rTargetSet.Put(pTextEditObj->GetItemSet());
if(pTextEditOutlinerView)
{
@@ -1344,7 +1346,14 @@ BOOL SdrObjEditView::SetAttributes(const SfxItemSet& rSet, BOOL bReplaceAll)
AddUndo(new SdrUndoGeoObj(*pTextEditObj));
AddUndo(new SdrUndoAttrObj(*pTextEditObj,FALSE,!bNoEEItems));
EndUndo();
- pTextEditObj->SetAttributes(*pSet,bReplaceAll);
+
+//-/ pTextEditObj->SetAttributes(*pSet,bReplaceAll);
+ SdrBroadcastItemChange aItemChange(*pTextEditObj);
+ if(bReplaceAll)
+ pTextEditObj->ClearItem();
+ pTextEditObj->SetItemSet(*pSet);
+ pTextEditObj->BroadcastItemChange(aItemChange);
+
FlushComeBackTimer(); // Damit ModeHasChanged sofort kommt
bRet=TRUE;
} else if (!bOnlyEEItems) { // sonst Set ggf. splitten
@@ -1367,7 +1376,14 @@ BOOL SdrObjEditView::SetAttributes(const SfxItemSet& rSet, BOOL bReplaceAll)
AddUndo(new SdrUndoGeoObj(*pTextEditObj));
AddUndo(new SdrUndoAttrObj(*pTextEditObj,FALSE,FALSE));
EndUndo();
- pTextEditObj->SetAttributes(aSet,bReplaceAll);
+
+//-/ pTextEditObj->SetAttributes(aSet,bReplaceAll);
+ SdrBroadcastItemChange aItemChange(*pTextEditObj);
+ if(bReplaceAll)
+ pTextEditObj->ClearItem();
+ pTextEditObj->SetItemSet(aSet);
+ pTextEditObj->BroadcastItemChange(aItemChange);
+
if (aMark.GetMarkCount()==1 && aMark.GetMark(0)->GetObj()==pTextEditObj) {
SetNotPersistAttrToMarked(aSet,bReplaceAll);
}
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index f5a680a32e37..5eba594c2fbb 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdfmtf.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: pw $ $Date: 2000-10-12 11:39:44 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -405,9 +405,12 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, FASTBOOL bForceText
if (pObj!=NULL)
{
pObj->SetLayer(nLayer);
- if (bLine) pObj->NbcSetAttributes(*pLineAttr,FALSE);
- if (bFill) pObj->NbcSetAttributes(*pFillAttr,FALSE);
- if (bText) pObj->NbcSetAttributes(*pTextAttr,FALSE);
+//-/ if (bLine) pObj->NbcSetAttributes(*pLineAttr,FALSE);
+//-/ if (bFill) pObj->NbcSetAttributes(*pFillAttr,FALSE);
+//-/ if (bText) pObj->NbcSetAttributes(*pTextAttr,FALSE);
+ if (bLine) pObj->SetItemSet(*pLineAttr);
+ if (bFill) pObj->SetItemSet(*pFillAttr);
+ if (bText) pObj->SetItemSet(*pTextAttr);
}
}
@@ -461,7 +464,8 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaRoundRectAction& rAct)
if (nRad!=0) {
SfxItemSet aSet(*pLineAttr->GetPool(),SDRATTR_ECKENRADIUS,SDRATTR_ECKENRADIUS);
aSet.Put(SdrEckenradiusItem(nRad));
- pRect->NbcSetAttributes(aSet,FALSE);
+//-/ pRect->NbcSetAttributes(aSet,FALSE);
+ pRect->SetItemSet(aSet);
}
InsertObj(pRect);
}
@@ -559,7 +563,8 @@ FASTBOOL ImpSdrGDIMetaFileImport::CheckLastPolyLineAndFillMerge(const XPolyPolyg
if (pLastPoly->GetPathPoly()==rPoly) {
SetAttributes(NULL);
if (!bNoLine && bNoFill) {
- pLastPoly->NbcSetAttributes(*pLineAttr,FALSE);
+//-/ pLastPoly->NbcSetAttributes(*pLineAttr,FALSE);
+ pLastPoly->SetItemSet(*pLineAttr);
return TRUE;
}
}
@@ -677,7 +682,8 @@ void ImpSdrGDIMetaFileImport::ImportText(const Point& rPos, const XubString& rSt
SfxItemSet aAttr(*pFillAttr->GetPool(),XATTR_FILL_FIRST,XATTR_FILL_LAST);
pFillAttr->Put(XFillStyleItem(XFILL_SOLID));
pFillAttr->Put(XFillColorItem(String(), aFnt.GetFillColor()));
- pText->NbcSetAttributes(aAttr,FALSE);
+//-/ pText->NbcSetAttributes(aAttr,FALSE);
+ pText->SetItemSet(aAttr);
}
ULONG nWink=aFnt.GetOrientation();
if (nWink!=0) {
@@ -794,7 +800,8 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaHatchAction& rAct )
aHatchAttr.Put( XFillStyleItem( XFILL_HATCH ) );
aHatchAttr.Put( XFillHatchItem( &pModel->GetItemPool(), XHatch( rHatch.GetColor(), eStyle,
rHatch.GetDistance(), rHatch.GetAngle() ) ) );
- pPath->NbcSetAttributes(aHatchAttr,FALSE);
+//-/ pPath->NbcSetAttributes(aHatchAttr,FALSE);
+ pPath->SetItemSet(aHatchAttr);
InsertObj(pPath);
}
}
@@ -894,7 +901,8 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pM
SetAttributes( pPath );
aGradAttr.Put( XFillStyleItem( XFILL_GRADIENT ) );
aGradAttr.Put( XFillGradientItem( &pModel->GetItemPool(), aXGradient ) );
- pPath->NbcSetAttributes(aGradAttr,FALSE);
+//-/ pPath->NbcSetAttributes(aGradAttr,FALSE);
+ pPath->SetItemSet(aGradAttr);
InsertObj(pPath);
}
}
diff --git a/svx/source/svdraw/svdfppt.cxx b/svx/source/svdraw/svdfppt.cxx
index 3a14d37d4403..5df58254a7e6 100644
--- a/svx/source/svdraw/svdfppt.cxx
+++ b/svx/source/svdraw/svdfppt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdfppt.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: sj $ $Date: 2000-10-24 11:49:05 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1203,7 +1203,10 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
aSet.Put( SdrTextMinFrameHeightItem( nMinFrameHeight ) );
pTObj->SetModel( pSdrModel );
- pTObj->NbcSetAttributes( aSet, FALSE );
+
+//-/ pTObj->NbcSetAttributes( aSet, FALSE );
+ pTObj->SetItemSet(aSet);
+
pTObj = ReadObjText( &aTextObj, pTObj, rData.pPage );
if ( pTObj )
{ // rotate text with shape ?
@@ -2660,17 +2663,21 @@ SdrPage* SdrPowerPointImport::ImportPage() // be sure not to import masterp
{
void* pPtr;
const SfxPoolItem* pPoolItem = NULL;
- SfxItemSet aSourceAttr( pSdrModel->GetItemPool() );
- pBackGroundObj->TakeAttributes( aSourceAttr, FALSE, TRUE );
- SfxItemState eState = aSourceAttr.GetItemState( XATTR_FILLCOLOR, FALSE, &pPoolItem );
+
+//-/ SfxItemSet aSourceAttr( pSdrModel->GetItemPool() );
+//-/ pBackGroundObj->TakeAttributes( aSourceAttr, FALSE, TRUE );
+//-/ SfxItemState eState = aSourceAttr.GetItemState( XATTR_FILLCOLOR, FALSE, &pPoolItem );
+ SfxItemState eState = pBackGroundObj->GetItemSet().GetItemState(XATTR_FILLCOLOR, FALSE, &pPoolItem);
+
if ( pPoolItem )
{
for ( pPtr = pList->First(); pPtr; pPtr = pList->Next() )
{
- SfxItemSet aTempAttr( pSdrModel->GetItemPool() );
- ((SdrObject*)pPtr)->TakeAttributes( aTempAttr, FALSE, TRUE );
- aTempAttr.Put( *pPoolItem );
- ((SdrObject*)pPtr)->NbcSetAttributes( aTempAttr, FALSE );
+ ((SdrObject*)pPtr)->SetItem(*pPoolItem);
+//-/ SfxItemSet aTempAttr( pSdrModel->GetItemPool() );
+//-/ ((SdrObject*)pPtr)->TakeAttributes( aTempAttr, FALSE, TRUE );
+//-/ aTempAttr.Put( *pPoolItem );
+//-/ ((SdrObject*)pPtr)->NbcSetAttributes( aTempAttr, FALSE );
}
}
}
@@ -2974,7 +2981,10 @@ SdrObject* SdrPowerPointImport::ImportPageBackgroundObject( const SdrPage& rPage
Rectangle aRect( rPage.GetLftBorder(), rPage.GetUppBorder(), rPage.GetWdt()-rPage.GetRgtBorder(), rPage.GetHgt()-rPage.GetLwrBorder() );
pRet = new SdrRectObj( aRect );
pRet->SetModel( pSdrModel );
- pRet->NbcSetAttributes( *pSet, FALSE );
+
+//-/ pRet->NbcSetAttributes( *pSet, FALSE );
+ pRet->SetItemSet(*pSet);
+
pRet->SetMarkProtect( TRUE );
pRet->SetMoveProtect( TRUE );
pRet->SetResizeProtect( TRUE );
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 317b6c8faa7b..b193f3e564c5 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdhdl.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:01:24 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -852,8 +852,9 @@ IMPL_LINK(SdrHdlGradient, ColorChangeHdl, SdrHdl*, pHdl)
void SdrHdlGradient::FromIAOToItem(SdrObject* pObj, BOOL bSetItemOnObject, BOOL bUndo)
{
// from IAO positions and colors to gradient
- SfxItemSet aSet(pObj->GetModel()->GetItemPool());
- pObj->TakeAttributes(aSet, FALSE, FALSE);
+//-/ SfxItemSet aSet(pObj->GetModel()->GetItemPool());
+//-/ pObj->TakeAttributes(aSet, FALSE, FALSE);
+ const SfxItemSet& rSet = pObj->GetItemSet();
GradTransformer aGradTransformer;
GradTransGradient aOldGradTransGradient;
@@ -870,9 +871,9 @@ void SdrHdlGradient::FromIAOToItem(SdrObject* pObj, BOOL bSetItemOnObject, BOOL
aGradTransVector.aCol2 = pColHdl2->GetColor();
if(IsGradient())
- aOldGradTransGradient.aGradient = ((XFillGradientItem&)aSet.Get(XATTR_FILLGRADIENT)).GetValue();
+ aOldGradTransGradient.aGradient = ((XFillGradientItem&)rSet.Get(XATTR_FILLGRADIENT)).GetValue();
else
- aOldGradTransGradient.aGradient = ((XFillFloatTransparenceItem&)aSet.Get(XATTR_FILLFLOATTRANSPARENCE)).GetValue();
+ aOldGradTransGradient.aGradient = ((XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE)).GetValue();
// transform vector data to gradient
aGradTransformer.VecToGrad(aGradTransVector, aGradTransGradient, aOldGradTransGradient, pObj, bMoveSingleHandle, bMoveFirstHandle);
@@ -902,7 +903,10 @@ void SdrHdlGradient::FromIAOToItem(SdrObject* pObj, BOOL bSetItemOnObject, BOOL
pModel->EndUndo();
}
- pObj->SetAttributes(aNewSet, FALSE);
+//-/ pObj->SetAttributes(aNewSet, FALSE);
+//-/ SdrBroadcastItemChange aItemChange(*pObj);
+ pObj->SetItemSetAndBroadcast(aNewSet);
+//-/ pObj->BroadcastItemChange(aItemChange);
}
// back transformation, set values on pIAOHandle
@@ -1139,8 +1143,11 @@ BOOL ImpEdgeHdl::IsHorzDrag() const
SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
if (pEdge==NULL) return FALSE;
if (nObjHdlNum<=1) return FALSE;
- SdrEdgeKind eKind=SDREDGE_ORTHOLINES;
- if (pEdge->pEdgeAttr!=NULL) eKind=((SdrEdgeKindItem&)(pEdge->pEdgeAttr->GetItemSet().Get(SDRATTR_EDGEKIND))).GetValue();
+
+//-/ SdrEdgeKind eKind=SDREDGE_ORTHOLINES;
+//-/ if (pEdge->pEdgeAttr!=NULL) eKind=((SdrEdgeKindItem&)(pEdge->pEdgeAttr->GetItemSet().Get(SDRATTR_EDGEKIND))).GetValue();
+ SdrEdgeKind eKind = ((SdrEdgeKindItem&)(pEdge->GetItem(SDRATTR_EDGEKIND))).GetValue();
+
const SdrEdgeInfoRec& rInfo=pEdge->aEdgeInfo;
if (eKind==SDREDGE_ORTHOLINES || eKind==SDREDGE_BEZIER) {
return !rInfo.ImpIsHorzLine(eLineCode,*pEdge->pEdgeTrack);
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index ccaac4925ab6..e9be440d668f 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdmodel.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dl $ $Date: 2000-10-18 10:59:24 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -268,7 +268,7 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, SvPersist* pPers,
bUIOnlyKomma=FALSE;
pLayerAdmin=NULL;
pItemPool=pPool;
- pUndoItemPool=NULL;
+//-/ pUndoItemPool=NULL;
bMyPool=FALSE;
pPersist=pPers;
pDrawOutliner=NULL;
@@ -339,15 +339,15 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, SvPersist* pPers,
SetTextDefaults();
// Undo-ItemPool anlegen
- if(!pUndoItemPool)
- {
- // Pool fuer UNDO-Objekte anlegen
- pUndoItemPool = new SdrItemPool(SDRATTR_START, SDRATTR_END);
- SfxItemPool* pUndoOutlPool = EditEngine::CreatePool();
- pUndoItemPool->SetSecondaryPool(pUndoOutlPool);
- pUndoItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit);
- pUndoItemPool->FreezeIdRanges();
- }
+//-/ if(!pUndoItemPool)
+//-/ {
+//-/ // Pool fuer UNDO-Objekte anlegen
+//-/ pUndoItemPool = new SdrItemPool(SDRATTR_START, SDRATTR_END);
+//-/ SfxItemPool* pUndoOutlPool = EditEngine::CreatePool();
+//-/ pUndoItemPool->SetSecondaryPool(pUndoOutlPool);
+//-/ pUndoItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit);
+//-/ pUndoItemPool->FreezeIdRanges();
+//-/ }
#ifdef DBG_UTIL
UINT16 nCnt(0);
@@ -491,13 +491,13 @@ SdrModel::~SdrModel()
delete pOutlPool;
}
- // UndoItemPool wegwerfen
- if(pUndoItemPool)
- {
- SfxItemPool* pUndoOutlPool = pUndoItemPool->GetSecondaryPool();
- delete pUndoItemPool;
- delete pUndoOutlPool;
- }
+//-/ // UndoItemPool wegwerfen
+//-/ if(pUndoItemPool)
+//-/ {
+//-/ SfxItemPool* pUndoOutlPool = pUndoItemPool->GetSecondaryPool();
+//-/ delete pUndoItemPool;
+//-/ delete pUndoOutlPool;
+//-/ }
delete pLoadedModel;
@@ -1054,7 +1054,7 @@ void SdrModel::SetScaleUnit(MapUnit eMap, const Fraction& rFrac)
eObjUnit=eMap;
aObjUnit=rFrac;
pItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit);
- pUndoItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit);
+//-/ pUndoItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit);
ImpSetUIUnit();
ImpSetOutlinerDefaults( pDrawOutliner );
ImpSetOutlinerDefaults( pHitTestOutliner );
@@ -1067,7 +1067,7 @@ void SdrModel::SetScaleUnit(MapUnit eMap)
if (eObjUnit!=eMap) {
eObjUnit=eMap;
pItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit);
- pUndoItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit);
+//-/ pUndoItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit);
ImpSetUIUnit();
ImpSetOutlinerDefaults( pDrawOutliner );
ImpSetOutlinerDefaults( pHitTestOutliner );
@@ -2377,34 +2377,83 @@ void SdrModel::SetStarDrawPreviewMode(BOOL bPreview)
void SdrModel::PrepareStore()
{
- // Prepare OutlinerParaObjects for storing
- USHORT nCnt = GetMasterPageCount();
- for ( USHORT i = 0; i < nCnt; i++ )
+ // is done by PreSave now
+ DBG_ERROR("Please call PreSave now. It'll do the desired job.");
+}
+
+//-/void SdrModel::PrepareStore()
+//-/{
+//-/ // Prepare OutlinerParaObjects for storing
+//-/ USHORT nCnt = GetMasterPageCount();
+//-/ for ( USHORT i = 0; i < nCnt; i++ )
+//-/ {
+//-/ // MasterPages
+//-/ SdrObjListIter aIter( *GetMasterPage( i ) );
+//-/ while( aIter.IsMore() )
+//-/ {
+//-/ OutlinerParaObject* pOPO = aIter.Next()->GetOutlinerParaObject();
+//-/ if( pOPO )
+//-/ pOPO->PrepareStore( (SfxStyleSheetPool*) pStyleSheetPool );
+//-/ }
+//-/ }
+//-/
+//-/ nCnt = GetPageCount();
+//-/ for ( i = 0; i < nCnt; i++ )
+//-/ {
+//-/ // Pages
+//-/ SdrObjListIter aIter( *GetPage( i ) );
+//-/ while( aIter.IsMore() )
+//-/ {
+//-/ OutlinerParaObject* pOPO = aIter.Next()->GetOutlinerParaObject();
+//-/ if( pOPO )
+//-/ pOPO->PrepareStore( (SfxStyleSheetPool*) pStyleSheetPool );
+//-/ }
+//-/ }
+//-/}
+
+void SdrModel::PreSave()
+{
+ sal_uInt16 nCnt(GetMasterPageCount());
+
+ for(sal_uInt16 i(0); i < nCnt; i++)
{
// MasterPages
- SdrObjListIter aIter( *GetMasterPage( i ) );
- while( aIter.IsMore() )
- {
- OutlinerParaObject* pOPO = aIter.Next()->GetOutlinerParaObject();
- if( pOPO )
- pOPO->PrepareStore( (SfxStyleSheetPool*) pStyleSheetPool );
- }
+ SdrObjListIter aIter(*GetMasterPage(i));
+ while(aIter.IsMore())
+ aIter.Next()->PreSave();
}
nCnt = GetPageCount();
- for ( i = 0; i < nCnt; i++ )
+ for(i = 0; i < nCnt; i++)
{
// Pages
- SdrObjListIter aIter( *GetPage( i ) );
- while( aIter.IsMore() )
- {
- OutlinerParaObject* pOPO = aIter.Next()->GetOutlinerParaObject();
- if( pOPO )
- pOPO->PrepareStore( (SfxStyleSheetPool*) pStyleSheetPool );
- }
+ SdrObjListIter aIter(*GetPage(i));
+ while(aIter.IsMore())
+ aIter.Next()->PreSave();
}
}
+void SdrModel::PostSave()
+{
+ sal_uInt16 nCnt(GetMasterPageCount());
+
+ for(sal_uInt16 i(0); i < nCnt; i++)
+ {
+ // MasterPages
+ SdrObjListIter aIter(*GetMasterPage(i));
+ while(aIter.IsMore())
+ aIter.Next()->PostSave();
+ }
+
+ nCnt = GetPageCount();
+ for(i = 0; i < nCnt; i++)
+ {
+ // Pages
+ SdrObjListIter aIter(*GetPage(i));
+ while(aIter.IsMore())
+ aIter.Next()->PostSave();
+ }
+}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -2430,3 +2479,13 @@ SdrHint::SdrHint(const SdrObject& rNewObj)
eHint=HINT_OBJCHG;
}
+SdrHint::SdrHint(const SdrObject& rNewObj, const Rectangle& rRect)
+{
+ aRect = rRect;
+ pPage = rNewObj.GetPage();
+ pObj = &rNewObj;
+ pObjList = rNewObj.GetObjList();
+ bNeedRepaint = TRUE;
+ eHint = HINT_OBJCHG;
+}
+
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index bbadf71146f6..30bc99a9990e 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdmrkv.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:01:25 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -974,10 +974,11 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode)
{
SdrObject* pObj = aMark.GetMark(0)->GetObj();
SdrModel* pModel = GetModel();
- SfxItemSet aSet(pModel->GetItemPool(), XATTR_FILLFLOATTRANSPARENCE, XATTR_FILLFLOATTRANSPARENCE, 0, 0);
- pObj->TakeAttributes(aSet, TRUE, FALSE);
+//-/ SfxItemSet aSet(pModel->GetItemPool(), XATTR_FILLFLOATTRANSPARENCE, XATTR_FILLFLOATTRANSPARENCE, 0, 0);
+//-/ pObj->TakeAttributes(aSet, TRUE, FALSE);
+ const SfxItemSet& rSet = pObj->GetItemSet();
const SfxPoolItem* pPoolItem;
- SfxItemState eState = aSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, FALSE, &pPoolItem);
+ SfxItemState eState = rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, FALSE, &pPoolItem);
if(SFX_ITEM_SET == eState)
{
@@ -991,14 +992,15 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode)
aGrad.SetStartIntens(100);
aGrad.SetEndIntens(100);
aNewItem.SetValue(aGrad);
- aSet.Put(aNewItem);
+//-/ aSet.Put(aNewItem);
// add undo to allow user to take back this step
pModel->BegUndo(SVX_RESSTR(SIP_XA_FILLTRANSPARENCE));
pModel->AddUndo(new SdrUndoAttrObj(*pObj));
pModel->EndUndo();
- pObj->SetAttributes(aSet, FALSE);
+ pObj->SetItem(aNewItem);
+//-/ pObj->SetAttributes(aSet, FALSE);
}
// set values and transform to vector set
@@ -1006,7 +1008,7 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode)
GradTransVector aGradTransVector;
GradTransGradient aGradTransGradient;
- aGradTransGradient.aGradient = ((XFillFloatTransparenceItem&)aSet.Get(XATTR_FILLFLOATTRANSPARENCE)).GetValue();
+ aGradTransGradient.aGradient = ((XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE)).GetValue();
aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, pObj);
// build handles
@@ -1036,9 +1038,10 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode)
if(nMarkAnz == 1)
{
SdrObject* pObj = aMark.GetMark(0)->GetObj();
- SfxItemSet aSet(GetModel()->GetItemPool());
- pObj->TakeAttributes(aSet, FALSE, FALSE);
- XFillStyle eFillStyle = ((XFillStyleItem&)(aSet.Get(XATTR_FILLSTYLE))).GetValue();
+//-/ SfxItemSet aSet(GetModel()->GetItemPool());
+//-/ pObj->TakeAttributes(aSet, FALSE, FALSE);
+ const SfxItemSet& rSet = pObj->GetItemSet();
+ XFillStyle eFillStyle = ((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue();
if(eFillStyle == XFILL_GRADIENT)
{
@@ -1048,7 +1051,7 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode)
GradTransGradient aGradTransGradient;
Size aHdlSize(15, 15);
- aGradTransGradient.aGradient = ((XFillGradientItem&)aSet.Get(XATTR_FILLGRADIENT)).GetValue();
+ aGradTransGradient.aGradient = ((XFillGradientItem&)rSet.Get(XATTR_FILLGRADIENT)).GetValue();
aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, pObj);
// build handles
diff --git a/svx/source/svdraw/svdoattr.cxx b/svx/source/svdraw/svdoattr.cxx
index 2133b7df1a42..2b7b6011d449 100644
--- a/svx/source/svdraw/svdoattr.cxx
+++ b/svx/source/svdraw/svdoattr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdoattr.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:01:25 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,15 +68,15 @@
#include "svdxout.hxx"
#include "svdpage.hxx"
#include "svdattr.hxx"
-#include "svdattrx.hxx" // NotPersistItems
+#include "svdattrx.hxx"
#include "svdpool.hxx"
#include "svdotext.hxx"
#include "svdocapt.hxx"
-#include "svdograf.hxx" // fuer GetAttributes: Keine Linie, keine Flaeche
-#include "svdoole2.hxx" // fuer GetAttributes: Keine Linie, keine Flaeche
-#include "svdorect.hxx" // fuer GetAttributes: Eckenradius
-#include "svdocirc.hxx" // fuer GetAttributes: Eckenradius
-#include "svdomeas.hxx" // fuer GetAttributes: Kein Fontwork, kein ContourFrame
+#include "svdograf.hxx"
+#include "svdoole2.hxx"
+#include "svdorect.hxx"
+#include "svdocirc.hxx"
+#include "svdomeas.hxx"
#ifndef _SFXSMPLHINT_HXX //autogen
#include <svtools/smplhint.hxx>
@@ -198,160 +198,187 @@
#include <xlnstit.hxx>
#endif
+#ifndef _SVX_ADJITEM_HXX
+#include <adjitem.hxx>
+#endif
+
////////////////////////////////////////////////////////////////////////////////////////////////////
TYPEINIT1(SdrAttrObj,SdrObject);
-SdrAttrObj::SdrAttrObj():
- pLineAttr(NULL),
- pFillAttr(NULL),
- pTextAttr(NULL),
- pShadAttr(NULL),
- pOutlAttr(NULL),
- pMiscAttr(NULL),
- pStyleSheet(NULL)
+SdrAttrObj::SdrAttrObj()
+//-/ pLineAttr(NULL),
+//-/ pFillAttr(NULL),
+//-/ pTextAttr(NULL),
+//-/ pShadAttr(NULL),
+//-/ pOutlAttr(NULL),
+//-/ pMiscAttr(NULL),
+: mpStyleSheet(NULL),
+ mpObjectItemSet(NULL)
{
}
SdrAttrObj::~SdrAttrObj()
{
- pLineAttr=(XLineAttrSetItem*) ImpSetNewAttr(pLineAttr,NULL,FALSE);
- pFillAttr=(XFillAttrSetItem*) ImpSetNewAttr(pFillAttr,NULL,FALSE);
- pTextAttr=(XTextAttrSetItem*) ImpSetNewAttr(pTextAttr,NULL,FALSE);
- pShadAttr=(SdrShadowSetItem*) ImpSetNewAttr(pShadAttr,NULL,FALSE);
- pOutlAttr=(SdrOutlinerSetItem*)ImpSetNewAttr(pOutlAttr,NULL,FALSE);
- pMiscAttr=(SdrMiscSetItem*) ImpSetNewAttr(pMiscAttr,NULL,FALSE);
+//-/ pLineAttr=(XLineAttrSetItem*) ImpSetNewAttr(pLineAttr,NULL,FALSE);
+//-/ pFillAttr=(XFillAttrSetItem*) ImpSetNewAttr(pFillAttr,NULL,FALSE);
+//-/ pTextAttr=(XTextAttrSetItem*) ImpSetNewAttr(pTextAttr,NULL,FALSE);
+//-/ pShadAttr=(SdrShadowSetItem*) ImpSetNewAttr(pShadAttr,NULL,FALSE);
+//-/ pOutlAttr=(SdrOutlinerSetItem*)ImpSetNewAttr(pOutlAttr,NULL,FALSE);
+//-/ pMiscAttr=(SdrMiscSetItem*) ImpSetNewAttr(pMiscAttr,NULL,FALSE);
+ ImpDeleteItemSet();
}
-const Rectangle& SdrAttrObj::GetSnapRect() const
+void SdrAttrObj::ImpDeleteItemSet()
{
- if (bSnapRectDirty) {
- ((SdrAttrObj*)this)->RecalcSnapRect();
- ((SdrAttrObj*)this)->bSnapRectDirty=FALSE;
+ if(mpObjectItemSet)
+ {
+ if(GetStyleSheet())
+ RemoveStyleSheet();
+
+ delete mpObjectItemSet;
+ mpObjectItemSet = 0L;
}
- return aSnapRect;
}
-void SdrAttrObj::operator=(const SdrObject& rObj)
+void SdrAttrObj::ImpForceItemSet()
{
- SdrObject::operator=(rObj);
- SdrObject* pObj=(SdrObject*)&rObj;
- SdrAttrObj* pAO=PTR_CAST(SdrAttrObj,pObj);
- if (pAO!=NULL) {
- pLineAttr=(const XLineAttrSetItem*) ImpSetNewAttr(pLineAttr,pAO->pLineAttr);
- pFillAttr=(const XFillAttrSetItem*) ImpSetNewAttr(pFillAttr,pAO->pFillAttr);
- pTextAttr=(const XTextAttrSetItem*) ImpSetNewAttr(pTextAttr,pAO->pTextAttr);
- pShadAttr=(const SdrShadowSetItem*) ImpSetNewAttr(pShadAttr,pAO->pShadAttr);
- pOutlAttr=(const SdrOutlinerSetItem*)ImpSetNewAttr(pOutlAttr,pAO->pOutlAttr);
- pMiscAttr=(const SdrMiscSetItem*) ImpSetNewAttr(pMiscAttr,pAO->pMiscAttr);
- RemoveStyleSheet();
- AddStyleSheet(pAO->pStyleSheet,TRUE);
+ if(!mpObjectItemSet)
+ {
+ SfxItemPool* pPool = GetItemPool();
+ mpObjectItemSet = CreateNewItemSet(*pPool);
+ ForceDefaultAttr();
}
}
-void SdrAttrObj::WriteData(SvStream& rOut) const
+const Rectangle& SdrAttrObj::GetSnapRect() const
{
- SdrObject::WriteData(rOut);
- SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
-#ifdef DBG_UTIL
- aCompat.SetID("SdrAttrObj");
-#endif
-
- SfxItemPool* pPool = GetItemPool();
- if (pPool!=NULL) {
- pPool->StoreSurrogate(rOut,pLineAttr);
- pPool->StoreSurrogate(rOut,pFillAttr);
- pPool->StoreSurrogate(rOut,pTextAttr);
- pPool->StoreSurrogate(rOut,pShadAttr);
- pPool->StoreSurrogate(rOut,pOutlAttr);
- pPool->StoreSurrogate(rOut,pMiscAttr);
- } else {
- rOut<<UINT16(SFX_ITEMS_NULL);
- rOut<<UINT16(SFX_ITEMS_NULL);
- rOut<<UINT16(SFX_ITEMS_NULL);
- rOut<<UINT16(SFX_ITEMS_NULL);
- rOut<<UINT16(SFX_ITEMS_NULL);
- rOut<<UINT16(SFX_ITEMS_NULL);
+ if(bSnapRectDirty)
+ {
+ ((SdrAttrObj*)this)->RecalcSnapRect();
+ ((SdrAttrObj*)this)->bSnapRectDirty = FALSE;
}
+ return maSnapRect;
+}
- // StyleSheet-Pointer als Name, Familie abspeichern
- // wenn kein StyleSheet vorhanden: leeren String speichern
- if(pStyleSheet)
- {
- // UNICODE: rOut << pStyleSheet->GetName();
- rOut.WriteByteString(pStyleSheet->GetName());
+void SdrAttrObj::operator=(const SdrObject& rObj)
+{
+ // call parent
+ SdrObject::operator=(rObj);
- rOut << (UINT16)(int)(pStyleSheet->GetFamily());
- }
- else
+ SdrAttrObj* pAO = PTR_CAST(SdrAttrObj, (SdrObject*)&rObj);
+ if(pAO)
{
- // UNICODE: rOut << String();
- rOut.WriteByteString(String());
+//-/ pLineAttr=(const XLineAttrSetItem*) ImpSetNewAttr(pLineAttr,pAO->pLineAttr);
+//-/ pFillAttr=(const XFillAttrSetItem*) ImpSetNewAttr(pFillAttr,pAO->pFillAttr);
+//-/ pTextAttr=(const XTextAttrSetItem*) ImpSetNewAttr(pTextAttr,pAO->pTextAttr);
+//-/ pShadAttr=(const SdrShadowSetItem*) ImpSetNewAttr(pShadAttr,pAO->pShadAttr);
+//-/ pOutlAttr=(const SdrOutlinerSetItem*)ImpSetNewAttr(pOutlAttr,pAO->pOutlAttr);
+//-/ pMiscAttr=(const SdrMiscSetItem*) ImpSetNewAttr(pMiscAttr,pAO->pMiscAttr);
+ ImpDeleteItemSet();
+
+ if(pAO->mpObjectItemSet)
+ mpObjectItemSet = pAO->mpObjectItemSet->Clone(TRUE);
+//-/ mpObjectItemSet = new SfxItemSet(*pAO->mpObjectItemSet);
+
+ if(pAO->GetStyleSheet())
+ AddStyleSheet(pAO->GetStyleSheet(), TRUE);
}
- // ab Version 1 wird der CharacterSet gespeichert
- // rOut << (INT16) ::GetSystemCharSet(); // und ab V11 nicht mehr
}
void SdrAttrObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
{
- if (rIn.GetError()!=0) return;
- SdrObject::ReadData(rHead,rIn);
- SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
+ if(rIn.GetError())
+ return;
+
+ // call parent
+ SdrObject::ReadData(rHead, rIn);
+
+ SdrDownCompat aCompat(rIn, STREAM_READ);
#ifdef DBG_UTIL
aCompat.SetID("SdrAttrObj");
#endif
- SfxItemPool* pPool=GetItemPool();
-
- if (pPool!=NULL) {
- USHORT nWhichRef;
- if (rHead.GetVersion()<11) { UINT16 nWhichDum; rIn>>nWhichDum; } // ab V11 keine WhichId mehr
- pLineAttr=(const XLineAttrSetItem*)ImpSetNewAttr(pLineAttr,NULL); // ggf altes rauswerfen
- nWhichRef=XATTRSET_LINE;
- pLineAttr=(const XLineAttrSetItem*)pPool->LoadSurrogate(rIn,nWhichRef,0);
-
- if (rHead.GetVersion()<11) { UINT16 nWhichDum; rIn>>nWhichDum; } // ab V11 keine WhichId mehr
- pFillAttr=(const XFillAttrSetItem*)ImpSetNewAttr(pFillAttr,NULL); // ggf altes rauswerfen
- nWhichRef=XATTRSET_FILL;
- pFillAttr=(const XFillAttrSetItem*)pPool->LoadSurrogate(rIn,nWhichRef,0);
-
- if (rHead.GetVersion()<11) { UINT16 nWhichDum; rIn>>nWhichDum; } // ab V11 keine WhichId mehr
- pTextAttr=(const XTextAttrSetItem*)ImpSetNewAttr(pTextAttr,NULL); // ggf altes rauswerfen
- nWhichRef=XATTRSET_TEXT;
- pTextAttr=(const XTextAttrSetItem*)pPool->LoadSurrogate(rIn,nWhichRef,0);
-
- if (rHead.GetVersion()<11) { UINT16 nWhichDum; rIn>>nWhichDum; } // ab V11 keine WhichId mehr
- pShadAttr=(const SdrShadowSetItem*)ImpSetNewAttr(pShadAttr,NULL); // ggf altes rauswerfen
- nWhichRef=SDRATTRSET_SHADOW;
- pShadAttr=(const SdrShadowSetItem*)pPool->LoadSurrogate(rIn,nWhichRef,0);
-
- if (rHead.GetVersion()>=5) {
- if (rHead.GetVersion()<11) { UINT16 nWhichDum; rIn>>nWhichDum; } // ab V11 keine WhichId mehr
- pOutlAttr=(const SdrOutlinerSetItem*)ImpSetNewAttr(pOutlAttr,NULL); // ggf altes rauswerfen
- nWhichRef=SDRATTRSET_OUTLINER;
- pOutlAttr=(const SdrOutlinerSetItem*)pPool->LoadSurrogate(rIn,nWhichRef,0);
+ SfxItemPool* pPool = GetItemPool();
+
+ if(pPool)
+ {
+ sal_uInt16 nSetID;
+ SfxItemSet aNewSet(GetItemSet());
+
+ if(rHead.GetVersion() < 11)
+ { sal_uInt16 nWhichDum; rIn >> nWhichDum; }
+ nSetID = XATTRSET_LINE;
+ const XLineAttrSetItem* pLineAttr = (const XLineAttrSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0);
+ if(pLineAttr)
+ aNewSet.Put(pLineAttr->GetItemSet());
+
+ if(rHead.GetVersion() < 11)
+ { sal_uInt16 nWhichDum; rIn >> nWhichDum; }
+ nSetID = XATTRSET_FILL;
+ const XFillAttrSetItem* pFillAttr = (const XFillAttrSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0);
+ if(pFillAttr)
+ aNewSet.Put(pFillAttr->GetItemSet());
+
+ if(rHead.GetVersion() < 11)
+ { sal_uInt16 nWhichDum; rIn >> nWhichDum; }
+ nSetID = XATTRSET_TEXT;
+ const XTextAttrSetItem* pTextAttr = (const XTextAttrSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0);
+ if(pTextAttr)
+ aNewSet.Put(pTextAttr->GetItemSet());
+
+ if(rHead.GetVersion() < 11)
+ { sal_uInt16 nWhichDum; rIn >> nWhichDum; }
+ nSetID = SDRATTRSET_SHADOW;
+ const SdrShadowSetItem* pShadAttr = (const SdrShadowSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0);
+ if(pShadAttr)
+ aNewSet.Put(pShadAttr->GetItemSet());
+
+ if(rHead.GetVersion() >= 5)
+ {
+ if(rHead.GetVersion() < 11)
+ { sal_uInt16 nWhichDum; rIn >> nWhichDum; }
+ nSetID = SDRATTRSET_OUTLINER;
+ const SdrOutlinerSetItem* pOutlAttr = (const SdrOutlinerSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0);
+ if(pOutlAttr)
+ aNewSet.Put(pOutlAttr->GetItemSet());
}
- if (rHead.GetVersion()>=6) {
- if (rHead.GetVersion()<11) { UINT16 nWhichDum; rIn>>nWhichDum; } // ab V11 keine WhichId mehr
- pMiscAttr=(const SdrMiscSetItem*)ImpSetNewAttr(pMiscAttr,NULL); // ggf altes rauswerfen
- nWhichRef=SDRATTRSET_MISC;
- pMiscAttr=(const SdrMiscSetItem*)pPool->LoadSurrogate(rIn,nWhichRef,0);
+ if(rHead.GetVersion() >= 6)
+ {
+ if(rHead.GetVersion() < 11)
+ { sal_uInt16 nWhichDum; rIn >> nWhichDum; }
+ nSetID = SDRATTRSET_MISC;
+ const SdrMiscSetItem* pMiscAttr = (const SdrMiscSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0);
+ if(pMiscAttr)
+ aNewSet.Put(pMiscAttr->GetItemSet());
}
- } else {
+
+ SetItemSet(aNewSet);
+ }
+ else
+ {
// an den Surrogaten und ggf. auch Whiches vorbeiseeken
- USHORT nAnz=4; // ganz zu anfang waren es 4 SetItems
- if (rHead.GetVersion()>=5) nAnz++;
- if (rHead.GetVersion()>=6) nAnz++;
- nAnz*=sizeof(UINT16);
- if (rHead.GetVersion()<11) nAnz*=2; // ab V11 keine WhichId mehr
+ // ganz zu anfang waren es 4 SetItems
+ sal_uInt16 nAnz(4);
+
+ if(rHead.GetVersion() >= 5)
+ nAnz++;
+
+ if(rHead.GetVersion() >= 6)
+ nAnz++;
+
+ nAnz *= sizeof(sal_uInt16);
+
+ if(rHead.GetVersion() < 11)
+ nAnz *= 2;
+
rIn.SeekRel(nAnz);
}
// TextToContour: altes Format(Flag) in neues Format(Item) wandeln
- if (rHead.GetVersion()<=4 && pPool!=NULL) {
- SfxItemSet aSet(*pPool);
- aSet.Put(XFormTextStyleItem(XFT_NONE));
- NbcSetAttributes(aSet,FALSE);
+ if(rHead.GetVersion() <= 4 && pPool)
+ {
+ SetItem(XFormTextStyleItem(XFT_NONE));
}
// Fuer die StyleSheetgeschichte gehoert eigentlich auch noch eine
@@ -360,7 +387,7 @@ void SdrAttrObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
// umwandeln lassen (SB)
XubString aStyleSheetName;
SfxStyleFamily eFamily;
- UINT16 nRead;
+ sal_uInt16 nRead;
// UNICODE: rIn>>aStyleSheetName;
rIn.ReadByteString(aStyleSheetName);
@@ -373,881 +400,1300 @@ void SdrAttrObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
// ab Version 1 wird der CharacterSet gelesen, ab V11 nicht mehr
if(rHead.GetVersion() > 0 && rHead.GetVersion() < 11)
{
- INT16 nCharSet;
+ sal_Int16 nCharSet;
rIn >> nCharSet;
//aStyleSheetName.Convert((CharSet)nCharSet);
// nicht mehr noetig, da ab Vers 11 der CharSet bereits am
// Stream gesetzt wird.
}
- DBG_ASSERT( pModel!=NULL, "SdrAttrObj::ReadData(): pModel=NULL, StyleSheet kann nicht gesetzt werden!");
- if (pModel!=NULL) {
- SfxStyleSheetBasePool* pPool=pModel->GetStyleSheetPool();
-#ifdef DBG_UTIL
- if( pPool == NULL )
- DBG_WARNING("SdrAttrObj::ReadData(): kein StyleSheetPool");
-#endif
- if (pPool!=NULL) {
- SfxStyleSheet* pTmpStyleSheet=(SfxStyleSheet*)pPool->Find(aStyleSheetName,eFamily);
-#ifdef DBG_UTIL
- if(pTmpStyleSheet == NULL)
- DBG_WARNING("SdrAttrObj::ReadData(): StyleSheet nicht gefunden");
-#endif
- if (pTmpStyleSheet!=NULL) {
- StartListening(*pPool);
- StartListening(*pTmpStyleSheet);
- SfxItemSet* pParent=&pTmpStyleSheet->GetItemSet();
- if (pLineAttr!=NULL) ((SfxItemSet*)&pLineAttr->GetItemSet())->SetParent(pParent);
- if (pFillAttr!=NULL) ((SfxItemSet*)&pFillAttr->GetItemSet())->SetParent(pParent);
- if (pTextAttr!=NULL) ((SfxItemSet*)&pTextAttr->GetItemSet())->SetParent(pParent);
- if (pShadAttr!=NULL) ((SfxItemSet*)&pShadAttr->GetItemSet())->SetParent(pParent);
- if (pOutlAttr!=NULL) ((SfxItemSet*)&pOutlAttr->GetItemSet())->SetParent(pParent);
- if (pMiscAttr!=NULL) ((SfxItemSet*)&pMiscAttr->GetItemSet())->SetParent(pParent);
- // ausnahmsweise die harte Attributierung nicht loeschen
- //AddStyleSheet(pTmpStyleSheet,TRUE);
- pStyleSheet=pTmpStyleSheet;
- }
+ DBG_ASSERT(pModel, "SdrAttrObj::ReadData(): pModel=NULL, StyleSheet kann nicht gesetzt werden!");
+ if(pModel)
+ {
+ SfxStyleSheetBasePool *pPool = pModel->GetStyleSheetPool();
+ DBG_ASSERT(pPool, "SdrAttrObj::ReadData(): kein StyleSheetPool");
+
+ if(pPool)
+ {
+ SfxStyleSheet *pTmpStyleSheet = (SfxStyleSheet*)pPool->Find(aStyleSheetName, eFamily);
+ DBG_ASSERT(pTmpStyleSheet, "SdrAttrObj::ReadData(): StyleSheet nicht gefunden");
+
+ if(pTmpStyleSheet)
+ AddStyleSheet(pTmpStyleSheet, TRUE);
+//-/ {
+//-/ StartListening(*pPool);
+//-/ StartListening(*pTmpStyleSheet);
+//-/
+//-///-/ SfxItemSet* pParent = &pTmpStyleSheet->GetItemSet();
+//-///-/ if (pLineAttr!=NULL) ((SfxItemSet*)&pLineAttr->GetItemSet())->SetParent(pParent);
+//-///-/ if (pFillAttr!=NULL) ((SfxItemSet*)&pFillAttr->GetItemSet())->SetParent(pParent);
+//-///-/ if (pTextAttr!=NULL) ((SfxItemSet*)&pTextAttr->GetItemSet())->SetParent(pParent);
+//-///-/ if (pShadAttr!=NULL) ((SfxItemSet*)&pShadAttr->GetItemSet())->SetParent(pParent);
+//-///-/ if (pOutlAttr!=NULL) ((SfxItemSet*)&pOutlAttr->GetItemSet())->SetParent(pParent);
+//-///-/ if (pMiscAttr!=NULL) ((SfxItemSet*)&pMiscAttr->GetItemSet())->SetParent(pParent);
+//-/
+//-/ if(!mpObjectItemSet)
+//-/ mpObjectItemSet = new SfxItemSet(*pPool);
+//-/
+//-/ mpObjectItemSet->SetParent(&pTmpStyleSheet->GetItemSet());
+//-/ }
}
}
}
}
-SfxItemPool* SdrAttrObj::ImpGetItemPool(const SfxPoolItem* pAlternateItem1, const SfxPoolItem* pAlternateItem2) const
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// pre- and postprocessing for objects for saving
+
+void SdrAttrObj::PreSave()
{
- SfxItemPool* pPool= (pModel==NULL) ? NULL : &pModel->GetItemPool();
- if (pPool==NULL) {
- SfxSetItem* pSI;
- if (pAlternateItem1!=NULL) {
- pSI=PTR_CAST(SfxSetItem,pAlternateItem1);
- if (pSI!=NULL) pPool=(SfxItemPool*)pSI->GetItemSet().GetPool();
- }
- if (pPool==NULL && pAlternateItem2!=NULL) {
- pSI=PTR_CAST(SfxSetItem,pAlternateItem2);
- if (pSI!=NULL) pPool=(SfxItemPool*)pSI->GetItemSet().GetPool();
- }
- }
- return pPool;
+ // call parent
+ SdrObject::PreSave();
+
+ // prepare SetItems for storage
+ const SfxItemSet& rSet = GetItemSet();
+ const SfxItemSet* pParent = GetStyleSheet() ? &GetStyleSheet()->GetItemSet() : 0L;
+
+ XLineAttrSetItem aLineAttr(rSet.GetPool());
+ aLineAttr.GetItemSet().Put(rSet);
+ aLineAttr.GetItemSet().SetParent(pParent);
+ mpObjectItemSet->Put(aLineAttr);
+
+ XFillAttrSetItem aFillAttr(rSet.GetPool());
+ aFillAttr.GetItemSet().Put(rSet);
+ aFillAttr.GetItemSet().SetParent(pParent);
+ mpObjectItemSet->Put(aFillAttr);
+
+ XTextAttrSetItem aTextAttr(rSet.GetPool());
+ aTextAttr.GetItemSet().Put(rSet);
+ aTextAttr.GetItemSet().SetParent(pParent);
+ mpObjectItemSet->Put(aTextAttr);
+
+ SdrShadowSetItem aShadAttr(rSet.GetPool());
+ aShadAttr.GetItemSet().Put(rSet);
+ aShadAttr.GetItemSet().SetParent(pParent);
+ mpObjectItemSet->Put(aShadAttr);
+
+ SdrOutlinerSetItem aOutlAttr(rSet.GetPool());
+ aOutlAttr.GetItemSet().Put(rSet);
+ aOutlAttr.GetItemSet().SetParent(pParent);
+ mpObjectItemSet->Put(aOutlAttr);
+
+ SdrMiscSetItem aMiscAttr(rSet.GetPool());
+ aMiscAttr.GetItemSet().Put(rSet);
+ aMiscAttr.GetItemSet().SetParent(pParent);
+ mpObjectItemSet->Put(aMiscAttr);
}
-SfxItemPool* SdrAttrObj::ImpGetItemPool() const
+void SdrAttrObj::PostSave()
{
- SfxItemPool* pPool= (pModel==NULL) ? NULL : &pModel->GetItemPool();
- if (pPool==NULL) {
- USHORT nAnz=GetSetItemCount();
- for (USHORT i=0; i<nAnz && pPool==NULL; i++) {
- const SfxSetItem* pSI=GetSetItem(i);
- if (pSI!=NULL) pPool=pSI->GetItemSet().GetPool();
- }
- }
- return pPool;
+ // call parent
+ SdrObject::PostSave();
+
+ // remove SetItems from local itemset
+ ((SdrAttrObj*)this)->ImpForceItemSet();
+ mpObjectItemSet->ClearItem(XATTRSET_LINE);
+ mpObjectItemSet->ClearItem(XATTRSET_FILL);
+ mpObjectItemSet->ClearItem(XATTRSET_TEXT);
+ mpObjectItemSet->ClearItem(SDRATTRSET_SHADOW);
+ mpObjectItemSet->ClearItem(SDRATTRSET_OUTLINER);
+ mpObjectItemSet->ClearItem(SDRATTRSET_MISC);
}
-const SfxPoolItem* SdrAttrObj::ImpSetNewAttr(const SfxPoolItem* pAkt, const SfxPoolItem* pNew, FASTBOOL bChg)
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrAttrObj::WriteData(SvStream& rOut) const
{
- SfxItemPool* pPool=ImpGetItemPool(pAkt,pNew);
- if (pPool!=NULL) {
- if (pAkt!=NULL) pPool->Remove(*pAkt);
- if (pNew!=NULL) pNew=&pPool->Put(*pNew);
+ // call parent
+ SdrObject::WriteData(rOut);
+
+ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
+ SdrDownCompat aCompat(rOut, STREAM_WRITE);
+#ifdef DBG_UTIL
+ aCompat.SetID("SdrAttrObj");
+#endif
+ SfxItemPool* pPool = GetItemPool();
+
+ if(pPool)
+ {
+ const SfxItemSet& rSet = GetItemSet();
+
+ pPool->StoreSurrogate(rOut, &rSet.Get(XATTRSET_LINE));
+ pPool->StoreSurrogate(rOut, &rSet.Get(XATTRSET_FILL));
+ pPool->StoreSurrogate(rOut, &rSet.Get(XATTRSET_TEXT));
+ pPool->StoreSurrogate(rOut, &rSet.Get(SDRATTRSET_SHADOW));
+ pPool->StoreSurrogate(rOut, &rSet.Get(SDRATTRSET_OUTLINER));
+ pPool->StoreSurrogate(rOut, &rSet.Get(SDRATTRSET_MISC));
+
+
+
+//-/ const SfxItemSet& rSet = GetItemSet();
+//-/
+//-/ XLineAttrSetItem aLineAttr(pPool);
+//-/ aLineAttr.GetItemSet().Put(rSet);
+//-/ const SfxPoolItem& rLineAttr = pPool->Put(aLineAttr);
+//-/ pPool->StoreSurrogate(rOut, &rLineAttr);
+//-/ pPool->Remove(rLineAttr);
+//-/
+//-/ XFillAttrSetItem aFillAttr(pPool);
+//-/ aFillAttr.GetItemSet().Put(rSet);
+//-/ const SfxPoolItem& rFillAttr = pPool->Put(aFillAttr);
+//-/ pPool->StoreSurrogate(rOut, &rFillAttr);
+//-/ pPool->Remove(rFillAttr);
+//-/
+//-/ XTextAttrSetItem aTextAttr(pPool);
+//-/ aTextAttr.GetItemSet().Put(rSet);
+//-/ const SfxPoolItem& rTextAttr = pPool->Put(aTextAttr);
+//-/ pPool->StoreSurrogate(rOut, &rTextAttr);
+//-/ pPool->Remove(rTextAttr);
+//-/
+//-/ SdrShadowSetItem aShadAttr(pPool);
+//-/ aShadAttr.GetItemSet().Put(rSet);
+//-/ const SfxPoolItem& rShadAttr = pPool->Put(aShadAttr);
+//-/ pPool->StoreSurrogate(rOut, &rShadAttr);
+//-/ pPool->Remove(rShadAttr);
+//-/
+//-/ SdrOutlinerSetItem aOutlAttr(pPool);
+//-/ aOutlAttr.GetItemSet().Put(rSet);
+//-/ const SfxPoolItem& rOutlAttr = pPool->Put(aOutlAttr);
+//-/ pPool->StoreSurrogate(rOut, &rOutlAttr);
+//-/ pPool->Remove(rOutlAttr);
+//-/
+//-/ SdrMiscSetItem aMiscAttr(pPool);
+//-/ aMiscAttr.GetItemSet().Put(rSet);
+//-/ const SfxPoolItem& rMiscAttr = pPool->Put(aMiscAttr);
+//-/ pPool->StoreSurrogate(rOut, &rMiscAttr);
+//-/ pPool->Remove(rMiscAttr);
+ }
+ else
+ {
+ rOut << sal_uInt16(SFX_ITEMS_NULL);
+ rOut << sal_uInt16(SFX_ITEMS_NULL);
+ rOut << sal_uInt16(SFX_ITEMS_NULL);
+ rOut << sal_uInt16(SFX_ITEMS_NULL);
+ rOut << sal_uInt16(SFX_ITEMS_NULL);
+ rOut << sal_uInt16(SFX_ITEMS_NULL);
+ }
+
+ // StyleSheet-Pointer als Name, Familie abspeichern
+ // wenn kein StyleSheet vorhanden: leeren String speichern
+ if(GetStyleSheet())
+ {
+ // UNICODE: rOut << pStyleSheet->GetName();
+ rOut.WriteByteString(GetStyleSheet()->GetName());
+ rOut << (sal_uInt16)(int)(GetStyleSheet()->GetFamily());
+ }
+ else
+ {
+ // UNICODE: rOut << String();
+ rOut.WriteByteString(String());
}
- return pNew;
}
+//-/SfxItemPool* SdrAttrObj::ImpGetItemPool(const SfxPoolItem* pAlternateItem1, const SfxPoolItem* pAlternateItem2) const
+//-/{
+//-/ SfxItemPool* pPool= (pModel==NULL) ? NULL : &pModel->GetItemPool();
+//-/ if (pPool==NULL) {
+//-/ SfxSetItem* pSI;
+//-/ if (pAlternateItem1!=NULL) {
+//-/ pSI=PTR_CAST(SfxSetItem,pAlternateItem1);
+//-/ if (pSI!=NULL) pPool=(SfxItemPool*)pSI->GetItemSet().GetPool();
+//-/ }
+//-/ if (pPool==NULL && pAlternateItem2!=NULL) {
+//-/ pSI=PTR_CAST(SfxSetItem,pAlternateItem2);
+//-/ if (pSI!=NULL) pPool=(SfxItemPool*)pSI->GetItemSet().GetPool();
+//-/ }
+//-/ }
+//-/ return pPool;
+//-/}
+
+//-/SfxItemPool* SdrAttrObj::ImpGetItemPool() const
+//-/{
+//-/ SfxItemPool* pPool = (!pModel) ? NULL : &pModel->GetItemPool();
+//-/
+//-/ if(!pPool && mpObjectItemSet)
+//-/ pPool = mpObjectItemSet->GetPool();
+//-/ {
+//-/ USHORT nAnz=GetSetItemCount();
+//-/ for (USHORT i=0; i<nAnz && pPool==NULL; i++) {
+//-/ const SfxSetItem* pSI=GetSetItem(i);
+//-/ if (pSI!=NULL) pPool=pSI->GetItemSet().GetPool();
+//-/ }
+//-/ }
+//-/
+//-/ return pPool;
+//-/}
+
+//-/const SfxPoolItem* SdrAttrObj::ImpSetNewAttr(const SfxPoolItem* pAkt, const SfxPoolItem* pNew, FASTBOOL bChg)
+//-/{
+//-/ SfxItemPool* pPool=ImpGetItemPool(pAkt,pNew);
+//-/ if (pPool!=NULL) {
+//-/ if (pAkt!=NULL) pPool->Remove(*pAkt);
+//-/ if (pNew!=NULL) pNew=&pPool->Put(*pNew);
+//-/ }
+//-/ return pNew;
+//-/}
+
static void ImpScaleItemSet(SfxItemSet& rSet, const Fraction& rScale)
{
- long nMul=rScale.GetNumerator();
- long nDiv=rScale.GetDenominator();
- if (!rScale.IsValid() || nDiv==0) return;
+ sal_Int32 nMul(rScale.GetNumerator());
+ sal_Int32 nDiv(rScale.GetDenominator());
+
+ if(!rScale.IsValid() || !nDiv)
+ return;
+
SfxWhichIter aIter(rSet);
- USHORT nWhich=aIter.FirstWhich();
- while (nWhich!=0) {
- const SfxPoolItem *pItem=NULL;
- if (rSet.GetItemState(nWhich,FALSE,&pItem)==SFX_ITEM_SET) {
- if (pItem->HasMetrics()) {
- SfxPoolItem* pNewItem=pItem->Clone();
- pNewItem->ScaleMetrics(nMul,nDiv);
+ 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);
}
- } // if (rSet.GetItemState(...)==SFX_ITEM_SET)
- nWhich=aIter.NextWhich();
+ }
+ nWhich = aIter.NextWhich();
}
}
void SdrAttrObj::SetModel(SdrModel* pNewModel)
{
- SdrModel* pOldModel=pModel;
+ SdrModel* pOldModel = pModel;
+
+ // test for correct pool in ItemSet; move to new pool if necessary
+ if(pNewModel && mpObjectItemSet && mpObjectItemSet->GetPool() != &pNewModel->GetItemPool())
+ MigrateItemPool(mpObjectItemSet->GetPool(), &pNewModel->GetItemPool());
+
+ // call parent
SdrObject::SetModel(pNewModel);
- if (pOldModel!=pNewModel && pNewModel!=NULL && !pNewModel->IsLoading()) {
- // fuer ein frisch eingefuegtes Obj die Defaultattribute setzen
- if (pOldModel==NULL) ForceDefaultAttr(&pModel->GetItemPool());
+
+ if(pOldModel != pNewModel && pNewModel && !pNewModel->IsLoading())
+ {
+//-/ // fuer ein frisch eingefuegtes Obj die Defaultattribute setzen
+//-/ if(!pOldModel)
+//-/ ForceDefaultAttr(&pModel->GetItemPool());
+
// fuer ein bereits "lebendes" Model die Attribute von einem Pool in den anderen schieben
- if (pOldModel!=NULL) {
+ if(pOldModel)
+ {
// Checken, ob sich die ScaleUnit geaendert hat.
// Denn dann muessen naemlich alle MetrikItems umgerechnet werden.
MapUnit aOldUnit(pOldModel->GetScaleUnit());
MapUnit aNewUnit(pNewModel->GetScaleUnit());
- FASTBOOL bScaleUnitChanged=aNewUnit!=aOldUnit;
+ BOOL bScaleUnitChanged(aNewUnit != aOldUnit);
Fraction aMetricFactor;
- if (bScaleUnitChanged) aMetricFactor=GetMapFactor(aOldUnit,aNewUnit).X();
+
+ if(bScaleUnitChanged)
+ {
+ aMetricFactor = GetMapFactor(aOldUnit, aNewUnit).X();
+
+ if(mpObjectItemSet)
+ ImpScaleItemSet(*mpObjectItemSet, aMetricFactor);
+ }
+
// Und nun alle Items auf die das Obj verweisst aus
// dem alten Pools raus und in den neuen rein.
- SdrItemPool& rOldPool=(SdrItemPool&)pOldModel->GetItemPool();
- SdrItemPool& rNewPool=(SdrItemPool&)pModel->GetItemPool();
-
- DBG_ASSERT(&rOldPool!=NULL,"SdrAttrObj::SetModel(): Kein ItemPool am alten Model");
- DBG_ASSERT(&rNewPool!=NULL,"SdrAttrObj::SetModel(): Kein ItemPool am neuen Model");
-
- USHORT nItemSetAnz=GetSetItemCount();
- for (USHORT i=0; i<nItemSetAnz; i++) {
- const SfxSetItem* pSI=GetSetItem(i);
- if (pSI!=NULL) {
- const SfxSetItem* pNewAttr=NULL;
- if (!bScaleUnitChanged) {
- pNewAttr=&(const SfxSetItem&)rNewPool.Put(*pSI);
- } else { // ggf. alle MetrikItems Skalieren
- SfxSetItem* pNewSetItem=(SfxSetItem*)pSI->Clone(&rNewPool);
- ImpScaleItemSet(pNewSetItem->GetItemSet(),aMetricFactor);
- pNewAttr=&(const SfxSetItem&)rNewPool.Put(*pNewSetItem);
- }
- rOldPool.Remove(*pSI);
- SetSetItem(i,pNewAttr);
- }
- }
+//-/ SdrItemPool& rOldPool = (SdrItemPool&)pOldModel->GetItemPool();
+//-/ SdrItemPool& rNewPool = (SdrItemPool&)pModel->GetItemPool();
+ SfxStyleSheet* pOldStyleSheet = GetStyleSheet();
+
+//-/ DBG_ASSERT(&rOldPool != NULL, "SdrAttrObj::SetModel(): Kein ItemPool am alten Model");
+//-/ DBG_ASSERT(&rNewPool != NULL, "SdrAttrObj::SetModel(): Kein ItemPool am neuen Model");
+
+//-/ if(mpObjectItemSet)
+//-/ {
+//-/ SfxItemSet* pNewSet = mpObjectItemSet->Clone(TRUE, &rNewPool);
+//-/
+//-/ if(bScaleUnitChanged)
+//-/ ImpScaleItemSet(*pNewSet, aMetricFactor);
+//-/
+//-/ // set new itemset
+//-/ ImpDeleteItemSet();
+//-/ mpObjectItemSet = pNewSet;
+//-/ }
+//-/ sal_uInt16 nItemSetAnz(GetSetItemCount());
+//-/ for(sal_uInt16 i(0); i < nItemSetAnz; i++)
+//-/ {
+//-/ const SfxSetItem* pSI=GetSetItem(i);
+//-/ if (pSI!=NULL) {
+//-/ const SfxSetItem* pNewAttr=NULL;
+//-/ if (!bScaleUnitChanged) {
+//-/ pNewAttr=&(const SfxSetItem&)rNewPool.Put(*pSI);
+//-/ } else { // ggf. alle MetrikItems Skalieren
+//-/ SfxSetItem* pNewSetItem=(SfxSetItem*)pSI->Clone(&rNewPool);
+//-/ ImpScaleItemSet(pNewSetItem->GetItemSet(),aMetricFactor);
+//-/ pNewAttr=&(const SfxSetItem&)rNewPool.Put(*pNewSetItem);
+//-/ }
+//-/ rOldPool.Remove(*pSI);
+//-/ SetSetItem(i,pNewAttr);
+//-/ }
+//-/ }
// ***** StyleSheets Anfang *****
// ggfs. StyleSheet und dessen Parents kopieren
// Follows werden nicht beruecksichtigt (ganz wie im Writer)
- if (pStyleSheet!=NULL) {
- SfxStyleSheetBase* pSheet =pStyleSheet;
- SfxStyleSheetBasePool* pOldPool=pOldModel->GetStyleSheetPool();
- SfxStyleSheetBasePool* pNewPool=pModel->GetStyleSheetPool();
- DBG_ASSERT(pOldPool!=NULL,"SdrAttrObj::SetModel(): Objekt hat StyleSheet aber keinen StyleSheetPool am SdrModel");
- if (pOldPool!=NULL) {
- if (pNewPool!=NULL) {
- // Liste der zu kopierenden Vorlagen
- List aList;
- SfxStyleSheetBase* pAnchor=NULL;
- if (pOldPool!=NULL && pNewPool!=NULL) {
- while (pSheet!=NULL) {
- pAnchor=pNewPool->Find(pSheet->GetName(),pSheet->GetFamily());
- if (pAnchor==NULL) {
- aList.Insert(pSheet,LIST_APPEND);
- pSheet=pOldPool->Find(pSheet->GetParent(),pSheet->GetFamily());
- } else {
- pSheet=NULL; // die gesuchte Vorlage gibt's schon
- }
- }
- }
+ if(pOldStyleSheet)
+ {
+ SfxStyleSheetBase* pSheet = pOldStyleSheet;
+ SfxStyleSheetBasePool* pOldPool = pOldModel->GetStyleSheetPool();
+ SfxStyleSheetBasePool* pNewPool = pModel->GetStyleSheetPool();
+ DBG_ASSERT(pOldPool, "SdrAttrObj::SetModel(): Objekt hat StyleSheet aber keinen StyleSheetPool am SdrModel");
+
+ if(pOldPool && pNewPool)
+ {
+ // Liste der zu kopierenden Vorlagen
+ List aList;
+ SfxStyleSheetBase* pAnchor = NULL;
- // kopieren und Parents der Kopien setzen
- pSheet=(SfxStyleSheetBase*)aList.First();
- SfxStyleSheetBase* pNewSheet=NULL;
- SfxStyleSheetBase* pLastSheet=NULL;
- SfxStyleSheetBase* pForThisObject=NULL;
- if (pNewPool!=NULL) {
- while (pSheet!=NULL) {
- pNewSheet = &pNewPool->Make(pSheet->GetName(),
- pSheet->GetFamily(),
- pSheet->GetMask());
- pNewSheet->GetItemSet().Put(pSheet->GetItemSet(),FALSE); // FALSE= InvalidItems nicht als Default, sondern als "Loecher" betrachten
- if (bScaleUnitChanged) { // ggf. alle MetrikItems Skalieren
- ImpScaleItemSet(pNewSheet->GetItemSet(),aMetricFactor);
- }
- if (pLastSheet!=NULL) {
- pLastSheet->SetParent(pNewSheet->GetName());
- }
-
- if (pForThisObject==NULL)
- pForThisObject=pNewSheet; // den kriegt das Objekt
-
- pLastSheet=pNewSheet;
- pSheet=(SfxStyleSheetBase*)aList.Next();
- }
+ while(pSheet)
+ {
+ pAnchor = pNewPool->Find(pSheet->GetName(), pSheet->GetFamily());
+
+ if(!pAnchor)
+ {
+ aList.Insert(pSheet, LIST_APPEND);
+ pSheet = pOldPool->Find(pSheet->GetParent(), pSheet->GetFamily());
+ }
+ else
+ {
+ // die gesuchte Vorlage gibt's schon
+ pSheet = NULL;
}
+ }
+
+ // kopieren und Parents der Kopien setzen
+ pSheet = (SfxStyleSheetBase*)aList.First();
+ SfxStyleSheetBase* pNewSheet = NULL;
+ SfxStyleSheetBase* pLastSheet = NULL;
+ SfxStyleSheetBase* pForThisObject = NULL;
- // Veknuepfung mit der im Zielpool gefundenen Vorlage
- if (pAnchor!=NULL && pLastSheet!=NULL)
- pLastSheet->SetParent(pAnchor->GetName());
+ while(pSheet)
+ {
+ pNewSheet = &pNewPool->Make(pSheet->GetName(), pSheet->GetFamily(), pSheet->GetMask());
+ pNewSheet->GetItemSet().Put(pSheet->GetItemSet(), FALSE);
+
+ if(bScaleUnitChanged)
+ ImpScaleItemSet(pNewSheet->GetItemSet(), aMetricFactor);
+
+ if(pLastSheet)
+ pLastSheet->SetParent(pNewSheet->GetName());
+
+ if(!pForThisObject)
+ pForThisObject = pNewSheet;
+
+ pLastSheet = pNewSheet;
+ pSheet = (SfxStyleSheetBase*)aList.Next();
+ }
- // falls die Liste leer war (alle Vorlagen schon im Zielpool
- // vorhanden) ist pForThisObject noch nicht gesetzt
- if (pForThisObject==NULL && pAnchor!=NULL)
- pForThisObject=pAnchor;
+ // Veknuepfung mit der im Zielpool gefundenen Vorlage
+ if(pAnchor && pLastSheet)
+ pLastSheet->SetParent(pAnchor->GetName());
- // am alten StyleSheet ab- und am neuen anmelden
+ // falls die Liste leer war (alle Vorlagen schon im Zielpool
+ // vorhanden) ist pForThisObject noch nicht gesetzt
+ if(!pForThisObject && pAnchor)
+ pForThisObject = pAnchor;
+
+ // am alten StyleSheet ab- und am neuen anmelden
+ if(GetStyleSheet() != pForThisObject)
+ {
RemoveStyleSheet();
- AddStyleSheet((SfxStyleSheet*)pForThisObject,TRUE);
- } else { // if (pNewPool!=NULL)
- // Aha, im neuen Model gibt's also kein StyleSheetPool
- // also setzte ich "einfach" alle Attribute des alten StyleSheets hart
- List aList;
- const SfxItemSet* pItemSet=&pStyleSheet->GetItemSet();
- while (pItemSet!=NULL) {
- aList.Insert((void*)pItemSet,CONTAINER_APPEND);
- pItemSet=pItemSet->GetParent();
- }
- SfxItemSet aSet(pNewModel->GetItemPool());
- pItemSet=(SfxItemSet*)aList.Last();
- while (pItemSet!=NULL) {
- aSet.Put(*pItemSet);
- pItemSet=(SfxItemSet*)aList.Prev();
- }
- // Attribute, die schon vorher hart gesetzt
- // waren muessen aber erhalten bleiben:
- for (USHORT i=0; i<nItemSetAnz; i++) {
- const SfxSetItem* pSI=GetSetItem(i);
- if (pSI!=NULL) {
- const SfxItemSet& rIS=pSI->GetItemSet();
- SfxWhichIter aIter(rIS);
- USHORT nWhich=aIter.FirstWhich();
- while (nWhich!=0) {
- if (rIS.GetItemState(nWhich,FALSE)==SFX_ITEM_SET) {
- aSet.ClearItem(nWhich);
- }
- nWhich=aIter.NextWhich();
- }
- }
- }
- if (bScaleUnitChanged) { // ggf. alle MetrikItems Skalieren
- ImpScaleItemSet(aSet,aMetricFactor);
+ AddStyleSheet((SfxStyleSheet*)pForThisObject, TRUE);
+ }
+ }
+ else
+ {
+ // Aha, im neuen Model gibt's also kein StyleSheetPool
+ // also setzte ich "einfach" alle Attribute des alten StyleSheets hart
+ List aList;
+ const SfxItemSet* pItemSet = &pOldStyleSheet->GetItemSet();
+
+ while(pItemSet)
+ {
+ aList.Insert((void*)pItemSet, CONTAINER_APPEND);
+ pItemSet = pItemSet->GetParent();
+ }
+
+ SfxItemSet* pNewSet = CreateNewItemSet(pNewModel->GetItemPool());
+ pItemSet = (SfxItemSet*)aList.Last();
+
+ while(pItemSet)
+ {
+ pNewSet->Put(*pItemSet);
+ pItemSet = (SfxItemSet*)aList.Prev();
+ }
+
+ // Attribute, die schon vorher hart gesetzt
+ // waren muessen aber erhalten bleiben:
+ if(mpObjectItemSet)
+ {
+ SfxWhichIter aIter(*mpObjectItemSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ while(nWhich)
+ {
+ if(mpObjectItemSet->GetItemState(nWhich, FALSE) == SFX_ITEM_SET)
+ pNewSet->Put(mpObjectItemSet->Get(nWhich));
+
+ nWhich = aIter.NextWhich();
}
- SetAttributes(aSet,FALSE);
- RemoveStyleSheet();
- } // if (pNewPool!=NULL)
- } // if (pOldPool!=NULL)
- } // if (pStyleSheet!=NULL)
+ }
+//-/ for(sal_uInt16 i(0); i < nItemSetAnz; i++)
+//-/ {
+//-/ const SfxSetItem* pSI = GetSetItem(i);
+//-/ if(pSI)
+//-/ {
+//-/ const SfxItemSet& rIS = pSI->GetItemSet();
+//-/ SfxWhichIter aIter(rIS);
+//-/ sal_uInt16 nWhich = aIter.FirstWhich();
+//-/
+//-/ while(nWhich)
+//-/ {
+//-/ if(rIS.GetItemState(nWhich, FALSE) == SFX_ITEM_SET)
+//-/ aSet.ClearItem(nWhich);
+//-/
+//-/ nWhich = aIter.NextWhich();
+//-/ }
+//-/ }
+//-/ }
+
+
+ if(bScaleUnitChanged)
+ ImpScaleItemSet(*pNewSet, aMetricFactor);
+
+ ImpDeleteItemSet();
+ mpObjectItemSet = pNewSet;
+
+//-/ SetAttributes(*pNewSet, FALSE);
+//-/ RemoveStyleSheet();
+ }
+ }
// ***** StyleSheets Ende *****
}
+
// Jedes Objekt bekommt initial den DefaultStyleSheet
// des Model, falls noch kein StyleSheet gesetzt.
- // Der DefaultStyleSheet wird jedoch nur gesetzt, wenn das Objekt auch
- // Attribute hat (Entscheidung anhand pLineAttr!=NULL). 3D-Objekte
- // haben naemlich z.T. keine eigenen Attribute. (Joe M. 04-12-1996)
- if (pLineAttr!=NULL && pStyleSheet==NULL && pModel!=NULL && !pModel->IsLoading()) {
- SfxStyleSheet* pDefSS=pModel->GetDefaultStyleSheet();
- if (pDefSS!=NULL) {
- // Dabei jedoch nicht die harte Attributierung loeschen!
- AddStyleSheet(pDefSS,TRUE);
- }
- }
- } // if (pOldModel!=pNewModel && pNewModel!=NULL && !pNewModel->IsLoading())
-}
+ if(mpObjectItemSet && !GetStyleSheet() && pModel && !pModel->IsLoading())
+ {
+ SfxStyleSheet* pDefSS = pModel->GetDefaultStyleSheet();
-void SdrAttrObj::ForceDefaultAttr(SfxItemPool* pPool)
-{
- if (pPool!=NULL && pLineAttr==NULL) {
- SdrTextObj* pText=PTR_CAST(SdrTextObj,this);
- SdrCaptionObj* pCapt=PTR_CAST(SdrCaptionObj,this);
- FASTBOOL bTextFrame=pText!=NULL && pText->IsTextFrame();
- FASTBOOL bCaption=pCapt!=NULL;
-
-#ifdef SDRDEFITEMCACHE
- // SdrItemPool in der Verkettung suchen (wg. Writer)
- SdrItemPool* pSdrPool=NULL;
- SfxItemPool* pTmpPool=pPool;
- while (pTmpPool!=NULL && pSdrPool==NULL) {
- // Etwas komplizierte Abfrage und auch Hack, weil am
- // Pool kein RTTI vorhanden ist! Joe, 02-09-1997
- if (pTmpPool->GetFirstWhich()<=SDRATTR_START && pTmpPool->GetLastWhich()>=SDRATTR_END) {
- if (pTmpPool->GetName().EqualsAscii("XOutdevItemPool"))
- pSdrPool=(SdrItemPool*)pTmpPool;
- }
- pTmpPool=pTmpPool->GetSecondaryPool();
- }
- DBG_ASSERT(pSdrPool!=NULL,"SdrAttrObj::ForceDefaultAttr(): Kein SdrItemPool gefunden!");
- if (pSdrPool->pDefLineAttr==NULL) pSdrPool->ImpMakeDefItems();
- if (bTextFrame) {
- pLineAttr=bCaption ? pSdrPool->pDefLineAttr : pSdrPool->pDefTextFrameLineAttr;
- pFillAttr=pSdrPool->pDefTextFrameFillAttr;
- pTextAttr=pSdrPool->pDefTextFrameTextAttr;
- pShadAttr=pSdrPool->pDefTextFrameShadAttr;
- pOutlAttr=pSdrPool->pDefTextFrameOutlAttr;
- pMiscAttr=pSdrPool->pDefTextFrameMiscAttr;
- } else {
- pLineAttr=pSdrPool->pDefLineAttr;
- pFillAttr=pSdrPool->pDefFillAttr;
- pTextAttr=pSdrPool->pDefTextAttr;
- pShadAttr=pSdrPool->pDefShadAttr;
- pOutlAttr=pSdrPool->pDefOutlAttr;
- pMiscAttr=pSdrPool->pDefMiscAttr;
- }
- pLineAttr->AddRef();
- pFillAttr->AddRef();
- pTextAttr->AddRef();
- pShadAttr->AddRef();
- pOutlAttr->AddRef();
- pMiscAttr->AddRef();
-#else // SDRDEFITEMCACHE
- if (pLineAttr==NULL) {
- XLineAttrSetItem aSetItem(pPool);
- if (bTextFrame && !bCaption) {
- aSetItem.GetItemSet().Put(XLineStyleItem(XLINE_NONE));
- }
- pLineAttr=(XLineAttrSetItem*)ImpSetNewAttr(pLineAttr,&aSetItem,FALSE);
- }
- if (pFillAttr==NULL) {
- XFillAttrSetItem aSetItem(pPool);
- if (bTextFrame) {
- aSetItem.GetItemSet().Put(XFillColorItem(String(),Color(COL_WHITE))); // Falls einer auf Solid umschaltet
- aSetItem.GetItemSet().Put(XFillStyleItem(XFILL_NONE));
- }
- pFillAttr=(XFillAttrSetItem*)ImpSetNewAttr(pFillAttr,&aSetItem,FALSE);
- }
- if (pTextAttr==NULL) {
- XTextAttrSetItem aSetItem(pPool);
- pTextAttr=(XTextAttrSetItem*)ImpSetNewAttr(pTextAttr,&aSetItem,FALSE);
- }
- if (pShadAttr==NULL) {
- SdrShadowSetItem aSetItem(pPool);
- pShadAttr=(SdrShadowSetItem*)ImpSetNewAttr(pShadAttr,&aSetItem,FALSE);
- }
- if (pOutlAttr==NULL) {
- SdrOutlinerSetItem aSetItem(pPool);
- if (!bTextFrame) {
- aSetItem.GetItemSet().Put(SvxAdjustItem(SVX_ADJUST_CENTER));
- }
- pOutlAttr=(SdrOutlinerSetItem*)ImpSetNewAttr(pOutlAttr,&aSetItem,FALSE);
- }
- if (pMiscAttr==NULL) {
- SdrMiscSetItem aSetItem(pPool);
- if (!bTextFrame) {
- aSetItem.GetItemSet().Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER));
- aSetItem.GetItemSet().Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
+ if(pDefSS)
+ {
+ // Dabei jedoch nicht die harte Attributierung loeschen!
+ AddStyleSheet(pDefSS, TRUE);
}
- pMiscAttr=(SdrMiscSetItem*)ImpSetNewAttr(pMiscAttr,&aSetItem,FALSE);
}
-#endif // SDRDEFITEMCACHE
}
}
-void SdrAttrObj::TakeAttributes(SfxItemSet& rAttr, FASTBOOL bMerge, FASTBOOL bOnlyHardAttr) const
+void SdrAttrObj::ForceDefaultAttr()
{
- USHORT nAnz=GetSetItemCount();
- FASTBOOL bHasText=GetOutlinerParaObject()!=NULL;
- SdrTextObj* pTextObj=PTR_CAST(SdrTextObj,this);
- FASTBOOL bIsContourFrame=pTextObj!=NULL && pTextObj->IsContourTextFrame();
- SdrMeasureObj* pMeasObj=PTR_CAST(SdrMeasureObj,this);
- if (!bHasText && pTextObj!=NULL && pTextObj->IsTextEditActive()) bHasText=TRUE;
- FASTBOOL bTextFrame=pTextObj!=NULL && pTextObj->IsTextFrame();
- FASTBOOL bCanFontwork=bHasText && pTextObj!=NULL && !bTextFrame && pMeasObj==NULL;
- FASTBOOL bCanContourFrame=bHasText && pTextObj!=NULL && !bTextFrame;
- FASTBOOL bGrafObj=HAS_BASE(SdrGrafObj,this) || HAS_BASE(SdrOle2Obj,this);
- FASTBOOL bHasEckRad=!bGrafObj && !bIsUnoObj && HAS_BASE(SdrRectObj,this) && !HAS_BASE(SdrCircObj,this);
- FASTBOOL bHasFill=bClosedObj;
- FASTBOOL bHasLEnd=!bClosedObj || HAS_BASE(SdrCaptionObj,this);
- for (USHORT i=0; i<nAnz; i++) {
- const SfxSetItem* pSI=GetSetItem(i);
- FASTBOOL bOk=pSI!=NULL;
- if (pSI==pFillAttr && !bHasFill) bOk=FALSE;
- if (pSI==pTextAttr && !bCanFontwork) bOk=FALSE;
- if (pSI==pOutlAttr && !bHasText) bOk=FALSE;
- if (bGrafObj && (pSI==pFillAttr || pSI==pLineAttr)) bOk=FALSE; // fuer Grafik und OLE
- if (pSI!=NULL && !bMerge && bOnlyHardAttr) bOk=TRUE; // z.B. im Falle Undo
- if (bOk) {
- const SfxItemSet& rIS=pSI->GetItemSet();
- SfxWhichIter aIter(rIS);
- USHORT nWhich=aIter.FirstWhich();
- while (nWhich!=0) {
- if ((bHasLEnd || nWhich<XATTR_LINESTART || nWhich>XATTR_LINEENDCENTER) &&
- (bHasEckRad || nWhich!=SDRATTR_ECKENRADIUS) &&
- (bHasText || nWhich<SDRATTR_TEXT_MINFRAMEHEIGHT || nWhich>SDRATTR_TEXT_CONTOURFRAME) &&
- (bTextFrame || (nWhich!=SDRATTR_TEXT_AUTOGROWHEIGHT && nWhich!=SDRATTR_TEXT_MINFRAMEHEIGHT && nWhich!=SDRATTR_TEXT_MAXFRAMEHEIGHT &&
- nWhich!=SDRATTR_TEXT_AUTOGROWWIDTH && nWhich!=SDRATTR_TEXT_MINFRAMEWIDTH && nWhich!=SDRATTR_TEXT_MAXFRAMEWIDTH)) &&
- (bCanContourFrame || nWhich!=SDRATTR_TEXT_CONTOURFRAME) &&
- (!bIsContourFrame || nWhich<SDRATTR_TEXT_MINFRAMEHEIGHT || nWhich>SDRATTR_TEXT_HORZADJUST) &&
- (nWhich<EE_FEATURE_START || nWhich>EE_FEATURE_END) )
- {
- if (!bOnlyHardAttr || rIS.GetItemState(nWhich,FALSE)==SFX_ITEM_SET) {
- const SfxPoolItem& rItem=rIS.Get(nWhich);
- if (bMerge) rAttr.MergeValue(rItem,TRUE);
- else rAttr.Put(rItem);
- }
- }
- nWhich=aIter.NextWhich();
- }
- }
+//-/ if(pPool)
+//-/ {
+ SdrTextObj* pText = PTR_CAST(SdrTextObj, this);
+ BOOL bTextFrame(pText && pText->IsTextFrame());
+
+//-/ mpObjectItemSet = CreateNewItemSet(*pPool);
+
+ if(bTextFrame)
+ {
+ SdrCaptionObj* pCapt = PTR_CAST(SdrCaptionObj, this);
+ BOOL bCaption(pCapt != 0L);
+
+ if(!bCaption)
+ SetItem(XLineStyleItem(XLINE_NONE));
+
+ SetItem(XFillColorItem(String(), Color(COL_WHITE)));
+ SetItem(XFillStyleItem(XFILL_NONE));
}
- if (!bMerge && pLineAttr!=NULL) {
- rAttr.SetParent(pLineAttr->GetItemSet().GetParent());
+ else
+ {
+ SetItem(SvxAdjustItem(SVX_ADJUST_CENTER));
+ SetItem(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER));
+ SetItem(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
}
+//-/ }
+//-/ if (pPool!=NULL && pLineAttr==NULL) {
+//-/ SdrTextObj* pText=PTR_CAST(SdrTextObj,this);
+//-/ SdrCaptionObj* pCapt=PTR_CAST(SdrCaptionObj,this);
+//-/ FASTBOOL bTextFrame=pText!=NULL && pText->IsTextFrame();
+//-/ FASTBOOL bCaption=pCapt!=NULL;
+//-/
+//-///-/#ifdef SDRDEFITEMCACHE
+//-///-/ // SdrItemPool in der Verkettung suchen (wg. Writer)
+//-///-/ SdrItemPool* pSdrPool=NULL;
+//-///-/ SfxItemPool* pTmpPool=pPool;
+//-///-/ while (pTmpPool!=NULL && pSdrPool==NULL) {
+//-///-/ // Etwas komplizierte Abfrage und auch Hack, weil am
+//-///-/ // Pool kein RTTI vorhanden ist! Joe, 02-09-1997
+//-///-/ if (pTmpPool->GetFirstWhich()<=SDRATTR_START && pTmpPool->GetLastWhich()>=SDRATTR_END) {
+//-///-/ if (pTmpPool->GetName().EqualsAscii("XOutdevItemPool"))
+//-///-/ pSdrPool=(SdrItemPool*)pTmpPool;
+//-///-/ }
+//-///-/ pTmpPool=pTmpPool->GetSecondaryPool();
+//-///-/ }
+//-///-/ DBG_ASSERT(pSdrPool!=NULL,"SdrAttrObj::ForceDefaultAttr(): Kein SdrItemPool gefunden!");
+//-///-/ if (pSdrPool->pDefLineAttr==NULL) pSdrPool->ImpMakeDefItems();
+//-///-/ if (bTextFrame) {
+//-///-/ pLineAttr=bCaption ? pSdrPool->pDefLineAttr : pSdrPool->pDefTextFrameLineAttr;
+//-///-/ pFillAttr=pSdrPool->pDefTextFrameFillAttr;
+//-///-/ pTextAttr=pSdrPool->pDefTextFrameTextAttr;
+//-///-/ pShadAttr=pSdrPool->pDefTextFrameShadAttr;
+//-///-/ pOutlAttr=pSdrPool->pDefTextFrameOutlAttr;
+//-///-/ pMiscAttr=pSdrPool->pDefTextFrameMiscAttr;
+//-///-/ } else {
+//-///-/ pLineAttr=pSdrPool->pDefLineAttr;
+//-///-/ pFillAttr=pSdrPool->pDefFillAttr;
+//-///-/ pTextAttr=pSdrPool->pDefTextAttr;
+//-///-/ pShadAttr=pSdrPool->pDefShadAttr;
+//-///-/ pOutlAttr=pSdrPool->pDefOutlAttr;
+//-///-/ pMiscAttr=pSdrPool->pDefMiscAttr;
+//-///-/ }
+//-///-/ pLineAttr->AddRef();
+//-///-/ pFillAttr->AddRef();
+//-///-/ pTextAttr->AddRef();
+//-///-/ pShadAttr->AddRef();
+//-///-/ pOutlAttr->AddRef();
+//-///-/ pMiscAttr->AddRef();
+//-///-/#else // SDRDEFITEMCACHE
+//-/ if (pLineAttr==NULL) {
+//-/ XLineAttrSetItem aSetItem(pPool);
+//-/ if (bTextFrame && !bCaption) {
+//-/ aSetItem.GetItemSet().Put(XLineStyleItem(XLINE_NONE));
+//-/ }
+//-/ pLineAttr=(XLineAttrSetItem*)ImpSetNewAttr(pLineAttr,&aSetItem,FALSE);
+//-/ }
+//-/ if (pFillAttr==NULL) {
+//-/ XFillAttrSetItem aSetItem(pPool);
+//-/ if (bTextFrame) {
+//-/ aSetItem.GetItemSet().Put(XFillColorItem(String(),Color(COL_WHITE))); // Falls einer auf Solid umschaltet
+//-/ aSetItem.GetItemSet().Put(XFillStyleItem(XFILL_NONE));
+//-/ }
+//-/ pFillAttr=(XFillAttrSetItem*)ImpSetNewAttr(pFillAttr,&aSetItem,FALSE);
+//-/ }
+//-/ if (pTextAttr==NULL) {
+//-/ XTextAttrSetItem aSetItem(pPool);
+//-/ pTextAttr=(XTextAttrSetItem*)ImpSetNewAttr(pTextAttr,&aSetItem,FALSE);
+//-/ }
+//-/ if (pShadAttr==NULL) {
+//-/ SdrShadowSetItem aSetItem(pPool);
+//-/ pShadAttr=(SdrShadowSetItem*)ImpSetNewAttr(pShadAttr,&aSetItem,FALSE);
+//-/ }
+//-/ if (pOutlAttr==NULL) {
+//-/ SdrOutlinerSetItem aSetItem(pPool);
+//-/ if (!bTextFrame) {
+//-/ aSetItem.GetItemSet().Put(SvxAdjustItem(SVX_ADJUST_CENTER));
+//-/ }
+//-/ pOutlAttr=(SdrOutlinerSetItem*)ImpSetNewAttr(pOutlAttr,&aSetItem,FALSE);
+//-/ }
+//-/ if (pMiscAttr==NULL) {
+//-/ SdrMiscSetItem aSetItem(pPool);
+//-/ if (!bTextFrame) {
+//-/ aSetItem.GetItemSet().Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER));
+//-/ aSetItem.GetItemSet().Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
+//-/ }
+//-/ pMiscAttr=(SdrMiscSetItem*)ImpSetNewAttr(pMiscAttr,&aSetItem,FALSE);
+//-/ }
+//-///-/#endif // SDRDEFITEMCACHE
+//-/ }
}
-void SdrAttrObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
-{
- SfxItemPool* pPool=GetItemPool();
- if (pPool==NULL) pPool=(SfxItemPool*)rAttr.GetPool();
- ForceDefaultAttr(pPool);
- USHORT nAnz=GetSetItemCount();
-
- if (bReplaceAll) {
- SfxWhichIter aWhIter(rAttr);
- for (USHORT i=0; i<nAnz; i++) {
- const SfxSetItem* pOldSI=GetSetItem(i);
- if (pOldSI!=NULL) {
- const SfxItemSet& rOldIS=pOldSI->GetItemSet();
- const USHORT* pRanges=rOldIS.GetRanges();
- FASTBOOL bOneRange=pRanges[2]==0;
- USHORT nAnf=pRanges[0];
- USHORT nEnd=pRanges[1];
- SfxSetItem* pNewSI=NULL; //MakeNewSetItem(i,TRUE);
- SfxItemSet* pDstSet=NULL; //pNewSI->GetItemSet();
- // funkt nicht:
- // pNewSI->GetItemSet().Set(rAttr);
- // deshalb manuell #36313#
- pNewSI=MakeNewSetItem(i,TRUE);
- pDstSet=&pNewSI->GetItemSet();
- USHORT nWhich=aWhIter.FirstWhich();
- while (nWhich!=0) {
- const SfxPoolItem* pItem=NULL;
- SfxItemState eState=rAttr.GetItemState(nWhich,TRUE,&pItem);
- if (eState==SFX_ITEM_DEFAULT) {
- pDstSet->ClearItem(nWhich);
- } else if (eState==SFX_ITEM_SET) {
- if (nWhich<EE_FEATURE_START || nWhich>EE_FEATURE_END) {
- pDstSet->Put(*pItem);
- }
- }
- nWhich=aWhIter.NextWhich();
- }
- if (pNewSI!=NULL) {
- SetSetItem(i,(SfxSetItem*)ImpSetNewAttr(pOldSI,pNewSI));
- delete pNewSI;
- }
- }
- }
- } else {
- SfxItemIter aItIter(rAttr);
- for (USHORT i=0; i<nAnz; i++) {
- const SfxSetItem* pOldSI=GetSetItem(i);
- if (pOldSI!=NULL) {
- const SfxItemSet& rOldIS=pOldSI->GetItemSet();
- const USHORT* pRanges=rOldIS.GetRanges();
- FASTBOOL bOneRange=pRanges[2]==0;
- USHORT nAnf=pRanges[0];
- USHORT nEnd=pRanges[1];
- SfxSetItem* pNewSI=NULL; //MakeNewSetItem(i,TRUE);
- SfxItemSet* pDstSet=NULL; //pNewSI->GetItemSet();
- // funkt nicht:
- //pNewSI->GetItemSet().Put(rAttr,FALSE); // FALSE= InvalidItems nicht als Default, sondern als "Loecher" betrachten
- // deshalb manuell. (Bug 21223)
- const SfxPoolItem* pItem=aItIter.FirstItem();
- BOOL bFillAttrChangeHint(FALSE);
-
- while (pItem!=NULL) {
- if (!IsInvalidItem(pItem)) {
- USHORT nWhich=pItem->Which();
- if ((nWhich<EE_FEATURE_START || nWhich>EE_FEATURE_END) &&
- (!bOneRange || (nWhich>=nAnf && nWhich<=nEnd))) {
- if (pNewSI==NULL) {
- pNewSI=MakeNewSetItem(i,TRUE);
- pDstSet=&pNewSI->GetItemSet();
- }
-
- // Hinweis auf Veraenderung FillStyle
- if(i==1 && nWhich == XATTR_FILLSTYLE)
- bFillAttrChangeHint = TRUE;
-
- pDstSet->Put(*pItem);
- }
- }
- pItem=aItIter.NextItem();
- }
-
- if (pNewSI!=NULL)
- {
- if(bFillAttrChangeHint)
- {
- // FillStyle hat sich eventuell geaendert
- XFillStyle eFillStyle = ((XFillStyleItem&)(rAttr.Get(XATTR_FILLSTYLE))).GetValue();
-
- // Alle vom momentanen Stil nicht benutzten Items
- // rauswerfen. Dies gilt NICHT fuer die Fuellfarbe
- // (XFILL_SOLID). Diese wird als immer vorhandene
- // Grundfarbe des Objektes angesehen (wird von 3D
- // bereits so verwendet)
+//-/void SdrAttrObj::TakeAttributes(SfxItemSet& rAttr, FASTBOOL bMerge, FASTBOOL bOnlyHardAttr) const
+//-/{
+//-/ USHORT nAnz=GetSetItemCount();
+//-/ FASTBOOL bHasText=GetOutlinerParaObject()!=NULL;
+//-/ SdrTextObj* pTextObj=PTR_CAST(SdrTextObj,this);
+//-/ FASTBOOL bIsContourFrame=pTextObj!=NULL && pTextObj->IsContourTextFrame();
+//-/ SdrMeasureObj* pMeasObj=PTR_CAST(SdrMeasureObj,this);
+//-/ if (!bHasText && pTextObj!=NULL && pTextObj->IsTextEditActive()) bHasText=TRUE;
+//-/ FASTBOOL bTextFrame=pTextObj!=NULL && pTextObj->IsTextFrame();
+//-/ FASTBOOL bCanFontwork=bHasText && pTextObj!=NULL && !bTextFrame && pMeasObj==NULL;
+//-/ FASTBOOL bCanContourFrame=bHasText && pTextObj!=NULL && !bTextFrame;
+//-/ FASTBOOL bGrafObj=HAS_BASE(SdrGrafObj,this) || HAS_BASE(SdrOle2Obj,this);
+//-/ FASTBOOL bHasEckRad=!bGrafObj && !bIsUnoObj && HAS_BASE(SdrRectObj,this) && !HAS_BASE(SdrCircObj,this);
+//-/ FASTBOOL bHasFill=bClosedObj;
+//-/ FASTBOOL bHasLEnd=!bClosedObj || HAS_BASE(SdrCaptionObj,this);
+//-/ for (USHORT i=0; i<nAnz; i++) {
+//-/ const SfxSetItem* pSI=GetSetItem(i);
+//-/ FASTBOOL bOk=pSI!=NULL;
+//-/ if (pSI==pFillAttr && !bHasFill) bOk=FALSE;
+//-/ if (pSI==pTextAttr && !bCanFontwork) bOk=FALSE;
+//-/ if (pSI==pOutlAttr && !bHasText) bOk=FALSE;
+//-/ if (bGrafObj && (pSI==pFillAttr || pSI==pLineAttr)) bOk=FALSE; // fuer Grafik und OLE
+//-/ if (pSI!=NULL && !bMerge && bOnlyHardAttr) bOk=TRUE; // z.B. im Falle Undo
+//-/ if (bOk) {
+//-/ const SfxItemSet& rIS=pSI->GetItemSet();
+//-/ SfxWhichIter aIter(rIS);
+//-/ USHORT nWhich=aIter.FirstWhich();
+//-/ while (nWhich!=0) {
+//-/ if ((bHasLEnd || nWhich<XATTR_LINESTART || nWhich>XATTR_LINEENDCENTER) &&
+//-/ (bHasEckRad || nWhich!=SDRATTR_ECKENRADIUS) &&
+//-/ (bHasText || nWhich<SDRATTR_TEXT_MINFRAMEHEIGHT || nWhich>SDRATTR_TEXT_CONTOURFRAME) &&
+//-/ (bTextFrame || (nWhich!=SDRATTR_TEXT_AUTOGROWHEIGHT && nWhich!=SDRATTR_TEXT_MINFRAMEHEIGHT && nWhich!=SDRATTR_TEXT_MAXFRAMEHEIGHT &&
+//-/ nWhich!=SDRATTR_TEXT_AUTOGROWWIDTH && nWhich!=SDRATTR_TEXT_MINFRAMEWIDTH && nWhich!=SDRATTR_TEXT_MAXFRAMEWIDTH)) &&
+//-/ (bCanContourFrame || nWhich!=SDRATTR_TEXT_CONTOURFRAME) &&
+//-/ (!bIsContourFrame || nWhich<SDRATTR_TEXT_MINFRAMEHEIGHT || nWhich>SDRATTR_TEXT_HORZADJUST) &&
+//-/ (nWhich<EE_FEATURE_START || nWhich>EE_FEATURE_END) )
+//-/ {
+//-/ if (!bOnlyHardAttr || rIS.GetItemState(nWhich,FALSE)==SFX_ITEM_SET) {
+//-/ const SfxPoolItem& rItem=rIS.Get(nWhich);
+//-/ if (bMerge) rAttr.MergeValue(rItem,TRUE);
+//-/ else rAttr.Put(rItem);
+//-/ }
+//-/ }
+//-/ nWhich=aIter.NextWhich();
+//-/ }
+//-/ }
+//-/ }
+//-/ if (!bMerge && pLineAttr!=NULL) {
+//-/ rAttr.SetParent(pLineAttr->GetItemSet().GetParent());
+//-/ }
+//-/}
+
+//-/void SdrAttrObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/{
+//-/ SfxItemPool* pPool=GetItemPool();
+//-/ if (pPool==NULL) pPool=(SfxItemPool*)rAttr.GetPool();
+//-/ ForceDefaultAttr(pPool);
+//-/ USHORT nAnz=GetSetItemCount();
+//-/
+//-/ if (bReplaceAll) {
+//-/ SfxWhichIter aWhIter(rAttr);
+//-/ for (USHORT i=0; i<nAnz; i++) {
+//-/ const SfxSetItem* pOldSI=GetSetItem(i);
+//-/ if (pOldSI!=NULL) {
+//-/ const SfxItemSet& rOldIS=pOldSI->GetItemSet();
+//-/ const USHORT* pRanges=rOldIS.GetRanges();
+//-/ FASTBOOL bOneRange=pRanges[2]==0;
+//-/ USHORT nAnf=pRanges[0];
+//-/ USHORT nEnd=pRanges[1];
+//-/ SfxSetItem* pNewSI=NULL; //MakeNewSetItem(i,TRUE);
+//-/ SfxItemSet* pDstSet=NULL; //pNewSI->GetItemSet();
+//-/ // funkt nicht:
+//-/ // pNewSI->GetItemSet().Set(rAttr);
+//-/ // deshalb manuell #36313#
+//-/ pNewSI=MakeNewSetItem(i,TRUE);
+//-/ pDstSet=&pNewSI->GetItemSet();
+//-/ USHORT nWhich=aWhIter.FirstWhich();
+//-/ while (nWhich!=0) {
+//-/ const SfxPoolItem* pItem=NULL;
+//-/ SfxItemState eState=rAttr.GetItemState(nWhich,TRUE,&pItem);
+//-/ if (eState==SFX_ITEM_DEFAULT) {
+//-/ pDstSet->ClearItem(nWhich);
+//-/ } else if (eState==SFX_ITEM_SET) {
+//-/ if (nWhich<EE_FEATURE_START || nWhich>EE_FEATURE_END) {
+//-/ pDstSet->Put(*pItem);
+//-/ }
+//-/ }
+//-/ nWhich=aWhIter.NextWhich();
+//-/ }
+//-/ if (pNewSI!=NULL) {
+//-/ SetSetItem(i,(SfxSetItem*)ImpSetNewAttr(pOldSI,pNewSI));
+//-/ delete pNewSI;
+//-/ }
+//-/ }
+//-/ }
+//-/ } else {
+//-/ SfxItemIter aItIter(rAttr);
+//-/ for (USHORT i=0; i<nAnz; i++) {
+//-/ const SfxSetItem* pOldSI=GetSetItem(i);
+//-/ if (pOldSI!=NULL) {
+//-/ const SfxItemSet& rOldIS=pOldSI->GetItemSet();
+//-/ const USHORT* pRanges=rOldIS.GetRanges();
+//-/ FASTBOOL bOneRange=pRanges[2]==0;
+//-/ USHORT nAnf=pRanges[0];
+//-/ USHORT nEnd=pRanges[1];
+//-/ SfxSetItem* pNewSI=NULL; //MakeNewSetItem(i,TRUE);
+//-/ SfxItemSet* pDstSet=NULL; //pNewSI->GetItemSet();
+//-/ // funkt nicht:
+//-/ //pNewSI->GetItemSet().Put(rAttr,FALSE); // FALSE= InvalidItems nicht als Default, sondern als "Loecher" betrachten
+//-/ // deshalb manuell. (Bug 21223)
+//-/ const SfxPoolItem* pItem=aItIter.FirstItem();
+//-/ BOOL bFillAttrChangeHint(FALSE);
+//-/
+//-/ while (pItem!=NULL) {
+//-/ if (!IsInvalidItem(pItem)) {
+//-/ USHORT nWhich=pItem->Which();
+//-/ if ((nWhich<EE_FEATURE_START || nWhich>EE_FEATURE_END) &&
+//-/ (!bOneRange || (nWhich>=nAnf && nWhich<=nEnd))) {
+//-/ if (pNewSI==NULL) {
+//-/ pNewSI=MakeNewSetItem(i,TRUE);
+//-/ pDstSet=&pNewSI->GetItemSet();
+//-/ }
+//-/
+//-/ // Hinweis auf Veraenderung FillStyle
+//-/ if(i==1 && nWhich == XATTR_FILLSTYLE)
+//-/ bFillAttrChangeHint = TRUE;
+//-/
+//-/ pDstSet->Put(*pItem);
+//-/ }
+//-/ }
+//-/ pItem=aItIter.NextItem();
+//-/ }
+//-/
+//-/ if (pNewSI!=NULL)
+//-/ {
+//-/ if(bFillAttrChangeHint)
+//-/ {
+//-/ // FillStyle hat sich eventuell geaendert
+//-/ XFillStyle eFillStyle = ((XFillStyleItem&)(rAttr.Get(XATTR_FILLSTYLE))).GetValue();
+//-/
+//-/ // Alle vom momentanen Stil nicht benutzten Items
+//-/ // rauswerfen. Dies gilt NICHT fuer die Fuellfarbe
+//-/ // (XFILL_SOLID). Diese wird als immer vorhandene
+//-/ // Grundfarbe des Objektes angesehen (wird von 3D
+//-/ // bereits so verwendet)
+//-/
+//-/ if(eFillStyle != XFILL_GRADIENT)
+//-/ pDstSet->ClearItem(XATTR_FILLGRADIENT);
+//-/
+//-/ if(eFillStyle != XFILL_HATCH)
+//-/ pDstSet->ClearItem(XATTR_FILLHATCH);
+//-/
+//-/ if(eFillStyle != XFILL_BITMAP)
+//-/ pDstSet->ClearItem(XATTR_FILLBITMAP);
+//-/ }
+//-/
+//-/ SetSetItem(i,(SfxSetItem*)ImpSetNewAttr(pOldSI,pNewSI));
+//-/ delete pNewSI;
+//-/ }
+//-/ }
+//-/ }
+//-/ }
+//-/ bBoundRectDirty=TRUE;
+//-/ SetRectsDirty(TRUE);
+//-/}
+
+//-/void SdrAttrObj::SetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/{
+//-/ Rectangle aBoundRect0;
+//-/
+//-/ if(pUserCall)
+//-/ aBoundRect0 = GetBoundRect();
+//-/
+//-/ SendRepaintBroadcast();
+//-/ NbcSetAttributes(rAttr, bReplaceAll);
+//-/ SetChanged();
+//-/ SendRepaintBroadcast();
+//-/ SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect0);
+//-/}
- if(eFillStyle != XFILL_GRADIENT)
- pDstSet->ClearItem(XATTR_FILLGRADIENT);
+////////////////////////////////////////////////////////////////////////////////////////////////////
- if(eFillStyle != XFILL_HATCH)
- pDstSet->ClearItem(XATTR_FILLHATCH);
+// ItemSet access
+const SfxItemSet& SdrAttrObj::GetItemSet() const
+{
+ ((SdrAttrObj*)this)->ImpForceItemSet();
+ return *mpObjectItemSet;
+}
- if(eFillStyle != XFILL_BITMAP)
- pDstSet->ClearItem(XATTR_FILLBITMAP);
- }
+void SdrAttrObj::SetItem(const SfxPoolItem& rItem)
+{
+ ((SdrAttrObj*)this)->ImpForceItemSet();
+ mpObjectItemSet->Put(rItem);
+ bBoundRectDirty = TRUE;
+ SetRectsDirty(TRUE);
+ SetChanged();
+}
- SetSetItem(i,(SfxSetItem*)ImpSetNewAttr(pOldSI,pNewSI));
- delete pNewSI;
- }
- }
- }
+void SdrAttrObj::ClearItem( USHORT nWhich )
+{
+ if(mpObjectItemSet)
+ {
+ mpObjectItemSet->ClearItem(nWhich);
+ bBoundRectDirty = TRUE;
+ SetRectsDirty(TRUE);
+ SetChanged();
}
- bBoundRectDirty=TRUE;
- SetRectsDirty(TRUE);
}
-void SdrAttrObj::SetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+void SdrAttrObj::SetItemSet( const SfxItemSet& rSet )
{
- Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect();
- SendRepaintBroadcast();
- NbcSetAttributes(rAttr,bReplaceAll);
+ ((SdrAttrObj*)this)->ImpForceItemSet();
+ mpObjectItemSet->Put(rSet);
+ bBoundRectDirty = TRUE;
+ SetRectsDirty(TRUE);
SetChanged();
- SendRepaintBroadcast();
- SendUserCall(SDRUSERCALL_CHGATTR,aBoundRect0);
}
-void __EXPORT SdrAttrObj::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType)
+SfxItemSet* SdrAttrObj::CreateNewItemSet(SfxItemPool& rPool)
{
- SfxSimpleHint *pSimple = PTR_CAST(SfxSimpleHint,&rHint);
- FASTBOOL bDataChg = pSimple != NULL && pSimple->GetId() == SFX_HINT_DATACHANGED;
+ // include ALL items, 2D and 3D
+ return new SfxItemSet(rPool,
+ // ranges from SdrAttrObj
+ SDRATTR_START, SDRATTRSET_SHADOW,
+ SDRATTRSET_OUTLINER, SDRATTRSET_MISC,
+
+ // outliner and end
+ EE_ITEMS_START, EE_ITEMS_END,
+ 0, 0);
+}
+
+//-/void SdrAttrObj::BroadcastItemChange(const SdrBroadcastItemChange& rChange)
+//-/{
+//-/ Rectangle aBoundRect0;
+//-/
+//-/ if(pUserCall)
+//-/ aBoundRect0 = GetBoundRect();
+//-/
+//-/ SendRepaintBroadcast();
+//-/ NbcSetAttributes(rAttr, bReplaceAll);
+//-/ SetChanged();
+//-/ SendRepaintBroadcast();
+//-/ SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect0);
+//-/}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+void __EXPORT SdrAttrObj::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType)
+{
+ SfxSimpleHint *pSimple = PTR_CAST(SfxSimpleHint, &rHint);
+ BOOL bDataChg(pSimple && SFX_HINT_DATACHANGED == pSimple->GetId());
SfxStyleSheetHint *pStyleHint = PTR_CAST(SfxStyleSheetHint, &rHint);
- FASTBOOL bDying = pStyleHint != NULL && pStyleHint->GetHint() == SFX_STYLESHEET_INDESTRUCTION;
+ BOOL bDying(pStyleHint && SFX_STYLESHEET_INDESTRUCTION == pStyleHint->GetHint());
- if (bDataChg || bDying) {
- Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect();
- SfxStyleSheet* pNewStSh=NULL;
- FASTBOOL bBoundRectDirty0=bBoundRectDirty;
- if (bDying) {
+ if(bDataChg || bDying)
+ {
+ Rectangle aBoundRect0;
+
+ if(pUserCall)
+ aBoundRect0 = GetBoundRect();
+
+ SfxStyleSheet* pNewStSh = NULL;
+ BOOL bBoundRectDirty0 = bBoundRectDirty;
+
+ if(bDying)
+ {
// wenn es einen Parent gibt, wird jetzt der genommen
- if (HAS_BASE(SfxStyleSheet,pStyleSheet) && pModel!=NULL) { // Sonst ist pStyleSheet schon zu weit weggestorben
- pNewStSh=(SfxStyleSheet*)pModel->GetStyleSheetPool()->Find(pStyleSheet->GetParent(),pStyleSheet->GetFamily());
+ if(pModel && HAS_BASE(SfxStyleSheet, GetStyleSheet()))
+ {
+ // Sonst ist pStyleSheet schon zu weit weggestorben
+ pNewStSh = (SfxStyleSheet*)pModel->GetStyleSheetPool()->Find(
+ GetStyleSheet()->GetParent(), GetStyleSheet()->GetFamily());
}
+
// wenn es keinen Parent gibt, nehmen wir die Standardvorlage
- if (pNewStSh==NULL && pModel!=NULL) {
- pNewStSh=pModel->GetDefaultStyleSheet();
- }
+ if(!pNewStSh && pModel)
+ pNewStSh = pModel->GetDefaultStyleSheet();
+
// alten StyleSheet vor SendRepaintBroadcast entfernen #42276#
RemoveStyleSheet(); // setzt bBoundRectDirty=TRUE
}
- if (!bBoundRectDirty0) {
- bBoundRectDirty=FALSE; // fuer Broadcast mit dem alten Rect
+
+ if(!bBoundRectDirty0)
+ {
+ bBoundRectDirty = FALSE; // fuer Broadcast mit dem alten Rect
+
if(pPage && pPage->IsInserted())
SendRepaintBroadcast(); // Erstmal mit dem alten Rect
- bBoundRectDirty=TRUE;
+
+ bBoundRectDirty = TRUE;
SetRectsDirty(TRUE); // Durch Vorlagenloeschung evtl. andere Linienbreite
}
- if (pNewStSh && !bDying)
- AddStyleSheet(pNewStSh,TRUE);
+
+ if(pNewStSh && !bDying)
+ AddStyleSheet(pNewStSh, TRUE);
if(pPage && pPage->IsInserted())
SendRepaintBroadcast();
- SendUserCall(SDRUSERCALL_CHGATTR,aBoundRect0);
+
+ SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect0);
}
}
SfxStyleSheet* SdrAttrObj::GetStyleSheet() const
{
- return pStyleSheet;
+ return mpStyleSheet;
}
void SdrAttrObj::RemoveStyleSheet()
{
// Typ checken, weil bei dying sich der Typ abbaut (bis zum Broadcaster runter)
- if (pStyleSheet!=NULL && HAS_BASE(SfxStyleSheet,pStyleSheet))
+ if(GetStyleSheet() && HAS_BASE(SfxStyleSheet, mpStyleSheet))
{
- EndListening(*pStyleSheet);
- EndListening(pStyleSheet->GetPool());
+ EndListening(*mpStyleSheet);
+ EndListening(mpStyleSheet->GetPool());
// das ItemSet der Vorlage ist jetzt nicht mehr Parent der
// eigenen ItemSets
- USHORT nAnz=GetSetItemCount();
- for (USHORT i=0; i<nAnz; i++) {
- SfxSetItem* pNewSI=MakeNewSetItem(i,TRUE);
- if (pNewSI!=NULL) {
- pNewSI->GetItemSet().SetParent(NULL);
- const SfxSetItem* pOldSI=GetSetItem(i);
- // Alle Items aus der Vorlage von pOldSI nach pNewSI putten,
- // also hart Attributieren.
- // ... fehlende Implementation
-
- const SfxSetItem* pNewSI2=(const SfxSetItem*)ImpSetNewAttr(pOldSI,pNewSI);
- SetSetItem(i,pNewSI2);
- delete pNewSI;
- }
- }
- bBoundRectDirty=TRUE;
+ if(mpObjectItemSet)
+ mpObjectItemSet->SetParent(NULL);
+
+//-/ USHORT nAnz=GetSetItemCount();
+//-/ for (USHORT i=0; i<nAnz; i++) {
+//-/ SfxSetItem* pNewSI=MakeNewSetItem(i,TRUE);
+//-/ if (pNewSI!=NULL) {
+//-/ pNewSI->GetItemSet().SetParent(NULL);
+//-/ const SfxSetItem* pOldSI=GetSetItem(i);
+//-/ // Alle Items aus der Vorlage von pOldSI nach pNewSI putten,
+//-/ // also hart Attributieren.
+//-/ // ... fehlende Implementation
+//-/
+//-/ const SfxSetItem* pNewSI2=(const SfxSetItem*)ImpSetNewAttr(pOldSI,pNewSI);
+//-/ SetSetItem(i,pNewSI2);
+//-/ delete pNewSI;
+//-/ }
+//-/ }
+ bBoundRectDirty = TRUE;
SetRectsDirty(TRUE);
}
- pStyleSheet=NULL;
+//-/
+ mpStyleSheet = NULL;
}
-USHORT SdrAttrObj::GetSetItemCount() const
-{
- return 6;
-}
+//-/USHORT SdrAttrObj::GetSetItemCount() const
+//-/{
+//-/ return 6;
+//-/}
+
+//-/const SfxSetItem* SdrAttrObj::GetSetItem(USHORT nNum) const
+//-/{
+//-/ switch (nNum)
+//-/ {
+//-/ case 0 : return pLineAttr;
+//-/ case 1 : return pFillAttr;
+//-/ case 2 : return pTextAttr;
+//-/ case 3 : return pShadAttr;
+//-/ case 4 : return pOutlAttr;
+//-/ case 5 : return pMiscAttr;
+//-/ }
+//-/ return NULL; // damit der Compiler nicht meckert
+//-/}
+
+//-/void SdrAttrObj::SetSetItem(USHORT nNum, const SfxSetItem* pAttr)
+//-/{
+//-/ switch (nNum)
+//-/ {
+//-/ case 0 : pLineAttr = (const XLineAttrSetItem*) pAttr; break;
+//-/ case 1 : pFillAttr = (const XFillAttrSetItem*) pAttr; break;
+//-/ case 2 : pTextAttr = (const XTextAttrSetItem*) pAttr; break;
+//-/ case 3 : pShadAttr = (const SdrShadowSetItem*) pAttr; break;
+//-/ case 4 : pOutlAttr = (const SdrOutlinerSetItem*)pAttr; break;
+//-/ case 5 : pMiscAttr = (const SdrMiscSetItem*) pAttr; break;
+//-/ }
+//-/}
+
+//-/SfxSetItem* SdrAttrObj::MakeNewSetItem(USHORT nNum, FASTBOOL bClone) const
+//-/{
+//-/ if (bClone)
+//-/ {
+//-/ switch (nNum)
+//-/ {
+//-/ case 0 : return new XLineAttrSetItem(*pLineAttr);
+//-/ case 1 : return new XFillAttrSetItem(*pFillAttr);
+//-/ case 2 : return new XTextAttrSetItem(*pTextAttr);
+//-/ case 3 : return new SdrShadowSetItem(*pShadAttr);
+//-/ case 4 : return new SdrOutlinerSetItem(*pOutlAttr);
+//-/ case 5 : return new SdrMiscSetItem(*pMiscAttr);
+//-/ }
+//-/ }
+//-/ else
+//-/ {
+//-/ switch (nNum)
+//-/ {
+//-/ case 0 : return new XLineAttrSetItem(GetItemPool());
+//-/ case 1 : return new XFillAttrSetItem(GetItemPool());
+//-/ case 2 : return new XTextAttrSetItem(GetItemPool());
+//-/ case 3 : return new SdrShadowSetItem(GetItemPool());
+//-/ case 4 : return new SdrOutlinerSetItem(GetItemPool());
+//-/ case 5 : return new SdrMiscSetItem(GetItemPool());
+//-/ }
+//-/ }
+//-/ return NULL; // damit der Compiler nicht meckert
+//-/}
-const SfxSetItem* SdrAttrObj::GetSetItem(USHORT nNum) const
+void SdrAttrObj::AddStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr)
{
- switch (nNum)
- {
- case 0 : return pLineAttr;
- case 1 : return pFillAttr;
- case 2 : return pTextAttr;
- case 3 : return pShadAttr;
- case 4 : return pOutlAttr;
- case 5 : return pMiscAttr;
- }
- return NULL; // damit der Compiler nicht meckert
-}
+ // old StyleSheet is deleted
+ DBG_ASSERT(!mpStyleSheet, "Old style sheet not deleted before setting new one (?)");
-void SdrAttrObj::SetSetItem(USHORT nNum, const SfxSetItem* pAttr)
-{
- switch (nNum)
+ if(pNewStyleSheet)
{
- case 0 : pLineAttr = (const XLineAttrSetItem*) pAttr; break;
- case 1 : pFillAttr = (const XFillAttrSetItem*) pAttr; break;
- case 2 : pTextAttr = (const XTextAttrSetItem*) pAttr; break;
- case 3 : pShadAttr = (const SdrShadowSetItem*) pAttr; break;
- case 4 : pOutlAttr = (const SdrOutlinerSetItem*)pAttr; break;
- case 5 : pMiscAttr = (const SdrMiscSetItem*) pAttr; break;
- }
-}
+ mpStyleSheet = pNewStyleSheet;
-SfxSetItem* SdrAttrObj::MakeNewSetItem(USHORT nNum, FASTBOOL bClone) const
-{
- if (bClone)
- {
- switch (nNum)
- {
- case 0 : return new XLineAttrSetItem(*pLineAttr);
- case 1 : return new XFillAttrSetItem(*pFillAttr);
- case 2 : return new XTextAttrSetItem(*pTextAttr);
- case 3 : return new SdrShadowSetItem(*pShadAttr);
- case 4 : return new SdrOutlinerSetItem(*pOutlAttr);
- case 5 : return new SdrMiscSetItem(*pMiscAttr);
- }
- }
- else
- {
- switch (nNum)
- {
- case 0 : return new XLineAttrSetItem(GetItemPool());
- case 1 : return new XFillAttrSetItem(GetItemPool());
- case 2 : return new XTextAttrSetItem(GetItemPool());
- case 3 : return new SdrShadowSetItem(GetItemPool());
- case 4 : return new SdrOutlinerSetItem(GetItemPool());
- case 5 : return new SdrMiscSetItem(GetItemPool());
- }
- }
- return NULL; // damit der Compiler nicht meckert
-}
+ // ItemSet is needed here, force it
+ ImpForceItemSet();
-void SdrAttrObj::AddStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr)
-{
- pStyleSheet=pNewStyleSheet;
- if (pStyleSheet!=NULL)
- {
// als Listener anmelden
- StartListening(pStyleSheet->GetPool());
- StartListening(*pStyleSheet);
-
- // harte Attributierung dort loeschen, wo was in der Vorlage steht?
- const SfxItemSet& rStyle=pNewStyleSheet->GetItemSet();
- // pWhichRangesInStyle enthaelt Zahlenpaare der Which-Ranges.
- // am Ende steht eine 0.
- const USHORT* pWhichRangesInStyle=rStyle.GetRanges();
- USHORT nAnz=GetSetItemCount();
- for (USHORT i=0; i<nAnz; i++) {
- const SfxSetItem* pOldSI=GetSetItem(i);
- SfxSetItem* pNewSI=MakeNewSetItem(i,pOldSI!=NULL);
- pNewSI->GetItemSet().SetParent(NULL);
- SfxItemSet& rIS=pNewSI->GetItemSet();
-
- USHORT nIndex =0;
- USHORT nCurrent=pWhichRangesInStyle[nIndex];
- USHORT nEnd =pWhichRangesInStyle[nIndex+1];
-
- while (nCurrent!=0) {
- if (!bDontRemoveHardAttr && rStyle.GetItemState(nCurrent)==SFX_ITEM_SET) {
- rIS.ClearItem(nCurrent);
- }
+ StartListening(pNewStyleSheet->GetPool());
+ StartListening(*pNewStyleSheet);
- nCurrent++;
- if (nCurrent>nEnd) {
- nIndex+=2;
- nCurrent=pWhichRangesInStyle[nIndex];
- if (nCurrent!=0) { // Ende der Ranges? nein
- nEnd=pWhichRangesInStyle[nIndex+1];
- }
- }
+ // harte Attributierung dort loeschen, wo was in der Vorlage steht
+ if(!bDontRemoveHardAttr)
+ {
+ const SfxItemSet& rStyle = pNewStyleSheet->GetItemSet();
+ SfxWhichIter aIter(rStyle);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ while(nWhich)
+ {
+ if(SFX_ITEM_SET == rStyle.GetItemState(nWhich))
+ mpObjectItemSet->ClearItem(nWhich);
+ nWhich = aIter.NextWhich();
}
- // ItemSet des StyleSheets als Parent der ItemSets der SetItems setzen
- rIS.SetParent(&(pNewStyleSheet->GetItemSet()));
- // die Zeiger auf die SetItems neu setzen
- SetSetItem(i,(const SfxSetItem*)ImpSetNewAttr(pOldSI,pNewSI));
- delete pNewSI;
}
+
+ // set new stylesheet as parent
+ mpObjectItemSet->SetParent(&pNewStyleSheet->GetItemSet());
}
+//-/ pStyleSheet=pNewStyleSheet;
+//-/ if(pNewStyleSheet && GetStyleSheet() != pNewStyleSheet)
+//-/ {
+//-/ // als Listener anmelden
+//-/ StartListening(pNewStyleSheet->GetPool());
+//-/ StartListening(*pNewStyleSheet);
+//-/
+//-/ // harte Attributierung dort loeschen, wo was in der Vorlage steht?
+//-/ const SfxItemSet& rStyle = pNewStyleSheet->GetItemSet();
+//-/
+//-/ // pWhichRangesInStyle enthaelt Zahlenpaare der Which-Ranges.
+//-/ // am Ende steht eine 0.
+//-/ const sal_uInt16* pWhichRangesInStyle = rStyle.GetRanges();
+//-/ sal_uInt16 nAnz(GetSetItemCount());
+//-/
+//-/ for(sal_uInt16 i(0); i < nAnz; i++)
+//-/ {
+//-/ const SfxSetItem* pOldSI=GetSetItem(i);
+//-/ SfxSetItem* pNewSI=MakeNewSetItem(i,pOldSI!=NULL);
+//-/ pNewSI->GetItemSet().SetParent(NULL);
+//-/ SfxItemSet& rIS=pNewSI->GetItemSet();
+//-/
+//-/ USHORT nIndex =0;
+//-/ USHORT nCurrent=pWhichRangesInStyle[nIndex];
+//-/ USHORT nEnd =pWhichRangesInStyle[nIndex+1];
+//-/
+//-/ while (nCurrent!=0) {
+//-/ if (!bDontRemoveHardAttr && rStyle.GetItemState(nCurrent)==SFX_ITEM_SET) {
+//-/ rIS.ClearItem(nCurrent);
+//-/ }
+//-/
+//-/ nCurrent++;
+//-/ if (nCurrent>nEnd) {
+//-/ nIndex+=2;
+//-/ nCurrent=pWhichRangesInStyle[nIndex];
+//-/ if (nCurrent!=0) { // Ende der Ranges? nein
+//-/ nEnd=pWhichRangesInStyle[nIndex+1];
+//-/ }
+//-/ }
+//-/ }
+//-/ // ItemSet des StyleSheets als Parent der ItemSets der SetItems setzen
+//-/ rIS.SetParent(&(pNewStyleSheet->GetItemSet()));
+//-/ // die Zeiger auf die SetItems neu setzen
+//-/ SetSetItem(i,(const SfxSetItem*)ImpSetNewAttr(pOldSI,pNewSI));
+//-/ delete pNewSI;
+//-/ }
+//-/ }
}
void SdrAttrObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr)
{
RemoveStyleSheet();
- AddStyleSheet(pNewStyleSheet,bDontRemoveHardAttr);
- bBoundRectDirty=TRUE;
+ AddStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+ bBoundRectDirty = TRUE;
SetRectsDirty(TRUE);
}
void SdrAttrObj::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr)
{
- Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect();
+ Rectangle aBoundRect0;
+
+ if(pUserCall)
+ aBoundRect0 = GetBoundRect();
+
SendRepaintBroadcast();
- NbcSetStyleSheet(pNewStyleSheet,bDontRemoveHardAttr);
+ NbcSetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
SetChanged();
SendRepaintBroadcast();
- SendUserCall(SDRUSERCALL_CHGATTR,aBoundRect0);
+ SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect0);
}
INT32 SdrAttrObj::ImpGetLineWdt() const
{
- if (pLineAttr!=NULL) {
- const SfxItemSet& rSet=pLineAttr->GetItemSet();
- XLineStyle eLine=((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
- if (eLine==XLINE_NONE) return 0; // Garkeine Linie da.
- INT32 nWdt=((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
- return nWdt;
- }
- return 0; // Defaultannahme ist: Haarlinie
+ const SfxItemSet& rSet = GetItemSet();
+ XLineStyle eLine = ((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
+
+ if(XLINE_NONE == eLine)
+ return 0; // Garkeine Linie da.
+
+ sal_Int32 nWdt = ((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
+
+ return nWdt;
}
INT32 SdrAttrObj::ImpGetLineEndAdd() const
{
- if(pLineAttr)
+ const SfxItemSet& rSet = GetItemSet();
+ BOOL bStartSet(TRUE);
+ BOOL bEndSet(TRUE);
+
+ if(SFX_ITEM_DONTCARE != rSet.GetItemState(XATTR_LINESTART))
{
- const SfxItemSet& rSet = pLineAttr->GetItemSet();
- BOOL bStartSet(TRUE);
- BOOL bEndSet(TRUE);
+ String aStr(((const XLineStartItem&)rSet.Get(XATTR_LINESTART)).GetName());
+ if(!aStr.Len())
+ bStartSet = FALSE;
+ }
- if(rSet.GetItemState( XATTR_LINESTART ) != SFX_ITEM_DONTCARE)
- {
- String aStr(((const XLineStartItem&)rSet.Get(XATTR_LINESTART)).GetName());
- if(!aStr.Len())
- bStartSet = FALSE;
- }
+ if(rSet.GetItemState(XATTR_LINEEND) != SFX_ITEM_DONTCARE)
+ {
+ String aStr(((const XLineEndItem&)rSet.Get(XATTR_LINEEND)).GetName());
+ if(!aStr.Len())
+ bEndSet = FALSE;
+ }
- if(rSet.GetItemState( XATTR_LINEEND ) != SFX_ITEM_DONTCARE)
- {
- String aStr(((const XLineEndItem&)rSet.Get(XATTR_LINEEND)).GetName());
- if(!aStr.Len())
- bEndSet = FALSE;
- }
+ BOOL bLineEndSet = bStartSet || bEndSet;
+ XLineStyle eLine = ((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
- BOOL bLineEndSet = bStartSet || bEndSet;
+ if(XLINE_NONE == eLine)
+ return 0; // Garkeine Linie da.
- XLineStyle eLine=((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
- if (eLine==XLINE_NONE) return 0; // Garkeine Linie da.
- INT32 nLineWdt=((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); // Strichstaerke
+ // Strichstaerke
+ sal_Int32 nLineWdt = ((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
+ sal_Int32 nSttWdt = ((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue();
- long nSttWdt=((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue();
- if (nSttWdt<0) nSttWdt=-nLineWdt*nSttWdt/100; // <0 = relativ
+ if(nSttWdt < 0)
+ nSttWdt = -nLineWdt * nSttWdt / 100;
- if(!bLineEndSet)
- nSttWdt = 0;
+ if(!bLineEndSet)
+ nSttWdt = 0;
- FASTBOOL bSttCenter=((const XLineStartCenterItem&)(rSet.Get(XATTR_LINESTARTCENTER))).GetValue();
- long nSttHgt=0;
- if (bSttCenter) { // Linienende steht um die Haelfe ueber
- XPolygon aSttPoly(((const XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetValue());
- nSttHgt=XOutputDevice::InitLineStartEnd(aSttPoly,nSttWdt,bSttCenter);
- // InitLineStartEnd liefert bei bCenter=TRUE die halbe Hoehe
- }
- nSttWdt++;
- nSttWdt/=2;
- // Lieber etwas mehr, dafuer keine Wurzel ziehen
- long nSttAdd=Max(nSttWdt,nSttHgt);
- nSttAdd*=3;
- nSttAdd/=2;
-
- long nEndWdt=((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue();
- if (nEndWdt<0) nEndWdt=-nLineWdt*nEndWdt/100; // <0 = relativ
-
- if(!bLineEndSet)
- nEndWdt = 0;
-
- FASTBOOL bEndCenter=((const XLineEndCenterItem&)(rSet.Get(XATTR_LINEENDCENTER))).GetValue();
- long nEndHgt=0;
- if (bEndCenter) { // Linienende steht um die Haelfe ueber
- XPolygon aEndPoly(((const XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetValue());
- nEndHgt=XOutputDevice::InitLineStartEnd(aEndPoly,nEndWdt,bEndCenter);
- // InitLineStartEnd liefert bei bCenter=TRUE die halbe Hoehe
- }
- nEndWdt++;
- nEndWdt/=2;
- // Lieber etwas mehr, dafuer keine Wurzel ziehen
- long nEndAdd=Max(nEndWdt,nEndHgt);
- nEndAdd*=3;
- nEndAdd/=2;
-
- return Max(nSttAdd,nEndAdd);
+ BOOL bSttCenter = ((const XLineStartCenterItem&)(rSet.Get(XATTR_LINESTARTCENTER))).GetValue();
+ sal_Int32 nSttHgt = 0;
+
+ if(bSttCenter)
+ {
+ // Linienende steht um die Haelfe ueber
+ XPolygon aSttPoly(((const XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetValue());
+ nSttHgt = XOutputDevice::InitLineStartEnd(aSttPoly, nSttWdt, bSttCenter);
+ // InitLineStartEnd liefert bei bCenter=TRUE die halbe Hoehe
+ }
+
+ nSttWdt++;
+ nSttWdt /= 2;
+
+ // Lieber etwas mehr, dafuer keine Wurzel ziehen
+ long nSttAdd = Max(nSttWdt, nSttHgt);
+ nSttAdd *= 3;
+ nSttAdd /= 2;
+
+ long nEndWdt = ((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue();
+
+ if(nEndWdt < 0)
+ nEndWdt = -nLineWdt * nEndWdt / 100; // <0 = relativ
+
+ if(!bLineEndSet)
+ nEndWdt = 0;
+
+ BOOL bEndCenter = ((const XLineEndCenterItem&)(rSet.Get(XATTR_LINEENDCENTER))).GetValue();
+ sal_Int32 nEndHgt = 0;
+
+ if(bEndCenter)
+ {
+ // Linienende steht um die Haelfe ueber
+ XPolygon aEndPoly(((const XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetValue());
+ nEndHgt = XOutputDevice::InitLineStartEnd(aEndPoly, nEndWdt, bEndCenter);
+ // InitLineStartEnd liefert bei bCenter=TRUE die halbe Hoehe
}
- return 0; // Defaultannahme ist: Keine Linienenden
+
+ nEndWdt++;
+ nEndWdt /= 2;
+
+ // Lieber etwas mehr, dafuer keine Wurzel ziehen
+ sal_Int32 nEndAdd = Max(nEndWdt, nEndHgt);
+ nEndAdd *= 3;
+ nEndAdd /= 2;
+
+ return Max(nSttAdd, nEndAdd);
}
+//////////////////////////////////////////////////////////////////////////////
+
FASTBOOL SdrAttrObj::ImpLineEndHitTest(const Point& rEndPt, double nSin, double nCos, FASTBOOL bStart, const Point& rHit, USHORT nTol) const
{
- if (pLineAttr!=NULL) {
- const SfxItemSet& rSet=pLineAttr->GetItemSet();
- long nWdt=0;
- FASTBOOL bCenter=FALSE;
- //long nHgt=0;
- XPolygon aXPoly;
- if (bStart) {
- nWdt=((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue();
- bCenter=((const XLineStartCenterItem&)(rSet.Get(XATTR_LINESTARTCENTER))).GetValue();
- aXPoly=((const XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetValue();
- } else {
- nWdt=((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue();
- bCenter=((const XLineEndCenterItem&)(rSet.Get(XATTR_LINEENDCENTER))).GetValue();
- aXPoly=((const XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetValue();
- }
- if (nWdt<0) {
- INT32 nLineWdt=((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); // Strichstaerke
- nWdt=-nLineWdt*nWdt/100; // <0 = relativ
- }
- // InitLineStartEnd liefert bei bCenter=TRUE die halbe Hoehe
- /*nHgt=*/XOutputDevice::InitLineStartEnd(aXPoly,nWdt,bCenter);
- RotateXPoly(aXPoly,Point(),nSin,nCos);
- Point aHit(rHit);
- aHit-=rEndPt;
- Rectangle aHitRect(aHit.X()-nTol,aHit.Y()-nTol,aHit.X()+nTol,aHit.Y()+nTol);
- FASTBOOL bHit=IsRectTouchesPoly(XOutCreatePolygon(aXPoly,NULL),aHitRect);
- return bHit;
+ const SfxItemSet& rSet = GetItemSet();
+ sal_Int32 nWdt = 0;
+ BOOL bCenter = FALSE;
+ XPolygon aXPoly;
+
+ if(bStart)
+ {
+ nWdt = ((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue();
+ bCenter = ((const XLineStartCenterItem&)(rSet.Get(XATTR_LINESTARTCENTER))).GetValue();
+ aXPoly = ((const XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetValue();
}
- return FALSE;
+ else
+ {
+ nWdt = ((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue();
+ bCenter = ((const XLineEndCenterItem&)(rSet.Get(XATTR_LINEENDCENTER))).GetValue();
+ aXPoly = ((const XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetValue();
+ }
+
+ if(nWdt < 0)
+ {
+ sal_Int32 nLineWdt = ((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); // Strichstaerke
+ nWdt = -nLineWdt * nWdt / 100; // <0 = relativ
+ }
+
+ // InitLineStartEnd liefert bei bCenter=TRUE die halbe Hoehe
+ XOutputDevice::InitLineStartEnd(aXPoly, nWdt, bCenter);
+ RotateXPoly(aXPoly, Point(), nSin, nCos);
+ Point aHit(rHit);
+ aHit -= rEndPt;
+ Rectangle aHitRect(aHit.X() - nTol, aHit.Y() - nTol, aHit.X() + nTol, aHit.Y() + nTol);
+ FASTBOOL bHit = IsRectTouchesPoly(XOutCreatePolygon(aXPoly, NULL), aHitRect);
+
+ return bHit;
}
-FASTBOOL SdrAttrObj::ImpGetShadowDist(INT32& nXDist, INT32& nYDist) const
+FASTBOOL SdrAttrObj::ImpGetShadowDist(sal_Int32& nXDist, sal_Int32& nYDist) const
{
- nXDist=0;
- nYDist=0;
- if (pShadAttr!=NULL) {
- FASTBOOL bShadOn=((SdrShadowItem&)(pShadAttr->GetItemSet().Get(SDRATTR_SHADOW))).GetValue();
- if (bShadOn) {
- nXDist=((SdrShadowXDistItem&)(pShadAttr->GetItemSet().Get(SDRATTR_SHADOWXDIST))).GetValue();
- nYDist=((SdrShadowYDistItem&)(pShadAttr->GetItemSet().Get(SDRATTR_SHADOWYDIST))).GetValue();
- return TRUE;
- }
+ const SfxItemSet& rSet = GetItemSet();
+
+ nXDist = 0L;
+ nYDist = 0L;
+
+ BOOL bShadOn = ((SdrShadowItem&)(rSet.Get(SDRATTR_SHADOW))).GetValue();
+ if(bShadOn)
+ {
+ nXDist = ((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue();
+ nYDist = ((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue();
+ return TRUE;
}
+
return FALSE;
}
void SdrAttrObj::ImpAddShadowToBoundRect()
{
- INT32 nXDist;
- INT32 nYDist;
- if (ImpGetShadowDist(nXDist,nYDist)) {
- if (nXDist>0) aOutRect.Right()+=nXDist;
- else aOutRect.Left()+=nXDist;
- if (nYDist>0) aOutRect.Bottom()+=nYDist;
- else aOutRect.Top()+=nYDist;
+ sal_Int32 nXDist;
+ sal_Int32 nYDist;
+
+ if(ImpGetShadowDist(nXDist, nYDist))
+ {
+ if(nXDist > 0)
+ aOutRect.Right() += nXDist;
+ else
+ aOutRect.Left() += nXDist;
+
+ if(nYDist > 0)
+ aOutRect.Bottom() += nYDist;
+ else
+ aOutRect.Top() += nYDist;
}
}
FASTBOOL SdrAttrObj::ImpSetShadowAttributes(ExtOutputDevice& rXOut, FASTBOOL bNoFill) const
{
- if (pShadAttr!=NULL) {
- FASTBOOL bShadOn=((SdrShadowItem&)(pShadAttr->GetItemSet().Get(SDRATTR_SHADOW))).GetValue();
- if (bShadOn) {
+ const SfxItemSet& rSet = GetItemSet();
+ BOOL bShadOn=((SdrShadowItem&)(rSet.Get(SDRATTR_SHADOW))).GetValue();
+
+ if(bShadOn)
+ {
// LineAttr for shadow no longer necessary, lines and line shadows are drawn in Paint()
// routines individually (grep for CreateLinePoly())
//
@@ -1257,71 +1703,119 @@ FASTBOOL SdrAttrObj::ImpSetShadowAttributes(ExtOutputDevice& rXOut, FASTBOOL bNo
// aL.GetItemSet().Put(XLineTransparenceItem(nTransp));
// rXOut.SetLineAttr(aL);
// }
- if (!bNoFill && pFillAttr!=NULL) {
- const SdrShadowColorItem& rShadColItem=((SdrShadowColorItem&)(pShadAttr->GetItemSet().Get(SDRATTR_SHADOWCOLOR)));
- Color aShadCol(rShadColItem.GetValue());
- USHORT nTransp=((SdrShadowTransparenceItem&)(pShadAttr->GetItemSet().Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue();
- XFillStyle eStyle=((XFillStyleItem&)(pFillAttr->GetItemSet().Get(XATTR_FILLSTYLE))).GetValue();
- XFillAttrSetItem aF(*pFillAttr);
- if (eStyle==XFILL_HATCH) { // #41666#
- XHatch aHatch=((XFillHatchItem&)(pFillAttr->GetItemSet().Get(XATTR_FILLHATCH))).GetValue();
- aHatch.SetColor(aShadCol);
- aF.GetItemSet().Put(XFillHatchItem(String(),aHatch));
- } else {
- if (eStyle!=XFILL_NONE && eStyle!=XFILL_SOLID) {
- // also fuer Gradient und Bitmap
- aF.GetItemSet().Put(XFillStyleItem(XFILL_SOLID));
- }
- aF.GetItemSet().Put(XFillColorItem(String(),aShadCol));
- aF.GetItemSet().Put(XFillTransparenceItem(nTransp));
+ if(!bNoFill)
+ {
+ const SdrShadowColorItem& rShadColItem = ((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR)));
+ Color aShadCol(rShadColItem.GetValue());
+ sal_uInt16 nTransp = ((SdrShadowTransparenceItem&)(rSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue();
+ XFillStyle eStyle = ((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue();
+
+//-/ XFillAttrSetItem aF(rSet.GetPool());
+ SfxItemSet aSet(rSet);
+//-/ aF.GetItemSet().Put(rSet);
+
+ if(eStyle==XFILL_HATCH)
+ {
+ // #41666#
+ XHatch aHatch = ((XFillHatchItem&)(rSet.Get(XATTR_FILLHATCH))).GetValue();
+ aHatch.SetColor(aShadCol);
+ aSet.Put(XFillHatchItem(String(), aHatch));
+ }
+ else
+ {
+ if(eStyle != XFILL_NONE && eStyle != XFILL_SOLID)
+ {
+ // also fuer Gradient und Bitmap
+ aSet.Put(XFillStyleItem(XFILL_SOLID));
}
- rXOut.SetFillAttr(aF);
+
+ aSet.Put(XFillColorItem(String(),aShadCol));
+ aSet.Put(XFillTransparenceItem(nTransp));
}
- return TRUE;
+
+ rXOut.SetFillAttr(aSet);
}
+ return TRUE;
}
+
return FALSE;
}
void SdrAttrObj::BurnInStyleSheetAttributes()
{
- SfxItemPool* pPool=ImpGetItemPool();
- if (pPool!=NULL) {
- SfxItemSet aSet(*pPool,
- SDRATTR_START,SDRATTR_NOTPERSIST_FIRST-1,
- SDRATTR_NOTPERSIST_LAST+1, SDRATTR_END,
- EE_ITEMS_START,EE_ITEMS_END,
- 0,0);
- TakeAttributes(aSet,FALSE,FALSE);
- NbcSetAttributes(aSet,FALSE);
- }
+//-/ SfxItemPool* pPool = GetItemPool();
+//-/
+//-/ if(pPool)
+//-/ {
+//-/ SfxItemSet aSet(*pPool,
+//-/ SDRATTR_START, SDRATTR_NOTPERSIST_FIRST-1,
+//-/ SDRATTR_NOTPERSIST_LAST+1, SDRATTR_END,
+//-/ EE_ITEMS_START, EE_ITEMS_END,
+//-/ 0, 0);
+//-/
+//-/ TakeAttributes(aSet,FALSE,FALSE);
+//-/ NbcSetAttributes(aSet,FALSE);
+//-/ }
}
-void SdrAttrObj::CopyAttributes(SdrObject* pDestObj) const
-{
- // ...
-}
+//-/void SdrAttrObj::CopyAttributes(SdrObject* pDestObj) const
+//-/{
+//-/ // ...
+//-/}
// ItemPool fuer dieses Objekt wechseln
void SdrAttrObj::MigrateItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool)
{
- // call parent
- SdrObject::MigrateItemPool(pSrcPool, pDestPool);
-
- // eigene Reaktion
- if(pDestPool && pSrcPool)
+ if(pSrcPool && pDestPool && (pSrcPool != pDestPool))
{
- UINT16 nItemSetAnz = GetSetItemCount();
- for(UINT16 i=0;i<nItemSetAnz;i++)
+ // call parent
+ SdrObject::MigrateItemPool(pSrcPool, pDestPool);
+
+ // eigene Reaktion
+ if(pDestPool && pSrcPool && (pDestPool != pSrcPool))
{
- const SfxSetItem* pSI = GetSetItem(i);
- if(pSI != NULL)
+ if(mpObjectItemSet)
{
- const SfxSetItem* pNewAttr = &(const SfxSetItem&)pDestPool->Put(*pSI);
- pSrcPool->Remove(*pSI);
- SetSetItem(i, pNewAttr);
+ // 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* pNewSet = mpObjectItemSet->Clone(TRUE, pDestPool);
+ SfxStyleSheet* pStySheet = GetStyleSheet();
+
+ if(GetStyleSheet())
+ pNewSet->SetParent(&GetStyleSheet()->GetItemSet());
+
+ // set new itemset
+ ImpDeleteItemSet();
+ mpObjectItemSet = pNewSet;
+
+ // set stylesheet (if used)
+ if(pStySheet)
+ AddStyleSheet(pStySheet, TRUE);
}
}
}
+//-/ UINT16 nItemSetAnz = GetSetItemCount();
+//-/ for(UINT16 i=0;i<nItemSetAnz;i++)
+//-/ {
+//-/ const SfxSetItem* pSI = GetSetItem(i);
+//-/ if(pSI != NULL)
+//-/ {
+//-/ const SfxSetItem* pNewAttr = &(const SfxSetItem&)pDestPool->Put(*pSI);
+//-/ pSrcPool->Remove(*pSI);
+//-/ SetSetItem(i, pNewAttr);
+//-/ }
+//-/ }
}
+BOOL SdrAttrObj::HasFill() const
+{
+ return (!bClosedObj) ? FALSE
+ : ((XFillStyleItem&)(GetItem(XATTR_FILLSTYLE))).GetValue()!=XFILL_NONE;
+}
+
+BOOL SdrAttrObj::HasLine() const
+{
+ return ((XLineStyleItem&)(GetItem(XATTR_LINESTYLE))).GetValue()!=XLINE_NONE;
+}
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 0011ef1af9f1..bf399451a7c3 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdobj.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2000-09-27 14:03:57 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -110,6 +110,14 @@
#include "xfltrit.hxx"
#include "xlinjoit.hxx"
+#ifndef _SVDPOOL_HXX
+#include "svdpool.hxx"
+#endif
+
+#ifndef _MyEDITENG_HXX
+#include "editeng.hxx"
+#endif
+
////////////////////////////////////////////////////////////////////////////////////////////////////
TYPEINIT0(SdrObjUserCall);
@@ -1108,6 +1116,52 @@ void LineGeometryCreator::ImpCreateLineGeometry(const Polygon3D& rSourcePoly)
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+// class to remember broadcast start positions
+
+SdrBroadcastItemChange::SdrBroadcastItemChange(const SdrObject& rObj)
+{
+ if(rObj.ISA(SdrObjGroup))
+ {
+ SdrObjListIter aIter((const SdrObjGroup&)rObj, IM_DEEPNOGROUPS);
+ mpData = new List();
+
+ while(aIter.IsMore())
+ {
+ SdrObject* pObj = aIter.Next();
+ if(pObj)
+ ((List*)mpData)->Insert(new Rectangle(pObj->GetBoundRect()), LIST_APPEND);
+ }
+
+ mnCount = ((List*)mpData)->Count();
+ }
+ else
+ {
+ mnCount = 1;
+ mpData = new Rectangle(rObj.GetBoundRect());
+ }
+}
+
+SdrBroadcastItemChange::~SdrBroadcastItemChange()
+{
+ if(mnCount > 1)
+ {
+ for(sal_uInt32 a(0); a < mnCount;a++)
+ delete ((Rectangle*)((List*)mpData)->GetObject(a));
+ delete ((List*)mpData);
+ }
+ else
+ delete ((Rectangle*)mpData);
+}
+
+const Rectangle& SdrBroadcastItemChange::GetRectangle(sal_uInt32 nIndex) const
+{
+ if(mnCount > 1)
+ return *((Rectangle*)((List*)mpData)->GetObject(nIndex));
+ else
+ return *((Rectangle*)mpData);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
//
// @@@@ @@@@@ @@@@@@ @@@@@ @@@@ @@@@@@
// @@ @@ @@ @@ @@ @@ @@ @@ @@
@@ -1179,12 +1233,15 @@ void SdrObject::SetRectsDirty(FASTBOOL bNotMyself)
void SdrObject::SetModel(SdrModel* pNewModel)
{
- if (pNewModel!=NULL && pPage!=NULL) {
- if (pPage->GetModel()!=pNewModel) {
- pPage=NULL;
+ if(pNewModel && pPage)
+ {
+ if(pPage->GetModel() != pNewModel)
+ {
+ pPage = NULL;
}
}
- pModel=pNewModel;
+
+ pModel = pNewModel;
}
void SdrObject::SetObjList(SdrObjList* pNewObjList)
@@ -1203,9 +1260,42 @@ void SdrObject::SetPage(SdrPage* pNewPage)
}
}
+// init global static itempool
+SdrItemPool* SdrObject::mpGlobalItemPool = NULL;
+
+SdrItemPool* SdrObject::GetGlobalDrawObjectItemPool()
+{
+ if(!mpGlobalItemPool)
+ {
+ mpGlobalItemPool = new SdrItemPool(SDRATTR_START, SDRATTR_END);
+ SfxItemPool* pGlobalOutlPool = EditEngine::CreatePool();
+ mpGlobalItemPool->SetSecondaryPool(pGlobalOutlPool);
+ mpGlobalItemPool->SetDefaultMetric((SfxMapUnit)SdrEngineDefaults::GetMapUnit());
+ mpGlobalItemPool->FreezeIdRanges();
+ }
+
+ return mpGlobalItemPool;
+}
+
+void SdrObject::FreeGlobalDrawObjectItemPool()
+{
+ // code for deletion of GlobalItemPool
+ if(mpGlobalItemPool)
+ {
+ SfxItemPool* pGlobalOutlPool = mpGlobalItemPool->GetSecondaryPool();
+ delete mpGlobalItemPool;
+ delete pGlobalOutlPool;
+ }
+}
+
SdrItemPool* SdrObject::GetItemPool() const
{
- return pModel==NULL ? NULL : (SdrItemPool*)(&pModel->GetItemPool());
+//-/ return pModel==NULL ? NULL : (SdrItemPool*)(&pModel->GetItemPool());
+ if(pModel)
+ return (SdrItemPool*)(&pModel->GetItemPool());
+
+ // use a static global default pool
+ return SdrObject::GetGlobalDrawObjectItemPool();
}
UINT32 SdrObject::GetObjInventor() const
@@ -1380,17 +1470,44 @@ void SdrObject::RecalcBoundRect()
{
}
-void SdrObject::SendRepaintBroadcast(FASTBOOL bNoPaintNeeded) const
+void SdrObject::SendRepaintBroadcast(const Rectangle& rRect) const
+{
+ BOOL bBrd(pPlusData && pPlusData->pBroadcast);
+ BOOL bPnt(bInserted && pModel);
+
+ if(bPnt || bBrd)
+ {
+ SdrHint aHint(*this, rRect);
+
+ if(bBrd)
+ pPlusData->pBroadcast->Broadcast(aHint);
+
+ if(bPnt)
+ pModel->Broadcast(aHint);
+
+ // alle Animationen wegen Obj-Aenderung neustarten
+ RestartAnimation(NULL);
+ }
+}
+
+void SdrObject::SendRepaintBroadcast(BOOL bNoPaintNeeded) const
{
- DBG_CHKTHIS(SdrObject,NULL);
- FASTBOOL bBrd=pPlusData!=NULL && pPlusData->pBroadcast!=NULL;
- FASTBOOL bPnt=bInserted && pModel!=NULL;
- if (bPnt || bBrd) {
+ BOOL bBrd(pPlusData && pPlusData->pBroadcast);
+ BOOL bPnt(bInserted && pModel);
+
+ if(bPnt || bBrd)
+ {
SdrHint aHint(*this);
aHint.SetNeedRepaint(!bNoPaintNeeded);
- if (bBrd) pPlusData->pBroadcast->Broadcast(aHint);
- if (bPnt) pModel->Broadcast(aHint);
- RestartAnimation(NULL); // alle Animationen wegen Obj-Aenderung neustarten
+
+ if(bBrd)
+ pPlusData->pBroadcast->Broadcast(aHint);
+
+ if(bPnt)
+ pModel->Broadcast(aHint);
+
+ // alle Animationen wegen Obj-Aenderung neustarten
+ RestartAnimation(NULL);
}
}
@@ -1418,9 +1535,10 @@ void SdrObject::CreateLinePoly(PolyPolygon3D& rPolyPolygon, PolyPolygon3D& rPoly
TakeXorPoly(aTmpPolyPolygon, TRUE);
// get LineStyleParameterPack
- SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
- TakeAttributes(aSet, FALSE, TRUE);
- LineStyleParameterPack aLineAttr(aSet, bForceHair || bIsLineDraft, rOut);
+//-/ SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
+//-/ TakeAttributes(aSet, FALSE, TRUE);
+//-/ LineStyleParameterPack aLineAttr(aSet, bForceHair || bIsLineDraft, rOut);
+ LineStyleParameterPack aLineAttr(GetItemSet(), bForceHair || bIsLineDraft, rOut);
LineGeometryCreator aLineCreator(aLineAttr, rPolyPolygon, rPolyLine, bIsLineDraft);
// compute single lines
@@ -2059,9 +2177,10 @@ void SdrObject::ImpDrawLineGeometry(
BOOL SdrObject::LineGeometryUsageIsNecessary() const
{
- SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
- TakeAttributes(aSet, FALSE, TRUE);
- XLineStyle eXLS = (XLineStyle)((const XLineStyleItem&)aSet.Get(XATTR_LINESTYLE)).GetValue();
+//-/ SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
+//-/ TakeAttributes(aSet, FALSE, TRUE);
+//-/ XLineStyle eXLS = (XLineStyle)((const XLineStyleItem&)aSet.Get(XATTR_LINESTYLE)).GetValue();
+ XLineStyle eXLS = (XLineStyle)((const XLineStyleItem&)GetItem(XATTR_LINESTYLE)).GetValue();
return (eXLS != XLINE_NONE);
}
@@ -2211,17 +2330,20 @@ void SdrObject::TakeContour( XPolyPolygon& rPoly ) const
ExtOutputDevice aXOut( &aBlackHole );
SdrObject* pClone = Clone();
- SfxItemSet aSet( (SfxItemPool&)( *GetItemPool() ),
- XATTR_LINESTYLE, XATTR_LINESTYLE,
- XATTR_LINECOLOR, XATTR_LINECOLOR,
- XATTR_FILLSTYLE, XATTR_FILLSTYLE, 0 );
-
- pClone->TakeAttributes( aSet, TRUE, FALSE );
-
- aSet.Put( XLineStyleItem( XLINE_SOLID ) );
- aSet.Put( XLineColorItem(String(), Color( COL_BLACK ) ) );
- aSet.Put( XFillStyleItem( XFILL_NONE ) );
- pClone->NbcSetAttributes( aSet, FALSE );
+//-/ SfxItemSet aSet( (SfxItemPool&)( *GetItemPool() ),
+//-/ XATTR_LINESTYLE, XATTR_LINESTYLE,
+//-/ XATTR_LINECOLOR, XATTR_LINECOLOR,
+//-/ XATTR_FILLSTYLE, XATTR_FILLSTYLE, 0 );
+//-/
+//-/ pClone->TakeAttributes( aSet, TRUE, FALSE );
+//-/
+//-/ aSet.Put( XLineStyleItem( XLINE_SOLID ) );
+//-/ aSet.Put( XLineColorItem(String(), Color( COL_BLACK ) ) );
+//-/ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+//-/ pClone->NbcSetAttributes( aSet, FALSE );
+ pClone->SetItem(XLineStyleItem(XLINE_SOLID));
+ pClone->SetItem(XLineColorItem(String(), Color(COL_BLACK)));
+ pClone->SetItem(XFillStyleItem(XFILL_NONE));
aMtf.Record( &aBlackHole );
aPaintInfo.nPaintMode = SDRPAINTMODE_DRAFTTEXT | SDRPAINTMODE_DRAFTGRAF;
@@ -3126,18 +3248,113 @@ void SdrObject::SetGeoData(const SdrObjGeoData& rGeo)
////////////////////////////////////////////////////////////////////////////////////////////////////
-void SdrObject::TakeAttributes(SfxItemSet& rAttr, FASTBOOL bMerge, FASTBOOL bOnlyHardAttr) const
+//-/void SdrObject::TakeAttributes(SfxItemSet& rAttr, FASTBOOL bMerge, FASTBOOL bOnlyHardAttr) const
+//-/{
+//-/}
+
+//-/void SdrObject::SetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/{
+//-/}
+
+//-/void SdrObject::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/{
+//-/}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SfxItemSet* SdrObject::CreateNewItemSet(SfxItemPool& rPool)
{
+//-/ return new SfxItemSet(rPool, SDRATTR_START, SDRATTR_END);
+ // Basic implementation; Basic object has NO attributes
+ return NULL;
}
-void SdrObject::SetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+SfxItemSet* SdrObject::mpEmptyItemSet = 0L;
+const SfxItemSet& SdrObject::GetItemSet() const
{
+ if(!mpEmptyItemSet)
+ mpEmptyItemSet = ((SdrObject*)this)->CreateNewItemSet((SfxItemPool&)(*GetItemPool()));
+ DBG_ASSERT(mpEmptyItemSet, "Could not create an SfxItemSet(!)");
+ return *mpEmptyItemSet;
}
-void SdrObject::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+void SdrObject::SetItem( const SfxPoolItem& rItem )
{
}
+void SdrObject::ClearItem( USHORT nWhich )
+{
+}
+
+void SdrObject::SetItemSet( const SfxItemSet& rSet )
+{
+}
+
+void SdrObject::BroadcastItemChange(const SdrBroadcastItemChange& rChange)
+{
+ sal_uInt32 nCount(rChange.GetRectangleCount());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ SendRepaintBroadcast(rChange.GetRectangle(a));
+
+ if(ISA(SdrObjGroup))
+ {
+ SdrObjListIter aIter(*((SdrObjGroup*)this), IM_DEEPNOGROUPS);
+ while(aIter.IsMore())
+ {
+ SdrObject* pObj = aIter.Next();
+ SendRepaintBroadcast(pObj->GetBoundRect());
+ }
+ }
+ else
+ SendRepaintBroadcast(GetBoundRect());
+
+ for(a = 0; a < nCount; a++)
+ SendUserCall(SDRUSERCALL_CHGATTR, rChange.GetRectangle(a));
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// syntactical sugar for ItemSet accesses
+
+void SdrObject::SetItemAndBroadcast(const SfxPoolItem& rItem)
+{
+ SdrBroadcastItemChange aC(*this);
+ SetItem(rItem);
+ BroadcastItemChange(aC);
+}
+
+void SdrObject::ClearItemAndBroadcast(USHORT nWhich)
+{
+ SdrBroadcastItemChange aC(*this);
+ ClearItem(nWhich);
+ BroadcastItemChange(aC);
+}
+
+void SdrObject::SetItemSetAndBroadcast(const SfxItemSet& rSet)
+{
+ SdrBroadcastItemChange aC(*this);
+ SetItemSet(rSet);
+ BroadcastItemChange(aC);
+}
+
+const SfxPoolItem& SdrObject::GetItem(USHORT nWhich) const
+{
+ return GetItemSet().Get(nWhich);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// pre- and postprocessing for objects for saving
+
+void SdrObject::PreSave()
+{
+}
+
+void SdrObject::PostSave()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
void SdrObject::ApplyNotPersistAttr(const SfxItemSet& rAttr)
{
Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect();
@@ -3523,8 +3740,9 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, BOOL bForceLineDas
// useful when new closed filled polygons are created
if(aPolyPoly3D.Count() || (bForceLineDash && aLinePoly3D.Count()))
{
- SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
- pRet->TakeAttributes(aSet, TRUE, FALSE);
+//-/ SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
+//-/ pRet->TakeAttributes(aSet, TRUE, FALSE);
+ SfxItemSet aSet(pRet->GetItemSet());
XFillStyle eOldFillStyle = ((const XFillStyleItem&)(aSet.Get(XATTR_FILLSTYLE))).GetValue();
SdrPathObj* aLinePolygonPart = NULL;
SdrPathObj* aLineLinePart = NULL;
@@ -3544,7 +3762,9 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, BOOL bForceLineDas
aSet.Put(XFillStyleItem(XFILL_SOLID));
aSet.Put(XLineStyleItem(XLINE_NONE));
aSet.Put(XFillTransparenceItem(nTransLine));
- aLinePolygonPart->NbcSetAttributes(aSet, FALSE);
+
+//-/ aLinePolygonPart->NbcSetAttributes(aSet, FALSE);
+ aLinePolygonPart->SetItemSet(aSet);
}
if(aLinePoly3D.Count())
@@ -3555,7 +3775,9 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, BOOL bForceLineDas
aSet.Put(XLineWidthItem(0L));
aSet.Put(XFillStyleItem(XFILL_NONE));
aSet.Put(XLineStyleItem(XLINE_SOLID));
- aLineLinePart->NbcSetAttributes(aSet, FALSE);
+
+//-/ aLineLinePart->NbcSetAttributes(aSet, FALSE);
+ aLineLinePart->SetItemSet(aSet);
if(aLinePolygonPart)
bBuildGroup = TRUE;
@@ -3577,13 +3799,18 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, BOOL bForceLineDas
pGroup->SetModel(pRet->GetModel());
aSet.ClearItem();
- pRet->TakeAttributes(aSet, TRUE, FALSE);
+
+//-/ pRet->TakeAttributes(aSet, TRUE, FALSE);
+ aSet.Put(pRet->GetItemSet());
+
aSet.Put(XLineStyleItem(XLINE_NONE));
aSet.Put(XLineWidthItem(0L));
SdrObject* pClone = pRet->Clone();
pClone->SetModel(pRet->GetModel());
- pClone->NbcSetAttributes(aSet, FALSE);
+
+//-/ pClone->NbcSetAttributes(aSet, FALSE);
+ pClone->SetItemSet(aSet);
pGroup->GetSubList()->NbcInsertObject( pClone );
diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx
index 1f7fa482e4a3..62b76773ee88 100644
--- a/svx/source/svdraw/svdocapt.cxx
+++ b/svx/source/svdraw/svdocapt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdocapt.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: john.marmion $ $Date: 2000-09-28 08:49:18 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -103,6 +103,10 @@
#include <xfltrit.hxx>
#endif
+#ifndef _EEITEM_HXX
+#include "eeitem.hxx"
+#endif
+
////////////////////////////////////////////////////////////////////////////////////////////////////
enum EscDir {LKS,RTS,OBN,UNT};
@@ -225,7 +229,7 @@ SdrCaptionObj::SdrCaptionObj():
aTailPoly(3), // Default Groesse: 3 Punkte = 2 Linien
mbSpecialTextBoxShadow(FALSE)
{
- pCaptAttr=NULL;
+//-/ pCaptAttr=NULL;
}
SdrCaptionObj::SdrCaptionObj(const Rectangle& rRect):
@@ -233,7 +237,7 @@ SdrCaptionObj::SdrCaptionObj(const Rectangle& rRect):
aTailPoly(3), // Default Groesse: 3 Punkte = 2 Linien
mbSpecialTextBoxShadow(FALSE)
{
- pCaptAttr=NULL;
+//-/ pCaptAttr=NULL;
}
SdrCaptionObj::SdrCaptionObj(const Rectangle& rRect, const Point& rTail):
@@ -242,13 +246,13 @@ SdrCaptionObj::SdrCaptionObj(const Rectangle& rRect, const Point& rTail):
mbSpecialTextBoxShadow(FALSE)
{
aTailPoly[0]=rTail;
- pCaptAttr=NULL;
+//-/ pCaptAttr=NULL;
}
SdrCaptionObj::~SdrCaptionObj()
{
// Attr entfernen (oder macht das SdrAttrObj noch nicht automatisch)
- pCaptAttr=(SdrCaptionSetItem*)ImpSetNewAttr(pCaptAttr,NULL,FALSE);
+//-/ pCaptAttr=(SdrCaptionSetItem*)ImpSetNewAttr(pCaptAttr,NULL,FALSE);
}
FASTBOOL SdrCaptionObj::Paint(ExtOutputDevice& rOut, const SdrPaintInfoRec& rInfoRec) const
@@ -256,32 +260,37 @@ FASTBOOL SdrCaptionObj::Paint(ExtOutputDevice& rOut, const SdrPaintInfoRec& rInf
// special shadow paint for calc
if(mbSpecialTextBoxShadow)
{
- sal_uInt32 nXDist = ((SdrShadowXDistItem&)(pShadAttr->GetItemSet().Get(SDRATTR_SHADOWXDIST))).GetValue();
- sal_uInt32 nYDist = ((SdrShadowYDistItem&)(pShadAttr->GetItemSet().Get(SDRATTR_SHADOWYDIST))).GetValue();
- const SdrShadowColorItem& rShadColItem = ((SdrShadowColorItem&)(pShadAttr->GetItemSet().Get(SDRATTR_SHADOWCOLOR)));
+ const SfxItemSet& rSet = GetItemSet();
+ sal_uInt32 nXDist = ((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue();
+ sal_uInt32 nYDist = ((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue();
+ const SdrShadowColorItem& rShadColItem = ((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR)));
Color aShadCol(rShadColItem.GetValue());
- sal_uInt16 nTransp = ((SdrShadowTransparenceItem&)(pShadAttr->GetItemSet().Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue();
- XFillStyle eStyle = ((XFillStyleItem&)(pFillAttr->GetItemSet().Get(XATTR_FILLSTYLE))).GetValue();
- XFillAttrSetItem aF(*pFillAttr);
+ sal_uInt16 nTransp = ((SdrShadowTransparenceItem&)(rSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue();
+ XFillStyle eStyle = ((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue();
+
+//-/ XFillAttrSetItem aF(rSet.GetPool());
+ SfxItemSet aSet(rSet);
+//-/ aF.GetItemSet().Put(rSet);
if(eStyle == XFILL_HATCH) // #41666#
{
- XHatch aHatch = ((XFillHatchItem&)(pFillAttr->GetItemSet().Get(XATTR_FILLHATCH))).GetValue();
+ XHatch aHatch = ((XFillHatchItem&)(rSet.Get(XATTR_FILLHATCH))).GetValue();
aHatch.SetColor(aShadCol);
- aF.GetItemSet().Put(XFillHatchItem(String(),aHatch));
+ aSet.Put(XFillHatchItem(String(),aHatch));
}
else
{
if(eStyle != XFILL_NONE && eStyle != XFILL_SOLID)
{
// also fuer Gradient und Bitmap
- aF.GetItemSet().Put(XFillStyleItem(XFILL_SOLID));
+ aSet.Put(XFillStyleItem(XFILL_SOLID));
}
- aF.GetItemSet().Put(XFillColorItem(String(),aShadCol));
- aF.GetItemSet().Put(XFillTransparenceItem(nTransp));
+ aSet.Put(XFillColorItem(String(),aShadCol));
+ aSet.Put(XFillTransparenceItem(nTransp));
}
- rOut.SetFillAttr(aF);
+
+ rOut.SetFillAttr(aSet);
sal_Int32 nEckRad(GetEckenradius());
if(PaintNeedsXPoly(nEckRad))
@@ -347,12 +356,15 @@ SdrObject* SdrCaptionObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfBy
FASTBOOL bHit=SdrRectObj::CheckHit(rPnt,nTol,pVisiLayer)!=NULL;
if (!bHit) {
INT32 nMyTol=nTol;
- INT32 nWdt=0;
- if (pLineAttr!=NULL) {
- nWdt=((XLineWidthItem&)(pLineAttr->GetItemSet().Get(XATTR_LINEWIDTH))).GetValue();
- nWdt++;
- nWdt/=2;
- }
+//-/ INT32 nWdt=0;
+
+//-/ if(mpObjectItemSet)
+//-/ {
+ INT32 nWdt = ((XLineWidthItem&)(GetItem(XATTR_LINEWIDTH))).GetValue();
+ nWdt++;
+ nWdt /= 2;
+//-/ }
+
if (nWdt>nMyTol) nMyTol=nWdt; // Bei dicker Linie keine Toleranz noetig
Rectangle aR(rPnt,rPnt);
aR.Left() -=nMyTol;
@@ -368,7 +380,7 @@ void SdrCaptionObj::operator=(const SdrObject& rObj)
{
SdrRectObj::operator=(rObj);
aTailPoly=((SdrCaptionObj&)rObj).aTailPoly;
- pCaptAttr=(SdrCaptionSetItem*)ImpSetNewAttr(pCaptAttr,((SdrCaptionObj&)rObj).pCaptAttr);
+//-/ pCaptAttr=(SdrCaptionSetItem*)ImpSetNewAttr(pCaptAttr,((SdrCaptionObj&)rObj).pCaptAttr);
}
void SdrCaptionObj::TakeObjNameSingul(XubString& rName) const
@@ -549,19 +561,20 @@ void SdrCaptionObj::TakeDragPoly(const SdrDragStat& rDrag, XPolyPolygon& rXPP) c
void SdrCaptionObj::ImpGetCaptParams(ImpCaptParams& rPara) const
{
- if (pCaptAttr!=NULL) {
- const SfxItemSet& rSet=pCaptAttr->GetItemSet();
- rPara.eType =((SdrCaptionTypeItem&) (rSet.Get(SDRATTR_CAPTIONTYPE ))).GetValue();
- rPara.bFixedAngle=((SdrCaptionFixedAngleItem&)(rSet.Get(SDRATTR_CAPTIONANGLE ))).GetValue();
- rPara.nAngle =((SdrCaptionAngleItem&) (rSet.Get(SDRATTR_CAPTIONFIXEDANGLE))).GetValue();
- rPara.nGap =((SdrCaptionGapItem&) (rSet.Get(SDRATTR_CAPTIONGAP ))).GetValue();
- rPara.eEscDir =((SdrCaptionEscDirItem&) (rSet.Get(SDRATTR_CAPTIONESCDIR ))).GetValue();
- rPara.bEscRel =((SdrCaptionEscIsRelItem&) (rSet.Get(SDRATTR_CAPTIONESCISREL ))).GetValue();
- rPara.nEscRel =((SdrCaptionEscRelItem&) (rSet.Get(SDRATTR_CAPTIONESCREL ))).GetValue();
- rPara.nEscAbs =((SdrCaptionEscAbsItem&) (rSet.Get(SDRATTR_CAPTIONESCABS ))).GetValue();
- rPara.nLineLen =((SdrCaptionLineLenItem&) (rSet.Get(SDRATTR_CAPTIONLINELEN ))).GetValue();
- rPara.bFitLineLen=((SdrCaptionFitLineLenItem&)(rSet.Get(SDRATTR_CAPTIONFITLINELEN))).GetValue();
- }
+//-/ if(mpObjectItemSet)
+//-/ {
+ const SfxItemSet& rSet = GetItemSet();
+ rPara.eType =((SdrCaptionTypeItem&) (rSet.Get(SDRATTR_CAPTIONTYPE ))).GetValue();
+ rPara.bFixedAngle=((SdrCaptionFixedAngleItem&)(rSet.Get(SDRATTR_CAPTIONANGLE ))).GetValue();
+ rPara.nAngle =((SdrCaptionAngleItem&) (rSet.Get(SDRATTR_CAPTIONFIXEDANGLE))).GetValue();
+ rPara.nGap =((SdrCaptionGapItem&) (rSet.Get(SDRATTR_CAPTIONGAP ))).GetValue();
+ rPara.eEscDir =((SdrCaptionEscDirItem&) (rSet.Get(SDRATTR_CAPTIONESCDIR ))).GetValue();
+ rPara.bEscRel =((SdrCaptionEscIsRelItem&) (rSet.Get(SDRATTR_CAPTIONESCISREL ))).GetValue();
+ rPara.nEscRel =((SdrCaptionEscRelItem&) (rSet.Get(SDRATTR_CAPTIONESCREL ))).GetValue();
+ rPara.nEscAbs =((SdrCaptionEscAbsItem&) (rSet.Get(SDRATTR_CAPTIONESCABS ))).GetValue();
+ rPara.nLineLen =((SdrCaptionLineLenItem&) (rSet.Get(SDRATTR_CAPTIONLINELEN ))).GetValue();
+ rPara.bFitLineLen=((SdrCaptionFitLineLenItem&)(rSet.Get(SDRATTR_CAPTIONFITLINELEN))).GetValue();
+//-/ }
}
void SdrCaptionObj::ImpRecalcTail()
@@ -755,7 +768,7 @@ const Point& SdrCaptionObj::GetAnchorPos() const
void SdrCaptionObj::RecalcSnapRect()
{
SdrRectObj::RecalcSnapRect();
- aSnapRect.Union(aTailPoly.GetBoundRect());
+ maSnapRect.Union(aTailPoly.GetBoundRect());
// !!!!! fehlende Impl.
}
@@ -821,73 +834,111 @@ void SdrCaptionObj::SetModel(SdrModel* pNewModel)
ImpRecalcTail();
}
-void SdrCaptionObj::ForceDefaultAttr(SfxItemPool* pPool)
-{
- FASTBOOL bLineMerk=pLineAttr==NULL;
- SdrRectObj::ForceDefaultAttr(pPool);
- if (pPool!=NULL) {
- if (pCaptAttr==NULL) {
- SdrCaptionSetItem aSetItem(pPool);
- pCaptAttr=(SdrCaptionSetItem*)ImpSetNewAttr(pCaptAttr,&aSetItem,FALSE);
- }
- if (bLineMerk && pLineAttr!=NULL) {
- XLineAttrSetItem aSetItem(*pLineAttr);
- aSetItem.GetItemSet().Put(XLineStyleItem(XLINE_SOLID));
- pLineAttr=(XLineAttrSetItem*)ImpSetNewAttr(pLineAttr,&aSetItem,FALSE);
- }
- }
-}
+//-/void SdrCaptionObj::ForceDefaultAttr(SfxItemPool* pPool)
+//-/{
+//-/ FASTBOOL bLineMerk=pLineAttr==NULL;
+//-/ SdrRectObj::ForceDefaultAttr(pPool);
+//-/ if (pPool!=NULL) {
+//-/ if (pCaptAttr==NULL) {
+//-/ SdrCaptionSetItem aSetItem(pPool);
+//-/ pCaptAttr=(SdrCaptionSetItem*)ImpSetNewAttr(pCaptAttr,&aSetItem,FALSE);
+//-/ }
+//-/ if (bLineMerk && pLineAttr!=NULL) {
+//-/ XLineAttrSetItem aSetItem(*pLineAttr);
+//-/ aSetItem.GetItemSet().Put(XLineStyleItem(XLINE_SOLID));
+//-/ pLineAttr=(XLineAttrSetItem*)ImpSetNewAttr(pLineAttr,&aSetItem,FALSE);
+//-/ }
+//-/ }
+//-/}
+
+//-/void SdrCaptionObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/{
+//-/ SdrRectObj::NbcSetAttributes(rAttr,bReplaceAll);
+//-/ ImpRecalcTail();
+//-/}
-void SdrCaptionObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrCaptionObj::SetItem( const SfxPoolItem& rItem )
{
- SdrRectObj::NbcSetAttributes(rAttr,bReplaceAll);
ImpRecalcTail();
+ SdrRectObj::SetItem(rItem);
}
-void SdrCaptionObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr)
+void SdrCaptionObj::ClearItem( USHORT nWhich )
{
- SdrRectObj::NbcSetStyleSheet(pNewStyleSheet,bDontRemoveHardAttr);
ImpRecalcTail();
+ SdrRectObj::ClearItem(nWhich);
}
-void SdrCaptionObj::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType)
+void SdrCaptionObj::SetItemSet( const SfxItemSet& rSet )
{
- SdrRectObj::SFX_NOTIFY(rBC,rBCType,rHint,rHintType);
ImpRecalcTail();
+ SdrRectObj::SetItemSet(rSet);
}
-USHORT SdrCaptionObj::GetSetItemCount() const
+SfxItemSet* SdrCaptionObj::CreateNewItemSet(SfxItemPool& rPool)
{
- return 1+SdrRectObj::GetSetItemCount();
-}
+ // include ALL items, 2D and 3D
+ return new SfxItemSet(rPool,
+ // ranges from SdrAttrObj
+ SDRATTR_START, SDRATTRSET_SHADOW,
+ SDRATTRSET_OUTLINER, SDRATTRSET_MISC,
-const SfxSetItem* SdrCaptionObj::GetSetItem(USHORT nNum) const
-{
- if (nNum==0) return pCaptAttr;
- nNum--;
- return SdrRectObj::GetSetItem(nNum);
+ // caption attributes
+ SDRATTR_CAPTION_FIRST, SDRATTRSET_CAPTION,
+
+ // outliner and end
+ EE_ITEMS_START, EE_ITEMS_END,
+ 0, 0);
}
-void SdrCaptionObj::SetSetItem(USHORT nNum, const SfxSetItem* pAttr)
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrCaptionObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr)
{
- if (nNum==0) pCaptAttr=(const SdrCaptionSetItem*)pAttr;
- else {
- nNum--;
- SdrRectObj::SetSetItem(nNum,pAttr);
- }
+ SdrRectObj::NbcSetStyleSheet(pNewStyleSheet,bDontRemoveHardAttr);
+ ImpRecalcTail();
}
-SfxSetItem* SdrCaptionObj::MakeNewSetItem(USHORT nNum, FASTBOOL bClone) const
+void SdrCaptionObj::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType)
{
- if (nNum==0) {
- if (bClone) return new SdrCaptionSetItem(*pCaptAttr);
- else return new SdrCaptionSetItem(GetItemPool());
- } else {
- nNum--;
- return SdrRectObj::MakeNewSetItem(nNum,bClone);
- }
+ SdrRectObj::SFX_NOTIFY(rBC,rBCType,rHint,rHintType);
+ ImpRecalcTail();
}
+//-/USHORT SdrCaptionObj::GetSetItemCount() const
+//-/{
+//-/ return 1+SdrRectObj::GetSetItemCount();
+//-/}
+
+//-/const SfxSetItem* SdrCaptionObj::GetSetItem(USHORT nNum) const
+//-/{
+//-/ if (nNum==0) return pCaptAttr;
+//-/ nNum--;
+//-/ return SdrRectObj::GetSetItem(nNum);
+//-/}
+
+//-/void SdrCaptionObj::SetSetItem(USHORT nNum, const SfxSetItem* pAttr)
+//-/{
+//-/ if (nNum==0) pCaptAttr=(const SdrCaptionSetItem*)pAttr;
+//-/ else {
+//-/ nNum--;
+//-/ SdrRectObj::SetSetItem(nNum,pAttr);
+//-/ }
+//-/}
+
+//-/SfxSetItem* SdrCaptionObj::MakeNewSetItem(USHORT nNum, FASTBOOL bClone) const
+//-/{
+//-/ if (nNum==0) {
+//-/ if (bClone) return new SdrCaptionSetItem(*pCaptAttr);
+//-/ else return new SdrCaptionSetItem(GetItemPool());
+//-/ } else {
+//-/ nNum--;
+//-/ return SdrRectObj::MakeNewSetItem(nNum,bClone);
+//-/ }
+//-/}
+
SdrObjGeoData* SdrCaptionObj::NewGeoData() const
{
return new SdrCaptObjGeoData;
@@ -930,6 +981,34 @@ SdrObject* SdrCaptionObj::DoConvertToPolyObj(BOOL bBezier) const
return pRet;
}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// pre- and postprocessing for objects for saving
+
+void SdrCaptionObj::PreSave()
+{
+ // call parent
+ SdrRectObj::PreSave();
+
+ // prepare SetItems for storage
+ const SfxItemSet& rSet = GetItemSet();
+ const SfxItemSet* pParent = GetStyleSheet() ? &GetStyleSheet()->GetItemSet() : 0L;
+ SdrCaptionSetItem aCaptAttr(rSet.GetPool());
+ aCaptAttr.GetItemSet().Put(rSet);
+ aCaptAttr.GetItemSet().SetParent(pParent);
+ mpObjectItemSet->Put(aCaptAttr);
+}
+
+void SdrCaptionObj::PostSave()
+{
+ // call parent
+ SdrRectObj::PostSave();
+
+ // remove SetItems from local itemset
+ mpObjectItemSet->ClearItem(SDRATTRSET_CAPTION);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
void SdrCaptionObj::WriteData(SvStream& rOut) const
{
SdrRectObj::WriteData(rOut);
@@ -937,37 +1016,64 @@ void SdrCaptionObj::WriteData(SvStream& rOut) const
#ifdef DBG_UTIL
aCompat.SetID("SdrCaptionObj");
#endif
- rOut<<aTailPoly;
- SfxItemPool* pPool=GetItemPool();
- if (pPool!=NULL) {
- pPool->StoreSurrogate(rOut,pCaptAttr);
- } else {
- rOut<<UINT16(SFX_ITEMS_NULL);
+
+ rOut << aTailPoly;
+ SfxItemPool* pPool = GetItemPool();
+
+ if(pPool)
+ {
+ const SfxItemSet& rSet = GetItemSet();
+
+ pPool->StoreSurrogate(rOut, &rSet.Get(SDRATTRSET_CAPTION));
+
+
+
+//-/ SdrCaptionSetItem aCaptAttr(pPool);
+//-/ aCaptAttr.GetItemSet().Put(GetItemSet());
+//-/ const SfxPoolItem& rCaptAttr = pPool->Put(aCaptAttr);
+//-/ pPool->StoreSurrogate(rOut, &rCaptAttr);
+//-/ pPool->StoreSurrogate(rOut,pCaptAttr);
+ }
+ else
+ {
+ rOut << UINT16(SFX_ITEMS_NULL);
}
}
void SdrCaptionObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
{
- if (rIn.GetError()!=0) return;
+ if(rIn.GetError())
+ return;
+
SdrRectObj::ReadData(rHead,rIn);
SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
#ifdef DBG_UTIL
aCompat.SetID("SdrCaptionObj");
#endif
- rIn>>aTailPoly;
-
- if (rHead.GetVersion()<11) { UINT16 nWhichDum; rIn>>nWhichDum; } // ab V11 keine WhichId mehr
- SfxItemPool* pPool=GetItemPool();
- if (pPool!=NULL) {
- pCaptAttr=(const SdrCaptionSetItem*)ImpSetNewAttr(pCaptAttr,NULL); // ggf altes rauswerfen
- USHORT nWhichRef=SDRATTRSET_CAPTION;
- pCaptAttr=(const SdrCaptionSetItem*)pPool->LoadSurrogate(rIn,nWhichRef,0);
- if (pStyleSheet!=NULL && pCaptAttr!=NULL) {
- ((SfxItemSet*)&pCaptAttr->GetItemSet())->SetParent(&pStyleSheet->GetItemSet());
- }
- } else {
- UINT16 nSuroDum;
- rIn>>nSuroDum;
+
+ rIn >> aTailPoly;
+
+ if(rHead.GetVersion() < 11) { sal_uInt16 nWhichDum; rIn >> nWhichDum; } // ab V11 keine WhichId mehr
+
+ SfxItemPool* pPool = GetItemPool();
+
+ if(pPool)
+ {
+ sal_uInt16 nSetID = SDRATTRSET_CAPTION;
+ const SdrCaptionSetItem* pCaptAttr = (const SdrCaptionSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0);
+ if(pCaptAttr)
+ SetItemSet(pCaptAttr->GetItemSet());
+//-/ pCaptAttr=(const SdrCaptionSetItem*)ImpSetNewAttr(pCaptAttr,NULL); // ggf altes rauswerfen
+//-/ USHORT nWhichRef=SDRATTRSET_CAPTION;
+//-/ pCaptAttr=(const SdrCaptionSetItem*)pPool->LoadSurrogate(rIn,nWhichRef,0);
+//-/ if (pStyleSheet!=NULL && pCaptAttr!=NULL) {
+//-/ ((SfxItemSet*)&pCaptAttr->GetItemSet())->SetParent(&pStyleSheet->GetItemSet());
+//-/ }
+ }
+ else
+ {
+ sal_uInt16 nSuroDum;
+ rIn >> nSuroDum;
}
}
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index 7feed5af688b..f131c4d22fe6 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdocirc.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2000-09-27 14:03:57 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -106,6 +106,10 @@
#include "svdglob.hxx" // StringCache
#include "svdstr.hrc" // Objektname
+#ifndef _EEITEM_HXX
+#include "eeitem.hxx"
+#endif
+
void SetWinkPnt(const Rectangle& rR, long nWink, Point& rPnt)
{
Point aCenter(rR.Center());
@@ -149,7 +153,7 @@ SdrCircObj::SdrCircObj(SdrObjKind eNewKind)
nEndWink=36000;
eKind=eNewKind;
bClosedObj=eNewKind!=OBJ_CARC;
- pCircAttr=NULL;
+//-/ pCircAttr=NULL;
}
SdrCircObj::SdrCircObj(SdrObjKind eNewKind, const Rectangle& rRect):
@@ -159,7 +163,7 @@ SdrCircObj::SdrCircObj(SdrObjKind eNewKind, const Rectangle& rRect):
nEndWink=36000;
eKind=eNewKind;
bClosedObj=eNewKind!=OBJ_CARC;
- pCircAttr=NULL;
+//-/ pCircAttr=NULL;
}
SdrCircObj::SdrCircObj(SdrObjKind eNewKind, const Rectangle& rRect, long nNewStartWink, long nNewEndWink):
@@ -171,13 +175,13 @@ SdrCircObj::SdrCircObj(SdrObjKind eNewKind, const Rectangle& rRect, long nNewSta
if (nWinkDif==36000) nEndWink+=nWinkDif; // Vollkreis
eKind=eNewKind;
bClosedObj=eNewKind!=OBJ_CARC;
- pCircAttr=NULL;
+//-/ pCircAttr=NULL;
}
SdrCircObj::~SdrCircObj()
{
// Attr entfernen (oder macht das SdrAttrObj noch nicht automatisch)
- pCircAttr=(SdrCircSetItem*)ImpSetNewAttr(pCircAttr,NULL,FALSE);
+//-/ pCircAttr=(SdrCircSetItem*)ImpSetNewAttr(pCircAttr,NULL,FALSE);
}
void SdrCircObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
@@ -204,33 +208,44 @@ FASTBOOL SdrCircObj::PaintNeedsXPoly() const
// Wenn nicht Win, dann fuer alle ausser Vollkreis (erstmal!!!)
if (eKind!=OBJ_CIRC) bNeed=TRUE;
#endif
- if (!bNeed && pLineAttr!=NULL) {
- const SfxItemSet& rSet=pLineAttr->GetItemSet();
+
+ const SfxItemSet& rSet = GetItemSet();
+ if(!bNeed)
+ {
// XPoly ist notwendig fuer alles was nicht LineSolid oder LineNone ist
- XLineStyle eLine=((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
- bNeed= eLine!=XLINE_NONE && eLine!=XLINE_SOLID;
+ XLineStyle eLine = ((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
+ bNeed = eLine != XLINE_NONE && eLine != XLINE_SOLID;
+
// XPoly ist notwendig fuer dicke Linien
- if (!bNeed && eLine!=XLINE_NONE) {
- bNeed=((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue()!=0;
- }
+ if(!bNeed && eLine != XLINE_NONE)
+ bNeed = ((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue() != 0;
+
// XPoly ist notwendig fuer Kreisboegen mit Linienenden
- if (!bNeed && eKind==OBJ_CARC) {
+ if(!bNeed && eKind == OBJ_CARC)
+ {
// Linienanfang ist da, wenn StartPolygon und StartWidth!=0
- bNeed=((XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetValue().GetPointCount()!=0 &&
- ((XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue()!=0;
- if (!bNeed) {
+ bNeed=((XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetValue().GetPointCount() != 0 &&
+ ((XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue() != 0;
+
+ if(!bNeed)
+ {
// Linienende ist da, wenn EndPolygon und EndWidth!=0
- bNeed=((XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetValue().GetPointCount()!=0 &&
- ((XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue()!=0;
+ bNeed = ((XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetValue().GetPointCount() != 0 &&
+ ((XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue() != 0;
}
}
}
+
// XPoly ist notwendig, wenn Fill !=None und !=Solid
- if (!bNeed && pFillAttr!=NULL && eKind!=OBJ_CARC) {
- XFillStyle eFill=((XFillStyleItem&)(pFillAttr->GetItemSet().Get(XATTR_FILLSTYLE))).GetValue();
- bNeed= eFill!=XFILL_NONE && eFill!=XFILL_SOLID;
+ if(!bNeed && eKind != OBJ_CARC)
+ {
+ XFillStyle eFill=((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue();
+ bNeed = eFill != XFILL_NONE && eFill != XFILL_SOLID;
}
- if (!bNeed && eKind!=OBJ_CIRC && nStartWink==nEndWink) bNeed=TRUE; // Weil sonst Vollkreis gemalt wird
+
+ if(!bNeed && eKind != OBJ_CIRC && nStartWink == nEndWink)
+ bNeed=TRUE; // Weil sonst Vollkreis gemalt wird
+
return bNeed;
}
@@ -332,24 +347,27 @@ FASTBOOL SdrCircObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoR
BOOL bIsFillDraft(0 != (rInfoRec.nPaintMode & SDRPAINTMODE_DRAFTFILL));
// prepare ItemSet of this object
- SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
- TakeAttributes(aSet, FALSE, TRUE);
+ const SfxItemSet& rSet = GetItemSet();
+//-/ SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
+//-/ TakeAttributes(aSet, FALSE, TRUE);
// perepare ItemSet to avoid old XOut line drawing
- XLineAttrSetItem aXLSet((SfxItemPool*)GetItemPool());
- aXLSet.GetItemSet().Put(XLineStyleItem(XLINE_NONE));
+//-/ XLineAttrSetItem aXLSet(rSet.GetPool());
+ SfxItemSet aEmptySet(*rSet.GetPool());
+ aEmptySet.Put(XLineStyleItem(XLINE_NONE));
+ aEmptySet.Put(XFillStyleItem(XFILL_NONE));
// prepare line geometry
- ImpLineGeometry* pLineGeometry = ImpPrepareLineGeometry(rXOut, aSet, bIsLineDraft);
+ ImpLineGeometry* pLineGeometry = ImpPrepareLineGeometry(rXOut, rSet, bIsLineDraft);
// Shadows
if(!bHideContour && ImpSetShadowAttributes(rXOut,eKind==OBJ_CARC || bIsFillDraft))
{
- UINT32 nXDist=((SdrShadowXDistItem&)(pShadAttr->GetItemSet().Get(SDRATTR_SHADOWXDIST))).GetValue();
- UINT32 nYDist=((SdrShadowYDistItem&)(pShadAttr->GetItemSet().Get(SDRATTR_SHADOWYDIST))).GetValue();
+ UINT32 nXDist=((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue();
+ UINT32 nYDist=((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue();
// avoid shadow line drawing in XOut
- rXOut.SetLineAttr(aXLSet);
+ rXOut.SetLineAttr(aEmptySet);
if (PaintNeedsXPoly()) {
XPolygon aX(GetXPoly()); // In dieser Reihenfolge, damit bXPolyIsLine gueltig ist.
@@ -384,24 +402,23 @@ FASTBOOL SdrCircObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoR
if(pLineGeometry)
{
// draw the line geometry
- ImpDrawShadowLineGeometry(rXOut, aSet, *pLineGeometry);
+ ImpDrawShadowLineGeometry(rXOut, rSet, *pLineGeometry);
}
}
// Before here the LineAttr were set: if(pLineAttr) rXOut.SetLineAttr(*pLineAttr);
- rXOut.SetLineAttr(aXLSet);
+ rXOut.SetLineAttr(aEmptySet);
if(bIsFillDraft)
{
// perepare ItemSet to avoid XOut filling
- XFillAttrSetItem aXFSet((SfxItemPool*)GetItemPool());
+ XFillAttrSetItem aXFSet(rSet.GetPool());
aXFSet.GetItemSet().Put(XFillStyleItem(XFILL_NONE));
- rXOut.SetFillAttr(aXFSet);
+ rXOut.SetFillAttr(aEmptySet);
}
else
{
- if(pFillAttr)
- rXOut.SetFillAttr(*pFillAttr);
+ rXOut.SetFillAttr(rSet);
}
if (!bHideContour) {
@@ -430,7 +447,7 @@ FASTBOOL SdrCircObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoR
if(!bHideContour && pLineGeometry)
{
// draw the line geometry
- ImpDrawColorLineGeometry(rXOut, aSet, *pLineGeometry);
+ ImpDrawColorLineGeometry(rXOut, rSet, *pLineGeometry);
}
FASTBOOL bOk=TRUE;
@@ -610,11 +627,12 @@ void SdrCircObj::TakeObjNamePlural(XubString& rName) const
void SdrCircObj::operator=(const SdrObject& rObj)
{
SdrRectObj::operator=(rObj);
- nStartWink=((SdrCircObj&)rObj).nStartWink;
- nEndWink =((SdrCircObj&)rObj).nEndWink;
- aPnt1 =((SdrCircObj&)rObj).aPnt1;
- aPnt2 =((SdrCircObj&)rObj).aPnt2;
- pCircAttr=(SdrCircSetItem*)ImpSetNewAttr(pCircAttr,((SdrCircObj&)rObj).pCircAttr);
+
+ nStartWink = ((SdrCircObj&)rObj).nStartWink;
+ nEndWink = ((SdrCircObj&)rObj).nEndWink;
+ aPnt1 = ((SdrCircObj&)rObj).aPnt1;
+ aPnt2 = ((SdrCircObj&)rObj).aPnt2;
+//-/ pCircAttr=(SdrCircSetItem*)ImpSetNewAttr(pCircAttr,((SdrCircObj&)rObj).pCircAttr);
}
void SdrCircObj::TakeXorPoly(XPolyPolygon& rPoly, FASTBOOL bDetail) const
@@ -1030,7 +1048,7 @@ void SdrCircObj::NbcMove(const Size& aSiz)
{
MoveRect(aRect,aSiz);
MoveRect(aOutRect,aSiz);
- MoveRect(aSnapRect,aSiz);
+ MoveRect(maSnapRect,aSiz);
MovePoint(aPnt1,aSiz);
MovePoint(aPnt2,aSiz);
SetXPolyDirty();
@@ -1245,9 +1263,9 @@ void SdrCircObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
void SdrCircObj::RecalcSnapRect()
{
if (PaintNeedsXPoly()) {
- aSnapRect=GetXPoly().GetBoundRect();
+ maSnapRect=GetXPoly().GetBoundRect();
} else {
- TakeUnrotatedSnapRect(aSnapRect);
+ TakeUnrotatedSnapRect(maSnapRect);
}
}
@@ -1259,7 +1277,7 @@ void SdrCircObj::NbcSetSnapRect(const Rectangle& rRect)
long nHgt0=aSR0.Bottom()-aSR0.Top();
long nWdt1=rRect.Right()-rRect.Left();
long nHgt1=rRect.Bottom()-rRect.Top();
- NbcResize(aSnapRect.TopLeft(),Fraction(nWdt1,nWdt0),Fraction(nHgt1,nHgt0));
+ NbcResize(maSnapRect.TopLeft(),Fraction(nWdt1,nWdt0),Fraction(nHgt1,nHgt0));
NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top()));
} else {
aRect=rRect;
@@ -1295,119 +1313,199 @@ void __EXPORT SdrCircObj::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType,
ImpSetAttrToCircInfo();
}
-void SdrCircObj::ForceDefaultAttr(SfxItemPool* pPool)
-{
- SdrRectObj::ForceDefaultAttr(pPool);
- if (pPool!=NULL) {
- if (pCircAttr==NULL) {
- SdrCircKind eKindA=SDRCIRC_FULL;
- if (eKind==OBJ_SECT) eKindA=SDRCIRC_SECT;
- else if (eKind==OBJ_CARC) eKindA=SDRCIRC_ARC;
- else if (eKind==OBJ_CCUT) eKindA=SDRCIRC_CUT;
- SdrCircSetItem aSetItem(pPool);
- SfxItemSet& rSet=aSetItem.GetItemSet();
- if (eKindA!=SDRCIRC_FULL) {
- rSet.Put(SdrCircKindItem(eKindA));
- if (nStartWink!=0) rSet.Put(SdrCircStartAngleItem(nStartWink));
- if (nEndWink!=36000) rSet.Put(SdrCircEndAngleItem(nEndWink));
- }
- pCircAttr=(SdrCircSetItem*)ImpSetNewAttr(pCircAttr,&aSetItem,FALSE);
- }
+void SdrCircObj::ForceDefaultAttr()
+{
+ SdrRectObj::ForceDefaultAttr();
+
+//-/ if(pPool)
+//-/ {
+ SdrCircKind eKindA = SDRCIRC_FULL;
+
+ 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)
+ {
+ SetItem(SdrCircKindItem(eKindA));
+
+ if(nStartWink)
+ SetItem(SdrCircStartAngleItem(nStartWink));
+
+ if(nEndWink != 36000)
+ SetItem(SdrCircEndAngleItem(nEndWink));
}
+//-/ }
+//-/ if (pPool!=NULL) {
+//-/ if (pCircAttr==NULL) {
+//-/ SdrCircKind eKindA=SDRCIRC_FULL;
+//-/ if (eKind==OBJ_SECT) eKindA=SDRCIRC_SECT;
+//-/ else if (eKind==OBJ_CARC) eKindA=SDRCIRC_ARC;
+//-/ else if (eKind==OBJ_CCUT) eKindA=SDRCIRC_CUT;
+//-/ SdrCircSetItem aSetItem(pPool);
+//-/ SfxItemSet& rSet=aSetItem.GetItemSet();
+//-/ if (eKindA!=SDRCIRC_FULL) {
+//-/ rSet.Put(SdrCircKindItem(eKindA));
+//-/ if (nStartWink!=0) rSet.Put(SdrCircStartAngleItem(nStartWink));
+//-/ if (nEndWink!=36000) rSet.Put(SdrCircEndAngleItem(nEndWink));
+//-/ }
+//-/ pCircAttr=(SdrCircSetItem*)ImpSetNewAttr(pCircAttr,&aSetItem,FALSE);
+//-/ }
+//-/ }
}
-USHORT SdrCircObj::GetSetItemCount() const
-{
- return 1+SdrRectObj::GetSetItemCount();
-}
+//-/USHORT SdrCircObj::GetSetItemCount() const
+//-/{
+//-/ return 1+SdrRectObj::GetSetItemCount();
+//-/}
+
+//-/const SfxSetItem* SdrCircObj::GetSetItem(USHORT nNum) const
+//-/{
+//-/ if (nNum==0) return pCircAttr;
+//-/ nNum--;
+//-/ return SdrRectObj::GetSetItem(nNum);
+//-/}
+
+//-/void SdrCircObj::SetSetItem(USHORT nNum, const SfxSetItem* pAttr)
+//-/{
+//-/ if (nNum==0) {
+//-/ pCircAttr=(const SdrCircSetItem*)pAttr;
+//-/ } else {
+//-/ nNum--;
+//-/ SdrRectObj::SetSetItem(nNum,pAttr);
+//-/ }
+//-/}
+
+//-/SfxSetItem* SdrCircObj::MakeNewSetItem(USHORT nNum, FASTBOOL bClone) const
+//-/{
+//-/ if (nNum==0) {
+//-/ if (bClone && pCircAttr!=NULL) return new SdrCircSetItem(*pCircAttr);
+//-/ else return new SdrCircSetItem(GetItemPool());
+//-/ } else {
+//-/ nNum--;
+//-/ return SdrRectObj::MakeNewSetItem(nNum,bClone);
+//-/ }
+//-/}
-const SfxSetItem* SdrCircObj::GetSetItem(USHORT nNum) const
+void SdrCircObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr)
{
- if (nNum==0) return pCircAttr;
- nNum--;
- return SdrRectObj::GetSetItem(nNum);
+ SetXPolyDirty();
+ SdrRectObj::NbcSetStyleSheet(pNewStyleSheet,bDontRemoveHardAttr);
+ ImpSetAttrToCircInfo();
}
-void SdrCircObj::SetSetItem(USHORT nNum, const SfxSetItem* pAttr)
-{
- if (nNum==0) {
- pCircAttr=(const SdrCircSetItem*)pAttr;
- } else {
- nNum--;
- SdrRectObj::SetSetItem(nNum,pAttr);
- }
-}
+//-/void SdrCircObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/{
+//-/ SetXPolyDirty();
+//-/ SdrRectObj::NbcSetAttributes(rAttr,bReplaceAll);
+//-/ ImpSetAttrToCircInfo();
+//-/}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
-SfxSetItem* SdrCircObj::MakeNewSetItem(USHORT nNum, FASTBOOL bClone) const
+void SdrCircObj::SetItem(const SfxPoolItem& rItem)
{
- if (nNum==0) {
- if (bClone && pCircAttr!=NULL) return new SdrCircSetItem(*pCircAttr);
- else return new SdrCircSetItem(GetItemPool());
- } else {
- nNum--;
- return SdrRectObj::MakeNewSetItem(nNum,bClone);
- }
+ SetXPolyDirty();
+ SdrRectObj::SetItem(rItem);
+ ImpSetAttrToCircInfo();
}
-void SdrCircObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr)
+void SdrCircObj::ClearItem(USHORT nWhich)
{
SetXPolyDirty();
- SdrRectObj::NbcSetStyleSheet(pNewStyleSheet,bDontRemoveHardAttr);
+ SdrRectObj::ClearItem(nWhich);
ImpSetAttrToCircInfo();
}
-void SdrCircObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+void SdrCircObj::SetItemSet(const SfxItemSet& rSet)
{
SetXPolyDirty();
- SdrRectObj::NbcSetAttributes(rAttr,bReplaceAll);
+ SdrRectObj::SetItemSet(rSet);
ImpSetAttrToCircInfo();
}
+SfxItemSet* SdrCircObj::CreateNewItemSet(SfxItemPool& rPool)
+{
+ // include ALL items, 2D and 3D
+ return new SfxItemSet(rPool,
+ // ranges from SdrAttrObj
+ SDRATTR_START, SDRATTRSET_SHADOW,
+ SDRATTRSET_OUTLINER, SDRATTRSET_MISC,
+
+ // circle attributes
+ SDRATTR_CIRC_FIRST, SDRATTRSET_CIRC,
+
+ // outliner and end
+ EE_ITEMS_START, EE_ITEMS_END,
+ 0, 0);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
void SdrCircObj::ImpSetAttrToCircInfo()
{
- if (pCircAttr!=NULL) {
- const SfxItemSet& rSet=pCircAttr->GetItemSet();
- SdrCircKind eNewKindA=((SdrCircKindItem&)rSet.Get(SDRATTR_CIRCKIND)).GetValue();
- SdrObjKind eNewKind=eKind;
- if (eNewKindA==SDRCIRC_FULL) eNewKind=OBJ_CIRC;
- else if (eNewKindA==SDRCIRC_SECT) eNewKind=OBJ_SECT;
- else if (eNewKindA==SDRCIRC_ARC) eNewKind=OBJ_CARC;
- else if (eNewKindA==SDRCIRC_CUT) eNewKind=OBJ_CCUT;
- long nNewStart=((SdrCircStartAngleItem&)rSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue();
- long nNewEnd=((SdrCircEndAngleItem&)rSet.Get(SDRATTR_CIRCENDANGLE)).GetValue();
- FASTBOOL bKindChg=eKind!=eNewKind;
- FASTBOOL bWinkChg=nNewStart!=nStartWink || nNewEnd!=nEndWink;
- if (bKindChg || bWinkChg) {
- eKind=eNewKind;
- nStartWink=nNewStart;
- nEndWink=nNewEnd;
- if (bKindChg || (eKind!=OBJ_CIRC && bWinkChg)) {
- SetXPolyDirty();
- SetRectsDirty();
- }
+ const SfxItemSet& rSet = GetItemSet();
+ SdrCircKind eNewKindA = ((SdrCircKindItem&)rSet.Get(SDRATTR_CIRCKIND)).GetValue();
+ SdrObjKind eNewKind = eKind;
+
+ if(eNewKindA == SDRCIRC_FULL)
+ eNewKind = OBJ_CIRC;
+ else if(eNewKindA == SDRCIRC_SECT)
+ eNewKind = OBJ_SECT;
+ else if(eNewKindA == SDRCIRC_ARC)
+ eNewKind = OBJ_CARC;
+ else if(eNewKindA == SDRCIRC_CUT)
+ eNewKind = OBJ_CCUT;
+
+ sal_Int32 nNewStart = ((SdrCircStartAngleItem&)rSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue();
+ sal_Int32 nNewEnd = ((SdrCircEndAngleItem&)rSet.Get(SDRATTR_CIRCENDANGLE)).GetValue();
+
+ BOOL bKindChg = eKind != eNewKind;
+ BOOL bWinkChg = nNewStart != nStartWink || nNewEnd != nEndWink;
+
+ if(bKindChg || bWinkChg)
+ {
+ eKind = eNewKind;
+ nStartWink = nNewStart;
+ nEndWink = nNewEnd;
+
+ if(bKindChg || (eKind != OBJ_CIRC && bWinkChg))
+ {
+ SetXPolyDirty();
+ SetRectsDirty();
}
}
}
void SdrCircObj::ImpSetCircInfoToAttr()
{
- if (pCircAttr!=NULL) {
- const SfxItemSet& rOldSet=pCircAttr->GetItemSet();
- SdrCircKind eNewKindA=SDRCIRC_FULL;
- if (eKind==OBJ_SECT) eNewKindA=SDRCIRC_SECT;
- else if (eKind==OBJ_CARC) eNewKindA=SDRCIRC_ARC;
- else if (eKind==OBJ_CCUT) eNewKindA=SDRCIRC_CUT;
- SdrCircKind eOldKindA=((SdrCircKindItem&)rOldSet.Get(SDRATTR_CIRCKIND)).GetValue();
- long nOldStartWink=((SdrCircStartAngleItem&)rOldSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue();
- long nOldEndWink=((SdrCircEndAngleItem&)rOldSet.Get(SDRATTR_CIRCENDANGLE)).GetValue();
- if (eNewKindA!=eOldKindA || nStartWink!=nOldStartWink || nEndWink!=nOldEndWink) {
- SdrCircSetItem aSI(*pCircAttr);
- SfxItemSet& rNewSet=aSI.GetItemSet();
- if (eNewKindA!=eOldKindA) rNewSet.Put(SdrCircKindItem(eNewKindA));
- if (nStartWink!=nOldStartWink) rNewSet.Put(SdrCircStartAngleItem(nStartWink));
- if (nEndWink!=nOldEndWink) rNewSet.Put(SdrCircEndAngleItem(nEndWink));
- pCircAttr=(SdrCircSetItem*)ImpSetNewAttr(pCircAttr,&aSI);
- }
+ SdrCircKind eNewKindA = SDRCIRC_FULL;
+ const SfxItemSet& rSet = GetItemSet();
+
+ if(eKind == OBJ_SECT)
+ eNewKindA = SDRCIRC_SECT;
+ else if(eKind == OBJ_CARC)
+ eNewKindA = SDRCIRC_ARC;
+ else if(eKind == OBJ_CCUT)
+ eNewKindA = SDRCIRC_CUT;
+
+ SdrCircKind eOldKindA = ((SdrCircKindItem&)rSet.Get(SDRATTR_CIRCKIND)).GetValue();
+ sal_Int32 nOldStartWink = ((SdrCircStartAngleItem&)rSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue();
+ sal_Int32 nOldEndWink = ((SdrCircEndAngleItem&)rSet.Get(SDRATTR_CIRCENDANGLE)).GetValue();
+
+ if(eNewKindA != eOldKindA || nStartWink != nOldStartWink || nEndWink != nOldEndWink)
+ {
+ if(eNewKindA != eOldKindA)
+ SetItem(SdrCircKindItem(eNewKindA));
+
+ if(nStartWink != nOldStartWink)
+ SetItem(SdrCircStartAngleItem(nStartWink));
+
+ if(nEndWink != nOldEndWink)
+ SetItem(SdrCircEndAngleItem(nEndWink));
}
}
@@ -1422,6 +1520,34 @@ SdrObject* SdrCircObj::DoConvertToPolyObj(BOOL bBezier) const
return pRet;
}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// pre- and postprocessing for objects for saving
+
+void SdrCircObj::PreSave()
+{
+ // call parent
+ SdrRectObj::PreSave();
+
+ // prepare SetItems for storage
+ const SfxItemSet& rSet = GetItemSet();
+ const SfxItemSet* pParent = GetStyleSheet() ? &GetStyleSheet()->GetItemSet() : 0L;
+ SdrCircSetItem aCircAttr(rSet.GetPool());
+ aCircAttr.GetItemSet().Put(rSet);
+ aCircAttr.GetItemSet().SetParent(pParent);
+ mpObjectItemSet->Put(aCircAttr);
+}
+
+void SdrCircObj::PostSave()
+{
+ // call parent
+ SdrRectObj::PostSave();
+
+ // remove SetItems from local itemset
+ mpObjectItemSet->ClearItem(SDRATTRSET_CIRC);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
void SdrCircObj::WriteData(SvStream& rOut) const
{
SdrRectObj::WriteData(rOut);
@@ -1429,67 +1555,96 @@ void SdrCircObj::WriteData(SvStream& rOut) const
#ifdef DBG_UTIL
aCompat.SetID("SdrCircObj");
#endif
- if (eKind!=OBJ_CIRC) {
- rOut<<nStartWink;
- rOut<<nEndWink;
+
+ if(eKind != OBJ_CIRC)
+ {
+ rOut << nStartWink;
+ rOut << nEndWink;
}
+
SfxItemPool* pPool=GetItemPool();
- if (pPool!=NULL) {
- pPool->StoreSurrogate(rOut,pCircAttr);
- } else {
- rOut<<UINT16(SFX_ITEMS_NULL);
+ if(pPool)
+ {
+ const SfxItemSet& rSet = GetItemSet();
+
+ pPool->StoreSurrogate(rOut, &rSet.Get(SDRATTRSET_CIRC));
+
+
+
+//-/ SdrCircSetItem aCircAttr(pPool);
+//-/ aCircAttr.GetItemSet().Put(GetItemSet());
+//-/ const SfxPoolItem& rCircAttr = pPool->Put(aCircAttr);
+//-/ pPool->StoreSurrogate(rOut, &rCircAttr);
+//-/ pPool->StoreSurrogate(rOut,pCircAttr);
+ }
+ else
+ {
+ rOut << UINT16(SFX_ITEMS_NULL);
}
}
void SdrCircObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
{
- if (rIn.GetError()!=0) return;
+ if(rIn.GetError())
+ return;
+
SdrRectObj::ReadData(rHead,rIn);
SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
#ifdef DBG_UTIL
aCompat.SetID("SdrCircObj");
#endif
- if (eKind!=OBJ_CIRC) {
- rIn>>nStartWink;
- rIn>>nEndWink;
+
+ if(eKind != OBJ_CIRC)
+ {
+ rIn >> nStartWink;
+ rIn >> nEndWink;
}
- if (aCompat.GetBytesLeft()>0) {
- SfxItemPool* pPool=GetItemPool();
- if (pPool!=NULL) {
- pCircAttr=(const SdrCircSetItem*)ImpSetNewAttr(pCircAttr,NULL); // ggf altes rauswerfen
- USHORT nWhichRef=SDRATTRSET_CIRC;
- pCircAttr=(const SdrCircSetItem*)pPool->LoadSurrogate(rIn,nWhichRef,0);
- if (pStyleSheet!=NULL && pCircAttr!=NULL) {
- ((SfxItemSet*)&pCircAttr->GetItemSet())->SetParent(&pStyleSheet->GetItemSet());
- }
- } else {
- UINT16 nSuroDum;
- rIn>>nSuroDum;
+
+ if(aCompat.GetBytesLeft() > 0)
+ {
+ SfxItemPool* pPool = GetItemPool();
+
+ if(pPool)
+ {
+ sal_uInt16 nSetID = SDRATTRSET_CIRC;
+ const SdrCircSetItem* pCircAttr = (const SdrCircSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0);
+ if(pCircAttr)
+ SetItemSet(pCircAttr->GetItemSet());
+//-/ pCircAttr=(const SdrCircSetItem*)ImpSetNewAttr(pCircAttr,NULL); // ggf altes rauswerfen
+//-/ USHORT nWhichRef=SDRATTRSET_CIRC;
+//-/ pCircAttr=(const SdrCircSetItem*)pPool->LoadSurrogate(rIn,nWhichRef,0);
+//-/ if (pStyleSheet!=NULL && pCircAttr!=NULL) {
+//-/ ((SfxItemSet*)&pCircAttr->GetItemSet())->SetParent(&pStyleSheet->GetItemSet());
+//-/ }
}
- } else {
+ else
+ {
+ sal_uInt16 nSuroDum;
+ rIn >> nSuroDum;
+ }
+ }
+ else
+ {
// create pCircAttr for old Objects to let ImpSetCircInfoToAttr() do it's work
SdrCircKind eKindA(SDRCIRC_FULL);
if(eKind == OBJ_SECT)
eKindA = SDRCIRC_SECT;
else if(eKind == OBJ_CARC)
- eKindA=SDRCIRC_ARC;
+ eKindA = SDRCIRC_ARC;
else if(eKind == OBJ_CCUT)
- eKindA=SDRCIRC_CUT;
-
- SfxItemPool* pPool = GetItemPool();
- SdrCircSetItem aSetItem(pPool);
- SfxItemSet& rSet = aSetItem.GetItemSet();
+ eKindA = SDRCIRC_CUT;
if(eKindA != SDRCIRC_FULL)
{
- rSet.Put(SdrCircKindItem(eKindA));
- if(nStartWink != 0)
- rSet.Put(SdrCircStartAngleItem(nStartWink));
+ SetItem(SdrCircKindItem(eKindA));
+
+ if(nStartWink)
+ SetItem(SdrCircStartAngleItem(nStartWink));
+
if(nEndWink != 36000)
- rSet.Put(SdrCircEndAngleItem(nEndWink));
+ SetItem(SdrCircEndAngleItem(nEndWink));
}
- pCircAttr = (SdrCircSetItem*)ImpSetNewAttr(pCircAttr, &aSetItem, FALSE);
}
}
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index 533f3433f630..f40d22442545 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdoedge.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: cl $ $Date: 2000-10-27 10:48:39 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -89,6 +89,10 @@
#include <svtools/smplhint.hxx>
#endif
+#ifndef _EEITEM_HXX
+#include "eeitem.hxx"
+#endif
+
////////////////////////////////////////////////////////////////////////////////////////////////////
SdrObjConnection::~SdrObjConnection()
@@ -300,11 +304,6 @@ SvStream& operator>>(SvStream& rIn, SdrEdgeInfoRec& rEI)
////////////////////////////////////////////////////////////////////////////////////////////////////
-#define GETEDGEKIND (pEdgeAttr==NULL ? SDREDGE_ORTHOLINES : \
- ((SdrEdgeKindItem&)(pEdgeAttr->GetItemSet().Get(SDRATTR_EDGEKIND))).GetValue())
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
TYPEINIT1(SdrEdgeObj,SdrTextObj);
SdrEdgeObj::SdrEdgeObj():
@@ -316,7 +315,7 @@ SdrEdgeObj::SdrEdgeObj():
bTmpDirtyOnAfterRead=FALSE;
nNotifyingCount=0;
pEdgeTrack=new XPolygon;
- pEdgeAttr=NULL;
+//-/ pEdgeAttr=NULL;
}
SdrEdgeObj::~SdrEdgeObj()
@@ -324,60 +323,98 @@ SdrEdgeObj::~SdrEdgeObj()
DisconnectFromNode(TRUE);
DisconnectFromNode(FALSE);
delete pEdgeTrack;
- pEdgeAttr=(SdrEdgeSetItem*)ImpSetNewAttr(pEdgeAttr,NULL,FALSE);
-}
+//-/ pEdgeAttr=(SdrEdgeSetItem*)ImpSetNewAttr(pEdgeAttr,NULL,FALSE);
+}
+
+//-/void SdrEdgeObj::ForceDefaultAttr(SfxItemPool* pPool)
+//-/{
+//-/ SdrTextObj::ForceDefaultAttr(pPool);
+//-/ if (pPool!=NULL) {
+//-/ if (pEdgeAttr==NULL) {
+//-/ SdrEdgeSetItem aSetItem(pPool);
+//-/ pEdgeAttr=(SdrEdgeSetItem*)ImpSetNewAttr(pEdgeAttr,&aSetItem,FALSE);
+//-/ }
+//-/ }
+//-/}
+
+//-/USHORT SdrEdgeObj::GetSetItemCount() const
+//-/{
+//-/ return 1+SdrTextObj::GetSetItemCount();
+//-/}
+
+//-/const SfxSetItem* SdrEdgeObj::GetSetItem(USHORT nNum) const
+//-/{
+//-/ if (nNum==0) return pEdgeAttr;
+//-/ nNum--;
+//-/ return SdrTextObj::GetSetItem(nNum);
+//-/}
+
+//-/void SdrEdgeObj::SetSetItem(USHORT nNum, const SfxSetItem* pAttr)
+//-/{
+//-/ if (nNum==0) {
+//-/ pEdgeAttr=(const SdrEdgeSetItem*)pAttr;
+//-/ bEdgeTrackDirty=TRUE;
+//-/ } else {
+//-/ nNum--;
+//-/ SdrTextObj::SetSetItem(nNum,pAttr);
+//-/ }
+//-/}
+
+//-/SfxSetItem* SdrEdgeObj::MakeNewSetItem(USHORT nNum, FASTBOOL bClone) const
+//-/{
+//-/ if (nNum==0) {
+//-/ if (bClone && pEdgeAttr!=NULL) return new SdrEdgeSetItem(*pEdgeAttr);
+//-/ else return new SdrEdgeSetItem(GetItemPool());
+//-/ } else {
+//-/ nNum--;
+//-/ return SdrTextObj::MakeNewSetItem(nNum,bClone);
+//-/ }
+//-/}
+
+//-/void SdrEdgeObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/{
+//-/ SdrTextObj::NbcSetAttributes(rAttr,bReplaceAll);
+//-/ ImpSetAttrToEdgeInfo(); // Werte vom Pool nach aEdgeInfo kopieren
+//-/}
-void SdrEdgeObj::ForceDefaultAttr(SfxItemPool* pPool)
-{
- SdrTextObj::ForceDefaultAttr(pPool);
- if (pPool!=NULL) {
- if (pEdgeAttr==NULL) {
- SdrEdgeSetItem aSetItem(pPool);
- pEdgeAttr=(SdrEdgeSetItem*)ImpSetNewAttr(pEdgeAttr,&aSetItem,FALSE);
- }
- }
-}
+////////////////////////////////////////////////////////////////////////////////////////////////////
-USHORT SdrEdgeObj::GetSetItemCount() const
+void SdrEdgeObj::SetItem(const SfxPoolItem& rItem)
{
- return 1+SdrTextObj::GetSetItemCount();
+ SdrTextObj::SetItem(rItem);
+ ImpSetAttrToEdgeInfo();
}
-const SfxSetItem* SdrEdgeObj::GetSetItem(USHORT nNum) const
+void SdrEdgeObj::ClearItem(USHORT nWhich)
{
- if (nNum==0) return pEdgeAttr;
- nNum--;
- return SdrTextObj::GetSetItem(nNum);
+ SdrTextObj::ClearItem(nWhich);
+ ImpSetAttrToEdgeInfo();
}
-void SdrEdgeObj::SetSetItem(USHORT nNum, const SfxSetItem* pAttr)
+void SdrEdgeObj::SetItemSet(const SfxItemSet& rSet)
{
- if (nNum==0) {
- pEdgeAttr=(const SdrEdgeSetItem*)pAttr;
- bEdgeTrackDirty=TRUE;
- } else {
- nNum--;
- SdrTextObj::SetSetItem(nNum,pAttr);
- }
+ SdrTextObj::SetItemSet(rSet);
+ ImpSetAttrToEdgeInfo();
}
-SfxSetItem* SdrEdgeObj::MakeNewSetItem(USHORT nNum, FASTBOOL bClone) const
+SfxItemSet* SdrEdgeObj::CreateNewItemSet(SfxItemPool& rPool)
{
- if (nNum==0) {
- if (bClone && pEdgeAttr!=NULL) return new SdrEdgeSetItem(*pEdgeAttr);
- else return new SdrEdgeSetItem(GetItemPool());
- } else {
- nNum--;
- return SdrTextObj::MakeNewSetItem(nNum,bClone);
- }
-}
+ // include ALL items, 2D and 3D
+ return new SfxItemSet(rPool,
+ // ranges from SdrAttrObj
+ SDRATTR_START, SDRATTRSET_SHADOW,
+ SDRATTRSET_OUTLINER, SDRATTRSET_MISC,
-void SdrEdgeObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
-{
- SdrTextObj::NbcSetAttributes(rAttr,bReplaceAll);
- ImpSetAttrToEdgeInfo(); // Werte vom Pool nach aEdgeInfo kopieren
+ // edge attributes
+ SDRATTR_EDGE_FIRST, SDRATTRSET_EDGE,
+
+ // outliner and end
+ EE_ITEMS_START, EE_ITEMS_END,
+ 0, 0);
}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
void SdrEdgeObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr)
{
SdrTextObj::NbcSetStyleSheet(pNewStyleSheet,bDontRemoveHardAttr);
@@ -386,105 +423,150 @@ void SdrEdgeObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontR
void SdrEdgeObj::ImpSetAttrToEdgeInfo()
{
- if (pEdgeAttr!=NULL) {
- SdrEdgeKind eKind=GETEDGEKIND;
- const SfxItemSet& rSet=pEdgeAttr->GetItemSet();
- long nVal1=((SdrEdgeLine1DeltaItem&)rSet.Get(SDRATTR_EDGELINE1DELTA)).GetValue();
- long nVal2=((SdrEdgeLine2DeltaItem&)rSet.Get(SDRATTR_EDGELINE2DELTA)).GetValue();
- long nVal3=((SdrEdgeLine3DeltaItem&)rSet.Get(SDRATTR_EDGELINE3DELTA)).GetValue();
- if (eKind==SDREDGE_ORTHOLINES || eKind==SDREDGE_BEZIER) {
- long nVals[3]={nVal1,nVal2,nVal3};
- USHORT n=0;
- if (aEdgeInfo.nObj1Lines>=2 && n<3) {
- aEdgeInfo.ImpSetLineVersatz(OBJ1LINE2,*pEdgeTrack,nVals[n]);
- n++;
- }
- if (aEdgeInfo.nObj1Lines>=3 && n<3) {
- aEdgeInfo.ImpSetLineVersatz(OBJ1LINE3,*pEdgeTrack,nVals[n]);
- n++;
- }
- if (aEdgeInfo.nMiddleLine!=0xFFFF && n<3) {
- aEdgeInfo.ImpSetLineVersatz(MIDDLELINE,*pEdgeTrack,nVals[n]);
- n++;
- }
- if (aEdgeInfo.nObj2Lines>=3 && n<3) {
- aEdgeInfo.ImpSetLineVersatz(OBJ2LINE3,*pEdgeTrack,nVals[n]);
- n++;
- }
- if (aEdgeInfo.nObj2Lines>=2 && n<3) {
- aEdgeInfo.ImpSetLineVersatz(OBJ2LINE2,*pEdgeTrack,nVals[n]);
- n++;
- }
- bEdgeTrackDirty=TRUE;
- } else if (eKind==SDREDGE_THREELINES) {
- FASTBOOL bHor1=aEdgeInfo.nAngle1==0 || aEdgeInfo.nAngle1==18000;
- FASTBOOL bHor2=aEdgeInfo.nAngle2==0 || aEdgeInfo.nAngle2==18000;
- if (bHor1) {
- aEdgeInfo.aObj1Line2.X()=nVal1;
- } else {
- aEdgeInfo.aObj1Line2.Y()=nVal1;
- }
- if (bHor2) {
- aEdgeInfo.aObj2Line2.X()=nVal2;
- } else {
- aEdgeInfo.aObj2Line2.Y()=nVal2;
- }
+ const SfxItemSet& rSet = GetItemSet();
+ SdrEdgeKind eKind = ((SdrEdgeKindItem&)(rSet.Get(SDRATTR_EDGEKIND))).GetValue();
+ sal_Int32 nVal1 = ((SdrEdgeLine1DeltaItem&)rSet.Get(SDRATTR_EDGELINE1DELTA)).GetValue();
+ sal_Int32 nVal2 = ((SdrEdgeLine2DeltaItem&)rSet.Get(SDRATTR_EDGELINE2DELTA)).GetValue();
+ sal_Int32 nVal3 = ((SdrEdgeLine3DeltaItem&)rSet.Get(SDRATTR_EDGELINE3DELTA)).GetValue();
+
+ if(eKind == SDREDGE_ORTHOLINES || eKind == SDREDGE_BEZIER)
+ {
+ sal_Int32 nVals[3] = { nVal1, nVal2, nVal3 };
+ sal_uInt16 n = 0;
+
+ if(aEdgeInfo.nObj1Lines >= 2 && n < 3)
+ {
+ aEdgeInfo.ImpSetLineVersatz(OBJ1LINE2, *pEdgeTrack, nVals[n]);
+ n++;
+ }
+
+ if(aEdgeInfo.nObj1Lines >= 3 && n < 3)
+ {
+ aEdgeInfo.ImpSetLineVersatz(OBJ1LINE3, *pEdgeTrack, nVals[n]);
+ n++;
+ }
+
+ if(aEdgeInfo.nMiddleLine != 0xFFFF && n < 3)
+ {
+ aEdgeInfo.ImpSetLineVersatz(MIDDLELINE, *pEdgeTrack, nVals[n]);
+ n++;
+ }
+
+ if(aEdgeInfo.nObj2Lines >= 3 && n < 3)
+ {
+ aEdgeInfo.ImpSetLineVersatz(OBJ2LINE3, *pEdgeTrack, nVals[n]);
+ n++;
+ }
+
+ if(aEdgeInfo.nObj2Lines >= 2 && n < 3)
+ {
+ aEdgeInfo.ImpSetLineVersatz(OBJ2LINE2, *pEdgeTrack, nVals[n]);
+ n++;
+ }
+
+ bEdgeTrackDirty = TRUE;
+ }
+ else if(eKind == SDREDGE_THREELINES)
+ {
+ BOOL bHor1 = aEdgeInfo.nAngle1 == 0 || aEdgeInfo.nAngle1 == 18000;
+ BOOL bHor2 = aEdgeInfo.nAngle2 == 0 || aEdgeInfo.nAngle2 == 18000;
+
+ if(bHor1)
+ {
+ aEdgeInfo.aObj1Line2.X() = nVal1;
+ }
+ else
+ {
+ aEdgeInfo.aObj1Line2.Y() = nVal1;
+ }
+
+ if(bHor2)
+ {
+ aEdgeInfo.aObj2Line2.X() = nVal2;
+ }
+ else
+ {
+ aEdgeInfo.aObj2Line2.Y() = nVal2;
}
}
}
void SdrEdgeObj::ImpSetEdgeInfoToAttr()
{
- if (pEdgeAttr!=NULL) {
- SdrEdgeKind eKind=GETEDGEKIND;
- const SfxItemSet& rSet=pEdgeAttr->GetItemSet();
- long nValAnz=((SdrEdgeLineDeltaAnzItem&)rSet.Get(SDRATTR_EDGELINEDELTAANZ)).GetValue();
- long nVal1=((SdrEdgeLine1DeltaItem&)rSet.Get(SDRATTR_EDGELINE1DELTA)).GetValue();
- long nVal2=((SdrEdgeLine2DeltaItem&)rSet.Get(SDRATTR_EDGELINE2DELTA)).GetValue();
- long nVal3=((SdrEdgeLine3DeltaItem&)rSet.Get(SDRATTR_EDGELINE3DELTA)).GetValue();
- long nVals[3]={nVal1,nVal2,nVal3};
- USHORT n=0;
- if (eKind==SDREDGE_ORTHOLINES || eKind==SDREDGE_BEZIER) {
- if (aEdgeInfo.nObj1Lines>=2 && n<3) {
- nVals[n]=aEdgeInfo.ImpGetLineVersatz(OBJ1LINE2,*pEdgeTrack);
- n++;
- }
- if (aEdgeInfo.nObj1Lines>=3 && n<3) {
- nVals[n]=aEdgeInfo.ImpGetLineVersatz(OBJ1LINE3,*pEdgeTrack);
- n++;
- }
- if (aEdgeInfo.nMiddleLine!=0xFFFF && n<3) {
- nVals[n]=aEdgeInfo.ImpGetLineVersatz(MIDDLELINE,*pEdgeTrack);
- n++;
- }
- if (aEdgeInfo.nObj2Lines>=3 && n<3) {
- nVals[n]=aEdgeInfo.ImpGetLineVersatz(OBJ2LINE3,*pEdgeTrack);
- n++;
- }
- if (aEdgeInfo.nObj2Lines>=2 && n<3) {
- nVals[n]=aEdgeInfo.ImpGetLineVersatz(OBJ2LINE2,*pEdgeTrack);
- n++;
- }
- } else if (eKind==SDREDGE_THREELINES) {
- FASTBOOL bHor1=aEdgeInfo.nAngle1==0 || aEdgeInfo.nAngle1==18000;
- FASTBOOL bHor2=aEdgeInfo.nAngle2==0 || aEdgeInfo.nAngle2==18000;
- n=2;
- nVals[0]=bHor1 ? aEdgeInfo.aObj1Line2.X() : aEdgeInfo.aObj1Line2.Y();
- nVals[1]=bHor2 ? aEdgeInfo.aObj2Line2.X() : aEdgeInfo.aObj2Line2.Y();
+ const SfxItemSet& rSet = GetItemSet();
+ SdrEdgeKind eKind = ((SdrEdgeKindItem&)(rSet.Get(SDRATTR_EDGEKIND))).GetValue();
+ sal_Int32 nValAnz = ((SdrEdgeLineDeltaAnzItem&)rSet.Get(SDRATTR_EDGELINEDELTAANZ)).GetValue();
+ sal_Int32 nVal1 = ((SdrEdgeLine1DeltaItem&)rSet.Get(SDRATTR_EDGELINE1DELTA)).GetValue();
+ sal_Int32 nVal2 = ((SdrEdgeLine2DeltaItem&)rSet.Get(SDRATTR_EDGELINE2DELTA)).GetValue();
+ sal_Int32 nVal3 = ((SdrEdgeLine3DeltaItem&)rSet.Get(SDRATTR_EDGELINE3DELTA)).GetValue();
+ sal_Int32 nVals[3] = { nVal1, nVal2, nVal3 };
+ sal_uInt16 n = 0;
+
+ if(eKind == SDREDGE_ORTHOLINES || eKind == SDREDGE_BEZIER)
+ {
+ if(aEdgeInfo.nObj1Lines >= 2 && n < 3)
+ {
+ nVals[n] = aEdgeInfo.ImpGetLineVersatz(OBJ1LINE2, *pEdgeTrack);
+ n++;
+ }
+
+ if(aEdgeInfo.nObj1Lines >= 3 && n < 3)
+ {
+ nVals[n] = aEdgeInfo.ImpGetLineVersatz(OBJ1LINE3, *pEdgeTrack);
+ n++;
+ }
+
+ if(aEdgeInfo.nMiddleLine != 0xFFFF && n < 3)
+ {
+ nVals[n] = aEdgeInfo.ImpGetLineVersatz(MIDDLELINE, *pEdgeTrack);
+ n++;
}
- if (n!=nValAnz || nVals[0]!=nVal1 || nVals[1]!=nVal2 || nVals[2]!=nVal3) {
- SdrEdgeSetItem aSI(*pEdgeAttr);
- SfxItemSet& rNewSet=aSI.GetItemSet();
- if (n!=nValAnz) rNewSet.Put(SdrEdgeLineDeltaAnzItem(n));
- if (nVals[0]!=nVal1) rNewSet.Put(SdrEdgeLine1DeltaItem(nVals[0]));
- if (nVals[1]!=nVal2) rNewSet.Put(SdrEdgeLine2DeltaItem(nVals[1]));
- if (nVals[2]!=nVal3) rNewSet.Put(SdrEdgeLine3DeltaItem(nVals[2]));
- if (n<3) rNewSet.ClearItem(SDRATTR_EDGELINE3DELTA);
- if (n<2) rNewSet.ClearItem(SDRATTR_EDGELINE2DELTA);
- if (n<1) rNewSet.ClearItem(SDRATTR_EDGELINE1DELTA);
- pEdgeAttr=(SdrEdgeSetItem*)ImpSetNewAttr(pEdgeAttr,&aSI);
+
+ if(aEdgeInfo.nObj2Lines >= 3 && n < 3)
+ {
+ nVals[n] = aEdgeInfo.ImpGetLineVersatz(OBJ2LINE3, *pEdgeTrack);
+ n++;
+ }
+
+ if(aEdgeInfo.nObj2Lines >= 2 && n < 3)
+ {
+ nVals[n] = aEdgeInfo.ImpGetLineVersatz(OBJ2LINE2, *pEdgeTrack);
+ n++;
}
}
+ else if(eKind == SDREDGE_THREELINES)
+ {
+ BOOL bHor1 = aEdgeInfo.nAngle1 == 0 || aEdgeInfo.nAngle1 == 18000;
+ BOOL bHor2 = aEdgeInfo.nAngle2 == 0 || aEdgeInfo.nAngle2 == 18000;
+
+ n = 2;
+ nVals[0] = bHor1 ? aEdgeInfo.aObj1Line2.X() : aEdgeInfo.aObj1Line2.Y();
+ nVals[1] = bHor2 ? aEdgeInfo.aObj2Line2.X() : aEdgeInfo.aObj2Line2.Y();
+ }
+
+ if(n != nValAnz || nVals[0] != nVal1 || nVals[1] != nVal2 || nVals[2] != nVal3)
+ {
+ if(n != nValAnz)
+ SetItem(SdrEdgeLineDeltaAnzItem(n));
+
+ if(nVals[0] != nVal1)
+ SetItem(SdrEdgeLine1DeltaItem(nVals[0]));
+
+ if(nVals[1] != nVal2)
+ SetItem(SdrEdgeLine2DeltaItem(nVals[1]));
+
+ if(nVals[2] != nVal3)
+ SetItem(SdrEdgeLine3DeltaItem(nVals[2]));
+
+ if(n < 3)
+ ClearItem(SDRATTR_EDGELINE3DELTA);
+
+ if(n < 2)
+ ClearItem(SDRATTR_EDGELINE2DELTA);
+
+ if(n < 1)
+ ClearItem(SDRATTR_EDGELINE1DELTA);
+ }
}
void SdrEdgeObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
@@ -526,7 +608,7 @@ const Rectangle& SdrEdgeObj::GetSnapRect() const
void SdrEdgeObj::RecalcSnapRect()
{
- aSnapRect=pEdgeTrack->GetBoundRect();
+ maSnapRect=pEdgeTrack->GetBoundRect();
}
void SdrEdgeObj::RecalcBoundRect()
@@ -562,25 +644,29 @@ FASTBOOL SdrEdgeObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoR
BOOL bIsLineDraft(0 != (rInfoRec.nPaintMode & SDRPAINTMODE_DRAFTLINE));
// prepare ItemSet of this object
- SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
- TakeAttributes(aSet, FALSE, TRUE);
+ const SfxItemSet& rSet = GetItemSet();
+//-/ GetItemSet aSet((SfxItemPool&)(*GetItemPool()));
+//-/ TakeAttributes(aSet, FALSE, TRUE);
// perepare ItemSet to avoid old XOut line drawing
- XLineAttrSetItem aXLSet((SfxItemPool*)GetItemPool());
- aXLSet.GetItemSet().Put(XLineStyleItem(XLINE_NONE));
+//-/ XLineAttrSetItem aXLSet((SfxItemPool*)GetItemPool());
+ SfxItemSet aEmptySet(*rSet.GetPool());
+ aEmptySet.Put(XLineStyleItem(XLINE_NONE));
+ aEmptySet.Put(XFillStyleItem(XFILL_NONE));
// prepare line geometry
- ImpLineGeometry* pLineGeometry = ImpPrepareLineGeometry(rXOut, aSet, bIsLineDraft);
+ ImpLineGeometry* pLineGeometry = ImpPrepareLineGeometry(rXOut, rSet, bIsLineDraft);
// Shadows
- if (!bHideContour && ImpSetShadowAttributes(rXOut,TRUE)) {
- UINT32 nXDist=((SdrShadowXDistItem&)(pShadAttr->GetItemSet().Get(SDRATTR_SHADOWXDIST))).GetValue();
- UINT32 nYDist=((SdrShadowYDistItem&)(pShadAttr->GetItemSet().Get(SDRATTR_SHADOWYDIST))).GetValue();
+ if(!bHideContour && ImpSetShadowAttributes(rXOut,TRUE))
+ {
+ UINT32 nXDist=((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue();
+ UINT32 nYDist=((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue();
XPolygon aXP(*pEdgeTrack);
aXP.Move(nXDist,nYDist);
// avoid shadow line drawing in XOut
- rXOut.SetLineAttr(aXLSet);
+ rXOut.SetLineAttr(aEmptySet);
rXOut.DrawXPolyLine(aXP);
@@ -588,24 +674,24 @@ FASTBOOL SdrEdgeObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoR
if(pLineGeometry)
{
// draw the line geometry
- ImpDrawShadowLineGeometry(rXOut, aSet, *pLineGeometry);
+ ImpDrawShadowLineGeometry(rXOut, rSet, *pLineGeometry);
}
}
// Before here the LineAttr were set: if(pLineAttr) rXOut.SetLineAttr(*pLineAttr);
- rXOut.SetLineAttr(aXLSet);
+ rXOut.SetLineAttr(aEmptySet);
if(bIsFillDraft)
{
// perepare ItemSet to avoid XOut filling
- XFillAttrSetItem aXFSet((SfxItemPool*)GetItemPool());
- aXFSet.GetItemSet().Put(XFillStyleItem(XFILL_NONE));
- rXOut.SetFillAttr(aXFSet);
+ rXOut.SetFillAttr(aEmptySet);
}
else
{
- if(bHideContour && pFillAttr)
- rXOut.SetFillAttr(*pFillAttr);
+ if(bHideContour)
+ {
+ rXOut.SetFillAttr(rSet);
+ }
}
if (!bHideContour) {
@@ -617,7 +703,7 @@ FASTBOOL SdrEdgeObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoR
if(!bHideContour && pLineGeometry)
{
// draw the line geometry
- ImpDrawColorLineGeometry(rXOut, aSet, *pLineGeometry);
+ ImpDrawColorLineGeometry(rXOut, rSet, *pLineGeometry);
}
FASTBOOL bOk=TRUE;
@@ -927,6 +1013,8 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection&
}
FASTBOOL bCon1=rCon1.pObj!=NULL && rCon1.pObj->GetPage()==pPage && rCon1.pObj->IsInserted();
FASTBOOL bCon2=rCon2.pObj!=NULL && rCon2.pObj->GetPage()==pPage && rCon2.pObj->IsInserted();
+ const SfxItemSet& rSet = GetItemSet();
+
if (bCon1) {
if (rCon1.pObj==(SdrObject*)this) { // sicherheitshalber Abfragen #44515#
aBoundRect1=aOutRect;
@@ -935,18 +1023,20 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection&
}
aBoundRect1.Move(rCon1.aObjOfs.X(),rCon1.aObjOfs.Y());
aBewareRect1=aBoundRect1;
- if (pEdgeAttr!=NULL) {
- const SfxItemSet& rSet=pEdgeAttr->GetItemSet();
- long nH=((SdrEdgeNode1HorzDistItem&)rSet.Get(SDRATTR_EDGENODE1HORZDIST)).GetValue();
- long nV=((SdrEdgeNode1VertDistItem&)rSet.Get(SDRATTR_EDGENODE1VERTDIST)).GetValue();
- aBewareRect1.Left()-=nH;
- aBewareRect1.Right()+=nH;
- aBewareRect1.Top()-=nV;
- aBewareRect1.Bottom()+=nV;
- } else {
- aBewareRect1.Left()-=500; aBewareRect1.Right()+=500;
- aBewareRect1.Top()-=500; aBewareRect1.Bottom()+=500;
- }
+
+//-/ if(mpObjectItemSet)
+//-/ {
+ sal_Int32 nH = ((SdrEdgeNode1HorzDistItem&)rSet.Get(SDRATTR_EDGENODE1HORZDIST)).GetValue();
+ sal_Int32 nV = ((SdrEdgeNode1VertDistItem&)rSet.Get(SDRATTR_EDGENODE1VERTDIST)).GetValue();
+
+ aBewareRect1.Left()-=nH;
+ aBewareRect1.Right()+=nH;
+ aBewareRect1.Top()-=nV;
+ aBewareRect1.Bottom()+=nV;
+//-/ } else {
+//-/ aBewareRect1.Left()-=500; aBewareRect1.Right()+=500;
+//-/ aBewareRect1.Top()-=500; aBewareRect1.Bottom()+=500;
+//-/ }
} else {
aBoundRect1=Rectangle(aPt1,aPt1);
aBoundRect1.Move(rCon1.aObjOfs.X(),rCon1.aObjOfs.Y());
@@ -960,18 +1050,20 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection&
}
aBoundRect2.Move(rCon2.aObjOfs.X(),rCon2.aObjOfs.Y());
aBewareRect2=aBoundRect2;
- if (pEdgeAttr!=NULL) {
- const SfxItemSet& rSet=pEdgeAttr->GetItemSet();
- long nH=((SdrEdgeNode2HorzDistItem&)rSet.Get(SDRATTR_EDGENODE2HORZDIST)).GetValue();
- long nV=((SdrEdgeNode2VertDistItem&)rSet.Get(SDRATTR_EDGENODE2VERTDIST)).GetValue();
- aBewareRect2.Left()-=nH;
- aBewareRect2.Right()+=nH;
- aBewareRect2.Top()-=nV;
- aBewareRect2.Bottom()+=nV;
- } else {
- aBewareRect2.Left()-=500; aBewareRect2.Right()+=500;
- aBewareRect2.Top()-=500; aBewareRect2.Bottom()+=500;
- }
+
+//-/ if(mpObjectItemSet)
+//-/ {
+ sal_Int32 nH = ((SdrEdgeNode2HorzDistItem&)rSet.Get(SDRATTR_EDGENODE2HORZDIST)).GetValue();
+ sal_Int32 nV = ((SdrEdgeNode2VertDistItem&)rSet.Get(SDRATTR_EDGENODE2VERTDIST)).GetValue();
+
+ aBewareRect2.Left()-=nH;
+ aBewareRect2.Right()+=nH;
+ aBewareRect2.Top()-=nV;
+ aBewareRect2.Bottom()+=nV;
+//-/ } else {
+//-/ aBewareRect2.Left()-=500; aBewareRect2.Right()+=500;
+//-/ aBewareRect2.Top()-=500; aBewareRect2.Bottom()+=500;
+//-/ }
} else {
aBoundRect2=Rectangle(aPt2,aPt2);
aBoundRect2.Move(rCon2.aObjOfs.X(),rCon2.aObjOfs.Y());
@@ -1033,7 +1125,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
const Point& rPt2, long nAngle2, const Rectangle& rBoundRect2, const Rectangle& rBewareRect2,
ULONG* pnQuality, SdrEdgeInfoRec* pInfo) const
{
- SdrEdgeKind eKind=GETEDGEKIND;
+ SdrEdgeKind eKind=((SdrEdgeKindItem&)(GetItem(SDRATTR_EDGEKIND))).GetValue();
FASTBOOL bRts1=nAngle1==0;
FASTBOOL bObn1=nAngle1==9000;
FASTBOOL bLks1=nAngle1==18000;
@@ -1826,7 +1918,6 @@ void SdrEdgeObj::operator=(const SdrObject& rObj)
aCon2 =((SdrEdgeObj&)rObj).aCon2;
aCon1.pObj=NULL;
aCon2.pObj=NULL;
- pEdgeAttr=(SdrEdgeSetItem*)ImpSetNewAttr(pEdgeAttr,((SdrEdgeObj&)rObj).pEdgeAttr);
aEdgeInfo=((SdrEdgeObj&)rObj).aEdgeInfo;
}
@@ -1858,7 +1949,7 @@ void SdrEdgeObj::TakeContour(XPolyPolygon& rXPoly, SdrContourType eType) const
USHORT SdrEdgeObj::GetHdlCount() const
{
- SdrEdgeKind eKind=GETEDGEKIND;
+ SdrEdgeKind eKind=((SdrEdgeKindItem&)(GetItem(SDRATTR_EDGEKIND))).GetValue();
USHORT nHdlAnz=0;
USHORT nPntAnz=pEdgeTrack->GetPointCount();
if (nPntAnz!=0) {
@@ -1888,7 +1979,7 @@ SdrHdl* SdrEdgeObj::GetHdl(USHORT nHdlNum) const
pHdl=new ImpEdgeHdl((*pEdgeTrack)[USHORT(nPntAnz-1)],HDL_POLY);
if (aCon2.pObj!=NULL && aCon2.bBestVertex) pHdl->Set1PixMore(TRUE);
} else {
- SdrEdgeKind eKind=GETEDGEKIND;
+ SdrEdgeKind eKind=((SdrEdgeKindItem&)(GetItem(SDRATTR_EDGEKIND))).GetValue();
if (eKind==SDREDGE_ORTHOLINES || eKind==SDREDGE_BEZIER) {
USHORT nO1=aEdgeInfo.nObj1Lines>0 ? aEdgeInfo.nObj1Lines-1 : 0;
USHORT nO2=aEdgeInfo.nObj2Lines>0 ? aEdgeInfo.nObj2Lines-1 : 0;
@@ -2417,6 +2508,34 @@ void SdrEdgeObj::RestGeoData(const SdrObjGeoData& rGeo)
aEdgeInfo =rEGeo.aEdgeInfo;
}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// pre- and postprocessing for objects for saving
+
+void SdrEdgeObj::PreSave()
+{
+ // call parent
+ SdrTextObj::PreSave();
+
+ // prepare SetItems for storage
+ const SfxItemSet& rSet = GetItemSet();
+ const SfxItemSet* pParent = GetStyleSheet() ? &GetStyleSheet()->GetItemSet() : 0L;
+ SdrEdgeSetItem aEdgeAttr(rSet.GetPool());
+ aEdgeAttr.GetItemSet().Put(rSet);
+ aEdgeAttr.GetItemSet().SetParent(pParent);
+ mpObjectItemSet->Put(aEdgeAttr);
+}
+
+void SdrEdgeObj::PostSave()
+{
+ // call parent
+ SdrTextObj::PostSave();
+
+ // remove SetItems from local itemset
+ mpObjectItemSet->ClearItem(SDRATTRSET_EDGE);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
void SdrEdgeObj::WriteData(SvStream& rOut) const
{
SdrTextObj::WriteData(rOut);
@@ -2424,22 +2543,40 @@ void SdrEdgeObj::WriteData(SvStream& rOut) const
#ifdef DBG_UTIL
aCompat.SetID("SdrEdgeObj");
#endif
+
{
SdrDownCompat aTrackCompat(rOut,STREAM_WRITE); // ab V11 eingepackt
#ifdef DBG_UTIL
aTrackCompat.SetID("SdrEdgeObj(EdgeTrack)");
#endif
- rOut<<*pEdgeTrack;
+ rOut << *pEdgeTrack;
}
- aCon1.Write(rOut,this); // Die Connections haben
- aCon2.Write(rOut,this); // ihren eigenen Header
- SfxItemPool* pPool=GetItemPool();
- if (pPool!=NULL) {
- pPool->StoreSurrogate(rOut,pEdgeAttr);
- } else {
- rOut<<UINT16(SFX_ITEMS_NULL);
+
+ aCon1.Write(rOut, this); // Die Connections haben
+ aCon2.Write(rOut, this); // ihren eigenen Header
+
+ SfxItemPool* pPool = GetItemPool();
+
+ if(pPool)
+ {
+ const SfxItemSet& rSet = GetItemSet();
+
+ pPool->StoreSurrogate(rOut, &rSet.Get(SDRATTRSET_EDGE));
+
+
+
+//-/ SdrEdgeSetItem aEdgeAttr(pPool);
+//-/ aEdgeAttr.GetItemSet().Put(GetItemSet());
+//-/ const SfxPoolItem& rEdgeAttr = pPool->Put(aEdgeAttr);
+//-/ pPool->StoreSurrogate(rOut, &rEdgeAttr);
+//-/ pPool->StoreSurrogate(rOut,pEdgeAttr);
}
- rOut<<aEdgeInfo;
+ else
+ {
+ rOut << UINT16(SFX_ITEMS_NULL);
+ }
+
+ rOut << aEdgeInfo;
}
void SdrEdgeObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
@@ -2472,20 +2609,31 @@ void SdrEdgeObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
aCon2.ReadTilV10(rIn,this); // Connections
}
}
- if (aCompat.GetBytesLeft()>0) { // ab 10-08-1996 (noch Vers 12) Items fuer Verbinder
- SfxItemPool* pPool=GetItemPool();
- if (pPool!=NULL) {
- pEdgeAttr=(const SdrEdgeSetItem*)ImpSetNewAttr(pEdgeAttr,NULL); // ggf altes rauswerfen
- USHORT nWhichRef=SDRATTRSET_EDGE;
- pEdgeAttr=(const SdrEdgeSetItem*)pPool->LoadSurrogate(rIn,nWhichRef,0);
- if (pStyleSheet!=NULL && pEdgeAttr!=NULL) {
- ((SfxItemSet*)&pEdgeAttr->GetItemSet())->SetParent(&pStyleSheet->GetItemSet());
- }
- } else {
- UINT16 nSuroDum;
- rIn>>nSuroDum;
+
+ if(aCompat.GetBytesLeft() > 0)
+ {
+ // ab 10-08-1996 (noch Vers 12) Items fuer Verbinder
+ SfxItemPool* pPool = GetItemPool();
+ if(pPool)
+ {
+ sal_uInt16 nSetID = SDRATTRSET_EDGE;
+ const SdrEdgeSetItem* pEdgeAttr = (const SdrEdgeSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0);
+ if(pEdgeAttr)
+ SetItemSet(pEdgeAttr->GetItemSet());
+//-/ pEdgeAttr=(const SdrEdgeSetItem*)ImpSetNewAttr(pEdgeAttr,NULL); // ggf altes rauswerfen
+//-/ USHORT nWhichRef=SDRATTRSET_EDGE;
+//-/ pEdgeAttr=(const SdrEdgeSetItem*)pPool->LoadSurrogate(rIn,nWhichRef,0);
+//-/ if (pStyleSheet!=NULL && pEdgeAttr!=NULL) {
+//-/ ((SfxItemSet*)&pEdgeAttr->GetItemSet())->SetParent(&pStyleSheet->GetItemSet());
+//-/ }
+ }
+ else
+ {
+ sal_uInt16 nSuroDum;
+ rIn >> nSuroDum;
}
}
+
if (aCompat.GetBytesLeft()>0) { // ab 14-01-1997 (noch Vers 12) EdgeInfoRec
rIn>>aEdgeInfo;
} else {
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 47a756a22984..be320148deba 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdograf.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: ka $ $Date: 2000-10-20 15:06:47 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -100,6 +100,10 @@
#include "svdfmtf.hxx"
#include "sdgcpitm.hxx"
+#ifndef _EEITEM_HXX
+#include "eeitem.hxx"
+#endif
+
#ifndef SVX_LIGHT
// ------------------
@@ -289,7 +293,7 @@ SdrGrafObj::SdrGrafObj():
bNoShear=TRUE;
#ifdef GRAFATTR
- pGrafAttr = NULL;
+//-/ pGrafAttr = NULL;
bCopyToPoolOnAfterRead = FALSE;
#endif // GRAFATTR
}
@@ -308,7 +312,7 @@ SdrGrafObj::SdrGrafObj(const Graphic& rGrf, const Rectangle& rRect):
bNoShear = TRUE;
#ifdef GRAFATTR
- pGrafAttr = NULL;
+//-/ pGrafAttr = NULL;
bCopyToPoolOnAfterRead = FALSE;
#endif // GRAFATTR
}
@@ -326,7 +330,7 @@ SdrGrafObj::SdrGrafObj( const Graphic& rGrf ):
bNoShear = TRUE;
#ifdef GRAFATTR
- pGrafAttr = NULL;
+//-/ pGrafAttr = NULL;
bCopyToPoolOnAfterRead = FALSE;
#endif // GRAFATTR
}
@@ -339,7 +343,7 @@ SdrGrafObj::~SdrGrafObj()
ImpLinkAbmeldung();
#ifdef GRAFATTR
- pGrafAttr = (SdrGrafSetItem*) ImpSetNewAttr( pGrafAttr, NULL, FALSE );
+//-/ pGrafAttr = (SdrGrafSetItem*) ImpSetNewAttr( pGrafAttr, NULL, FALSE );
#endif // GRAFATTR
}
@@ -1137,7 +1141,7 @@ void SdrGrafObj::operator=( const SdrObject& rObj )
SetGraphicLink( aFileName, aFilterName );
#ifdef GRAFATTR
- if( ( pGrafAttr = (SdrGrafSetItem*) ImpSetNewAttr( pGrafAttr, ( (SdrGrafObj&) rObj ).pGrafAttr ) ) != NULL )
+//-/ if( ( pGrafAttr = (SdrGrafSetItem*) ImpSetNewAttr( pGrafAttr, ( (SdrGrafObj&) rObj ).pGrafAttr ) ) != NULL )
ImpSetAttrToGrafInfo();
#endif // GRAFATTR
}
@@ -1327,7 +1331,33 @@ const GDIMetaFile* SdrGrafObj::GetGDIMetaFile() const
return &GetGraphic().GetGDIMetaFile();
}
-// -----------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// pre- and postprocessing for objects for saving
+
+void SdrGrafObj::PreSave()
+{
+ // call parent
+ SdrRectObj::PreSave();
+
+ // prepare SetItems for storage
+ const SfxItemSet& rSet = GetItemSet();
+ const SfxItemSet* pParent = GetStyleSheet() ? &GetStyleSheet()->GetItemSet() : 0L;
+ SdrGrafSetItem aGrafAttr(rSet.GetPool());
+ aGrafAttr.GetItemSet().Put(rSet);
+ aGrafAttr.GetItemSet().SetParent(pParent);
+ mpObjectItemSet->Put(aGrafAttr);
+}
+
+void SdrGrafObj::PostSave()
+{
+ // call parent
+ SdrRectObj::PostSave();
+
+ // remove SetItems from local itemset
+ mpObjectItemSet->ClearItem(SDRATTRSET_GRAF);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
void SdrGrafObj::WriteData(SvStream& rOut) const
{
@@ -1401,7 +1431,19 @@ void SdrGrafObj::WriteData(SvStream& rOut) const
SfxItemPool* pPool = GetItemPool();
if(pPool)
- pPool->StoreSurrogate(rOut, pGrafAttr);
+ {
+ const SfxItemSet& rSet = GetItemSet();
+
+ pPool->StoreSurrogate(rOut, &rSet.Get(SDRATTRSET_GRAF));
+
+
+
+//-/ SdrGrafSetItem aGrafAttr(pPool);
+//-/ aGrafAttr.GetItemSet().Put(GetItemSet());
+//-/ const SfxPoolItem& rGrafAttr = pPool->Put(aGrafAttr);
+//-/ pPool->StoreSurrogate(rOut, &rGrafAttr);
+//-/ pPool->StoreSurrogate(rOut, pGrafAttr);
+ }
else
rOut << UINT16( SFX_ITEMS_NULL );
#endif // GRAFATTR
@@ -1552,18 +1594,22 @@ void SdrGrafObj::ReadData( const SdrObjIOHeader& rHead, SvStream& rIn )
if( pPool )
{
- USHORT nWhich = SDRATTRSET_GRAF;
-
- pGrafAttr = (const SdrGrafSetItem*) ImpSetNewAttr( pGrafAttr, NULL );
- pGrafAttr = (const SdrGrafSetItem*) pPool->LoadSurrogate( rIn, nWhich, 0 );
-
- if( pGrafAttr )
- {
- if( pStyleSheet )
- ( (SfxItemSet*) &pGrafAttr->GetItemSet() )->SetParent( &pStyleSheet->GetItemSet() );
-
+ sal_uInt16 nSetID = SDRATTRSET_GRAF;
+ const SdrGrafSetItem* pGrafAttr = (const SdrGrafSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0);
+ if(pGrafAttr)
+ SetItemSet(pGrafAttr->GetItemSet());
+//-/ USHORT nWhich = SDRATTRSET_GRAF;
+//-/
+//-/ pGrafAttr = (const SdrGrafSetItem*) ImpSetNewAttr( pGrafAttr, NULL );
+//-/ pGrafAttr = (const SdrGrafSetItem*) pPool->LoadSurrogate( rIn, nWhich, 0 );
+//-/
+//-/ if( pGrafAttr )
+//-/ {
+//-/ if( pStyleSheet )
+//-/ ( (SfxItemSet*) &pGrafAttr->GetItemSet() )->SetParent( &pStyleSheet->GetItemSet() );
+//-/
ImpSetAttrToGrafInfo();
- }
+//-/ }
}
else
{
@@ -1707,16 +1753,27 @@ SdrObject* SdrGrafObj::DoConvertToPolyObj(BOOL bBezier) const
// Bitmap als Attribut retten
if(pRetval)
{
- SfxItemSet aSet(GetModel()->GetItemPool());
- TakeAttributes(aSet, FALSE, TRUE);
+//-/ SfxItemSet aSet(GetModel()->GetItemPool());
+//-/ TakeAttributes(aSet, FALSE, TRUE);
+//-/
+//-/ // Bitmap als Fuellung holen
+//-/ aSet.Put(XFillStyleItem(XFILL_BITMAP));
+//-/ Bitmap aBitmap( GetTransformedGraphic().GetBitmap() );
+//-/ XOBitmap aXBmp(aBitmap, XBITMAP_STRETCH);
+//-/ aSet.Put(XFillBitmapItem(String(), aXBmp));
+//-/ aSet.Put(XFillBmpTileItem(FALSE));
+//-/ pRetval->NbcSetAttributes(aSet, FALSE);
// Bitmap als Fuellung holen
+ SfxItemSet aSet(GetItemSet());
+
aSet.Put(XFillStyleItem(XFILL_BITMAP));
Bitmap aBitmap( GetTransformedGraphic().GetBitmap() );
XOBitmap aXBmp(aBitmap, XBITMAP_STRETCH);
aSet.Put(XFillBitmapItem(String(), aXBmp));
aSet.Put(XFillBmpTileItem(FALSE));
- pRetval->NbcSetAttributes(aSet, FALSE);
+
+ pRetval->SetItemSet(aSet);
}
break;
}
@@ -1758,75 +1815,88 @@ void SdrGrafObj::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
// -----------------------------------------------------------------------------
-void SdrGrafObj::ForceDefaultAttr( SfxItemPool* pPool )
+void SdrGrafObj::ForceDefaultAttr()
{
- SdrRectObj::ForceDefaultAttr( pPool );
+ SdrRectObj::ForceDefaultAttr();
- if( pPool )
- {
- if( !pGrafAttr )
- {
- SdrGrafSetItem aSetItem( pPool );
- SfxItemSet& rSet = aSetItem.GetItemSet();
-
- rSet.Put( SdrGrafLuminanceItem( 0 ) );
- rSet.Put( SdrGrafContrastItem( 0 ) );
- rSet.Put( SdrGrafRedItem( 0 ) );
- rSet.Put( SdrGrafGreenItem( 0 ) );
- rSet.Put( SdrGrafBlueItem( 0 ) );
- rSet.Put( SdrGrafGamma100Item( 100 ) );
- rSet.Put( SdrGrafTransparenceItem( 0 ) );
- rSet.Put( SdrGrafInvertItem( FALSE ) );
- rSet.Put( SdrGrafModeItem( GRAPHICDRAWMODE_STANDARD ) );
- rSet.Put( SdrGrafCropItem( 0, 0, 0, 0 ) );
-
- pGrafAttr = (SdrGrafSetItem*) ImpSetNewAttr( pGrafAttr, &aSetItem, FALSE );
- }
- }
+//-/ if(pPool)
+//-/ {
+ SetItem( SdrGrafLuminanceItem( 0 ) );
+ SetItem( SdrGrafContrastItem( 0 ) );
+ SetItem( SdrGrafRedItem( 0 ) );
+ SetItem( SdrGrafGreenItem( 0 ) );
+ SetItem( SdrGrafBlueItem( 0 ) );
+ SetItem( SdrGrafGamma100Item( 100 ) );
+ SetItem( SdrGrafTransparenceItem( 0 ) );
+ SetItem( SdrGrafInvertItem( FALSE ) );
+ SetItem( SdrGrafModeItem( GRAPHICDRAWMODE_STANDARD ) );
+ SetItem( SdrGrafCropItem( 0, 0, 0, 0 ) );
+//-/ }
+//-/ if( pPool )
+//-/ {
+//-/ if( !pGrafAttr )
+//-/ {
+//-/ SdrGrafSetItem aSetItem( pPool );
+//-/ SfxItemSet& rSet = aSetItem.GetItemSet();
+//-/
+//-/ rSet.Put( SdrGrafLuminanceItem( 0 ) );
+//-/ rSet.Put( SdrGrafContrastItem( 0 ) );
+//-/ rSet.Put( SdrGrafRedItem( 0 ) );
+//-/ rSet.Put( SdrGrafGreenItem( 0 ) );
+//-/ rSet.Put( SdrGrafBlueItem( 0 ) );
+//-/ rSet.Put( SdrGrafGamma100Item( 100 ) );
+//-/ rSet.Put( SdrGrafTransparenceItem( 0 ) );
+//-/ rSet.Put( SdrGrafInvertItem( FALSE ) );
+//-/ rSet.Put( SdrGrafModeItem( GRAPHICDRAWMODE_STANDARD ) );
+//-/ rSet.Put( SdrGrafCropItem( 0, 0, 0, 0 ) );
+//-/
+//-/ pGrafAttr = (SdrGrafSetItem*) ImpSetNewAttr( pGrafAttr, &aSetItem, FALSE );
+//-/ }
+//-/ }
}
// -----------------------------------------------------------------------------
-USHORT SdrGrafObj::GetSetItemCount() const
-{
- return( 1 + SdrRectObj::GetSetItemCount() );
-}
+//-/USHORT SdrGrafObj::GetSetItemCount() const
+//-/{
+//-/ return( 1 + SdrRectObj::GetSetItemCount() );
+//-/}
// -----------------------------------------------------------------------------
-const SfxSetItem* SdrGrafObj::GetSetItem( USHORT nNum ) const
-{
- return( !nNum ? pGrafAttr : SdrRectObj::GetSetItem( --nNum ) );
-}
+//-/const SfxSetItem* SdrGrafObj::GetSetItem( USHORT nNum ) const
+//-/{
+//-/ return( !nNum ? pGrafAttr : SdrRectObj::GetSetItem( --nNum ) );
+//-/}
// -----------------------------------------------------------------------------
-void SdrGrafObj::SetSetItem( USHORT nNum, const SfxSetItem* pAttr )
-{
- if( !nNum )
- pGrafAttr = (const SdrGrafSetItem*) pAttr;
- else
- SdrRectObj::SetSetItem( --nNum, pAttr );
-}
+//-/void SdrGrafObj::SetSetItem( USHORT nNum, const SfxSetItem* pAttr )
+//-/{
+//-/ if( !nNum )
+//-/ pGrafAttr = (const SdrGrafSetItem*) pAttr;
+//-/ else
+//-/ SdrRectObj::SetSetItem( --nNum, pAttr );
+//-/}
// -----------------------------------------------------------------------------
-SfxSetItem* SdrGrafObj::MakeNewSetItem( USHORT nNum, FASTBOOL bClone ) const
-{
- SfxSetItem* pRet;
-
- if( !nNum )
- {
- if( bClone && pGrafAttr )
- pRet = new SdrGrafSetItem( *pGrafAttr );
- else
- pRet = new SdrGrafSetItem( GetItemPool() );
- }
- else
- pRet = SdrRectObj::MakeNewSetItem( --nNum, bClone );
-
- return pRet;
-}
+//-/SfxSetItem* SdrGrafObj::MakeNewSetItem( USHORT nNum, FASTBOOL bClone ) const
+//-/{
+//-/ SfxSetItem* pRet;
+//-/
+//-/ if( !nNum )
+//-/ {
+//-/ if( bClone && pGrafAttr )
+//-/ pRet = new SdrGrafSetItem( *pGrafAttr );
+//-/ else
+//-/ pRet = new SdrGrafSetItem( GetItemPool() );
+//-/ }
+//-/ else
+//-/ pRet = SdrRectObj::MakeNewSetItem( --nNum, bClone );
+//-/
+//-/ return pRet;
+//-/}
// -----------------------------------------------------------------------------
@@ -1839,61 +1909,90 @@ void SdrGrafObj::NbcSetStyleSheet( SfxStyleSheet* pNewStyleSheet, FASTBOOL bDont
// -----------------------------------------------------------------------------
-void SdrGrafObj::NbcSetAttributes( const SfxItemSet& rAttr, FASTBOOL bReplaceAll )
+//-/void SdrGrafObj::NbcSetAttributes( const SfxItemSet& rAttr, FASTBOOL bReplaceAll )
+//-/{
+//-/ SetXPolyDirty();
+//-/ SdrRectObj::NbcSetAttributes( rAttr, bReplaceAll );
+//-/ ImpSetAttrToGrafInfo();
+//-/}
+
+void SdrGrafObj::SetItem(const SfxPoolItem& rItem)
+{
+ SetXPolyDirty();
+ SdrRectObj::SetItem(rItem);
+ ImpSetAttrToGrafInfo();
+}
+
+void SdrGrafObj::ClearItem(USHORT nWhich)
{
SetXPolyDirty();
- SdrRectObj::NbcSetAttributes( rAttr, bReplaceAll );
+ SdrRectObj::ClearItem(nWhich);
ImpSetAttrToGrafInfo();
}
+void SdrGrafObj::SetItemSet(const SfxItemSet& rSet)
+{
+ SetXPolyDirty();
+ SdrRectObj::SetItemSet(rSet);
+ ImpSetAttrToGrafInfo();
+}
+
+SfxItemSet* SdrGrafObj::CreateNewItemSet(SfxItemPool& rPool)
+{
+ // include ALL items, 2D and 3D
+ return new SfxItemSet(rPool,
+ // ranges from SdrAttrObj
+ SDRATTR_START, SDRATTRSET_SHADOW,
+ SDRATTRSET_OUTLINER, SDRATTRSET_MISC,
+
+ // graf attributes
+ SDRATTR_GRAF_FIRST, SDRATTRSET_GRAF,
+
+ // outliner and end
+ EE_ITEMS_START, EE_ITEMS_END,
+ 0, 0);
+}
+
// -----------------------------------------------------------------------------
void SdrGrafObj::ImpSetAttrToGrafInfo()
{
- if( pGrafAttr )
- {
- const SfxItemSet& rSet = pGrafAttr->GetItemSet();
- const USHORT nTrans = ( (SdrGrafTransparenceItem&) rSet.Get( SDRATTR_GRAFTRANSPARENCE ) ).GetValue();
- const SdrGrafCropItem& rCrop = (const SdrGrafCropItem&) rSet.Get( SDRATTR_GRAFCROP );
-
- aGrafInfo.SetLuminance( ( (SdrGrafLuminanceItem&) rSet.Get( SDRATTR_GRAFLUMINANCE ) ).GetValue() );
- aGrafInfo.SetContrast( ( (SdrGrafContrastItem&) rSet.Get( SDRATTR_GRAFCONTRAST ) ).GetValue() );
- aGrafInfo.SetChannelR( ( (SdrGrafRedItem&) rSet.Get( SDRATTR_GRAFRED ) ).GetValue() );
- aGrafInfo.SetChannelG( ( (SdrGrafGreenItem&) rSet.Get( SDRATTR_GRAFGREEN ) ).GetValue() );
- aGrafInfo.SetChannelB( ( (SdrGrafBlueItem&) rSet.Get( SDRATTR_GRAFBLUE ) ).GetValue() );
- aGrafInfo.SetGamma( ( (SdrGrafGamma100Item&) rSet.Get( SDRATTR_GRAFGAMMA ) ).GetValue() * 0.01 );
- aGrafInfo.SetTransparency( (BYTE) FRound( Min( nTrans, (USHORT) 100 ) * 2.55 ) );
- aGrafInfo.SetInvert( ( (SdrGrafInvertItem&) rSet.Get( SDRATTR_GRAFINVERT ) ).GetValue() );
- aGrafInfo.SetDrawMode( ( (SdrGrafModeItem&) rSet.Get( SDRATTR_GRAFMODE ) ).GetValue() );
- aGrafInfo.SetCrop( rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom() );
-
- SetXPolyDirty();
- SetRectsDirty();
- }
+//-/ if(mpObjectItemSet)
+//-/ {
+ const SfxItemSet& rSet = GetItemSet();
+ const sal_uInt16 nTrans = ( (SdrGrafTransparenceItem&) rSet.Get( SDRATTR_GRAFTRANSPARENCE ) ).GetValue();
+ const SdrGrafCropItem& rCrop = (const SdrGrafCropItem&) rSet.Get( SDRATTR_GRAFCROP );
+
+ aGrafInfo.SetLuminance( ( (SdrGrafLuminanceItem&) rSet.Get( SDRATTR_GRAFLUMINANCE ) ).GetValue() );
+ aGrafInfo.SetContrast( ( (SdrGrafContrastItem&) rSet.Get( SDRATTR_GRAFCONTRAST ) ).GetValue() );
+ aGrafInfo.SetChannelR( ( (SdrGrafRedItem&) rSet.Get( SDRATTR_GRAFRED ) ).GetValue() );
+ aGrafInfo.SetChannelG( ( (SdrGrafGreenItem&) rSet.Get( SDRATTR_GRAFGREEN ) ).GetValue() );
+ aGrafInfo.SetChannelB( ( (SdrGrafBlueItem&) rSet.Get( SDRATTR_GRAFBLUE ) ).GetValue() );
+ aGrafInfo.SetGamma( ( (SdrGrafGamma100Item&) rSet.Get( SDRATTR_GRAFGAMMA ) ).GetValue() * 0.01 );
+ aGrafInfo.SetTransparency( (BYTE) FRound( Min( nTrans, (USHORT) 100 ) * 2.55 ) );
+ aGrafInfo.SetInvert( ( (SdrGrafInvertItem&) rSet.Get( SDRATTR_GRAFINVERT ) ).GetValue() );
+ aGrafInfo.SetDrawMode( ( (SdrGrafModeItem&) rSet.Get( SDRATTR_GRAFMODE ) ).GetValue() );
+ aGrafInfo.SetCrop( rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom() );
+
+ SetXPolyDirty();
+ SetRectsDirty();
+//-/ }
}
// -----------------------------------------------------------------------------
void SdrGrafObj::ImpSetGrafInfoToAttr()
{
- if( pGrafAttr )
- {
- SdrGrafSetItem aSetItem( *pGrafAttr );
- SfxItemSet& rSet = aSetItem.GetItemSet();
-
- rSet.Put( SdrGrafLuminanceItem( aGrafInfo.GetLuminance() ) );
- rSet.Put( SdrGrafContrastItem( aGrafInfo.GetContrast() ) );
- rSet.Put( SdrGrafRedItem( aGrafInfo.GetChannelR() ) );
- rSet.Put( SdrGrafGreenItem( aGrafInfo.GetChannelG() ) );
- rSet.Put( SdrGrafBlueItem( aGrafInfo.GetChannelB() ) );
- rSet.Put( SdrGrafGamma100Item( FRound( aGrafInfo.GetGamma() * 100.0 ) ) );
- rSet.Put( SdrGrafTransparenceItem( (USHORT) FRound( aGrafInfo.GetTransparency() / 2.55 ) ) );
- rSet.Put( SdrGrafInvertItem( aGrafInfo.IsInvert() ) );
- rSet.Put( SdrGrafModeItem( aGrafInfo.GetDrawMode() ) );
- rSet.Put( SdrGrafCropItem( aGrafInfo.GetLeftCrop(), aGrafInfo.GetTopCrop(), aGrafInfo.GetRightCrop(), aGrafInfo.GetBottomCrop() ) );
-
- pGrafAttr = (SdrGrafSetItem*) ImpSetNewAttr( pGrafAttr, &aSetItem );
- }
+ SetItem( SdrGrafLuminanceItem( aGrafInfo.GetLuminance() ) );
+ SetItem( SdrGrafContrastItem( aGrafInfo.GetContrast() ) );
+ SetItem( SdrGrafRedItem( aGrafInfo.GetChannelR() ) );
+ SetItem( SdrGrafGreenItem( aGrafInfo.GetChannelG() ) );
+ SetItem( SdrGrafBlueItem( aGrafInfo.GetChannelB() ) );
+ SetItem( SdrGrafGamma100Item( FRound( aGrafInfo.GetGamma() * 100.0 ) ) );
+ SetItem( SdrGrafTransparenceItem( (USHORT) FRound( aGrafInfo.GetTransparency() / 2.55 ) ) );
+ SetItem( SdrGrafInvertItem( aGrafInfo.IsInvert() ) );
+ SetItem( SdrGrafModeItem( aGrafInfo.GetDrawMode() ) );
+ SetItem( SdrGrafCropItem( aGrafInfo.GetLeftCrop(), aGrafInfo.GetTopCrop(), aGrafInfo.GetRightCrop(), aGrafInfo.GetBottomCrop() ) );
}
#endif // GRAFATTR
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index 070f3bc7700e..388f9c7fcfeb 100644
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdogrp.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:01:25 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -107,6 +107,14 @@
#include <so3/persist.hxx>
#endif
+#ifndef _SVX_SVXIDS_HRC
+#include "svxids.hrc"
+#endif
+
+#ifndef _SFX_WHITER_HXX
+#include <svtools/whiter.hxx>
+#endif
+
#ifndef SVX_LIGHT
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -358,6 +366,7 @@ SdrObjGroup::SdrObjGroup()
nDrehWink=0;
nShearWink=0;
bClosedObj=FALSE;
+ mpGroupItemSet = NULL;
}
@@ -365,6 +374,8 @@ SdrObjGroup::~SdrObjGroup()
{
ReleaseGroupLink();
delete pSub;
+ if(mpGroupItemSet)
+ delete mpGroupItemSet;
}
@@ -696,11 +707,6 @@ void SdrObjGroup::SetObjList(SdrObjList* pNewObjList)
{
SdrObject::SetObjList(pNewObjList);
pSub->SetUpList(pNewObjList);
- /*if (pNewObjList!=NULL) {
- pUp=pNewObjList->GetOwnerObj();
- } else {
- pUp=NULL;
- }*/
}
@@ -868,7 +874,6 @@ void SdrObjGroup::operator=(const SdrObject& rObj)
aName =((SdrObjGroup&)rObj).aName;
aRefPoint =((SdrObjGroup&)rObj).aRefPoint;
bRefPoint =((SdrObjGroup&)rObj).bRefPoint;
- bReserve =((SdrObjGroup&)rObj).bReserve;
}
}
@@ -1340,55 +1345,152 @@ void SdrObjGroup::SetRelativePos(const Point& rPnt)
}
-void SdrObjGroup::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//-/void SdrObjGroup::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/{
+//-/ const SfxItemSet* pAttr=&rAttr;
+//-/ //
+//-/ //SfxItemSet aSet(rAttr);
+//-/ //pAttr=&aSet;
+//-/ //for (USHORT nWhich=SDRATTR_NOTPERSIST_FIRST; nWhich<=SDRATTR_NOTPERSIST_LAST; nWhich++) {
+//-/ // aSet.InvalidateItem(nWhich);
+//-/ //}
+//-/
+//-/ if (!IsLinkedGroup()) {
+//-/ SdrObjList* pOL=pSub;
+//-/ ULONG nObjAnz=pOL->GetObjCount();
+//-/ for (ULONG i=0; i<nObjAnz; i++) {
+//-/ pOL->GetObj(i)->NbcSetAttributes(*pAttr,bReplaceAll);
+//-/ }
+//-/ }
+//-/
+//-/ // NbcApplyNotPersistAttr(rAttr);
+//-/}
+
+//-/void SdrObjGroup::SetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/{
+//-/ if (!IsLinkedGroup()) {
+//-/ SdrObjList* pOL=pSub;
+//-/ ULONG nObjAnz=pOL->GetObjCount();
+//-/ for (ULONG i=0; i<nObjAnz; i++) {
+//-/ pOL->GetObj(i)->SetAttributes(rAttr,bReplaceAll);
+//-/ }
+//-/ }
+//-/}
+
+//-/void SdrObjGroup::TakeAttributes(SfxItemSet& rAttr, FASTBOOL bMerge, FASTBOOL bOnlyHardAttr) const
+//-/{
+//-/ SdrObjList* pOL=pSub;
+//-/ ULONG nObjAnz=pOL->GetObjCount();
+//-/ for (ULONG i=0; i<nObjAnz; i++) {
+//-/ pOL->GetObj(i)->TakeAttributes(rAttr,TRUE,bOnlyHardAttr);
+//-/ }
+//-/
+//-/ //if (bMerge) {
+//-/ // NotPersist-Items erstmal mit Put, damit die Werte der Sub-Objekte ueberschrieben werden
+//-/ // Todo: Muss mit den urspruenglichen Werten Gemerged werden!
+//-/ //}
+//-/ // TakeNotPersistAttr(rAttr,FALSE);
+//-/}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// groups may contain 3d objects(?)
+//-/SfxItemSet* SdrObjGroup::CreateNewItemSet(SfxItemPool& rPool)
+//-/{
+//-/ return new SfxItemSet(rPool,
+//-/ SDRATTR_START, SDRATTR_END,
+//-/ SID_ATTR_3D_START, SID_ATTR_3D_END,
+//-/ 0, 0);
+//-/}
+
+const SfxItemSet& SdrObjGroup::GetItemSet() const
{
- const SfxItemSet* pAttr=&rAttr;
- //
- //SfxItemSet aSet(rAttr);
- //pAttr=&aSet;
- //for (USHORT nWhich=SDRATTR_NOTPERSIST_FIRST; nWhich<=SDRATTR_NOTPERSIST_LAST; nWhich++) {
- // aSet.InvalidateItem(nWhich);
- //}
+ if(!mpGroupItemSet)
+ {
+ ((SdrObjGroup*)this)->mpGroupItemSet =
+ ((SdrObjGroup*)this)->CreateNewItemSet((SfxItemPool&)(*GetItemPool()));
+ DBG_ASSERT(mpGroupItemSet, "Could not create an SfxItemSet(!)");
+ }
- if (!IsLinkedGroup()) {
- SdrObjList* pOL=pSub;
- ULONG nObjAnz=pOL->GetObjCount();
- for (ULONG i=0; i<nObjAnz; i++) {
- pOL->GetObj(i)->NbcSetAttributes(*pAttr,bReplaceAll);
+ // collect all ItemSets in mpGroupItemSet
+ mpGroupItemSet->ClearItem();
+
+ sal_uInt32 nCount(pSub->GetObjCount());
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+//-/ mpGroupItemSet->MergeValues(pSub->GetObj(a)->GetItemSet(), TRUE);
+ const SfxItemSet& rSet = pSub->GetObj(a)->GetItemSet();
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+
+ while(nWhich)
+ {
+ const SfxPoolItem* pItem = NULL;
+ rSet.GetItemState(nWhich, TRUE, &pItem);
+
+ if(pItem)
+ {
+ if(pItem == (SfxPoolItem *)-1)
+ mpGroupItemSet->InvalidateItem(nWhich);
+ else
+ mpGroupItemSet->MergeValue(*pItem, TRUE);
+ }
+ nWhich = aIter.NextWhich();
}
}
- // NbcApplyNotPersistAttr(rAttr);
+ return *mpGroupItemSet;
}
-
-void SdrObjGroup::SetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+void SdrObjGroup::SetItem( const SfxPoolItem& rItem )
{
- if (!IsLinkedGroup()) {
- SdrObjList* pOL=pSub;
- ULONG nObjAnz=pOL->GetObjCount();
- for (ULONG i=0; i<nObjAnz; i++) {
- pOL->GetObj(i)->SetAttributes(rAttr,bReplaceAll);
- }
+ if(!IsLinkedGroup())
+ {
+ sal_uInt32 nCount(pSub->GetObjCount());
+ for(sal_uInt32 a(0); a < nCount; a++)
+ pSub->GetObj(a)->SetItem( rItem );
}
}
+void SdrObjGroup::ClearItem( USHORT nWhich )
+{
+ if(!IsLinkedGroup())
+ {
+ sal_uInt32 nCount(pSub->GetObjCount());
+ for(sal_uInt32 a(0); a < nCount; a++)
+ pSub->GetObj(a)->ClearItem( nWhich );
+ }
+}
-void SdrObjGroup::TakeAttributes(SfxItemSet& rAttr, FASTBOOL bMerge, FASTBOOL bOnlyHardAttr) const
+void SdrObjGroup::SetItemSet( const SfxItemSet& rSet )
{
- SdrObjList* pOL=pSub;
- ULONG nObjAnz=pOL->GetObjCount();
- for (ULONG i=0; i<nObjAnz; i++) {
- pOL->GetObj(i)->TakeAttributes(rAttr,TRUE,bOnlyHardAttr);
+ if(!IsLinkedGroup())
+ {
+ sal_uInt32 nCount(pSub->GetObjCount());
+ for(sal_uInt32 a(0); a < nCount; a++)
+ pSub->GetObj(a)->SetItemSet( rSet );
}
+}
- //if (bMerge) {
- // NotPersist-Items erstmal mit Put, damit die Werte der Sub-Objekte ueberschrieben werden
- // Todo: Muss mit den urspruenglichen Werten Gemerged werden!
- //}
- // TakeNotPersistAttr(rAttr,FALSE);
+SfxItemSet* SdrObjGroup::CreateNewItemSet(SfxItemPool& rPool)
+{
+ // include ALL items
+ return new SfxItemSet(rPool, SDRATTR_START, SDRATTR_END);
}
+//-/void SdrObjGroup::BroadcastItemChange(const SdrBroadcastItemChange& rChange)
+//-/{
+//-/ if(!IsLinkedGroup())
+//-/ {
+//-/ sal_uInt32 nCount(pSub->GetObjCount());
+//-/ for(sal_uInt32 a(0); a < nCount; a++)
+//-/ pSub->GetObj(a)->BroadcastItemChange(rOldRect);
+//-/ }
+//-/}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
SfxStyleSheet* SdrObjGroup::GetStyleSheet() const
{
@@ -1535,15 +1637,19 @@ void SdrObjGroup::AfterRead()
// ItemPool fuer dieses Objekt wechseln
void SdrObjGroup::MigrateItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool)
{
- // call parent
- SdrObject::MigrateItemPool(pSrcPool, pDestPool);
-
- // own reaction
- SdrObjList* pOL = pSub;
- UINT32 nObjAnz = pOL->GetObjCount();
- for(UINT32 a=0;a<nObjAnz;a++)
+ if(pSrcPool && pDestPool && (pSrcPool != pDestPool))
{
- pOL->GetObj(a)->MigrateItemPool(pSrcPool, pDestPool);
+ // call parent
+ SdrObject::MigrateItemPool(pSrcPool, pDestPool);
+
+ // own reaction
+ SdrObjList* pOL = pSub;
+ sal_uInt32 nObjAnz(pOL->GetObjCount());
+
+ for(sal_uInt32 a(0); a < nObjAnz; a++)
+ {
+ pOL->GetObj(a)->MigrateItemPool(pSrcPool, pDestPool);
+ }
}
}
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index 73ecb791f032..c5cf3af73fe1 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdomeas.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2000-09-27 14:03:57 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -188,15 +188,11 @@ void SdrMeasureField::TakeRepresentation(const SdrMeasureObj& rObj, XubString& r
FieldUnit eMeasureUnit(FUNIT_NONE);
FieldUnit eModUIUnit(FUNIT_NONE);
- if(rObj.pMeasureAttr)
- {
- const SfxItemSet& rSet = rObj.pMeasureAttr->GetItemSet();
-
- bTextRota90 = ((SdrMeasureTextRota90Item&)rSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue();
- eMeasureUnit = ((SdrMeasureUnitItem&)rSet.Get(SDRATTR_MEASUREUNIT)).GetValue();
- aMeasureScale = ((SdrMeasureScaleItem&)rSet.Get(SDRATTR_MEASURESCALE)).GetValue();
- bShowUnit = ((SdrMeasureShowUnitItem&)rSet.Get(SDRATTR_MEASURESHOWUNIT)).GetValue();
- }
+ const SfxItemSet& rSet = rObj.GetItemSet();
+ bTextRota90 = ((SdrMeasureTextRota90Item&)rSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue();
+ eMeasureUnit = ((SdrMeasureUnitItem&)rSet.Get(SDRATTR_MEASUREUNIT)).GetValue();
+ aMeasureScale = ((SdrMeasureScaleItem&)rSet.Get(SDRATTR_MEASURESCALE)).GetValue();
+ bShowUnit = ((SdrMeasureShowUnitItem&)rSet.Get(SDRATTR_MEASURESHOWUNIT)).GetValue();
SdrModel* pModel = rObj.pModel;
@@ -304,85 +300,101 @@ void SdrMeasureField::TakeRepresentation(const SdrMeasureObj& rObj, XubString& r
TYPEINIT1(SdrMeasureObj,SdrTextObj);
-void SdrMeasureObj::ForceDefaultAttr(SfxItemPool* pPool)
-{
- BOOL bLineMerk(!pLineAttr);
- BOOL bOutlMerk(!pOutlAttr);
- BOOL bMiscMerk(!pMiscAttr);
-
- SdrTextObj::ForceDefaultAttr(pPool);
-
- if(pPool)
- {
- if(!pMeasureAttr)
- {
- SdrMeasureSetItem aSetItem(pPool);
-
- //#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
- aSetItem.GetItemSet().Put(SdrMeasureShowUnitItem(TRUE));
-
- pMeasureAttr = (SdrMeasureSetItem*)ImpSetNewAttr(pMeasureAttr, &aSetItem, FALSE);
- }
-
- if(bLineMerk && pLineAttr)
- {
- XLineAttrSetItem aSetItem(*pLineAttr);
-
- aSetItem.GetItemSet().Put(XLineStyleItem(XLINE_SOLID));
-
- XPolygon aXP(4); // []
- aXP[0] = Point(100,0); // 0,4__[]__2,4
- aXP[1] = Point(200,400); // \ /
- aXP[2] = Point(0,400); // \ /
- aXP[3] = Point(100,0); // \/1,0
-
- aSetItem.GetItemSet().Put(XLineStartItem(String(), aXP));
- aSetItem.GetItemSet().Put(XLineStartWidthItem(200));
- aSetItem.GetItemSet().Put(XLineEndItem(String(), aXP));
- aSetItem.GetItemSet().Put(XLineEndWidthItem(200));
- aSetItem.GetItemSet().Put(XLineStyleItem(XLINE_SOLID));
-
- pLineAttr=(XLineAttrSetItem*)ImpSetNewAttr(pLineAttr, &aSetItem, FALSE);
- }
- }
-}
-
-USHORT SdrMeasureObj::GetSetItemCount() const
-{
- return 1+SdrTextObj::GetSetItemCount();
-}
-
-const SfxSetItem* SdrMeasureObj::GetSetItem(USHORT nNum) const
-{
- if (nNum==0) return pMeasureAttr;
- nNum--;
- return SdrTextObj::GetSetItem(nNum);
-}
-
-void SdrMeasureObj::SetSetItem(USHORT nNum, const SfxSetItem* pAttr)
-{
- if (nNum==0) pMeasureAttr=(const SdrMeasureSetItem*)pAttr;
- else {
- nNum--;
- SdrTextObj::SetSetItem(nNum,pAttr);
- }
-}
-
-SfxSetItem* SdrMeasureObj::MakeNewSetItem(USHORT nNum, FASTBOOL bClone) const
-{
- if (nNum==0) {
- if (bClone) return new SdrMeasureSetItem(*pMeasureAttr);
- else return new SdrMeasureSetItem(GetItemPool());
- } else {
- nNum--;
- return SdrTextObj::MakeNewSetItem(nNum,bClone);
- }
-}
+void SdrMeasureObj::ForceDefaultAttr()
+{
+//-/ BOOL bLineMerk(!pLineAttr);
+//-/ BOOL bOutlMerk(!pOutlAttr);
+//-/ BOOL bMiscMerk(!pMiscAttr);
+
+ SdrTextObj::ForceDefaultAttr();
+
+//-/ if(pPool)
+//-/ {
+ //#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
+ SetItem(SdrMeasureShowUnitItem(TRUE));
+
+ XPolygon aXP(4); // []
+ aXP[0] = Point(100,0); // 0,4__[]__2,4
+ aXP[1] = Point(200,400); // \ /
+ aXP[2] = Point(0,400); // \ /
+ aXP[3] = Point(100,0); // \/1,0
+
+ SetItem(XLineStartItem(String(), aXP));
+ SetItem(XLineStartWidthItem(200));
+ SetItem(XLineEndItem(String(), aXP));
+ SetItem(XLineEndWidthItem(200));
+ SetItem(XLineStyleItem(XLINE_SOLID));
+//-/ if(!pMeasureAttr)
+//-/ {
+//-/ SdrMeasureSetItem aSetItem(pPool);
+//-/
+//-/ //#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
+//-/ aSetItem.GetItemSet().Put(SdrMeasureShowUnitItem(TRUE));
+//-/
+//-/ pMeasureAttr = (SdrMeasureSetItem*)ImpSetNewAttr(pMeasureAttr, &aSetItem, FALSE);
+//-/ }
+//-/
+//-/ if(bLineMerk && pLineAttr)
+//-/ {
+//-/ XLineAttrSetItem aSetItem(*pLineAttr);
+//-/
+//-/ aSetItem.GetItemSet().Put(XLineStyleItem(XLINE_SOLID));
+//-/
+//-/ XPolygon aXP(4); // []
+//-/ aXP[0] = Point(100,0); // 0,4__[]__2,4
+//-/ aXP[1] = Point(200,400); // \ /
+//-/ aXP[2] = Point(0,400); // \ /
+//-/ aXP[3] = Point(100,0); // \/1,0
+//-/
+//-/ aSetItem.GetItemSet().Put(XLineStartItem(String(), aXP));
+//-/ aSetItem.GetItemSet().Put(XLineStartWidthItem(200));
+//-/ aSetItem.GetItemSet().Put(XLineEndItem(String(), aXP));
+//-/ aSetItem.GetItemSet().Put(XLineEndWidthItem(200));
+//-/ aSetItem.GetItemSet().Put(XLineStyleItem(XLINE_SOLID));
+//-/
+//-/ pLineAttr=(XLineAttrSetItem*)ImpSetNewAttr(pLineAttr, &aSetItem, FALSE);
+//-/ }
+//-/ }
+}
+
+//-/USHORT SdrMeasureObj::GetSetItemCount() const
+//-/{
+//-/ return 1+SdrTextObj::GetSetItemCount();
+//-/}
+
+//-/const SfxSetItem* SdrMeasureObj::GetSetItem(USHORT nNum) const
+//-/{
+//-/ if (nNum==0) return pMeasureAttr;
+//-/ nNum--;
+//-/ return SdrTextObj::GetSetItem(nNum);
+//-/}
+
+//-/void SdrMeasureObj::SetSetItem(USHORT nNum, const SfxSetItem* pAttr)
+//-/{
+//-/ if (nNum==0) pMeasureAttr=(const SdrMeasureSetItem*)pAttr;
+//-/ else {
+//-/ nNum--;
+//-/ SdrTextObj::SetSetItem(nNum,pAttr);
+//-/ }
+//-/}
+
+//-/SfxSetItem* SdrMeasureObj::MakeNewSetItem(USHORT nNum, FASTBOOL bClone) const
+//-/{
+//-/ if (nNum==0) {
+//-/ if (bClone) return new SdrMeasureSetItem(*pMeasureAttr);
+//-/ else return new SdrMeasureSetItem(GetItemPool());
+//-/ } else {
+//-/ nNum--;
+//-/ return SdrTextObj::MakeNewSetItem(nNum,bClone);
+//-/ }
+//-/}
SdrMeasureObj::SdrMeasureObj():
- pMeasureAttr(NULL),
+//-/ pMeasureAttr(NULL),
bTextDirty(FALSE)
{
}
@@ -390,7 +402,7 @@ SdrMeasureObj::SdrMeasureObj():
SdrMeasureObj::SdrMeasureObj(const Point& rPt1, const Point& rPt2):
aPt1(rPt1),
aPt2(rPt2),
- pMeasureAttr(NULL),
+//-/ pMeasureAttr(NULL),
bTextDirty(FALSE)
{
}
@@ -398,7 +410,7 @@ SdrMeasureObj::SdrMeasureObj(const Point& rPt1, const Point& rPt2):
SdrMeasureObj::~SdrMeasureObj()
{
// Attr entfernen (macht das SdrAttrObj noch nicht automatisch)
- pMeasureAttr=(SdrMeasureSetItem*)ImpSetNewAttr(pMeasureAttr,NULL,FALSE);
+//-/ pMeasureAttr=(SdrMeasureSetItem*)ImpSetNewAttr(pMeasureAttr,NULL,FALSE);
}
void SdrMeasureObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
@@ -496,52 +508,56 @@ struct ImpMeasurePoly
void SdrMeasureObj::ImpTakeAttr(ImpMeasureRec& rRec) const
{
- rRec.aPt1=aPt1;
- rRec.aPt2=aPt2;
- if (pMeasureAttr!=NULL) {
- const SfxItemSet& rSet=pMeasureAttr->GetItemSet();
- rRec.eKind =((SdrMeasureKindItem& )rSet.Get(SDRATTR_MEASUREKIND )).GetValue();
- rRec.eWantTextHPos =((SdrMeasureTextHPosItem& )rSet.Get(SDRATTR_MEASURETEXTHPOS )).GetValue();
- rRec.eWantTextVPos =((SdrMeasureTextVPosItem& )rSet.Get(SDRATTR_MEASURETEXTVPOS )).GetValue();
- rRec.nLineDist =((SdrMeasureLineDistItem& )rSet.Get(SDRATTR_MEASURELINEDIST )).GetValue();
- rRec.nHelplineOverhang=((SdrMeasureHelplineOverhangItem&)rSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue();
- rRec.nHelplineDist =((SdrMeasureHelplineDistItem& )rSet.Get(SDRATTR_MEASUREHELPLINEDIST )).GetValue();
- rRec.nHelpline1Len =((SdrMeasureHelpline1LenItem& )rSet.Get(SDRATTR_MEASUREHELPLINE1LEN )).GetValue();
- rRec.nHelpline2Len =((SdrMeasureHelpline2LenItem& )rSet.Get(SDRATTR_MEASUREHELPLINE2LEN )).GetValue();
- rRec.bBelowRefEdge =((SdrMeasureBelowRefEdgeItem& )rSet.Get(SDRATTR_MEASUREBELOWREFEDGE )).GetValue();
- rRec.bTextRota90 =((SdrMeasureTextRota90Item& )rSet.Get(SDRATTR_MEASURETEXTROTA90 )).GetValue();
- rRec.bTextUpsideDown =((SdrMeasureTextUpsideDownItem& )rSet.Get(SDRATTR_MEASURETEXTUPSIDEDOWN )).GetValue();
- rRec.nMeasureOverhang =((SdrMeasureOverhangItem& )rSet.Get(SDRATTR_MEASUREOVERHANG )).GetValue();
- rRec.eMeasureUnit =((SdrMeasureUnitItem& )rSet.Get(SDRATTR_MEASUREUNIT )).GetValue();
- rRec.aMeasureScale =((SdrMeasureScaleItem& )rSet.Get(SDRATTR_MEASURESCALE )).GetValue();
- rRec.bShowUnit =((SdrMeasureShowUnitItem& )rSet.Get(SDRATTR_MEASURESHOWUNIT )).GetValue();
- rRec.aFormatString =((SdrMeasureFormatStringItem& )rSet.Get(SDRATTR_MEASUREFORMATSTRING )).GetValue();
- rRec.bTextAutoAngle =((SdrMeasureTextAutoAngleItem& )rSet.Get(SDRATTR_MEASURETEXTAUTOANGLE )).GetValue();
- rRec.nTextAutoAngleView=((SdrMeasureTextAutoAngleViewItem&)rSet.Get(SDRATTR_MEASURETEXTAUTOANGLEVIEW)).GetValue();
- rRec.bTextIsFixedAngle =((SdrMeasureTextIsFixedAngleItem& )rSet.Get(SDRATTR_MEASURETEXTISFIXEDANGLE )).GetValue();
- rRec.nTextFixedAngle =((SdrMeasureTextFixedAngleItem& )rSet.Get(SDRATTR_MEASURETEXTFIXEDANGLE )).GetValue();
- } else {
- rRec.eKind=SDRMEASURE_STD;
- rRec.eWantTextHPos=SDRMEASURE_TEXTHAUTO;
- rRec.eWantTextVPos=SDRMEASURE_TEXTVAUTO;
- rRec.nLineDist=800;
- rRec.nHelplineOverhang=200;
- rRec.nHelplineDist=100;
- rRec.nHelpline1Len=0;
- rRec.nHelpline2Len=0;
- rRec.bBelowRefEdge=FALSE;
- rRec.bTextRota90=FALSE;
- rRec.bTextUpsideDown=FALSE;
- rRec.nMeasureOverhang=600;
- rRec.eMeasureUnit=FUNIT_NONE;
- rRec.aMeasureScale=Fraction(1,1);
- rRec.bShowUnit=FALSE;
- rRec.aFormatString.Erase();
- rRec.bTextAutoAngle=TRUE;
- rRec.nTextAutoAngleView=31500;
- rRec.bTextIsFixedAngle=FALSE;
- rRec.nTextFixedAngle=0;
- }
+ rRec.aPt1 = aPt1;
+ rRec.aPt2 = aPt2;
+
+//-/ if(mpObjectItemSet)
+//-/ {
+ const SfxItemSet& rSet = GetItemSet();
+ rRec.eKind =((SdrMeasureKindItem& )rSet.Get(SDRATTR_MEASUREKIND )).GetValue();
+ rRec.eWantTextHPos =((SdrMeasureTextHPosItem& )rSet.Get(SDRATTR_MEASURETEXTHPOS )).GetValue();
+ rRec.eWantTextVPos =((SdrMeasureTextVPosItem& )rSet.Get(SDRATTR_MEASURETEXTVPOS )).GetValue();
+ rRec.nLineDist =((SdrMeasureLineDistItem& )rSet.Get(SDRATTR_MEASURELINEDIST )).GetValue();
+ rRec.nHelplineOverhang=((SdrMeasureHelplineOverhangItem&)rSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue();
+ rRec.nHelplineDist =((SdrMeasureHelplineDistItem& )rSet.Get(SDRATTR_MEASUREHELPLINEDIST )).GetValue();
+ rRec.nHelpline1Len =((SdrMeasureHelpline1LenItem& )rSet.Get(SDRATTR_MEASUREHELPLINE1LEN )).GetValue();
+ rRec.nHelpline2Len =((SdrMeasureHelpline2LenItem& )rSet.Get(SDRATTR_MEASUREHELPLINE2LEN )).GetValue();
+ rRec.bBelowRefEdge =((SdrMeasureBelowRefEdgeItem& )rSet.Get(SDRATTR_MEASUREBELOWREFEDGE )).GetValue();
+ rRec.bTextRota90 =((SdrMeasureTextRota90Item& )rSet.Get(SDRATTR_MEASURETEXTROTA90 )).GetValue();
+ rRec.bTextUpsideDown =((SdrMeasureTextUpsideDownItem& )rSet.Get(SDRATTR_MEASURETEXTUPSIDEDOWN )).GetValue();
+ rRec.nMeasureOverhang =((SdrMeasureOverhangItem& )rSet.Get(SDRATTR_MEASUREOVERHANG )).GetValue();
+ rRec.eMeasureUnit =((SdrMeasureUnitItem& )rSet.Get(SDRATTR_MEASUREUNIT )).GetValue();
+ rRec.aMeasureScale =((SdrMeasureScaleItem& )rSet.Get(SDRATTR_MEASURESCALE )).GetValue();
+ rRec.bShowUnit =((SdrMeasureShowUnitItem& )rSet.Get(SDRATTR_MEASURESHOWUNIT )).GetValue();
+ rRec.aFormatString =((SdrMeasureFormatStringItem& )rSet.Get(SDRATTR_MEASUREFORMATSTRING )).GetValue();
+ rRec.bTextAutoAngle =((SdrMeasureTextAutoAngleItem& )rSet.Get(SDRATTR_MEASURETEXTAUTOANGLE )).GetValue();
+ rRec.nTextAutoAngleView=((SdrMeasureTextAutoAngleViewItem&)rSet.Get(SDRATTR_MEASURETEXTAUTOANGLEVIEW)).GetValue();
+ rRec.bTextIsFixedAngle =((SdrMeasureTextIsFixedAngleItem& )rSet.Get(SDRATTR_MEASURETEXTISFIXEDANGLE )).GetValue();
+ rRec.nTextFixedAngle =((SdrMeasureTextFixedAngleItem& )rSet.Get(SDRATTR_MEASURETEXTFIXEDANGLE )).GetValue();
+//-/ }
+//-/ else
+//-/ {
+//-/ rRec.eKind=SDRMEASURE_STD;
+//-/ rRec.eWantTextHPos=SDRMEASURE_TEXTHAUTO;
+//-/ rRec.eWantTextVPos=SDRMEASURE_TEXTVAUTO;
+//-/ rRec.nLineDist=800;
+//-/ rRec.nHelplineOverhang=200;
+//-/ rRec.nHelplineDist=100;
+//-/ rRec.nHelpline1Len=0;
+//-/ rRec.nHelpline2Len=0;
+//-/ rRec.bBelowRefEdge=FALSE;
+//-/ rRec.bTextRota90=FALSE;
+//-/ rRec.bTextUpsideDown=FALSE;
+//-/ rRec.nMeasureOverhang=600;
+//-/ rRec.eMeasureUnit=FUNIT_NONE;
+//-/ rRec.aMeasureScale=Fraction(1,1);
+//-/ rRec.bShowUnit=FALSE;
+//-/ rRec.aFormatString.Erase();
+//-/ rRec.bTextAutoAngle=TRUE;
+//-/ rRec.nTextAutoAngleView=31500;
+//-/ rRec.bTextIsFixedAngle=FALSE;
+//-/ rRec.nTextFixedAngle=0;
+//-/ }
}
void SdrMeasureObj::ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly& rPol) const
@@ -563,28 +579,34 @@ void SdrMeasureObj::ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly&
long nArrowNeed=0;
long nShortLen=0;
FASTBOOL bPfeileAussen=FALSE;
- if (pLineAttr!=NULL) {
- const SfxItemSet& rSet=pLineAttr->GetItemSet();
- INT32 nLineWdt=((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); // Strichstaerke
- rPol.nLineWdt2=(nLineWdt+1)/2;
-
- nArrow1Wdt=((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue();
- if (nArrow1Wdt<0) nArrow1Wdt=-nLineWdt*nArrow1Wdt/100; // <0 = relativ
- nArrow2Wdt=((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue();
- if (nArrow2Wdt<0) nArrow2Wdt=-nLineWdt*nArrow2Wdt/100; // <0 = relativ
-
- XPolygon aPol1(((const XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetValue());
- XPolygon aPol2(((const XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetValue());
- bArrow1Center=((const XLineStartCenterItem&)(rSet.Get(XATTR_LINESTARTCENTER))).GetValue();
- bArrow2Center=((const XLineEndCenterItem&)(rSet.Get(XATTR_LINEENDCENTER))).GetValue();
- nArrow1Len=XOutputDevice::InitLineStartEnd(aPol1,nArrow1Wdt,bArrow1Center)-1;
- nArrow2Len=XOutputDevice::InitLineStartEnd(aPol2,nArrow2Wdt,bArrow2Center)-1;
- // nArrowLen ist bei bCenter bereits halbiert
- // Bei 2 Pfeilen a 4mm ist unter 10mm Schluss.
- nArrowNeed=nArrow1Len+nArrow2Len+(nArrow1Wdt+nArrow2Wdt)/2;
- if (rPol.nLineLen<nArrowNeed) bPfeileAussen=TRUE;
- nShortLen=(nArrow1Len+nArrow1Wdt + nArrow2Len+nArrow2Wdt) /2;
- }
+
+//-/ if(mpObjectItemSet)
+//-/ {
+ const SfxItemSet& rSet = GetItemSet();
+ sal_Int32 nLineWdt = ((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); // Strichstaerke
+ rPol.nLineWdt2 = (nLineWdt + 1) / 2;
+
+ nArrow1Wdt = ((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue();
+ if(nArrow1Wdt < 0)
+ nArrow1Wdt = -nLineWdt * nArrow1Wdt / 100; // <0 = relativ
+
+ nArrow2Wdt = ((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue();
+ if(nArrow2Wdt < 0)
+ nArrow2Wdt = -nLineWdt * nArrow2Wdt / 100; // <0 = relativ
+
+ XPolygon aPol1(((const XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetValue());
+ XPolygon aPol2(((const XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetValue());
+ bArrow1Center = ((const XLineStartCenterItem&)(rSet.Get(XATTR_LINESTARTCENTER))).GetValue();
+ bArrow2Center = ((const XLineEndCenterItem&)(rSet.Get(XATTR_LINEENDCENTER))).GetValue();
+ nArrow1Len = XOutputDevice::InitLineStartEnd(aPol1, nArrow1Wdt, bArrow1Center) - 1;
+ nArrow2Len = XOutputDevice::InitLineStartEnd(aPol2, nArrow2Wdt, bArrow2Center) - 1;
+
+ // nArrowLen ist bei bCenter bereits halbiert
+ // Bei 2 Pfeilen a 4mm ist unter 10mm Schluss.
+ nArrowNeed=nArrow1Len+nArrow2Len+(nArrow1Wdt+nArrow2Wdt)/2;
+ if (rPol.nLineLen<nArrowNeed) bPfeileAussen=TRUE;
+ nShortLen=(nArrow1Len+nArrow1Wdt + nArrow2Len+nArrow2Wdt) /2;
+//-/ }
rPol.eUsedTextHPos=rRec.eWantTextHPos;
rPol.eUsedTextVPos=rRec.eWantTextVPos;
@@ -743,27 +765,29 @@ FASTBOOL SdrMeasureObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rIn
return TRUE;
// prepare ItemSet of this object
- SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
- TakeAttributes(aSet, FALSE, TRUE);
+ const SfxItemSet& rSet = GetItemSet();
+//-/ SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
+//-/ TakeAttributes(aSet, FALSE, TRUE);
// perepare ItemSet to avoid old XOut line drawing
- XLineAttrSetItem aXLSet((SfxItemPool*)GetItemPool());
- aXLSet.GetItemSet().Put(XLineStyleItem(XLINE_NONE));
+//-/ XLineAttrSetItem aXLSet(rSet.GetPool());
+ SfxItemSet aEmptySet(*rSet.GetPool());
+ aEmptySet.Put(XLineStyleItem(XLINE_NONE));
// prepare line geometry
BOOL bIsLineDraft(0 != (rInfoRec.nPaintMode & SDRPAINTMODE_DRAFTLINE));
- ImpLineGeometry* pLineGeometry = ImpPrepareLineGeometry(rXOut, aSet, bIsLineDraft);
+ ImpLineGeometry* pLineGeometry = ImpPrepareLineGeometry(rXOut, rSet, bIsLineDraft);
// Shadows
- BOOL bShadOn = ((SdrShadowItem&)(aSet.Get(SDRATTR_SHADOW))).GetValue();
+ BOOL bShadOn = ((SdrShadowItem&)(rSet.Get(SDRATTR_SHADOW))).GetValue();
if(bShadOn && pLineGeometry)
{
// draw the line geometry
- ImpDrawShadowLineGeometry(rXOut, aSet, *pLineGeometry);
+ ImpDrawShadowLineGeometry(rXOut, rSet, *pLineGeometry);
}
// Before here the LineAttr were set: if(pLineAttr) rXOut.SetLineAttr(*pLineAttr);
- rXOut.SetLineAttr(aXLSet);
+ rXOut.SetLineAttr(aEmptySet);
// !!! aGeo muss noch fuer Textausgabe gesetzt werden !!!
// aRect ebenso
@@ -796,7 +820,7 @@ FASTBOOL SdrMeasureObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rIn
if(pLineGeometry)
{
// draw the line geometry
- ImpDrawColorLineGeometry(rXOut, aSet, *pLineGeometry);
+ ImpDrawColorLineGeometry(rXOut, rSet, *pLineGeometry);
}
FASTBOOL bOk=TRUE;
@@ -843,8 +867,15 @@ void SdrMeasureObj::UndirtyText() const
rOutliner.QuickInsertField(SvxFieldItem(SdrMeasureField(SDRMEASUREFIELD_VALUE)),ESelection(0,1));
rOutliner.QuickInsertField(SvxFieldItem(SdrMeasureField(SDRMEASUREFIELD_UNIT)),ESelection(0,2));
rOutliner.QuickInsertField(SvxFieldItem(SdrMeasureField(SDRMEASUREFIELD_ROTA90BLANCS)),ESelection(0,3));
- if (pStyleSheet!=NULL) rOutliner.SetStyleSheet( 0, pStyleSheet );
- if (pOutlAttr!=NULL) rOutliner.SetParaAttribs(0,pOutlAttr->GetItemSet());
+
+ if(GetStyleSheet())
+ rOutliner.SetStyleSheet(0, GetStyleSheet());
+
+//-/ if(mpObjectItemSet)
+ rOutliner.SetParaAttribs(0, GetItemSet());
+//-/ if(pOutlAttr)
+//-/ rOutliner.SetParaAttribs(0, pOutlAttr->GetItemSet());
+
// casting auf nonconst
((SdrMeasureObj*)this)->pOutlinerParaObject=rOutliner.CreateParaObject();
} else {
@@ -987,7 +1018,7 @@ void SdrMeasureObj::operator=(const SdrObject& rObj)
SdrTextObj::operator=(rObj);
aPt1=((SdrMeasureObj&)rObj).aPt1;
aPt2=((SdrMeasureObj&)rObj).aPt2;
- pMeasureAttr=(SdrMeasureSetItem*)ImpSetNewAttr(pMeasureAttr,((SdrMeasureObj&)rObj).pMeasureAttr);
+//-/ pMeasureAttr=(SdrMeasureSetItem*)ImpSetNewAttr(pMeasureAttr,((SdrMeasureObj&)rObj).pMeasureAttr);
bTextDirty=((SdrMeasureObj&)rObj).bTextDirty;
}
@@ -1089,27 +1120,60 @@ FASTBOOL SdrMeasureObj::EndDrag(SdrDragStat& rDrag)
switch (nHdlNum) {
case 2: aPt1=pMR->aPt1; SetTextDirty(); break;
case 3: aPt2=pMR->aPt2; SetTextDirty(); break;
- default: {
- SdrMeasureSetItem aSI(*pMeasureAttr);
- switch (nHdlNum) {
- case 0: case 1: {
- if (pMR->nHelpline1Len!=aRec0.nHelpline1Len) {
- aSI.GetItemSet().Put(SdrMeasureHelpline1LenItem(pMR->nHelpline1Len));
+ default:
+ {
+ switch(nHdlNum)
+ {
+ case 0:
+ case 1:
+ {
+ if(pMR->nHelpline1Len!=aRec0.nHelpline1Len)
+ {
+ SetItem(SdrMeasureHelpline1LenItem(pMR->nHelpline1Len));
}
- if (pMR->nHelpline2Len!=aRec0.nHelpline2Len) {
- aSI.GetItemSet().Put(SdrMeasureHelpline2LenItem(pMR->nHelpline2Len));
+
+ if(pMR->nHelpline2Len!=aRec0.nHelpline2Len)
+ {
+ SetItem(SdrMeasureHelpline2LenItem(pMR->nHelpline2Len));
}
- } break;
- case 4: case 5: {
- if (pMR->nLineDist!=aRec0.nLineDist) {
- aSI.GetItemSet().Put(SdrMeasureLineDistItem(pMR->nLineDist));
+
+ break;
+ }
+
+ case 4:
+ case 5:
+ {
+ if (pMR->nLineDist!=aRec0.nLineDist)
+ {
+ SetItem(SdrMeasureLineDistItem(pMR->nLineDist));
}
- if (pMR->bBelowRefEdge!=aRec0.bBelowRefEdge) {
- aSI.GetItemSet().Put(SdrMeasureBelowRefEdgeItem(pMR->bBelowRefEdge));
+
+ if(pMR->bBelowRefEdge!=aRec0.bBelowRefEdge)
+ {
+ SetItem(SdrMeasureBelowRefEdgeItem(pMR->bBelowRefEdge));
}
}
}
- pMeasureAttr=(SdrMeasureSetItem*)ImpSetNewAttr(pMeasureAttr,&aSI);
+//-/ SdrMeasureSetItem aSI(*pMeasureAttr);
+//-/ switch (nHdlNum) {
+//-/ case 0: case 1: {
+//-/ if (pMR->nHelpline1Len!=aRec0.nHelpline1Len) {
+//-/ aSI.GetItemSet().Put(SdrMeasureHelpline1LenItem(pMR->nHelpline1Len));
+//-/ }
+//-/ if (pMR->nHelpline2Len!=aRec0.nHelpline2Len) {
+//-/ aSI.GetItemSet().Put(SdrMeasureHelpline2LenItem(pMR->nHelpline2Len));
+//-/ }
+//-/ } break;
+//-/ case 4: case 5: {
+//-/ if (pMR->nLineDist!=aRec0.nLineDist) {
+//-/ aSI.GetItemSet().Put(SdrMeasureLineDistItem(pMR->nLineDist));
+//-/ }
+//-/ if (pMR->bBelowRefEdge!=aRec0.bBelowRefEdge) {
+//-/ aSI.GetItemSet().Put(SdrMeasureBelowRefEdgeItem(pMR->bBelowRefEdge));
+//-/ }
+//-/ }
+//-/ }
+//-/ pMeasureAttr=(SdrMeasureSetItem*)ImpSetNewAttr(pMeasureAttr,&aSI);
}
} // switch
SetRectsDirty();
@@ -1371,8 +1435,8 @@ void SdrMeasureObj::RecalcBoundRect()
void SdrMeasureObj::RecalcSnapRect()
{
// !!!!! nur zu Testzwecken !!!!!
- aSnapRect=Rectangle(aPt1,aPt2);
- aSnapRect.Justify();
+ maSnapRect=Rectangle(aPt1,aPt2);
+ maSnapRect.Justify();
}
USHORT SdrMeasureObj::GetSnapPointCount() const
@@ -1439,9 +1503,9 @@ void SdrMeasureObj::CreateLinePoly(PolyPolygon3D& rPolyPolygon, PolyPolygon3D& r
TakeXorPoly(aTmpPolyPolygon, TRUE);
// get LineStyleParameterPack
- SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
- TakeAttributes(aSet, FALSE, TRUE);
- LineStyleParameterPack aLineAttr(aSet, bForceHair || bIsLineDraft, rOut);
+//-/ SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
+//-/ TakeAttributes(aSet, FALSE, TRUE);
+ LineStyleParameterPack aLineAttr(GetItemSet(), bForceHair || bIsLineDraft, rOut);
LineGeometryCreator aLineCreator(aLineAttr, rPolyPolygon, rPolyLine, bIsLineDraft);
UINT16 nCount(aTmpPolyPolygon.Count());
Polygon3D aPoly3D;
@@ -1507,8 +1571,9 @@ SdrObject* SdrMeasureObj::DoConvertToPolyObj(BOOL bBezier) const
TakeXorPoly(aTmpPolyPolygon, TRUE);
// get local ItemSet
- SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
- TakeAttributes(aSet, TRUE, FALSE);
+//-/ SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
+//-/ TakeAttributes(aSet, TRUE, FALSE);
+ SfxItemSet aSet(GetItemSet());
// prepare group
SdrObjGroup* pGroup = new SdrObjGroup;
@@ -1527,7 +1592,10 @@ SdrObject* SdrMeasureObj::DoConvertToPolyObj(BOOL bBezier) const
aNewPoly.Insert(aTmpPolyPolygon[0]);
pPath = new SdrPathObj(OBJ_PATHLINE, aNewPoly);
pPath->SetModel(GetModel());
- pPath->NbcSetAttributes(aSet, FALSE);
+
+//-/ pPath->NbcSetAttributes(aSet, FALSE);
+ pPath->SetItemSet(aSet);
+
pGroup->GetSubList()->NbcInsertObject(pPath);
aSet.Put(XLineStartWidthItem(0L));
@@ -1547,7 +1615,10 @@ SdrObject* SdrMeasureObj::DoConvertToPolyObj(BOOL bBezier) const
aNewPoly.Insert(aTmpPolyPolygon[0]);
pPath = new SdrPathObj(OBJ_PATHLINE, aNewPoly);
pPath->SetModel(GetModel());
- pPath->NbcSetAttributes(aSet, FALSE);
+
+//-/ pPath->NbcSetAttributes(aSet, FALSE);
+ pPath->SetItemSet(aSet);
+
pGroup->GetSubList()->NbcInsertObject(pPath);
aSet.Put(XLineEndWidthItem(nEndWidth));
@@ -1557,7 +1628,10 @@ SdrObject* SdrMeasureObj::DoConvertToPolyObj(BOOL bBezier) const
aNewPoly.Insert(aTmpPolyPolygon[1]);
pPath = new SdrPathObj(OBJ_PATHLINE, aNewPoly);
pPath->SetModel(GetModel());
- pPath->NbcSetAttributes(aSet, FALSE);
+
+//-/ pPath->NbcSetAttributes(aSet, FALSE);
+ pPath->SetItemSet(aSet);
+
pGroup->GetSubList()->NbcInsertObject(pPath);
aSet.Put(XLineEndWidthItem(0L));
@@ -1575,7 +1649,10 @@ SdrObject* SdrMeasureObj::DoConvertToPolyObj(BOOL bBezier) const
aNewPoly.Insert(aTmpPolyPolygon[0]);
pPath = new SdrPathObj(OBJ_PATHLINE, aNewPoly);
pPath->SetModel(GetModel());
- pPath->NbcSetAttributes(aSet, FALSE);
+
+//-/ pPath->NbcSetAttributes(aSet, FALSE);
+ pPath->SetItemSet(aSet);
+
pGroup->GetSubList()->NbcInsertObject(pPath);
aSet.Put(XLineEndWidthItem(nEndWidth));
@@ -1585,7 +1662,10 @@ SdrObject* SdrMeasureObj::DoConvertToPolyObj(BOOL bBezier) const
aNewPoly.Insert(aTmpPolyPolygon[1]);
pPath = new SdrPathObj(OBJ_PATHLINE, aNewPoly);
pPath->SetModel(GetModel());
- pPath->NbcSetAttributes(aSet, FALSE);
+
+//-/ pPath->NbcSetAttributes(aSet, FALSE);
+ pPath->SetItemSet(aSet);
+
pGroup->GetSubList()->NbcInsertObject(pPath);
aSet.Put(XLineEndWidthItem(0L));
@@ -1598,7 +1678,10 @@ SdrObject* SdrMeasureObj::DoConvertToPolyObj(BOOL bBezier) const
aNewPoly.Insert(aTmpPolyPolygon[nLoopStart]);
pPath = new SdrPathObj(OBJ_PATHLINE, aNewPoly);
pPath->SetModel(GetModel());
- pPath->NbcSetAttributes(aSet, FALSE);
+
+//-/ pPath->NbcSetAttributes(aSet, FALSE);
+ pPath->SetItemSet(aSet);
+
pGroup->GetSubList()->NbcInsertObject(pPath);
}
@@ -1738,28 +1821,109 @@ void SdrMeasureObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDo
SdrTextObj::NbcSetStyleSheet(pNewStyleSheet,bDontRemoveHardAttr);
}
-void SdrMeasureObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/void SdrMeasureObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/{
+//-/ SetTextDirty();
+//-/ SdrTextObj::NbcSetAttributes(rAttr,bReplaceAll);
+//-/}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrMeasureObj::SetItem(const SfxPoolItem& rItem)
{
SetTextDirty();
- SdrTextObj::NbcSetAttributes(rAttr,bReplaceAll);
+ SdrTextObj::SetItem(rItem);
+}
+
+void SdrMeasureObj::ClearItem(USHORT nWhich)
+{
+ SetTextDirty();
+ SdrTextObj::ClearItem(nWhich);
+}
+
+void SdrMeasureObj::SetItemSet(const SfxItemSet& rSet)
+{
+ SetTextDirty();
+ SdrTextObj::SetItemSet(rSet);
+}
+
+SfxItemSet* SdrMeasureObj::CreateNewItemSet(SfxItemPool& rPool)
+{
+ // include ALL items, 2D and 3D
+ return new SfxItemSet(rPool,
+ // ranges from SdrAttrObj
+ SDRATTR_START, SDRATTRSET_SHADOW,
+ SDRATTRSET_OUTLINER, SDRATTRSET_MISC,
+
+ // measure attributes
+ SDRATTR_MEASURE_FIRST, SDRATTRSET_MEASURE,
+
+ // outliner and end
+ EE_ITEMS_START, EE_ITEMS_END,
+ 0, 0);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// pre- and postprocessing for objects for saving
+
+void SdrMeasureObj::PreSave()
+{
+ // call parent
+ SdrTextObj::PreSave();
+
+ // prepare SetItems for storage
+ const SfxItemSet& rSet = GetItemSet();
+ const SfxItemSet* pParent = GetStyleSheet() ? &GetStyleSheet()->GetItemSet() : 0L;
+ SdrMeasureSetItem aMeasAttr(rSet.GetPool());
+ aMeasAttr.GetItemSet().Put(rSet);
+ aMeasAttr.GetItemSet().SetParent(pParent);
+ mpObjectItemSet->Put(aMeasAttr);
+}
+
+void SdrMeasureObj::PostSave()
+{
+ // call parent
+ SdrTextObj::PostSave();
+
+ // remove SetItems from local itemset
+ mpObjectItemSet->ClearItem(SDRATTRSET_MEASURE);
}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
void SdrMeasureObj::WriteData(SvStream& rOut) const
{
UndirtyText();
+
SdrTextObj::WriteData(rOut);
SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
#ifdef DBG_UTIL
aCompat.SetID("SdrMeasureObj");
#endif
- rOut<<aPt1;
- rOut<<aPt2;
- rOut<<BOOL(FALSE); // bTextOverwritten wg. Kompatibilitaet. Gibt's nicht mehr.
+
+ rOut << aPt1;
+ rOut << aPt2;
+ rOut << BOOL(FALSE); // bTextOverwritten wg. Kompatibilitaet. Gibt's nicht mehr.
+
SfxItemPool* pPool=GetItemPool();
- if (pPool!=NULL) {
- pPool->StoreSurrogate(rOut,pMeasureAttr);
- } else {
- rOut<<UINT16(SFX_ITEMS_NULL);
+
+ if(pPool)
+ {
+ const SfxItemSet& rSet = GetItemSet();
+
+ pPool->StoreSurrogate(rOut, &rSet.Get(SDRATTRSET_MEASURE));
+
+
+
+//-/ SdrMeasureSetItem aMeasAttr(pPool);
+//-/ aMeasAttr.GetItemSet().Put(GetItemSet());
+//-/ const SfxPoolItem& rMeasAttr = pPool->Put(aMeasAttr);
+//-/ pPool->StoreSurrogate(rOut, &rMeasAttr);
+//-/ pPool->StoreSurrogate(rOut,pMeasureAttr);
+ }
+ else
+ {
+ rOut << sal_uInt16(SFX_ITEMS_NULL);
}
}
@@ -1776,16 +1940,24 @@ void SdrMeasureObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
BOOL bTextOverwrittenTmp;
rIn>>bTextOverwrittenTmp;
SfxItemPool* pPool=GetItemPool();
- if (pPool!=NULL) {
- pMeasureAttr=(const SdrMeasureSetItem*)ImpSetNewAttr(pMeasureAttr,NULL); // ggf altes rauswerfen
- USHORT nWhichRef=SDRATTRSET_MEASURE;
- pMeasureAttr=(const SdrMeasureSetItem*)pPool->LoadSurrogate(rIn,nWhichRef,0);
- if (pStyleSheet!=NULL && pMeasureAttr!=NULL) {
- ((SfxItemSet*)&pMeasureAttr->GetItemSet())->SetParent(&pStyleSheet->GetItemSet());
- }
- } else {
- UINT16 nSuroDum;
- rIn>>nSuroDum;
+
+ if(pPool)
+ {
+ sal_uInt16 nSetID = SDRATTRSET_MEASURE;
+ const SdrMeasureSetItem* pMeasAttr = (const SdrMeasureSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0);
+ if(pMeasAttr)
+ SetItemSet(pMeasAttr->GetItemSet());
+//-/ pMeasureAttr=(const SdrMeasureSetItem*)ImpSetNewAttr(pMeasureAttr,NULL); // ggf altes rauswerfen
+//-/ USHORT nWhichRef=SDRATTRSET_MEASURE;
+//-/ pMeasureAttr=(const SdrMeasureSetItem*)pPool->LoadSurrogate(rIn,nWhichRef,0);
+//-/ if (pStyleSheet!=NULL && pMeasureAttr!=NULL) {
+//-/ ((SfxItemSet*)&pMeasureAttr->GetItemSet())->SetParent(&pStyleSheet->GetItemSet());
+//-/ }
+ }
+ else
+ {
+ sal_uInt16 nSuroDum;
+ rIn >> nSuroDum;
}
}
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index ff8c9554238a..ddf14d24f40c 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdopath.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2000-09-27 14:03:57 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -305,26 +305,29 @@ FASTBOOL SdrPathObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoR
BOOL bIsLineDraft(0 != (rInfoRec.nPaintMode & SDRPAINTMODE_DRAFTLINE));
// prepare ItemSet of this object
- SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
- TakeAttributes(aSet, FALSE, TRUE);
+ const SfxItemSet& rSet = GetItemSet();
+//-/ SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
+//-/ TakeAttributes(aSet, FALSE, TRUE);
// perepare ItemSet to avoid old XOut line drawing
- XLineAttrSetItem aXLSet((SfxItemPool*)GetItemPool());
- aXLSet.GetItemSet().Put(XLineStyleItem(XLINE_NONE));
+//-/ XLineAttrSetItem aXLSet(rSet.GetPool());
+ SfxItemSet aEmptySet(*rSet.GetPool());
+ aEmptySet.Put(XLineStyleItem(XLINE_NONE));
+ aEmptySet.Put(XFillStyleItem(XFILL_NONE));
// prepare line geometry
- ImpLineGeometry* pLineGeometry = ImpPrepareLineGeometry(rXOut, aSet, bIsLineDraft);
+ ImpLineGeometry* pLineGeometry = ImpPrepareLineGeometry(rXOut, rSet, bIsLineDraft);
// Shadows
if (!bHideContour && ImpSetShadowAttributes(rXOut,!IsClosed()))
{
- UINT32 nXDist=((SdrShadowXDistItem&)(aSet.Get(SDRATTR_SHADOWXDIST))).GetValue();
- UINT32 nYDist=((SdrShadowYDistItem&)(aSet.Get(SDRATTR_SHADOWYDIST))).GetValue();
+ UINT32 nXDist=((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue();
+ UINT32 nYDist=((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue();
XPolyPolygon aTmpXPoly(aPathPolygon);
aTmpXPoly.Move(nXDist,nYDist);
// avoid shadow line drawing in XOut
- rXOut.SetLineAttr(aXLSet);
+ rXOut.SetLineAttr(aEmptySet);
if (!IsClosed()) {
USHORT nPolyAnz=aTmpXPoly.Count();
@@ -339,25 +342,25 @@ FASTBOOL SdrPathObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoR
if(pLineGeometry)
{
// draw the line geometry
- ImpDrawShadowLineGeometry(rXOut, aSet, *pLineGeometry);
+ ImpDrawShadowLineGeometry(rXOut, rSet, *pLineGeometry);
}
}
// Before here the LineAttr were set: if(pLineAttr) rXOut.SetLineAttr(*pLineAttr);
// avoid line drawing in XOut
- rXOut.SetLineAttr(aXLSet);
+ rXOut.SetLineAttr(aEmptySet);
if(bIsFillDraft)
{
// perepare ItemSet to avoid XOut filling
- XFillAttrSetItem aXFSet((SfxItemPool*)GetItemPool());
- aXFSet.GetItemSet().Put(XFillStyleItem(XFILL_NONE));
- rXOut.SetFillAttr(aXFSet);
+ rXOut.SetFillAttr(aEmptySet);
}
else
{
- if(pFillAttr && (IsClosed() || bHideContour))
- rXOut.SetFillAttr(*pFillAttr);
+ if(IsClosed() || bHideContour)
+ {
+ rXOut.SetFillAttr(rSet);
+ }
}
if (!bHideContour) {
@@ -375,7 +378,7 @@ FASTBOOL SdrPathObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoR
if(!bHideContour && pLineGeometry)
{
// draw the line geometry
- ImpDrawColorLineGeometry(rXOut, aSet, *pLineGeometry);
+ ImpDrawColorLineGeometry(rXOut, rSet, *pLineGeometry);
}
FASTBOOL bOk=TRUE;
@@ -2059,7 +2062,7 @@ void SdrPathObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
void SdrPathObj::RecalcSnapRect()
{
- aSnapRect=aPathPolygon.GetBoundRect();
+ maSnapRect=aPathPolygon.GetBoundRect();
}
void SdrPathObj::NbcSetSnapRect(const Rectangle& rRect)
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
index 9e761c643cb8..d8045ab463e0 100644
--- a/svx/source/svdraw/svdorect.cxx
+++ b/svx/source/svdraw/svdorect.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdorect.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2000-09-27 14:03:58 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -217,7 +217,7 @@ void SdrRectObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
rInfo.bTransparenceAllowed = TRUE;
// gradient depends on fillstyle
- XFillStyle eFillStyle = ((XFillStyleItem&)(GetSetItem(1)->GetItemSet().Get(XATTR_FILLSTYLE))).GetValue();
+ XFillStyle eFillStyle = ((XFillStyleItem&)(GetItem(XATTR_FILLSTYLE))).GetValue();
rInfo.bGradientAllowed = (eFillStyle == XFILL_GRADIENT);
rInfo.bShearAllowed =bNoTextFrame;
@@ -319,23 +319,27 @@ FASTBOOL SdrRectObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoR
BOOL bIsLineDraft(0 != (rInfoRec.nPaintMode & SDRPAINTMODE_DRAFTLINE));
// prepare ItemSet of this object
- SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
- TakeAttributes(aSet, FALSE, TRUE);
+ const SfxItemSet& rSet = GetItemSet();
+//-/ SfxItemSet aSet((SfxItemPool&)(*GetItemPool()));
+//-/ TakeAttributes(aSet, FALSE, TRUE);
// perepare ItemSet to avoid old XOut line drawing
- XLineAttrSetItem aXLSet((SfxItemPool*)GetItemPool());
- aXLSet.GetItemSet().Put(XLineStyleItem(XLINE_NONE));
+//-/ XLineAttrSetItem aXLSet(rSet.GetPool());
+ SfxItemSet aEmptySet(*rSet.GetPool());
+ aEmptySet.Put(XLineStyleItem(XLINE_NONE));
+ aEmptySet.Put(XFillStyleItem(XFILL_NONE));
// prepare line geometry
- ImpLineGeometry* pLineGeometry = ImpPrepareLineGeometry(rXOut, aSet, bIsLineDraft);
+ ImpLineGeometry* pLineGeometry = ImpPrepareLineGeometry(rXOut, rSet, bIsLineDraft);
// Shadows
- if (!bHideContour && ImpSetShadowAttributes(rXOut,FALSE)) {
- UINT32 nXDist=((SdrShadowXDistItem&)(pShadAttr->GetItemSet().Get(SDRATTR_SHADOWXDIST))).GetValue();
- UINT32 nYDist=((SdrShadowYDistItem&)(pShadAttr->GetItemSet().Get(SDRATTR_SHADOWYDIST))).GetValue();
+ if (!bHideContour && ImpSetShadowAttributes(rXOut,FALSE))
+ {
+ UINT32 nXDist=((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue();
+ UINT32 nYDist=((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue();
// avoid shadow line drawing in XOut
- rXOut.SetLineAttr(aXLSet);
+ rXOut.SetLineAttr(aEmptySet);
if (PaintNeedsXPoly(nEckRad)) {
XPolygon aX(GetXPoly());
@@ -351,26 +355,23 @@ FASTBOOL SdrRectObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoR
if(pLineGeometry)
{
// draw the line geometry
- ImpDrawShadowLineGeometry(rXOut, aSet, *pLineGeometry);
+ ImpDrawShadowLineGeometry(rXOut, rSet, *pLineGeometry);
}
}
- if(pFillAttr!=NULL || !IsTextFrame())
+ if(!IsTextFrame())
{
// Before here the LineAttr were set: if(pLineAttr) rXOut.SetLineAttr(*pLineAttr);
- rXOut.SetLineAttr(aXLSet);
+ rXOut.SetLineAttr(aEmptySet);
if(bIsFillDraft)
{
// perepare ItemSet to avoid XOut filling
- XFillAttrSetItem aXFSet((SfxItemPool*)GetItemPool());
- aXFSet.GetItemSet().Put(XFillStyleItem(XFILL_NONE));
- rXOut.SetFillAttr(aXFSet);
+ rXOut.SetFillAttr(aEmptySet);
}
else
{
- if(pFillAttr)
- rXOut.SetFillAttr(*pFillAttr);
+ rXOut.SetFillAttr(rSet);
}
if (!bHideContour) {
@@ -388,7 +389,7 @@ FASTBOOL SdrRectObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoR
if(!bHideContour && pLineGeometry)
{
// draw the line geometry
- ImpDrawColorLineGeometry(rXOut, aSet, *pLineGeometry);
+ ImpDrawColorLineGeometry(rXOut, rSet, *pLineGeometry);
}
if (HasText()) {
@@ -524,7 +525,7 @@ void SdrRectObj::RecalcSnapRect()
{
long nEckRad=GetEckenradius();
if ((aGeo.nDrehWink!=0 || aGeo.nShearWink!=0) && nEckRad!=0) {
- aSnapRect=GetXPoly().GetBoundRect();
+ maSnapRect=GetXPoly().GetBoundRect();
} else {
SdrTextObj::RecalcSnapRect();
}
@@ -748,12 +749,15 @@ XubString SdrRectObj::GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const
SdrGluePoint SdrRectObj::GetVertexGluePoint(USHORT nPosNum) const
{
- INT32 nWdt=0;
- if (pLineAttr!=NULL) {
- nWdt=((XLineWidthItem&)(pLineAttr->GetItemSet().Get(XATTR_LINEWIDTH))).GetValue();
- nWdt++;
- nWdt/=2;
- }
+//-/ INT32 nWdt=0;
+
+//-/ if(mpObjectItemSet)
+//-/ {
+ INT32 nWdt = ((XLineWidthItem&)(GetItem(XATTR_LINEWIDTH))).GetValue();
+ nWdt++;
+ nWdt /= 2;
+//-/ }
+
Point aPt;
switch (nPosNum) {
case 0: aPt=aRect.TopCenter(); aPt.Y()-=nWdt; break;
@@ -771,12 +775,15 @@ SdrGluePoint SdrRectObj::GetVertexGluePoint(USHORT nPosNum) const
SdrGluePoint SdrRectObj::GetCornerGluePoint(USHORT nPosNum) const
{
- INT32 nWdt=0;
- if (pLineAttr!=NULL) {
- nWdt=((XLineWidthItem&)(pLineAttr->GetItemSet().Get(XATTR_LINEWIDTH))).GetValue();
- nWdt++;
- nWdt/=2;
- }
+//-/ INT32 nWdt=0;
+
+//-/ if(mpObjectItemSet)
+//-/ {
+ INT32 nWdt = ((XLineWidthItem&)(GetItem(XATTR_LINEWIDTH))).GetValue();
+ nWdt++;
+ nWdt /= 2;
+//-/ }
+
Point aPt;
switch (nPosNum) {
case 0: aPt=aRect.TopLeft(); aPt.X()-=nWdt; aPt.Y()-=nWdt; break;
@@ -813,12 +820,34 @@ void SdrRectObj::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const Sf
SetXPolyDirty(); // wg. Eckenradius
}
-void SdrRectObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/void SdrRectObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/{
+//-/ SdrTextObj::NbcSetAttributes(rAttr,bReplaceAll);
+//-/ SetXPolyDirty(); // wg. Eckenradius
+//-/}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrRectObj::SetItem(const SfxPoolItem& rItem)
{
- SdrTextObj::NbcSetAttributes(rAttr,bReplaceAll);
- SetXPolyDirty(); // wg. Eckenradius
+ SdrTextObj::SetItem(rItem);
+ SetXPolyDirty();
}
+void SdrRectObj::ClearItem(USHORT nWhich)
+{
+ SdrTextObj::ClearItem(nWhich);
+ SetXPolyDirty();
+}
+
+void SdrRectObj::SetItemSet(const SfxItemSet& rSet)
+{
+ SdrTextObj::SetItemSet(rSet);
+ SetXPolyDirty();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
void SdrRectObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr)
{
SdrTextObj::NbcSetStyleSheet(pNewStyleSheet,bDontRemoveHardAttr);
@@ -870,7 +899,9 @@ void SdrRectObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
aSet.Put(XFillStyleItem(XFILL_NONE));
aSet.Put(XLineColorItem(String(),Color(COL_BLACK))); // Falls einer auf Solid umschaltet
aSet.Put(XLineStyleItem(XLINE_NONE));
- NbcSetAttributes(aSet,FALSE);
+
+//-/ NbcSetAttributes(aSet,FALSE);
+ SetItemSet(aSet);
}
} else {
SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code)
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 1e541dad535f..1f3b7e03b8f2 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdotext.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dl $ $Date: 2000-10-18 11:00:29 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -319,73 +319,104 @@ const Size& SdrTextObj::GetTextSize() const
FASTBOOL SdrTextObj::IsAutoGrowHeight() const
{
- if (!bTextFrame) return FALSE; // AutoGrow nur bei TextFrames
- if (pMiscAttr!=NULL) {
- const SfxItemSet& rSet=pMiscAttr->GetItemSet();
- FASTBOOL bRet=((SdrTextAutoGrowHeightItem&)(rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT))).GetValue();
- if (bRet) {
- SdrTextAniKind eAniKind=((SdrTextAniKindItem&)(rSet.Get(SDRATTR_TEXT_ANIKIND))).GetValue();
- if (eAniKind==SDRTEXTANI_SCROLL || eAniKind==SDRTEXTANI_ALTERNATE || eAniKind==SDRTEXTANI_SLIDE) {
- SdrTextAniDirection eDirection=((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue();
- if (eDirection==SDRTEXTANI_UP || eDirection==SDRTEXTANI_DOWN) {
- bRet=FALSE;
- }
+ if(!bTextFrame)
+ return FALSE; // AutoGrow nur bei TextFrames
+
+ const SfxItemSet& rSet = GetItemSet();
+//-/ if(mpObjectItemSet)
+//-/ {
+ BOOL bRet = ((SdrTextAutoGrowHeightItem&)(rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT))).GetValue();
+
+ if(bRet)
+ {
+ SdrTextAniKind eAniKind = ((SdrTextAniKindItem&)(rSet.Get(SDRATTR_TEXT_ANIKIND))).GetValue();
+
+ if(eAniKind == SDRTEXTANI_SCROLL || eAniKind == SDRTEXTANI_ALTERNATE || eAniKind == SDRTEXTANI_SLIDE)
+ {
+ SdrTextAniDirection eDirection = ((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue();
+
+ if(eDirection == SDRTEXTANI_UP || eDirection == SDRTEXTANI_DOWN)
+ {
+ bRet = FALSE;
}
}
- return bRet;
}
- return TRUE; // default ist TRUE
+ return bRet;
+//-/ }
+//-/ return TRUE; // default ist TRUE
}
FASTBOOL SdrTextObj::IsAutoGrowWidth() const
{
- if (!bTextFrame) return FALSE; // AutoGrow nur bei TextFrames
- if (pMiscAttr!=NULL) {
- const SfxItemSet& rSet=pMiscAttr->GetItemSet();
- FASTBOOL bRet=((SdrTextAutoGrowHeightItem&)(rSet.Get(SDRATTR_TEXT_AUTOGROWWIDTH))).GetValue();
- if (bRet) {
- SdrTextAniKind eAniKind=((SdrTextAniKindItem&)(rSet.Get(SDRATTR_TEXT_ANIKIND))).GetValue();
- if (eAniKind==SDRTEXTANI_SCROLL || eAniKind==SDRTEXTANI_ALTERNATE || eAniKind==SDRTEXTANI_SLIDE) {
- SdrTextAniDirection eDirection=((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue();
- if (eDirection==SDRTEXTANI_LEFT || eDirection==SDRTEXTANI_RIGHT) {
- bRet=FALSE;
- }
+ if(!bTextFrame)
+ return FALSE; // AutoGrow nur bei TextFrames
+
+ const SfxItemSet& rSet = GetItemSet();
+//-/ if(mpObjectItemSet)
+//-/ {
+ BOOL bRet = ((SdrTextAutoGrowHeightItem&)(rSet.Get(SDRATTR_TEXT_AUTOGROWWIDTH))).GetValue();
+
+ if(bRet)
+ {
+ SdrTextAniKind eAniKind = ((SdrTextAniKindItem&)(rSet.Get(SDRATTR_TEXT_ANIKIND))).GetValue();
+
+ if(eAniKind == SDRTEXTANI_SCROLL || eAniKind == SDRTEXTANI_ALTERNATE || eAniKind == SDRTEXTANI_SLIDE)
+ {
+ SdrTextAniDirection eDirection = ((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue();
+
+ if(eDirection == SDRTEXTANI_LEFT || eDirection == SDRTEXTANI_RIGHT)
+ {
+ bRet = FALSE;
}
}
- return bRet;
}
- return FALSE; // default ist FALSE
+ return bRet;
+//-/ }
+//-/ return FALSE; // default ist FALSE
}
SdrTextHorzAdjust SdrTextObj::GetTextHorizontalAdjust() const
{
- if (IsContourTextFrame()) return SDRTEXTHORZADJUST_BLOCK;
- if (pMiscAttr!=NULL) {
- const SfxItemSet& rSet=pMiscAttr->GetItemSet();
- SdrTextHorzAdjust eRet=((SdrTextHorzAdjustItem&)(rSet.Get(SDRATTR_TEXT_HORZADJUST))).GetValue();
- if (eRet==SDRTEXTHORZADJUST_BLOCK) {
- SdrTextAniKind eAniKind=((SdrTextAniKindItem&)(rSet.Get(SDRATTR_TEXT_ANIKIND))).GetValue();
- if (eAniKind==SDRTEXTANI_SCROLL || eAniKind==SDRTEXTANI_ALTERNATE || eAniKind==SDRTEXTANI_SLIDE) {
- SdrTextAniDirection eDirection=((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue();
- if (eDirection==SDRTEXTANI_LEFT || eDirection==SDRTEXTANI_RIGHT) {
- eRet=SDRTEXTHORZADJUST_LEFT;
- }
+ if(IsContourTextFrame())
+ return SDRTEXTHORZADJUST_BLOCK;
+
+ const SfxItemSet& rSet = GetItemSet();
+//-/ if(mpObjectItemSet)
+//-/ {
+ SdrTextHorzAdjust eRet = ((SdrTextHorzAdjustItem&)(rSet.Get(SDRATTR_TEXT_HORZADJUST))).GetValue();
+
+ if(eRet == SDRTEXTHORZADJUST_BLOCK)
+ {
+ SdrTextAniKind eAniKind = ((SdrTextAniKindItem&)(rSet.Get(SDRATTR_TEXT_ANIKIND))).GetValue();
+
+ if(eAniKind == SDRTEXTANI_SCROLL || eAniKind == SDRTEXTANI_ALTERNATE || eAniKind == SDRTEXTANI_SLIDE)
+ {
+ SdrTextAniDirection eDirection = ((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue();
+
+ if(eDirection == SDRTEXTANI_LEFT || eDirection == SDRTEXTANI_RIGHT)
+ {
+ eRet = SDRTEXTHORZADJUST_LEFT;
}
}
- return eRet;
}
- return bTextFrame ? SDRTEXTHORZADJUST_BLOCK : SDRTEXTHORZADJUST_CENTER;
+ return eRet;
+//-/ }
+//-/
+//-/ return bTextFrame ? SDRTEXTHORZADJUST_BLOCK : SDRTEXTHORZADJUST_CENTER;
} // defaults: BLOCK fuer Textrahmen, CENTER fuer beschriftete Grafikobjekte
SdrTextVertAdjust SdrTextObj::GetTextVerticalAdjust() const
{
- if (IsContourTextFrame()) return SDRTEXTVERTADJUST_TOP;
- if (pMiscAttr!=NULL) {
- const SfxItemSet& rSet=pMiscAttr->GetItemSet();
- SdrTextVertAdjust eRet=((SdrTextVertAdjustItem&)(rSet.Get(SDRATTR_TEXT_VERTADJUST))).GetValue();
- return eRet;
- }
- return bTextFrame ? SDRTEXTVERTADJUST_TOP : SDRTEXTVERTADJUST_CENTER;
+ if(IsContourTextFrame())
+ return SDRTEXTVERTADJUST_TOP;
+
+//-/ if(mpObjectItemSet)
+//-/ {
+ SdrTextVertAdjust eRet = ((SdrTextVertAdjustItem&)(GetItem(SDRATTR_TEXT_VERTADJUST))).GetValue();
+ return eRet;
+//-/ }
+
+//-/ return bTextFrame ? SDRTEXTVERTADJUST_TOP : SDRTEXTVERTADJUST_CENTER;
} // defaults: TOP fuer Textrahmen, CENTER fuer beschriftete Grafikobjekte
void SdrTextObj::ImpJustifyRect(Rectangle& rRect) const
@@ -420,7 +451,7 @@ void SdrTextObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
rInfo.bTransparenceAllowed = TRUE;
// gradient depends on fillstyle
- XFillStyle eFillStyle = ((XFillStyleItem&)(GetSetItem(1)->GetItemSet().Get(XATTR_FILLSTYLE))).GetValue();
+ XFillStyle eFillStyle = ((XFillStyleItem&)(GetItem(XATTR_FILLSTYLE))).GetValue();
rInfo.bGradientAllowed = (eFillStyle == XFILL_GRADIENT);
rInfo.bShearAllowed =bNoTextFrame;
FASTBOOL bCanConv=ImpCanConvTextToCurve();
@@ -474,10 +505,11 @@ void SdrTextObj::SetPage(SdrPage* pNewPage)
void SdrTextObj::SetModel(SdrModel* pNewModel)
{
+ const SfxItemSet& rSet = GetItemSet();
SdrModel* pOldModel=pModel;
- FASTBOOL bLinked=IsLinkedText();
- FASTBOOL bChg=pNewModel!=pModel;
- FASTBOOL bHgtSet=pOutlAttr!=NULL && pOutlAttr->GetItemSet().GetItemState(EE_CHAR_FONTHEIGHT,TRUE)==SFX_ITEM_SET;
+ BOOL bLinked=IsLinkedText();
+ BOOL bChg=pNewModel!=pModel;
+ BOOL bHgtSet = rSet.GetItemState(EE_CHAR_FONTHEIGHT, TRUE) == SFX_ITEM_SET;
if (bLinked && bChg) {
ImpLinkAbmeldung();
}
@@ -495,15 +527,17 @@ void SdrTextObj::SetModel(SdrModel* pNewModel)
// !!! fehlende Implementation !!!
ULONG nOldFontHgt=pOldModel->GetDefaultFontHeight();
ULONG nNewFontHgt=pNewModel->GetDefaultFontHeight();
- FASTBOOL bDefHgtChanged=nNewFontHgt!=nOldFontHgt;
- FASTBOOL bSetHgtItem=bDefHgtChanged && pOutlAttr!=NULL && !bHgtSet;
+ BOOL bDefHgtChanged=nNewFontHgt!=nOldFontHgt;
+ BOOL bSetHgtItem=bDefHgtChanged && !bHgtSet;
if (bSetHgtItem) { // #32665#
// zunaechst das HeightItem festklopfen, damit
// 1. Es eben bestehen bleibt und
// 2. DoStretchChars vom richtigen Wert ausgeht
- SdrOutlinerSetItem aSI(*pOutlAttr);
- aSI.GetItemSet().Put(SvxFontHeightItem(nOldFontHgt));
- pOutlAttr=(SdrOutlinerSetItem*)ImpSetNewAttr(pOutlAttr,&aSI);
+ //-/ aSI.GetItemSet().Put(SvxFontHeightItem(nOldFontHgt));
+ SetItem(SvxFontHeightItem(nOldFontHgt));
+//-/ SdrOutlinerSetItem aSI(*pOutlAttr);
+//-/ aSI.GetItemSet().Put(SvxFontHeightItem(nOldFontHgt));
+//-/ pOutlAttr=(SdrOutlinerSetItem*)ImpSetNewAttr(pOutlAttr,&aSI);
}
// erst jetzt den Outliner holen, etc. damit obiges SetAttr auch wirkt
SdrOutliner& rOutliner=ImpGetDrawOutliner();
@@ -522,9 +556,10 @@ void SdrTextObj::SetModel(SdrModel* pNewModel)
if (bSetHgtItem) {
// Und nun noch das Rahmenattribut korregieren
nOldFontHgt=BigMulDiv(nOldFontHgt,aMetricFactor.GetNumerator(),aMetricFactor.GetDenominator());
- SdrOutlinerSetItem aSI(*pOutlAttr);
- aSI.GetItemSet().Put(SvxFontHeightItem(nOldFontHgt));
- pOutlAttr=(SdrOutlinerSetItem*)ImpSetNewAttr(pOutlAttr,&aSI);
+ SetItem(SvxFontHeightItem(nOldFontHgt));
+//-/ SdrOutlinerSetItem aSI(*pOutlAttr);
+//-/ aSI.GetItemSet().Put(SvxFontHeightItem(nOldFontHgt));
+//-/ pOutlAttr=(SdrOutlinerSetItem*)ImpSetNewAttr(pOutlAttr,&aSI);
}
}
SetOutlinerParaObject(rOutliner.CreateParaObject()); // #34494#
@@ -564,21 +599,19 @@ SdrOutliner& SdrTextObj::ImpGetDrawOutliner() const
FASTBOOL SdrTextObj::NbcSetEckenradius(long nRad)
{
- if (pMiscAttr!=NULL) {
- SdrMiscSetItem aSI(*pMiscAttr);
- aSI.GetItemSet().Put(SdrEckenradiusItem(nRad));
- pMiscAttr=(SdrMiscSetItem*)ImpSetNewAttr(pMiscAttr,&aSI);
- return TRUE;
- }
- return FALSE;
+//-/ if(mpObjectItemSet)
+//-/ {
+ SetItem(SdrEckenradiusItem(nRad));
+ return TRUE;
+//-/ }
+//-/ return FALSE;
}
FASTBOOL SdrTextObj::NbcSetAutoGrowHeight(FASTBOOL bAuto)
{
- if (pMiscAttr!=NULL && bTextFrame) {
- SdrMiscSetItem aSI(*pMiscAttr);
- aSI.GetItemSet().Put(SdrTextAutoGrowHeightItem(bAuto));
- pMiscAttr=(SdrMiscSetItem*)ImpSetNewAttr(pMiscAttr,&aSI);
+ if(bTextFrame)
+ {
+ SetItem(SdrTextAutoGrowHeightItem(bAuto));
return TRUE;
}
return FALSE;
@@ -586,10 +619,9 @@ FASTBOOL SdrTextObj::NbcSetAutoGrowHeight(FASTBOOL bAuto)
FASTBOOL SdrTextObj::NbcSetMinTextFrameHeight(long nHgt)
{
- if (pMiscAttr!=NULL && bTextFrame) {
- SdrMiscSetItem aSI(*pMiscAttr);
- aSI.GetItemSet().Put(SdrTextMinFrameHeightItem(nHgt));
- pMiscAttr=(SdrMiscSetItem*)ImpSetNewAttr(pMiscAttr,&aSI);
+ if(bTextFrame)
+ {
+ SetItem(SdrTextMinFrameHeightItem(nHgt));
return TRUE;
}
return FALSE;
@@ -597,10 +629,9 @@ FASTBOOL SdrTextObj::NbcSetMinTextFrameHeight(long nHgt)
FASTBOOL SdrTextObj::NbcSetMaxTextFrameHeight(long nHgt)
{
- if (pMiscAttr!=NULL && bTextFrame) {
- SdrMiscSetItem aSI(*pMiscAttr);
- aSI.GetItemSet().Put(SdrTextMaxFrameHeightItem(nHgt));
- pMiscAttr=(SdrMiscSetItem*)ImpSetNewAttr(pMiscAttr,&aSI);
+ if(bTextFrame)
+ {
+ SetItem(SdrTextMaxFrameHeightItem(nHgt));
return TRUE;
}
return FALSE;
@@ -608,10 +639,9 @@ FASTBOOL SdrTextObj::NbcSetMaxTextFrameHeight(long nHgt)
FASTBOOL SdrTextObj::NbcSetAutoGrowWidth(FASTBOOL bAuto)
{
- if (pMiscAttr!=NULL && bTextFrame) {
- SdrMiscSetItem aSI(*pMiscAttr);
- aSI.GetItemSet().Put(SdrTextAutoGrowWidthItem(bAuto));
- pMiscAttr=(SdrMiscSetItem*)ImpSetNewAttr(pMiscAttr,&aSI);
+ if(bTextFrame)
+ {
+ SetItem(SdrTextAutoGrowWidthItem(bAuto));
return TRUE;
}
return FALSE;
@@ -619,14 +649,14 @@ FASTBOOL SdrTextObj::NbcSetAutoGrowWidth(FASTBOOL bAuto)
FASTBOOL SdrTextObj::NbcSetMinTextFrameWidth(long nWdt)
{
- if (pMiscAttr!=NULL && bTextFrame) {
- SdrMiscSetItem aSI(*pMiscAttr);
- aSI.GetItemSet().Put(SdrTextMinFrameWidthItem(nWdt));
- if (bDisableAutoWidthOnDragging) {
- bDisableAutoWidthOnDragging=FALSE;
- aSI.GetItemSet().Put(SdrTextAutoGrowWidthItem(FALSE));
+ if(bTextFrame)
+ {
+ SetItem(SdrTextMinFrameWidthItem(nWdt));
+ if(bDisableAutoWidthOnDragging)
+ {
+ bDisableAutoWidthOnDragging = FALSE;
+ SetItem(SdrTextAutoGrowWidthItem(FALSE));
}
- pMiscAttr=(SdrMiscSetItem*)ImpSetNewAttr(pMiscAttr,&aSI);
return TRUE;
}
return FALSE;
@@ -634,10 +664,9 @@ FASTBOOL SdrTextObj::NbcSetMinTextFrameWidth(long nWdt)
FASTBOOL SdrTextObj::NbcSetMaxTextFrameWidth(long nWdt)
{
- if (pMiscAttr!=NULL && bTextFrame) {
- SdrMiscSetItem aSI(*pMiscAttr);
- aSI.GetItemSet().Put(SdrTextMaxFrameWidthItem(nWdt));
- pMiscAttr=(SdrMiscSetItem*)ImpSetNewAttr(pMiscAttr,&aSI);
+ if(bTextFrame)
+ {
+ SetItem(SdrTextMaxFrameWidthItem(nWdt));
return TRUE;
}
return FALSE;
@@ -645,10 +674,9 @@ FASTBOOL SdrTextObj::NbcSetMaxTextFrameWidth(long nWdt)
FASTBOOL SdrTextObj::NbcSetFitToSize(SdrFitToSizeType eFit)
{
- if (pMiscAttr!=NULL && bTextFrame) {
- SdrMiscSetItem aSI(*pMiscAttr);
- aSI.GetItemSet().Put(SdrTextFitToSizeTypeItem(eFit));
- pMiscAttr=(SdrMiscSetItem*)ImpSetNewAttr(pMiscAttr,&aSI);
+ if(bTextFrame)
+ {
+ SetItem(SdrTextFitToSizeTypeItem(eFit));
return TRUE;
}
return FALSE;
@@ -984,7 +1012,13 @@ FASTBOOL SdrTextObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoR
{
rOutliner.SetUpdateMode(TRUE); // hier kann ggf. noch optimiert werden !!!
ImpTextPortionHandler aTPHandler(rOutliner,*this);
- rXOut.SetTextAttr(*pTextAttr);
+
+//-/ rXOut.SetTextAttr(*pTextAttr);
+//-/ const SfxItemSet& rSet = GetItemSet();
+//-/ XTextAttrSetItem aTextSetItem(rSet.GetPool());
+//-/ aTextSetItem.GetItemSet().Put(rSet);
+ rXOut.SetTextAttr(GetItemSet());
+
aTPHandler.DrawTextToPath(rXOut); // drucken bei aktivem Textedit fehlt hier
rOutliner.Clear();
}
@@ -1184,18 +1218,23 @@ void SdrTextObj::StopTextAnimation(OutputDevice* pOutDev, long nExtraData)
}
FASTBOOL SdrTextObj::ImpPaintAnimatedText(OutputDevice& rOut, const Point& rOffset,
- SdrOutliner& rOutliner, const Rectangle& rAnchorRect, const Rectangle& rPaintRect, const SdrPaintInfoRec& rInfoRec) const
-{
- if (pMiscAttr==NULL) return FALSE;
- const SfxItemSet& rSet=pMiscAttr->GetItemSet();
- SdrTextAniKind eAniKind=GetTextAniKind();
- FASTBOOL bBlink=eAniKind==SDRTEXTANI_BLINK;
- SdrTextAniDirection eDirection=((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue();
- ImpSdrMtfAnimator* pAnimator=((SdrTextObj*)this)->ImpForceMtfAnimator();
+ SdrOutliner& rOutliner, const Rectangle& rAnchorRect, const Rectangle& rPaintRect,
+ const SdrPaintInfoRec& rInfoRec) const
+{
+//-/ if(!mpObjectItemSet)
+//-/ return FALSE;
+
+ SdrTextAniKind eAniKind = GetTextAniKind();
+ FASTBOOL bBlink = eAniKind == SDRTEXTANI_BLINK;
+ const SfxItemSet& rSet = GetItemSet();
+ SdrTextAniDirection eDirection = ((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue();
+ ImpSdrMtfAnimator* pAnimator = ((SdrTextObj*)this)->ImpForceMtfAnimator();
pAnimator->SetAnimationNotifyHdl(LINK(this,SdrTextObj,ImpAnimationHdl));
+
// erstmal checken, ob nicht schon laeuft
- ImpMtfAnimationInfo* pRunningInfo=NULL;
- for (ULONG nInfoNum=pAnimator->GetInfoCount(); nInfoNum>0 && pRunningInfo==NULL;) {
+ ImpMtfAnimationInfo* pRunningInfo = NULL;
+
+ for(ULONG nInfoNum = pAnimator->GetInfoCount(); nInfoNum>0 && pRunningInfo==NULL;) {
nInfoNum--;
ImpMtfAnimationInfo* pInfo=pAnimator->GetInfo(nInfoNum);
if (pInfo->pPageView==rInfoRec.pPV && pInfo->pOutDev==&rOut) {
@@ -1331,7 +1370,16 @@ void SdrTextObj::ImpAddTextToBoundRect()
SdrOutliner& rOutl=ImpGetDrawOutliner();
rOutl.SetUpdateMode(TRUE);
ImpTextPortionHandler aTPHandler(rOutl,*this);
- aXOut.SetTextAttr(*pTextAttr);
+
+//-/ if(mpObjectItemSet)
+//-/ {
+//-/ const SfxItemSet& rSet = GetItemSet();
+//-/ XTextAttrSetItem aTextSetItem(rSet.GetPool());
+//-/ aTextSetItem.GetItemSet().Put(rSet);
+ aXOut.SetTextAttr(GetItemSet());
+//-/ aXOut.SetTextAttr(*pTextAttr);
+//-/ }
+
aTPHandler.DrawTextToPath(aXOut,FALSE);
if (pFormTextBoundRect==NULL) pFormTextBoundRect=new Rectangle;
*pFormTextBoundRect=aTPHandler.GetFormTextBoundRect();
@@ -1575,9 +1623,9 @@ void SdrTextObj::RecalcSnapRect()
Polygon aPol(aRect);
if (aGeo.nShearWink!=0) ShearPoly(aPol,aRect.TopLeft(),aGeo.nTan);
if (aGeo.nDrehWink!=0) RotatePoly(aPol,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
- aSnapRect=aPol.GetBoundRect();
+ maSnapRect=aPol.GetBoundRect();
} else {
- aSnapRect=aRect;
+ maSnapRect=aRect;
}
}
@@ -1610,6 +1658,22 @@ void SdrTextObj::ImpCheckMasterCachable()
}
}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// pre- and postprocessing for objects for saving
+
+void SdrTextObj::PreSave()
+{
+ // call parent
+ SdrAttrObj::PreSave();
+
+ // Prepare OutlinerParaObjects for storing
+ OutlinerParaObject* pParaObj = GetOutlinerParaObject();
+ if(pParaObj && GetModel())
+ pParaObj->PrepareStore((SfxStyleSheetPool*)GetModel()->GetStyleSheetPool());
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
OutlinerParaObject* SdrTextObj::GetOutlinerParaObject() const
{
return pOutlinerParaObject;
@@ -1826,15 +1890,16 @@ void SdrTextObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
rIn>>*pFormTextBoundRect;
}
}
- if (rHead.GetVersion()<12 && !bTextFrame) {
- SdrMiscSetItem aMisc(*pMiscAttr);
- aMisc.GetItemSet().Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER));
- aMisc.GetItemSet().Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
- pMiscAttr=(SdrMiscSetItem*)ImpSetNewAttr(pMiscAttr,&aMisc);
- SdrOutlinerSetItem aOutl(*pOutlAttr);
- aOutl.GetItemSet().Put(SvxAdjustItem(SVX_ADJUST_CENTER));
- pOutlAttr=(SdrOutlinerSetItem*)ImpSetNewAttr(pOutlAttr,&aOutl);
+
+ if(rHead.GetVersion() < 12 && !bTextFrame)
+ {
+ SetItem(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER));
+ SetItem(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
+//-/ SdrOutlinerSetItem aOutl(*pOutlAttr);
+//-/ aOutl.GetItemSet().Put(SvxAdjustItem(SVX_ADJUST_CENTER));
+ SetItem(SvxAdjustItem(SVX_ADJUST_CENTER));
}
+
if (bTextFrame && pOutlinerParaObject!=NULL)
NbcAdjustTextFrameWidthAndHeight();
@@ -1842,7 +1907,7 @@ void SdrTextObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn)
pOutlinerParaObject->GetTextObject().GetVersion() < 500 &&
!pOutlinerParaObject->IsEditDoc() )
{
- pOutlinerParaObject->MergeParaAttribs( pOutlAttr->GetItemSet() );
+ pOutlinerParaObject->MergeParaAttribs( GetItemSet() );
}
ImpSetTextStyleSheetListeners();
@@ -1976,10 +2041,8 @@ SdrFitToSizeType SdrTextObj::GetFitToSize() const
{
SdrFitToSizeType eType = SDRTEXTFIT_NONE;
- if( pMiscAttr && !IsAutoGrowWidth() )
- {
- eType = ((SdrTextFitToSizeTypeItem&)(pMiscAttr->GetItemSet().Get(SDRATTR_TEXT_FITTOSIZE))).GetValue();
- }
+ if(!IsAutoGrowWidth())
+ eType = ((SdrTextFitToSizeTypeItem&)(GetItem(SDRATTR_TEXT_FITTOSIZE))).GetValue();
return eType;
}
diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx
index e037f847421f..7f8ae1e5d302 100644
--- a/svx/source/svdraw/svdotxat.cxx
+++ b/svx/source/svdraw/svdotxat.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdotxat.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:01:25 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -198,21 +198,21 @@ void SdrTextObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontR
if (nParaCount!=0) {
for (USHORT nPara=0; nPara<nParaCount; nPara++)
{
- if ( pStyleSheet )
+ if ( GetStyleSheet() )
{
if( nPara > 0 && eTextKind == OBJ_OUTLINETEXT && GetObjInventor() == SdrInventor )
{
- String aNewStyleSheetName( pStyleSheet->GetName() );
+ String aNewStyleSheetName( GetStyleSheet()->GetName() );
aNewStyleSheetName.Erase( aNewStyleSheetName.Len()-1, 1 );
aNewStyleSheetName += String::CreateFromInt32( rOutliner.GetDepth( nPara ) );
SfxStyleSheetBasePool* pStylePool = pModel!=NULL ? pModel->GetStyleSheetPool() : NULL;
- SfxStyleSheet* pNewStyle = (SfxStyleSheet*) pStylePool->Find( aNewStyleSheetName, pStyleSheet->GetFamily() );
+ 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, pStyleSheet );
+ rOutliner.SetStyleSheet( nPara, GetStyleSheet() );
}
else
rOutliner.SetStyleSheet( nPara, NULL ); // StyleSheet entfernen
@@ -245,32 +245,275 @@ void SdrTextObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontR
}
}
-void SdrTextObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/void SdrTextObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/{
+//-/ SfxItemSet aAttr( rAttr );
+//-/
+//-/ BOOL bCreateLRSpaceItems = FALSE;
+//-/
+//-/ if ( aAttr.GetItemState( EE_PARA_LRSPACE ) == SFX_ITEM_ON )
+//-/ {
+//-/ // SvxLRSpaceItem hart gesetzt: SvxNumBulletItem anpassen
+//-/ SfxItemSet aSet( *aAttr.GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE, 0 );
+//-/ TakeAttributes( aSet, TRUE, TRUE);
+//-/
+//-/ if ( aSet.GetItemState( EE_PARA_LRSPACE ) != SFX_ITEM_ON ||
+//-/ ((const SvxLRSpaceItem&) aSet.Get( EE_PARA_LRSPACE )) !=
+//-/ ((const SvxLRSpaceItem&) aAttr.Get( EE_PARA_LRSPACE )) )
+//-/ {
+//-/ SvxNumBulletItem* pNumBullet = NULL;
+//-/
+//-/ if ( aAttr.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
+//-/ pNumBullet = new SvxNumBulletItem( (const SvxNumBulletItem&) aAttr.Get(EE_PARA_NUMBULLET) );
+//-/ else
+//-/ {
+//-/ pNumBullet = new SvxNumBulletItem( (const SvxNumBulletItem&) aSet.Get(EE_PARA_NUMBULLET) );
+//-/
+//-/ if( eTextKind == OBJ_OUTLINETEXT &&
+//-/ pNumBullet->GetNumRule()->GetNumRuleType() != SVX_RULETYPE_PRESENTATION_NUMBERING )
+//-/ {
+//-/ // Das ist das 10er-Item aus den Defaults.
+//-/ // Dieses darf bei Gliederungsobjekten nicht verwendet werden!
+//-/ // Daher wird das Item aus der Vorlage geholt
+//-/ delete pNumBullet;
+//-/ pNumBullet = NULL;
+//-/
+//-/ if( GetStyleSheet() &&
+//-/ GetStyleSheet()->GetItemSet().GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
+//-/ pNumBullet = new SvxNumBulletItem( (const SvxNumBulletItem&) GetStyleSheet()->GetItemSet().Get(EE_PARA_NUMBULLET) );
+//-/ }
+//-/ }
+//-/
+//-/ if( pNumBullet )
+//-/ {
+//-/ USHORT nLevel = 0;
+//-/ if( pNumBullet->GetNumRule()->GetNumRuleType() == SVX_RULETYPE_PRESENTATION_NUMBERING )
+//-/ nLevel = 1;
+//-/
+//-/ EditEngine::ImportBulletItem( *pNumBullet, nLevel, NULL,
+//-/ &(const SvxLRSpaceItem&) aAttr.Get( EE_PARA_LRSPACE ) );
+//-/ ( (SfxItemSet&) aAttr).Put( *pNumBullet );
+//-/
+//-/ delete pNumBullet;
+//-/ }
+//-/ else
+//-/ DBG_ASSERT(FALSE, "SdrTextObj::NbcSetAttributes: SvxNumBulletItem nicht angepasst!");
+//-/ }
+//-/ }
+//-/ else if ( aAttr.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
+//-/ {
+//-/ // SvxNumBulletItem hart gesetzt: SvxLRSpaceItem anpassen
+//-/ SfxItemSet aSet( *aAttr.GetPool(), EE_PARA_NUMBULLET, EE_PARA_NUMBULLET, 0 );
+//-/ TakeAttributes( aSet, TRUE, TRUE);
+//-/
+//-/ if ( aSet.GetItemState( EE_PARA_NUMBULLET ) != SFX_ITEM_ON ||
+//-/ ((const SvxNumBulletItem&) aSet.Get( EE_PARA_NUMBULLET )) !=
+//-/ ((const SvxNumBulletItem&) aAttr.Get( EE_PARA_NUMBULLET )) )
+//-/ {
+//-/ SvxLRSpaceItem aLRSpace( (const SvxLRSpaceItem&) aSet.Get(EE_PARA_LRSPACE) );
+//-/ USHORT nLevel = 0;
+//-/ if( eTextKind == OBJ_OUTLINETEXT )
+//-/ nLevel = 1;
+//-/
+//-/ if ( Outliner::CreateLRSpaceItem( (const SvxNumBulletItem&) aAttr.Get( EE_PARA_NUMBULLET ), nLevel, aLRSpace ) )
+//-/ ( (SfxItemSet&) aAttr).Put( aLRSpace );
+//-/
+//-/ bCreateLRSpaceItems = TRUE;
+//-/ }
+//-/ }
+//-/
+//-/ if ( aAttr.GetItemState( SDRATTR_TEXT_CONTOURFRAME ) == SFX_ITEM_ON )
+//-/ {
+//-/ // Extra-Repaint wenn das Layout so radikal geaendert wird (#43139#)
+//-/ SendRepaintBroadcast();
+//-/
+//-/ if(IsTextEditActive())
+//-/ {
+//-/ // Text wird gerade editiert, zusaetzlich redraw auf EditText
+//-/ const EditEngine& rEditEng = pEdtOutl->GetEditEngine();
+//-/ for(UINT16 a=0;a<rEditEng.GetViewCount();a++)
+//-/ {
+//-/ EditView* pEdView = rEditEng.GetView(a);
+//-/
+//-/ if(pEdView)
+//-/ {
+//-/ pEdView->Invalidate();
+//-/ }
+//-/ }
+//-/ }
+//-/ }
+//-/
+//-/ SdrAttrObj::NbcSetAttributes(aAttr,bReplaceAll);
+//-/ FASTBOOL bGrowChecked=FALSE;
+//-/ // Attribute auf den gesamten Text anwenden
+//-/ if (pOutlinerParaObject!=NULL)
+//-/ {
+//-/ if ((pEdtOutl==NULL || bCreateLRSpaceItems) && !IsLinkedText())
+//-/ {
+//-/ // #46762# Sonderbehandlung fuer bReplaceAll
+//-/ if (SearchOutlinerItems(aAttr,bReplaceAll))
+//-/ {
+//-/ Outliner* pOutliner;
+//-/ if(pEdtOutl == NULL)
+//-/ {
+//-/ pOutliner = &ImpGetDrawOutliner();
+//-/ pOutliner->SetText(*pOutlinerParaObject);
+//-/ }
+//-/ else
+//-/ {
+//-/ pOutliner = pEdtOutl;
+//-/ }
+//-/ USHORT nParaCount=(USHORT)pOutliner->GetParagraphCount();
+//-/ if (nParaCount!=0)
+//-/ {
+//-/ for (USHORT nPara=0; nPara<nParaCount; nPara++)
+//-/ {
+//-/ // Neue Attribute mit alten (bereits vorhandenen) mergen
+//-/ SfxItemSet aTmpSet(pOutliner->GetParaAttribs(nPara));
+//-/
+//-/ SvxLRSpaceItem aLRSpace( (const SvxLRSpaceItem&) aTmpSet.Get(EE_PARA_LRSPACE) );
+//-/
+//-/ if(pEdtOutl==NULL)
+//-/ {
+//-/ if(bReplaceAll)
+//-/ {
+//-/ // #46762#: bReplaceAll beachten
+//-/ SfxWhichIter aIter(aAttr);
+//-/ USHORT nWh=aIter.FirstWhich();
+//-/ while (nWh!=0)
+//-/ {
+//-/ if (nWh>=EE_ITEMS_START && nWh<=EE_ITEMS_END)
+//-/ {
+//-/ SfxItemState eState=aAttr.GetItemState(nWh,FALSE);
+//-/ if (eState==SFX_ITEM_DEFAULT) aTmpSet.ClearItem(nWh);
+//-/ }
+//-/ nWh=aIter.NextWhich();
+//-/ }
+//-/ }
+//-/ aTmpSet.Put(aAttr,FALSE); // FALSE= InvalidItems nicht als Default, sondern als "Loecher" betrachten
+//-/ }
+//-/
+//-/ if(bCreateLRSpaceItems)
+//-/ {
+//-/ const INT16 nLevel = pOutliner->GetDepth( nPara );
+//-/
+//-/ if ( Outliner::CreateLRSpaceItem( (const SvxNumBulletItem&) aAttr.Get( EE_PARA_NUMBULLET ), nLevel, aLRSpace ) )
+//-/ aTmpSet.Put( aLRSpace );
+//-/ }
+//-/
+//-/ pOutliner->SetParaAttribs(nPara,aTmpSet);
+//-/
+//-/ if(pEdtOutl==NULL)
+//-/ {
+//-/ // Fuer alle hinzugekommenen Attribute:
+//-/ // entsprechende CharAttribs entfernen.
+//-/ if (bReplaceAll)
+//-/ {
+//-/ if( aAttr.Count() == 0 && aTmpSet.Count() == 0 )
+//-/ {
+//-/ // Format -> Standard
+//-/ pOutliner->QuickRemoveCharAttribs(nPara, 0);
+//-/ }
+//-/ else
+//-/ {
+//-/ SfxItemIter aIter( aTmpSet );
+//-/ const SfxPoolItem* pItem = aIter.FirstItem();
+//-/ while ( pItem )
+//-/ {
+//-/ if ( !IsInvalidItem(pItem) )
+//-/ {
+//-/ USHORT nW = pItem->Which();
+//-/ if ( nW >= EE_CHAR_START && nW <= EE_CHAR_END )
+//-/ pOutliner->QuickRemoveCharAttribs( nPara, nW );
+//-/ }
+//-/
+//-/ pItem=aIter.NextItem();
+//-/ }
+//-/ }
+//-/ }
+//-/ }
+//-/ }
+//-/ if(pEdtOutl == NULL)
+//-/ {
+//-/ OutlinerParaObject* pTemp=pOutliner->CreateParaObject( 0, nParaCount );
+//-/ pOutliner->Clear();
+//-/ NbcSetOutlinerParaObject(pTemp);
+//-/ }
+//-/ bGrowChecked=TRUE;
+//-/ }
+//-/ }
+//-/ }
+//-/
+//-/ // #36989#: AutoGrow auch bei TextEdit
+//-/ if (bTextFrame && !bGrowChecked)
+//-/ {
+//-/ NbcAdjustTextFrameWidthAndHeight();
+//-/ bGrowChecked=TRUE;
+//-/ }
+//-/ }
+//-/}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrTextObj::SetItem( const SfxPoolItem& rItem )
{
- SfxItemSet aAttr( rAttr );
+ const SfxItemSet& rSet = GetItemSet();
+
+ if(rSet.Get(rItem.Which()) != rItem)
+ {
+ SfxItemSet aNewSet(rSet);
+ aNewSet.Put(rItem);
+ SdrTextObj::SetItemSet(aNewSet);
+ }
+ else
+ SdrAttrObj::SetItem(rItem);
+}
- BOOL bCreateLRSpaceItems = FALSE;
+void SdrTextObj::ClearItem( USHORT nWhich )
+{
+ const SfxItemSet& rSet = GetItemSet();
- if ( aAttr.GetItemState( EE_PARA_LRSPACE ) == SFX_ITEM_ON )
+ if(SFX_ITEM_UNKNOWN != rSet.GetItemState(nWhich))
{
- // SvxLRSpaceItem hart gesetzt: SvxNumBulletItem anpassen
- SfxItemSet aSet( *aAttr.GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE, 0 );
- TakeAttributes( aSet, TRUE, TRUE);
+ SfxItemSet aNewSet(rSet);
+ aNewSet.ClearItem(nWhich);
+ SdrTextObj::SetItemSet(aNewSet);
+ }
+ else
+ SdrAttrObj::ClearItem(nWhich);
+}
+
+void SdrTextObj::SetItemSet( const SfxItemSet& rSet )
+{
+ ImpCheckItemSetChanges(rSet);
+ SdrAttrObj::SetItemSet(rSet);
+}
+
+void SdrTextObj::ImpCheckItemSetChanges(const SfxItemSet& rAttr)
+{
+ BOOL bReplaceAll = TRUE;
+ BOOL bCreateLRSpaceItems(FALSE);
+ const SfxItemSet& rSet = GetItemSet();
- if ( aSet.GetItemState( EE_PARA_LRSPACE ) != SFX_ITEM_ON ||
- ((const SvxLRSpaceItem&) aSet.Get( EE_PARA_LRSPACE )) !=
- ((const SvxLRSpaceItem&) aAttr.Get( EE_PARA_LRSPACE )) )
+ if(SFX_ITEM_ON == rAttr.GetItemState(EE_PARA_LRSPACE))
+ {
+ // SvxLRSpaceItem hart gesetzt: SvxNumBulletItem anpassen
+ if(rSet.GetItemState(EE_PARA_LRSPACE) != SFX_ITEM_ON
+ || ((const SvxLRSpaceItem&)rSet.Get(EE_PARA_LRSPACE))
+ != ((const SvxLRSpaceItem&)rAttr.Get(EE_PARA_LRSPACE)))
{
SvxNumBulletItem* pNumBullet = NULL;
- if ( aAttr.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
- pNumBullet = new SvxNumBulletItem( (const SvxNumBulletItem&) aAttr.Get(EE_PARA_NUMBULLET) );
+ if(SFX_ITEM_ON == rAttr.GetItemState(EE_PARA_NUMBULLET))
+ {
+ pNumBullet = new SvxNumBulletItem((const SvxNumBulletItem&)rAttr.Get(EE_PARA_NUMBULLET));
+ }
else
{
- pNumBullet = new SvxNumBulletItem( (const SvxNumBulletItem&) aSet.Get(EE_PARA_NUMBULLET) );
+ pNumBullet = new SvxNumBulletItem((const SvxNumBulletItem&)rSet.Get(EE_PARA_NUMBULLET));
- if( eTextKind == OBJ_OUTLINETEXT &&
- pNumBullet->GetNumRule()->GetNumRuleType() != SVX_RULETYPE_PRESENTATION_NUMBERING )
+ if(OBJ_OUTLINETEXT == eTextKind
+ && pNumBullet->GetNumRule()->GetNumRuleType() != SVX_RULETYPE_PRESENTATION_NUMBERING)
{
// Das ist das 10er-Item aus den Defaults.
// Dieses darf bei Gliederungsobjekten nicht verwendet werden!
@@ -278,21 +521,26 @@ void SdrTextObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
delete pNumBullet;
pNumBullet = NULL;
- if( pStyleSheet &&
- pStyleSheet->GetItemSet().GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
- pNumBullet = new SvxNumBulletItem( (const SvxNumBulletItem&) pStyleSheet->GetItemSet().Get(EE_PARA_NUMBULLET) );
+ if(GetStyleSheet()
+ && SFX_ITEM_ON == GetStyleSheet()->GetItemSet().GetItemState(EE_PARA_NUMBULLET))
+ {
+ pNumBullet = new SvxNumBulletItem((const SvxNumBulletItem&)
+ GetStyleSheet()->GetItemSet().Get(EE_PARA_NUMBULLET));
+ }
}
}
- if( pNumBullet )
+ if(pNumBullet)
{
- USHORT nLevel = 0;
- if( pNumBullet->GetNumRule()->GetNumRuleType() == SVX_RULETYPE_PRESENTATION_NUMBERING )
+ sal_uInt16 nLevel(0);
+
+ if(pNumBullet->GetNumRule()->GetNumRuleType() == SVX_RULETYPE_PRESENTATION_NUMBERING)
nLevel = 1;
- EditEngine::ImportBulletItem( *pNumBullet, nLevel, NULL,
- &(const SvxLRSpaceItem&) aAttr.Get( EE_PARA_LRSPACE ) );
- ( (SfxItemSet&) aAttr).Put( *pNumBullet );
+ EditEngine::ImportBulletItem(*pNumBullet, nLevel, NULL,
+ &(const SvxLRSpaceItem&)rAttr.Get(EE_PARA_LRSPACE));
+
+ ((SfxItemSet&)rAttr).Put(*pNumBullet);
delete pNumBullet;
}
@@ -300,29 +548,32 @@ void SdrTextObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
DBG_ASSERT(FALSE, "SdrTextObj::NbcSetAttributes: SvxNumBulletItem nicht angepasst!");
}
}
- else if ( aAttr.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
+ else if(SFX_ITEM_ON == rAttr.GetItemState(EE_PARA_NUMBULLET))
{
// SvxNumBulletItem hart gesetzt: SvxLRSpaceItem anpassen
- SfxItemSet aSet( *aAttr.GetPool(), EE_PARA_NUMBULLET, EE_PARA_NUMBULLET, 0 );
- TakeAttributes( aSet, TRUE, TRUE);
-
- if ( aSet.GetItemState( EE_PARA_NUMBULLET ) != SFX_ITEM_ON ||
- ((const SvxNumBulletItem&) aSet.Get( EE_PARA_NUMBULLET )) !=
- ((const SvxNumBulletItem&) aAttr.Get( EE_PARA_NUMBULLET )) )
+ SfxItemSet aSet(*rAttr.GetPool(),
+ EE_PARA_NUMBULLET, EE_PARA_NUMBULLET,
+ 0, 0);
+ aSet.Put(rSet);
+
+ if(SFX_ITEM_ON != aSet.GetItemState(EE_PARA_NUMBULLET)
+ || ((const SvxNumBulletItem&)aSet.Get(EE_PARA_NUMBULLET))
+ != ((const SvxNumBulletItem&) rAttr.Get(EE_PARA_NUMBULLET)))
{
- SvxLRSpaceItem aLRSpace( (const SvxLRSpaceItem&) aSet.Get(EE_PARA_LRSPACE) );
- USHORT nLevel = 0;
- if( eTextKind == OBJ_OUTLINETEXT )
+ SvxLRSpaceItem aLRSpace((const SvxLRSpaceItem&)aSet.Get(EE_PARA_LRSPACE));
+ sal_uInt16 nLevel(0);
+
+ if(eTextKind == OBJ_OUTLINETEXT)
nLevel = 1;
- if ( Outliner::CreateLRSpaceItem( (const SvxNumBulletItem&) aAttr.Get( EE_PARA_NUMBULLET ), nLevel, aLRSpace ) )
- ( (SfxItemSet&) aAttr).Put( aLRSpace );
+ if(Outliner::CreateLRSpaceItem((const SvxNumBulletItem&)rAttr.Get(EE_PARA_NUMBULLET), nLevel, aLRSpace))
+ ((SfxItemSet&)rAttr).Put(aLRSpace);
bCreateLRSpaceItems = TRUE;
}
}
- if ( aAttr.GetItemState( SDRATTR_TEXT_CONTOURFRAME ) == SFX_ITEM_ON )
+ if(rAttr.GetItemState(SDRATTR_TEXT_CONTOURFRAME) == SFX_ITEM_ON)
{
// Extra-Repaint wenn das Layout so radikal geaendert wird (#43139#)
SendRepaintBroadcast();
@@ -331,30 +582,27 @@ void SdrTextObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
{
// Text wird gerade editiert, zusaetzlich redraw auf EditText
const EditEngine& rEditEng = pEdtOutl->GetEditEngine();
- for(UINT16 a=0;a<rEditEng.GetViewCount();a++)
+ for(sal_uInt16 a(0); a < rEditEng.GetViewCount(); a++)
{
EditView* pEdView = rEditEng.GetView(a);
-
if(pEdView)
- {
pEdView->Invalidate();
- }
}
}
}
- SdrAttrObj::NbcSetAttributes(aAttr,bReplaceAll);
- FASTBOOL bGrowChecked=FALSE;
+ BOOL bGrowChecked(FALSE);
// Attribute auf den gesamten Text anwenden
- if (pOutlinerParaObject!=NULL)
+ if(pOutlinerParaObject)
{
- if ((pEdtOutl==NULL || bCreateLRSpaceItems) && !IsLinkedText())
+ if((!pEdtOutl || bCreateLRSpaceItems) && !IsLinkedText())
{
// #46762# Sonderbehandlung fuer bReplaceAll
- if (SearchOutlinerItems(aAttr,bReplaceAll))
+ if(SearchOutlinerItems(rAttr, bReplaceAll))
{
Outliner* pOutliner;
- if(pEdtOutl == NULL)
+
+ if(!pEdtOutl)
{
pOutliner = &ImpGetDrawOutliner();
pOutliner->SetText(*pOutlinerParaObject);
@@ -363,96 +611,104 @@ void SdrTextObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
{
pOutliner = pEdtOutl;
}
- USHORT nParaCount=(USHORT)pOutliner->GetParagraphCount();
- if (nParaCount!=0)
+
+ sal_uInt16 nParaCount((USHORT)pOutliner->GetParagraphCount());
+
+ if(nParaCount)
{
- for (USHORT nPara=0; nPara<nParaCount; nPara++)
+ for(sal_uInt16 nPara(0); nPara < nParaCount; nPara++)
{
// Neue Attribute mit alten (bereits vorhandenen) mergen
SfxItemSet aTmpSet(pOutliner->GetParaAttribs(nPara));
+ SvxLRSpaceItem aLRSpace((const SvxLRSpaceItem&)aTmpSet.Get(EE_PARA_LRSPACE));
- SvxLRSpaceItem aLRSpace( (const SvxLRSpaceItem&) aTmpSet.Get(EE_PARA_LRSPACE) );
-
- if(pEdtOutl==NULL)
+ if(!pEdtOutl)
{
if(bReplaceAll)
{
// #46762#: bReplaceAll beachten
- SfxWhichIter aIter(aAttr);
- USHORT nWh=aIter.FirstWhich();
- while (nWh!=0)
+ SfxWhichIter aIter(rAttr);
+ sal_uInt16 nWh(aIter.FirstWhich());
+
+ while(nWh)
{
- if (nWh>=EE_ITEMS_START && nWh<=EE_ITEMS_END)
+ if(nWh >= EE_ITEMS_START && nWh <= EE_ITEMS_END)
{
- SfxItemState eState=aAttr.GetItemState(nWh,FALSE);
- if (eState==SFX_ITEM_DEFAULT) aTmpSet.ClearItem(nWh);
+ SfxItemState eState = rAttr.GetItemState(nWh, FALSE);
+ if(eState == SFX_ITEM_DEFAULT)
+ aTmpSet.ClearItem(nWh);
}
- nWh=aIter.NextWhich();
+ nWh = aIter.NextWhich();
}
}
- aTmpSet.Put(aAttr,FALSE); // FALSE= InvalidItems nicht als Default, sondern als "Loecher" betrachten
+ aTmpSet.Put(rAttr, FALSE); // FALSE= InvalidItems nicht als Default, sondern als "Loecher" betrachten
}
if(bCreateLRSpaceItems)
{
- const INT16 nLevel = pOutliner->GetDepth( nPara );
+ const sal_Int16 nLevel(pOutliner->GetDepth(nPara));
- if ( Outliner::CreateLRSpaceItem( (const SvxNumBulletItem&) aAttr.Get( EE_PARA_NUMBULLET ), nLevel, aLRSpace ) )
- aTmpSet.Put( aLRSpace );
+ if( Outliner::CreateLRSpaceItem((const SvxNumBulletItem&)rAttr.Get(EE_PARA_NUMBULLET), nLevel, aLRSpace))
+ aTmpSet.Put(aLRSpace);
}
- pOutliner->SetParaAttribs(nPara,aTmpSet);
+ pOutliner->SetParaAttribs(nPara, aTmpSet);
- if(pEdtOutl==NULL)
+ if(!pEdtOutl)
{
// Fuer alle hinzugekommenen Attribute:
// entsprechende CharAttribs entfernen.
- if (bReplaceAll)
+ if(bReplaceAll)
{
- if( aAttr.Count() == 0 && aTmpSet.Count() == 0 )
+ if(!rAttr.Count() && !aTmpSet.Count())
{
// Format -> Standard
pOutliner->QuickRemoveCharAttribs(nPara, 0);
}
else
{
- SfxItemIter aIter( aTmpSet );
+ SfxItemIter aIter(aTmpSet);
const SfxPoolItem* pItem = aIter.FirstItem();
- while ( pItem )
+
+ while(pItem)
{
- if ( !IsInvalidItem(pItem) )
+ if (!IsInvalidItem(pItem))
{
- USHORT nW = pItem->Which();
- if ( nW >= EE_CHAR_START && nW <= EE_CHAR_END )
- pOutliner->QuickRemoveCharAttribs( nPara, nW );
- }
+ sal_uInt16 nW(pItem->Which());
- pItem=aIter.NextItem();
+ if(nW >= EE_CHAR_START && nW <= EE_CHAR_END)
+ pOutliner->QuickRemoveCharAttribs(nPara, nW);
+ }
+ pItem = aIter.NextItem();
}
}
}
}
}
- if(pEdtOutl == NULL)
+
+ if(!pEdtOutl)
{
- OutlinerParaObject* pTemp=pOutliner->CreateParaObject( 0, nParaCount );
+ OutlinerParaObject* pTemp = pOutliner->CreateParaObject(0, nParaCount);
pOutliner->Clear();
NbcSetOutlinerParaObject(pTemp);
}
- bGrowChecked=TRUE;
+
+ bGrowChecked = TRUE;
}
}
}
// #36989#: AutoGrow auch bei TextEdit
- if (bTextFrame && !bGrowChecked)
+ if(bTextFrame && !bGrowChecked)
{
NbcAdjustTextFrameWidthAndHeight();
- bGrowChecked=TRUE;
+ bGrowChecked = TRUE;
}
}
}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
void SdrTextObj::BurnInStyleSheetAttributes()
{
if ( pModel && pOutlinerParaObject && !pEdtOutl && !IsLinkedText() )
@@ -702,7 +958,7 @@ void SdrTextObj::ImpSetTextStyleSheetListeners()
SfxStyleSheetBase* pStyleBase=pStylePool->Find(*pName,eFam);
SfxStyleSheet* pStyle=PTR_CAST(SfxStyleSheet,pStyleBase);
delete pName;
- if (pStyle!=NULL && pStyle!=pStyleSheet) {
+ if (pStyle!=NULL && pStyle!=GetStyleSheet()) {
aStyles.Replace(pStyle,nNum);
} else {
aStyles.Remove(nNum);
@@ -714,7 +970,7 @@ void SdrTextObj::ImpSetTextStyleSheetListeners()
nNum--;
SfxBroadcaster* pBroadcast=GetBroadcasterJOE((USHORT)nNum);
SfxStyleSheet* pStyle=PTR_CAST(SfxStyleSheet,pBroadcast);
- if (pStyle!=NULL && pStyle!=pStyleSheet) { // Sonderbehandlung fuer den StyleSheet des Objekts
+ if (pStyle!=NULL && pStyle!=GetStyleSheet()) { // Sonderbehandlung fuer den StyleSheet des Objekts
if (aStyles.GetPos(pStyle)==CONTAINER_ENTRY_NOTFOUND) {
EndListening(*pStyle);
}
@@ -743,35 +999,44 @@ void SdrTextObj::NbcResizeTextAttributes(const Fraction& xFact, const Fraction&
if (nY<0) nY=-nY;
if (nY<1) nY=1;
if (nY>0xFFFF) nY=0xFFFF;
- if (nX!=100 || nY!=100) {
- if (pOutlAttr!=NULL) { // Rahmenattribute
- const SfxItemSet& rOldSet=pOutlAttr->GetItemSet();
- const SvxFontWidthItem& rOldWdt=(SvxFontWidthItem&)rOldSet.Get(EE_CHAR_FONTWIDTH);
- const SvxFontHeightItem& rOldHgt=(SvxFontHeightItem&)rOldSet.Get(EE_CHAR_FONTHEIGHT);
- // erstmal die alten Werte holen
- long nAbsWdt=rOldWdt.GetWidth();
- long nRelWdt=rOldWdt.GetProp();
- long nAbsHgt=rOldHgt.GetHeight();
- long nRelHgt=rOldHgt.GetProp();
- // Relative Breite aendern
- nRelWdt*=nX;
- nRelWdt/=nY;
- if (nRelWdt<0) nRelWdt=-nRelWdt; // nicht negativ
- if (nRelWdt<=0) nRelWdt=1; // und mind. 1%
- if (nRelWdt>0xFFFF) nRelWdt=0xFFFF;
- // Absolute Hoehe aendern
- nAbsHgt*=nY;
- nAbsHgt/=100;
- if (nAbsHgt<0) nAbsHgt=-nAbsHgt; // nicht negativ
- if (nAbsHgt<=0) nAbsHgt=1; // und mind. 1
- if (nAbsHgt>0xFFFF) nAbsHgt=0xFFFF;
- // und nun attributieren
- SdrOutlinerSetItem aNewOI(*pOutlAttr);
- SfxItemSet& rNewSet=aNewOI.GetItemSet();
- rNewSet.Put(SvxFontWidthItem((USHORT)nAbsWdt,(USHORT)nRelWdt));
- rNewSet.Put(SvxFontHeightItem(nAbsHgt,(USHORT)nRelHgt));
- pOutlAttr=(SdrOutlinerSetItem*)ImpSetNewAttr(pOutlAttr,&aNewOI);
- }
+ if (nX!=100 || nY!=100)
+ {
+//-/ if(mpObjectItemSet)
+//-/ {
+ // Rahmenattribute
+ const SfxItemSet& rSet = GetItemSet();
+ const SvxFontWidthItem& rOldWdt=(SvxFontWidthItem&)rSet.Get(EE_CHAR_FONTWIDTH);
+ const SvxFontHeightItem& rOldHgt=(SvxFontHeightItem&)rSet.Get(EE_CHAR_FONTHEIGHT);
+
+ // erstmal die alten Werte holen
+ long nAbsWdt=rOldWdt.GetWidth();
+ long nRelWdt=rOldWdt.GetProp();
+ long nAbsHgt=rOldHgt.GetHeight();
+ long nRelHgt=rOldHgt.GetProp();
+
+ // Relative Breite aendern
+ nRelWdt*=nX;
+ nRelWdt/=nY;
+ if (nRelWdt<0) nRelWdt=-nRelWdt; // nicht negativ
+ if (nRelWdt<=0) nRelWdt=1; // und mind. 1%
+ if (nRelWdt>0xFFFF) nRelWdt=0xFFFF;
+
+ // Absolute Hoehe aendern
+ nAbsHgt*=nY;
+ nAbsHgt/=100;
+ if (nAbsHgt<0) nAbsHgt=-nAbsHgt; // nicht negativ
+ if (nAbsHgt<=0) nAbsHgt=1; // und mind. 1
+ if (nAbsHgt>0xFFFF) nAbsHgt=0xFFFF;
+
+ // und nun attributieren
+ SetItem(SvxFontWidthItem((USHORT)nAbsWdt,(USHORT)nRelWdt));
+ SetItem(SvxFontHeightItem(nAbsHgt,(USHORT)nRelHgt));
+//-/ SdrOutlinerSetItem aNewOI(*pOutlAttr);
+//-/ SfxItemSet& rNewSet=aNewOI.GetItemSet();
+//-/ rNewSet.Put(SvxFontWidthItem((USHORT)nAbsWdt,(USHORT)nRelWdt));
+//-/ rNewSet.Put(SvxFontHeightItem(nAbsHgt,(USHORT)nRelHgt));
+//-/ pOutlAttr=(SdrOutlinerSetItem*)ImpSetNewAttr(pOutlAttr,&aNewOI);
+//-/ }
// Zeichen- und Absatzattribute innerhalb des OutlinerParaObjects
Outliner& rOutliner=ImpGetDrawOutliner();
rOutliner.SetPaperSize(Size(LONG_MAX,LONG_MAX));
diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx
index 0b08d62134e0..19621dfef1cb 100644
--- a/svx/source/svdraw/svdotxed.cxx
+++ b/svx/source/svdraw/svdotxed.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdotxed.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2000-09-26 10:46:04 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -129,19 +129,25 @@ FASTBOOL SdrTextObj::BegTextEdit(SdrOutliner& rOutl)
// damit sich der Outliner initiallisiert
rOutl.SetText( String(), rOutl.GetParagraph( 0 ) );
- if(pStyleSheet)
- rOutl.SetStyleSheet( 0, pStyleSheet );
+ if(GetStyleSheet())
+ rOutl.SetStyleSheet( 0, GetStyleSheet());
// Beim setzen der harten Attribute an den ersten Absatz muss
// der Parent pOutlAttr (=die Vorlage) temporaer entfernt
// werden, da sonst bei SetParaAttribs() auch alle in diesem
// Parent enthaltenen Items hart am Absatz attributiert werden.
// -> BugID 22467
- const SfxItemSet* pTmpSet=&pOutlAttr->GetItemSet();
- const SfxItemSet* pParentMerk=pTmpSet->GetParent();
+//-/ if(mpObjectItemSet)
+//-/ {
+ const SfxItemSet& rSet = GetItemSet();
+ SdrOutlinerSetItem aOutlSetItem(rSet.GetPool());
+ aOutlSetItem.GetItemSet().Put(rSet);
+ const SfxItemSet* pTmpSet = &aOutlSetItem.GetItemSet();
+ const SfxItemSet* pParentMerk = pTmpSet->GetParent();
((SfxItemSet*)pTmpSet)->SetParent(NULL);
rOutl.SetParaAttribs(0,*pTmpSet);
((SfxItemSet*)pTmpSet)->SetParent(pParentMerk);
+//-/ }
}
}
if (bFitToSize) {
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index f80c2fd1e1da..6dcba38b12f9 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdotxtr.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:01:25 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -96,7 +96,7 @@ void SdrTextObj::NbcSetSnapRect(const Rectangle& rRect)
long nHgt0=aSR0.Bottom()-aSR0.Top();
long nWdt1=rRect.Right()-rRect.Left();
long nHgt1=rRect.Bottom()-rRect.Top();
- SdrTextObj::NbcResize(aSnapRect.TopLeft(),Fraction(nWdt1,nWdt0),Fraction(nHgt1,nHgt0));
+ SdrTextObj::NbcResize(maSnapRect.TopLeft(),Fraction(nWdt1,nWdt0),Fraction(nHgt1,nHgt0));
SdrTextObj::NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top()));
} else {
long nHDist=GetTextLeftDistance()+GetTextRightDistance();
@@ -160,7 +160,7 @@ void SdrTextObj::NbcMove(const Size& rSiz)
{
MoveRect(aRect,rSiz);
MoveRect(aOutRect,rSiz);
- MoveRect(aSnapRect,rSiz);
+ MoveRect(maSnapRect,rSiz);
SetRectsDirty(TRUE);
}
@@ -385,10 +385,15 @@ void SdrTextObj::ImpConvertSetAttrAndLayer(SdrObject* pObj, FASTBOOL bNoSetAttr)
if (pModel!=NULL) {
pObj->SetModel(pModel);
if (!bNoSetAttr) {
- SfxItemSet aItemSet((SfxItemPool&)(*GetItemPool()));
- TakeAttributes(aItemSet,FALSE,TRUE);
- pObj->SetAttributes(aItemSet,TRUE);
- pObj->NbcSetStyleSheet(pStyleSheet,TRUE);
+//-/ SfxItemSet aItemSet((SfxItemPool&)(*GetItemPool()));
+//-/ TakeAttributes(aItemSet,FALSE,TRUE);
+//-/ pObj->SetAttributes(aItemSet,TRUE);
+ SdrBroadcastItemChange aItemChange(*pObj);
+ pObj->ClearItem();
+ pObj->SetItemSet(GetItemSet());
+ pObj->BroadcastItemChange(aItemChange);
+
+ pObj->NbcSetStyleSheet(GetStyleSheet(),TRUE);
}
}
}
diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx
index ecfa6afd4345..a48a0c4559d4 100644
--- a/svx/source/svdraw/svdouno.cxx
+++ b/svx/source/svdraw/svdouno.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdouno.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: pb $ $Date: 2000-10-23 12:14:31 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -332,13 +332,18 @@ FASTBOOL SdrUnoObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoRe
{
if( pPV->GetView().IsFillDraft() )
{
- // perepare ItemSet to avoid old XOut filling
- XFillAttrSetItem aXFSet((SfxItemPool*)GetItemPool());
- aXFSet.GetItemSet().Put(XFillStyleItem(XFILL_NONE));
- rXOut.SetFillAttr(aXFSet);
+ const SfxItemSet& rSet = GetItemSet();
- if ( pLineAttr )
- rXOut.SetLineAttr( *pLineAttr );
+ // perepare ItemSet to avoid old XOut filling
+//-/ XFillAttrSetItem aFillAttrSet(rSet.GetPool());
+ SfxItemSet aEmptySet(*rSet.GetPool());
+ aEmptySet.Put(XFillStyleItem(XFILL_NONE));
+ rXOut.SetFillAttr(aEmptySet);
+
+//-/ if(mpObjectItemSet)
+//-/ {
+ rXOut.SetLineAttr(rSet);
+//-/ }
rXOut.DrawRect( aRect );
}
diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx
index 85da05c53951..26d925d49259 100644
--- a/svx/source/svdraw/svdovirt.cxx
+++ b/svx/source/svdraw/svdovirt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdovirt.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:01:25 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -158,10 +158,10 @@ void SdrVirtObj::RecalcBoundRect()
aOutRect+=aAnchor;
}
-void SdrVirtObj::SendRepaintBroadcast(FASTBOOL bNoPaintNeeded) const
-{
- SdrObject::SendRepaintBroadcast(bNoPaintNeeded);
-}
+//-/void SdrVirtObj::SendRepaintBroadcast(FASTBOOL bNoPaintNeeded) const
+//-/{
+//-/ SdrObject::SendRepaintBroadcast(bNoPaintNeeded);
+//-/}
void SdrVirtObj::SetChanged()
{
@@ -567,21 +567,48 @@ void SdrVirtObj::SetGeoData(const SdrObjGeoData& rGeo)
////////////////////////////////////////////////////////////////////////////////////////////////////
-void SdrVirtObj::TakeAttributes(SfxItemSet& rAttr, FASTBOOL bMerge, FASTBOOL bOnlyHardAttr) const
+//-/void SdrVirtObj::TakeAttributes(SfxItemSet& rAttr, FASTBOOL bMerge, FASTBOOL bOnlyHardAttr) const
+//-/{
+//-/ rRefObj.TakeAttributes(rAttr,bMerge,bOnlyHardAttr);
+//-/}
+
+//-/void SdrVirtObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/{
+//-/ rRefObj.NbcSetAttributes(rAttr,bReplaceAll);
+//-/}
+
+//-/void SdrVirtObj::SetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+//-/{
+//-/ rRefObj.SetAttributes(rAttr,bReplaceAll);
+//-/}
+
+const SfxItemSet& SdrVirtObj::GetItemSet() const
{
- rRefObj.TakeAttributes(rAttr,bMerge,bOnlyHardAttr);
+ return rRefObj.GetItemSet();
}
-void SdrVirtObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+void SdrVirtObj::SetItem( const SfxPoolItem& rItem )
{
- rRefObj.NbcSetAttributes(rAttr,bReplaceAll);
+ rRefObj.SetItem(rItem);
}
-void SdrVirtObj::SetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll)
+void SdrVirtObj::ClearItem( USHORT nWhich )
{
- rRefObj.SetAttributes(rAttr,bReplaceAll);
+ rRefObj.ClearItem(nWhich);
}
+void SdrVirtObj::SetItemSet( const SfxItemSet& rSet )
+{
+ rRefObj.SetItemSet(rSet);
+}
+
+void SdrVirtObj::BroadcastItemChange(const SdrBroadcastItemChange& rChange)
+{
+ rRefObj.BroadcastItemChange(rChange);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
SfxStyleSheet* SdrVirtObj::GetStyleSheet() const
{
return rRefObj.GetStyleSheet();
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 3d0f9f2f1fdb..841a5aeea986 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdpage.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:01:25 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -925,9 +925,9 @@ void SdrObjList::RestartAllAnimations(SdrPageView* pPageView) const
FASTBOOL SdrObjList::ImpGetFillColor(SdrObject* pObj, Color& rCol) const
{
- SfxItemSet aSet(pModel->GetItemPool());
- pObj->TakeAttributes(aSet,FALSE,FALSE);
- return GetDraftFillColor(aSet,rCol);
+//-/ SfxItemSet aSet(pModel->GetItemPool());
+//-/ pObj->TakeAttributes(aSet,FALSE,FALSE);
+ return GetDraftFillColor(pObj->GetItemSet(),rCol);
}
FASTBOOL SdrObjList::GetFillColor(const Point& rPnt, const SetOfByte& rVisLayers,
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index aed80686bbcd..abaa1a6961d6 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdpagv.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: pb $ $Date: 2000-10-23 12:14:31 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1318,21 +1318,13 @@ FASTBOOL SdrPageView::MasterShouldBeCached(const SdrPage* pPg) const
if (!bYes) bYes=pObj->GetSubList()!=NULL;
// Und nun Attribute Checken
if (!bYes) {
- SfxItemSet aSet(rView.pMod->GetItemPool());
- pObj->TakeAttributes(aSet,FALSE,FALSE);
- XLineStyle eLineStyle=((XLineStyleItem&)(aSet.Get(XATTR_LINESTYLE))).GetValue();
- XFillStyle eFillStyle=((XFillStyleItem&)(aSet.Get(XATTR_FILLSTYLE))).GetValue();
+//-/ SfxItemSet aSet(rView.pMod->GetItemPool());
+//-/ pObj->TakeAttributes(aSet,FALSE,FALSE);
+ const SfxItemSet& rSet = pObj->GetItemSet();
+ XLineStyle eLineStyle=((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
+ XFillStyle eFillStyle=((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue();
bYes=(eLineStyle!=XLINE_NONE && eLineStyle!=XLINE_SOLID) ||
(eFillStyle!=XFILL_NONE && eFillStyle!=XFILL_SOLID);
-#ifdef nichtmehrJOEDEBUG
- DebWriteln("SdrPageView::MasterShouldBeCached()");
- DebIncIndent();
- DEBOUT(nObjNum);
- DEBOUT(USHORT(nId));
- DEBOUT(eLineStyle);
- DEBOUT(eFillStyle);
- DebDecIndent();
-#endif
}
}
}
diff --git a/svx/source/svdraw/svdtxhdl.cxx b/svx/source/svdraw/svdtxhdl.cxx
index c552dfac9a32..00ffca8a9943 100644
--- a/svx/source/svdraw/svdtxhdl.cxx
+++ b/svx/source/svdraw/svdtxhdl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdtxhdl.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:01:26 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -250,7 +250,10 @@ IMPL_LINK(ImpTextPortionHandler,ConvertHdl,DrawPortionInfo*,pInfo)
//RotateXPoly(aXPP,aFormTextBoundRect.TopLeft(),rTextObj.aGeo.nSin,rTextObj.aGeo.nCos);
SdrObject* pObj = rTextObj.ImpConvertMakeObj(aXPP, TRUE, !bToPoly, TRUE);
- pObj->NbcSetAttributes(aAttrSet, FALSE);
+
+//-/ pObj->NbcSetAttributes(aAttrSet, FALSE);
+ pObj->SetItemSet(aAttrSet);
+
pGroup->GetSubList()->InsertObject(pObj);
}
@@ -298,7 +301,10 @@ IMPL_LINK(ImpTextPortionHandler,ConvertHdl,DrawPortionInfo*,pInfo)
// #35825# Rotieren erst nach Resize (wg. FitToSize)
//RotateXPoly(aXPP,aFormTextBoundRect.TopLeft(),rTextObj.aGeo.nSin,rTextObj.aGeo.nCos);
SdrObject* pObj=rTextObj.ImpConvertMakeObj(aXPP,TRUE,!bToPoly, TRUE);
- pObj->NbcSetAttributes(aAttrSet,FALSE);
+
+//-/ pObj->NbcSetAttributes(aAttrSet,FALSE);
+ pObj->SetItemSet(aAttrSet);
+
pGroup->GetSubList()->InsertObject(pObj);
}
if (eStrk!=STRIKEOUT_NONE) {
@@ -326,7 +332,10 @@ IMPL_LINK(ImpTextPortionHandler,ConvertHdl,DrawPortionInfo*,pInfo)
// #35825# Rotieren erst nach Resize (wg. FitToSize)
//RotateXPoly(aXPP,aFormTextBoundRect.TopLeft(),rTextObj.aGeo.nSin,rTextObj.aGeo.nCos);
SdrObject* pObj=rTextObj.ImpConvertMakeObj(aXPP,TRUE,!bToPoly, TRUE);
- pObj->NbcSetAttributes(aAttrSet,FALSE);
+
+//-/ pObj->NbcSetAttributes(aAttrSet,FALSE);
+ pObj->SetItemSet(aAttrSet);
+
pGroup->GetSubList()->InsertObject(pObj);
}
return 0;
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index f658e24ca6bf..01370097aa76 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdundo.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:01:26 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -293,8 +293,14 @@ SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, FASTBOOL bStyleSheet1, FASTBO
bHaveToTakeRedoSet(TRUE)
{
bStyleSheet=bStyleSheet1;
- pUndoSet=new SfxItemSet(rNewObj.GetModel()->GetUndoItemPool());
- pRedoSet=new SfxItemSet(rNewObj.GetModel()->GetUndoItemPool());
+
+//-/ pUndoSet=new SfxItemSet(rNewObj.GetModel()->GetUndoItemPool());
+//-/ pRedoSet=new SfxItemSet(rNewObj.GetModel()->GetUndoItemPool());
+//-/ pUndoSet = rNewObj.CreateNewItemSet(rNewObj.GetModel()->GetUndoItemPool());
+//-/ pRedoSet = rNewObj.CreateNewItemSet(rNewObj.GetModel()->GetUndoItemPool());
+ pUndoSet = rNewObj.CreateNewItemSet(*((SfxItemPool*)SdrObject::GetGlobalDrawObjectItemPool()));
+ pRedoSet = rNewObj.CreateNewItemSet(*((SfxItemPool*)SdrObject::GetGlobalDrawObjectItemPool()));
+
SdrObjList* pOL=rNewObj.GetSubList();
if (pOL!=NULL && pOL->GetObjCount()) { // Aha, Gruppenobjekt
pUndoGroup=new SdrUndoGroup(*pObj->GetModel());
@@ -302,8 +308,12 @@ SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, FASTBOOL bStyleSheet1, FASTBO
for (ULONG nObjNum=0; nObjNum<nObjAnz; nObjNum++) {
pUndoGroup->AddAction(new SdrUndoAttrObj(*pOL->GetObj(nObjNum),bStyleSheet1));
}
- } else {
- pObj->TakeAttributes(*pUndoSet,FALSE,TRUE);
+ }
+ else
+ {
+//-/ pObj->TakeAttributes(*pUndoSet,FALSE,TRUE);
+ pUndoSet->Put(pObj->GetItemSet());
+
if (bStyleSheet) pUndoStyleSheet=pObj->GetStyleSheet();
if (bSaveText) {
pTextUndo=pObj->GetOutlinerParaObject();
@@ -324,7 +334,11 @@ __EXPORT SdrUndoAttrObj::~SdrUndoAttrObj()
void SdrUndoAttrObj::SetRepeatAttr(const SfxItemSet& rSet)
{
if (pRepeatSet!=NULL) delete pRepeatSet;
- pRepeatSet=new SfxItemSet(pObj->GetModel()->GetUndoItemPool());
+
+//-/ pRepeatSet=new SfxItemSet(pObj->GetModel()->GetUndoItemPool());
+//-/ pRepeatSet = pObj->CreateNewItemSet(pObj->GetModel()->GetUndoItemPool());
+ pRepeatSet = pObj->CreateNewItemSet(*((SfxItemPool*)SdrObject::GetGlobalDrawObjectItemPool()));
+
pRepeatSet->Put(rSet);
}
@@ -335,14 +349,23 @@ void __EXPORT SdrUndoAttrObj::Undo()
} else {
if (bHaveToTakeRedoSet) {
bHaveToTakeRedoSet=FALSE;
- pObj->TakeAttributes(*pRedoSet,FALSE,TRUE);
+
+//-/ pObj->TakeAttributes(*pRedoSet,FALSE,TRUE);
+ pRedoSet->Put(pObj->GetItemSet());
+
if (bStyleSheet) pRedoStyleSheet=pObj->GetStyleSheet();
}
if (bStyleSheet) {
pRedoStyleSheet=pObj->GetStyleSheet();
pObj->SetStyleSheet(pUndoStyleSheet,TRUE);
}
- pObj->SetAttributes(*pUndoSet,TRUE);
+
+//-/ pObj->SetAttributes(*pUndoSet,TRUE);
+ SdrBroadcastItemChange aItemChange(*pObj);
+ pObj->ClearItem();
+ pObj->SetItemSet(*pUndoSet);
+ pObj->BroadcastItemChange(aItemChange);
+
if (pTextUndo!=NULL) {
pObj->SetOutlinerParaObject(pTextUndo->Clone());
}
@@ -358,7 +381,12 @@ void __EXPORT SdrUndoAttrObj::Redo()
pUndoStyleSheet=pObj->GetStyleSheet();
pObj->SetStyleSheet(pRedoStyleSheet,TRUE);
}
- pObj->SetAttributes(*pRedoSet,TRUE);
+
+//-/ pObj->SetAttributes(*pRedoSet,TRUE);
+ SdrBroadcastItemChange aItemChange(*pObj);
+ pObj->ClearItem();
+ pObj->SetItemSet(*pRedoSet);
+ pObj->BroadcastItemChange(aItemChange);
}
}
@@ -528,11 +556,13 @@ void SdrUndoObjList::SetOwner(BOOL bNew)
// Undo-Managers wechseln
if(bNew)
{
- pObj->MigrateItemPool(&rMod.GetItemPool(), &rMod.GetUndoItemPool());
+//-/ pObj->MigrateItemPool(&rMod.GetItemPool(), &rMod.GetUndoItemPool());
+ pObj->MigrateItemPool(&rMod.GetItemPool(), ((SfxItemPool*)SdrObject::GetGlobalDrawObjectItemPool()));
}
else
{
- pObj->MigrateItemPool(&rMod.GetUndoItemPool(), &rMod.GetItemPool());
+//-/ pObj->MigrateItemPool(&rMod.GetUndoItemPool(), &rMod.GetItemPool());
+ pObj->MigrateItemPool(((SfxItemPool*)SdrObject::GetGlobalDrawObjectItemPool()), &rMod.GetItemPool());
pObj->SetStyleSheet(pObj->GetStyleSheet(), TRUE);
}
@@ -739,11 +769,13 @@ void SdrUndoReplaceObj::SetNewOwner(BOOL bNew)
// Undo-Managers wechseln
if(bNew)
{
- pNewObj->MigrateItemPool(&rMod.GetItemPool(), &rMod.GetUndoItemPool());
+//-/ pNewObj->MigrateItemPool(&rMod.GetItemPool(), &rMod.GetUndoItemPool());
+ pNewObj->MigrateItemPool(&rMod.GetItemPool(), ((SfxItemPool*)SdrObject::GetGlobalDrawObjectItemPool()));
}
else
{
- pNewObj->MigrateItemPool(&rMod.GetUndoItemPool(), &rMod.GetItemPool());
+//-/ pNewObj->MigrateItemPool(&rMod.GetUndoItemPool(), &rMod.GetItemPool());
+ pNewObj->MigrateItemPool(((SfxItemPool*)SdrObject::GetGlobalDrawObjectItemPool()), &rMod.GetItemPool());
}
// umsetzen
@@ -760,11 +792,13 @@ void SdrUndoReplaceObj::SetOldOwner(BOOL bNew)
// Undo-Managers wechseln
if(bNew)
{
- pObj->MigrateItemPool(&rMod.GetItemPool(), &rMod.GetUndoItemPool());
+//-/ pObj->MigrateItemPool(&rMod.GetItemPool(), &rMod.GetUndoItemPool());
+ pObj->MigrateItemPool(&rMod.GetItemPool(), ((SfxItemPool*)SdrObject::GetGlobalDrawObjectItemPool()));
}
else
{
- pObj->MigrateItemPool(&rMod.GetUndoItemPool(), &rMod.GetItemPool());
+//-/ pObj->MigrateItemPool(&rMod.GetUndoItemPool(), &rMod.GetItemPool());
+ pObj->MigrateItemPool(((SfxItemPool*)SdrObject::GetGlobalDrawObjectItemPool()), &rMod.GetItemPool());
}
// umsetzen
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
index 5e9b337541db..7b5a9ae340c1 100644
--- a/svx/source/svdraw/svdxcgv.cxx
+++ b/svx/source/svdraw/svdxcgv.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: svdxcgv.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:01:26 $
+ * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -304,11 +304,17 @@ BOOL SdrExchangeView::Paste(const XubString& rStr, const Point& rPos, SdrObjList
pObj->SetLayer(nLayer);
pObj->NbcSetText(rStr); // #32424# SetText vor SetAttr, weil SetAttr sonst unwirksam!
if (pDefaultStyleSheet!=NULL) pObj->NbcSetStyleSheet(pDefaultStyleSheet,FALSE);
- pObj->NbcSetAttributes(aDefaultAttr,FALSE);
+
+//-/ pObj->NbcSetAttributes(aDefaultAttr,FALSE);
+ pObj->SetItemSet(aDefaultAttr);
+
SfxItemSet aTempAttr(pMod->GetItemPool()); // Keine Fuellung oder Linie
aTempAttr.Put(XLineStyleItem(XLINE_NONE));
aTempAttr.Put(XFillStyleItem(XFILL_NONE));
- pObj->NbcSetAttributes(aTempAttr, FALSE);
+
+//-/ pObj->NbcSetAttributes(aTempAttr, FALSE);
+ pObj->SetItemSet(aTempAttr);
+
pObj->FitFrameToTextSize();
Size aSiz(pObj->GetLogicRect().GetSize());
MapUnit eMap=pMod->GetScaleUnit();
@@ -344,11 +350,17 @@ BOOL SdrExchangeView::Paste(SvStream& rInput, USHORT eFormat, const Point& rPos,
pObj->SetModel(pMod);
pObj->SetLayer(nLayer);
if (pDefaultStyleSheet!=NULL) pObj->NbcSetStyleSheet(pDefaultStyleSheet,FALSE);
- pObj->NbcSetAttributes(aDefaultAttr,FALSE);
+
+//-/ pObj->NbcSetAttributes(aDefaultAttr,FALSE);
+ pObj->SetItemSet(aDefaultAttr);
+
SfxItemSet aTempAttr(pMod->GetItemPool()); // Keine Fuellung oder Linie
aTempAttr.Put(XLineStyleItem(XLINE_NONE));
aTempAttr.Put(XFillStyleItem(XFILL_NONE));
- pObj->NbcSetAttributes(aTempAttr, FALSE);
+
+//-/ pObj->NbcSetAttributes(aTempAttr, FALSE);
+ pObj->SetItemSet(aTempAttr);
+
pObj->NbcSetText(rInput,eFormat);
pObj->FitFrameToTextSize();
Size aSiz(pObj->GetLogicRect().GetSize());