View | Details | Raw Unified | Return to issue 3958
Collapse All | Expand All

(-)escher.hxx (+2 lines)
Lines 72-77 Link Here
72
{
72
{
73
public:
73
public:
74
    void WriteData(EscherEx& rEx) const;
74
    void WriteData(EscherEx& rEx) const;
75
    void WriteInline(EscherEx& rEx) const;
75
    void SetAnchoring(const SwFrmFmt& rFmt, bool bBROKEN = false);
76
    void SetAnchoring(const SwFrmFmt& rFmt, bool bBROKEN = false);
76
private:
77
private:
77
    sal_uInt32 nXAlign;
78
    sal_uInt32 nXAlign;
Lines 103-108 Link Here
103
	SvStream* QueryPicStream();
104
	SvStream* QueryPicStream();
104
public:
105
public:
105
    SwBasicEscherEx(SvStream* pStrm, SwWW8Writer& rWrt, UINT32 nDrawings = 1);
106
    SwBasicEscherEx(SvStream* pStrm, SwWW8Writer& rWrt, UINT32 nDrawings = 1);
107
    INT32 WriteDummyFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId);
106
	INT32 WriteGrfFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId);
108
	INT32 WriteGrfFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId);
107
	virtual void WriteFrmExtraData(const SwFrmFmt& rFmt);
109
	virtual void WriteFrmExtraData(const SwFrmFmt& rFmt);
108
	virtual void WritePictures();
110
	virtual void WritePictures();
(-)wrtw8esh.cxx (-84 / +119 lines)
Lines 242-247 Link Here
242
{
242
{
243
}
243
}
244
244
245
Rectangle PlcDrawObj::FindLayoutRect(const SwFrmFmt &rFmt, Point aTopLeft)
246
{
247
    const SdrObject* pObj = rFmt.FindRealSdrObject();
248
249
    Rectangle aRect;
250
    const SwFmtVertOrient& rVOr = rFmt.GetVertOrient();
251
    const SwFmtHoriOrient& rHOr = rFmt.GetHoriOrient();
252
    if (RES_FLYFRMFMT == rFmt.Which())
253
    {
254
        Point aObjPos;
255
        SwRect aLayRect(rFmt.FindLayoutRect(false, &aObjPos));
256
        // the Object is not visible - so get the values from
257
        // the format. The Position may not be correct.
258
        if (aLayRect.IsEmpty())
259
            aRect.SetSize(rFmt.GetFrmSize().GetSize());
260
        else
261
            aRect = aLayRect.SVRect();
262
263
        aRect -= aTopLeft;
264
        aObjPos = aRect.TopLeft();
265
        if (VERT_NONE == rVOr.GetVertOrient())
266
            aObjPos.Y() = rVOr.GetPos();
267
        if (HORI_NONE == rHOr.GetHoriOrient())
268
            aObjPos.X() = rHOr.GetPos();
269
        aRect.SetPos( aObjPos );
270
    }
271
    else
272
    {
273
        ASSERT(pObj, "wo ist das SDR-Object?");
274
        if (pObj)
275
            aRect = pObj->GetSnapRect();
276
        aRect -= aTopLeft;
277
    }
278
279
    return aRect;
280
}
281
245
void PlcDrawObj::WritePlc(SwWW8Writer& rWrt) const
282
void PlcDrawObj::WritePlc(SwWW8Writer& rWrt) const
246
{
283
{
247
	if (8 > rWrt.pFib->nVersion)    // Cannot export drawobject in vers 7-
284
	if (8 > rWrt.pFib->nVersion)    // Cannot export drawobject in vers 7-
Lines 269-305 Link Here
269
		{
306
		{
270
			// write the fspa-struct
307
			// write the fspa-struct
271
			const SwFrmFmt& rFmt = aIter->mrCntnt;
308
			const SwFrmFmt& rFmt = aIter->mrCntnt;
272
			const SdrObject* pObj = rFmt.FindRealSdrObject();
309
			Rectangle aRect = FindLayoutRect(rFmt, aIter->maParentPos);
273
274
			Rectangle aRect;
275
            const SwFmtVertOrient& rVOr = rFmt.GetVertOrient();
276
            const SwFmtHoriOrient& rHOr = rFmt.GetHoriOrient();
277
			if (RES_FLYFRMFMT == rFmt.Which())
278
			{
279
                Point aObjPos;
280
				SwRect aLayRect(rFmt.FindLayoutRect(false, &aObjPos));
281
                // the Object is not visible - so get the values from
282
                // the format. The Position may not be correct.
283
				if( aLayRect.IsEmpty() )
284
					aRect.SetSize( rFmt.GetFrmSize().GetSize() );
285
				else
286
					aRect = aLayRect.SVRect();
287
288
                aRect -= aIter->maParentPos;
289
                aObjPos = aRect.TopLeft();
290
                if (VERT_NONE == rVOr.GetVertOrient())
291
                    aObjPos.Y() = rVOr.GetPos();
292
                if (HORI_NONE == rHOr.GetHoriOrient())
293
                    aObjPos.X() = rHOr.GetPos();
294
                aRect.SetPos( aObjPos );
295
			}
296
			else
297
			{
298
				ASSERT(pObj, "wo ist das SDR-Object?");
299
				if (pObj)
300
					aRect = pObj->GetSnapRect();
301
                aRect -= aIter->maParentPos;
302
			}
303
310
304
			// spid
311
			// spid
305
			SwWW8Writer::WriteLong(*rWrt.pTableStrm, aIter->mnShapeId);
312
			SwWW8Writer::WriteLong(*rWrt.pTableStrm, aIter->mnShapeId);
Lines 307-319 Link Here
307
			//xaLeft/yaTop/xaRight/yaBottom - rel. to anchor
314
			//xaLeft/yaTop/xaRight/yaBottom - rel. to anchor
308
            //(most of) the border is outside the graphic is word, so
315
            //(most of) the border is outside the graphic is word, so
309
            //change dimensions to fit
316
            //change dimensions to fit
310
			SwWW8Writer::WriteLong(*rWrt.pTableStrm,aRect.Left() + 
317
			SwWW8Writer::WriteLong(*rWrt.pTableStrm, aRect.Left() + 
311
                aIter->mnThick);
318
                aIter->mnThick);
312
			SwWW8Writer::WriteLong(*rWrt.pTableStrm,aRect.Top() + 
319
			SwWW8Writer::WriteLong(*rWrt.pTableStrm, aRect.Top() + 
313
                aIter->mnThick);
320
                aIter->mnThick);
314
			SwWW8Writer::WriteLong(*rWrt.pTableStrm,aRect.Right() - 
321
			SwWW8Writer::WriteLong(*rWrt.pTableStrm, aRect.Right() - 
315
                aIter->mnThick);
322
                aIter->mnThick);
316
			SwWW8Writer::WriteLong(*rWrt.pTableStrm,aRect.Bottom() - 
323
			SwWW8Writer::WriteLong(*rWrt.pTableStrm, aRect.Bottom() - 
317
                aIter->mnThick);
324
                aIter->mnThick);
318
325
319
			//fHdr/bx/by/wr/wrk/fRcaSimple/fBelowText/fAnchorLock
326
			//fHdr/bx/by/wr/wrk/fRcaSimple/fBelowText/fAnchorLock
Lines 347-352 Link Here
347
                    nFlags |= 0x0400 | nContour;
354
                    nFlags |= 0x0400 | nContour;
348
                    break;
355
                    break;
349
			}
356
			}
357
            const SdrObject* pObj = rFmt.FindRealSdrObject();
350
			if( pObj && pObj->GetLayer() == rWrt.pDoc->GetHellId() )
358
			if( pObj && pObj->GetLayer() == rWrt.pDoc->GetHellId() )
351
				nFlags |= 0x4000;
359
				nFlags |= 0x4000;
352
360
Lines 1076-1082 Link Here
1076
    }
1084
    }
1077
}
1085
}
1078
1086
1079
/*  */
1087
void WinwordAnchoring::WriteInline(EscherEx& rEx) const
1088
{
1089
    rEx.AddAtom(24, DFF_msofbtUDefProp, 3, 4 ); //Prop id is 0xF122
1090
    SvStream& rSt = rEx.GetStream();
1091
    rSt << (UINT16)0x0390 << 3L;
1092
    rSt << (UINT16)0x0392 << 3L;
1093
}
1080
1094
1081
void SwWW8Writer::CreateEscher()
1095
void SwWW8Writer::CreateEscher()
1082
{
1096
{
Lines 1145-1150 Link Here
1145
    GetStream() << 0x80000000;
1159
    GetStream() << 0x80000000;
1146
}
1160
}
1147
1161
1162
INT32 SwBasicEscherEx::WriteDummyFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId)
1163
{
1164
    INT32 nBorderThick=0;
1165
	OpenContainer( ESCHER_SpContainer );
1166
1167
	AddShape(ESCHER_ShpInst_PictureFrame, 0xa00, nShapeId);
1168
1169
	EscherPropertyContainer aPropOpt;
1170
1171
    nBorderThick = WriteFlyFrameAttr(rFmt, mso_sptPictureFrame, aPropOpt);
1172
1173
    WinwordAnchoring aWinwordAnchoring;
1174
    aWinwordAnchoring.WriteInline(*this);
1175
1176
	aPropOpt.Commit(GetStream());
1177
1178
	CloseContainer();	// ESCHER_SpContainer
1179
    return nBorderThick;
1180
}
1181
1182
1148
INT32 SwBasicEscherEx::WriteGrfFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId)
1183
INT32 SwBasicEscherEx::WriteGrfFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId)
1149
{
1184
{
1150
    INT32 nBorderThick=0;
1185
    INT32 nBorderThick=0;
Lines 1156-1224 Link Here
1156
1191
1157
	UINT32 nFlags = ESCHER_BlipFlagDefault;
1192
	UINT32 nFlags = ESCHER_BlipFlagDefault;
1158
	SwNodeIndex aIdx( *rFmt.GetCntnt().GetCntntIdx(), 1 );
1193
	SwNodeIndex aIdx( *rFmt.GetCntnt().GetCntntIdx(), 1 );
1159
	SwGrfNode& rGrfNd = *aIdx.GetNode().GetGrfNode();
1194
	SwGrfNode &rGrfNd = *aIdx.GetNode().GetGrfNode();
1160
	if( rGrfNd.IsLinkedFile() )
1195
    if(rGrfNd.IsLinkedFile())
1161
	{
1196
    {
1162
		String sURL;
1197
        String sURL;
1163
		rGrfNd.GetFileFilterNms( &sURL, 0 );
1198
        rGrfNd.GetFileFilterNms( &sURL, 0 );
1164
1199
1165
		WW8Bytes aBuf;
1200
        WW8Bytes aBuf;
1166
		SwWW8Writer::InsAsString16( aBuf, sURL );
1201
        SwWW8Writer::InsAsString16( aBuf, sURL );
1167
		SwWW8Writer::InsUInt16( aBuf, 0 );
1202
        SwWW8Writer::InsUInt16( aBuf, 0 );
1168
1203
1169
		USHORT nArrLen = aBuf.Count();
1204
        USHORT nArrLen = aBuf.Count();
1170
		BYTE* pArr = new BYTE[ nArrLen ];
1205
        BYTE* pArr = new BYTE[ nArrLen ];
1171
		memcpy( pArr, aBuf.GetData(), nArrLen );
1206
        memcpy( pArr, aBuf.GetData(), nArrLen );
1172
1207
1173
		aPropOpt.AddOpt(ESCHER_Prop_pibName, true, nArrLen, pArr, nArrLen);
1208
        aPropOpt.AddOpt(ESCHER_Prop_pibName, true, nArrLen, pArr, nArrLen);
1174
		nFlags = ESCHER_BlipFlagLinkToFile | ESCHER_BlipFlagURL |
1209
        nFlags = ESCHER_BlipFlagLinkToFile | ESCHER_BlipFlagURL |
1175
					ESCHER_BlipFlagDoNotSave;
1210
                    ESCHER_BlipFlagDoNotSave;
1176
	}
1211
    }
1177
	else
1212
    else
1178
	{
1213
    {
1179
		rGrfNd.SwapIn(true);
1214
        rGrfNd.SwapIn(true);
1180
1215
1181
		Graphic			aGraphic( rGrfNd.GetGrf() );
1216
        Graphic			aGraphic(rGrfNd.GetGrf());
1182
		GraphicObject	aGraphicObject( aGraphic );
1217
        GraphicObject	aGraphicObject(aGraphic);
1183
		ByteString		aUniqueId = aGraphicObject.GetUniqueID();
1218
        ByteString		aUniqueId = aGraphicObject.GetUniqueID();
1184
1219
1185
		if ( aUniqueId.Len() )
1220
        if ( aUniqueId.Len() )
1186
		{
1221
        {
1187
		 	const	MapMode aMap100mm( MAP_100TH_MM );
1222
            const	MapMode aMap100mm( MAP_100TH_MM );
1188
			Size	aSize( aGraphic.GetPrefSize() );
1223
            Size	aSize( aGraphic.GetPrefSize() );
1189
1224
1190
			if ( MAP_PIXEL == aGraphic.GetPrefMapMode().GetMapUnit() )
1225
            if ( MAP_PIXEL == aGraphic.GetPrefMapMode().GetMapUnit() )
1191
            {
1226
            {
1192
				aSize = Application::GetDefaultDevice()->PixelToLogic(
1227
                aSize = Application::GetDefaultDevice()->PixelToLogic(
1193
                    aSize, aMap100mm );
1228
                    aSize, aMap100mm );
1194
            }
1229
            }
1195
			else
1230
            else
1196
            {
1231
            {
1197
				aSize = OutputDevice::LogicToLogic( aSize,
1232
                aSize = OutputDevice::LogicToLogic( aSize,
1198
                    aGraphic.GetPrefMapMode(), aMap100mm );
1233
                    aGraphic.GetPrefMapMode(), aMap100mm );
1199
            }
1234
            }
1200
1235
1201
			Point aEmptyPoint = Point();
1236
            Point aEmptyPoint = Point();
1202
			Rectangle aRect( aEmptyPoint, aSize );
1237
            Rectangle aRect( aEmptyPoint, aSize );
1203
1238
1204
			sal_uInt32 nBlibId = GetBlibID( *QueryPicStream(), aUniqueId,
1239
            sal_uInt32 nBlibId = GetBlibID( *QueryPicStream(), aUniqueId,
1205
                aRect, 0 );
1240
                aRect, 0 );
1206
			if ( nBlibId )
1241
            if (nBlibId)
1207
			{
1242
            {
1208
				aPropOpt.AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture );
1243
                aPropOpt.AddOpt(ESCHER_Prop_fillType, ESCHER_FillPicture);
1209
				aPropOpt.AddOpt( ESCHER_Prop_pib, nBlibId, sal_True );
1244
                aPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, sal_True);
1210
			}
1245
            }
1211
		}
1246
        }
1212
	}
1247
    }
1213
1248
1214
	aPropOpt.AddOpt( ESCHER_Prop_pibFlags, nFlags );
1249
    aPropOpt.AddOpt(ESCHER_Prop_pibFlags, nFlags);
1215
	nBorderThick = WriteFlyFrameAttr(rFmt,mso_sptPictureFrame,aPropOpt);
1250
    nBorderThick = WriteFlyFrameAttr(rFmt,mso_sptPictureFrame,aPropOpt);
1216
	WriteGrfAttr( rGrfNd, aPropOpt );
1251
    WriteGrfAttr(rGrfNd, aPropOpt);
1217
    
1252
   
1218
	aPropOpt.Commit( GetStream() );
1253
	aPropOpt.Commit(GetStream());
1219
1254
1220
	// store anchor attribute
1255
	// store anchor attribute
1221
	WriteFrmExtraData( rFmt );
1256
	WriteFrmExtraData(rFmt);
1222
1257
1223
	CloseContainer();	// ESCHER_SpContainer
1258
	CloseContainer();	// ESCHER_SpContainer
1224
    return nBorderThick;
1259
    return nBorderThick;
Lines 2158-2164 Link Here
2158
2193
2159
void SwEscherEx::WriteFrmExtraData( const SwFrmFmt& rFmt )
2194
void SwEscherEx::WriteFrmExtraData( const SwFrmFmt& rFmt )
2160
{
2195
{
2161
    aWinwordAnchoring.SetAnchoring(rFmt );
2196
    aWinwordAnchoring.SetAnchoring(rFmt);
2162
	aWinwordAnchoring.WriteData(*this);
2197
	aWinwordAnchoring.WriteData(*this);
2163
2198
2164
	AddAtom(4, ESCHER_ClientAnchor);
2199
	AddAtom(4, ESCHER_ClientAnchor);
(-)wrtw8nds.cxx (-7 / +50 lines)
Lines 2111-2122 Link Here
2111
{
2111
{
2112
    const SwFmtAnchor& rAnch = rFrmFmt.GetAnchor();
2112
    const SwFmtAnchor& rAnch = rFrmFmt.GetAnchor();
2113
2113
2114
    /*
2114
    bool bUseTraditionalInline = false;
2115
    ##897##
2115
    if (!bWrtWW8)
2116
    Note that something anchored as a character must be
2116
        bUseTraditionalInline = true;
2117
    exported using the older WW6 mechanism
2117
    else
2118
    */
2118
    {
2119
    if( !bWrtWW8 || (FLY_IN_CNTNT == rAnch.GetAnchorId()) )
2119
        /*
2120
        ##897##
2121
        Note that something anchored as a character must be exported with a
2122
        shape field with a 0x1 empty graphic following the 0x8
2123
        */
2124
        if (FLY_IN_CNTNT == rAnch.GetAnchorId())
2125
        {
2126
            if (const SwNodeIndex* pNdIdx = rFrmFmt.GetCntnt().GetCntntIdx())
2127
            {
2128
                SwNodeIndex aIdx( *pNdIdx, 1 );
2129
                switch( aIdx.GetNode().GetNodeType() )
2130
                {
2131
                    case ND_GRFNODE:
2132
                    case ND_OLENODE:
2133
                        bUseTraditionalInline = true;
2134
                        break;
2135
                    default:
2136
                        bUseTraditionalInline = false;
2137
                        break;
2138
                }
2139
            }
2140
        }
2141
    }
2142
2143
    if (bUseTraditionalInline)
2120
	{
2144
	{
2121
		if( RES_DRAWFRMFMT == rFrmFmt.Which() )
2145
		if( RES_DRAWFRMFMT == rFrmFmt.Which() )
2122
		{
2146
		{
Lines 2202-2213 Link Here
2202
	}
2226
	}
2203
	else
2227
	else
2204
	{
2228
	{
2229
        if (FLY_IN_CNTNT == rAnch.GetAnchorId())
2230
        {
2231
            String sShape(CREATE_CONST_ASC(" SHAPE "));
2232
            OutField(0, 95, sShape, WRITEFIELD_START | WRITEFIELD_CMD_START | 
2233
                WRITEFIELD_CMD_END);
2234
        }
2235
2205
		// write as escher
2236
		// write as escher
2206
		WW8_CP nCP = Fc2Cp( Strm().Tell() );
2237
		WW8_CP nCP = Fc2Cp( Strm().Tell() );
2207
		AppendFlyInFlys( nCP, rFrmFmt, rNdTopLeft );
2238
		AppendFlyInFlys( nCP, rFrmFmt, rNdTopLeft );
2239
2240
        if (FLY_IN_CNTNT == rAnch.GetAnchorId())
2241
        {
2242
            Point aTopLeft(0,0);
2243
            Rectangle aRect = PlcDrawObj::FindLayoutRect(rFrmFmt, aTopLeft);
2244
            nFlyWidth  = aRect.GetWidth();  // Fuer Anpassung Graphic-Groesse
2245
            nFlyHeight = aRect.GetHeight();
2246
            SwFlyFrmFmt *pOld = pFlyFmt;
2247
            pFlyFmt = (SwFlyFrmFmt*)&rFrmFmt;
2248
            OutGrf(0);    //0x1 graphic
2249
            pFlyFmt = pOld;
2250
            OutField(0, 95, aEmptyStr, WRITEFIELD_END | WRITEFIELD_CLOSE);
2251
        }
2208
	}
2252
	}
2209
}
2253
}
2210
2211
2254
2212
void SwWW8Writer::OutFlyFrms( const SwCntntNode& rNode )
2255
void SwWW8Writer::OutFlyFrms( const SwCntntNode& rNode )
2213
{
2256
{
(-)wrtww8.hxx (+1 lines)
Lines 354-359 Link Here
354
	const ::std::vector<DrawObj> &GetObjArr() const { return maDrawObjs; }
354
	const ::std::vector<DrawObj> &GetObjArr() const { return maDrawObjs; }
355
	void SetShapeDetails( const SwFrmFmt& rFmt, UINT32 nId, INT32 nThick );
355
	void SetShapeDetails( const SwFrmFmt& rFmt, UINT32 nId, INT32 nThick );
356
    virtual ~PlcDrawObj();
356
    virtual ~PlcDrawObj();
357
    static Rectangle FindLayoutRect(const SwFrmFmt &rFmt, Point aTopLeft);
357
};
358
};
358
359
359
class MainTxtPlcDrawObj : public PlcDrawObj		
360
class MainTxtPlcDrawObj : public PlcDrawObj		
(-)wrtww8gr.cxx (-3 / +33 lines)
Lines 800-816 Link Here
800
void SwWW8WrGrf::Write1Grf( SvStream& rStrm, const SwNoTxtNode* pNd,
800
void SwWW8WrGrf::Write1Grf( SvStream& rStrm, const SwNoTxtNode* pNd,
801
					const SwFlyFrmFmt* pFly, UINT16 nWidth, UINT16 nHeight )
801
					const SwFlyFrmFmt* pFly, UINT16 nWidth, UINT16 nHeight )
802
{
802
{
803
	if( !pNd || ( !pNd->IsGrfNode() && !pNd->IsOLENode() ) )
803
	if (pNd && (!pNd->IsGrfNode() && !pNd->IsOLENode()))
804
		return;
804
		return;
805
805
806
	UINT32 nPos = rStrm.Tell();			// Grafik-Anfang merken
806
	UINT32 nPos = rStrm.Tell();			// Grafik-Anfang merken
807
807
808
	if( pNd->IsGrfNode() )
808
    if (!pNd)
809
    {
810
        ASSERT(rWrt.bWrtWW8 && pFly, "This only makes sense for ww8 and the"
811
            "shape field dummy 0x1 to shadow the 0x8 escher image");
812
        if (!(rWrt.bWrtWW8 && pFly))
813
            return;
814
#if 1
815
	    BYTE aArr[ 0x44 ] = { 0 };
816
	    BYTE *pArr = aArr + 4;
817
	    Set_UInt16(pArr, sizeof(aArr));
818
	    Set_UInt16(pArr, 0x64);
819
820
	    Set_UInt16(pArr, nWidth * 254L / 144);
821
	    Set_UInt16(pArr, nHeight * 254L / 144);
822
	    pArr += 16;
823
	    Set_UInt16(pArr, nWidth);
824
	    Set_UInt16(pArr, nHeight);
825
826
        double fVal = nWidth * 1000.0 / (nWidth);
827
		Set_UInt16(pArr, (USHORT)SolarMath::Round(fVal));
828
829
        fVal = nHeight * 1000.0 / (nHeight);
830
		Set_UInt16(pArr, (USHORT)SolarMath::Round(fVal));
831
832
	    rStrm.Write(aArr, sizeof(aArr));
833
#endif
834
        SwBasicEscherEx aInlineEscher(&rStrm, rWrt);
835
        aInlineEscher.WriteDummyFlyFrame(*pFly, 0x401);
836
        aInlineEscher.WritePictures();
837
    }
838
    else if (pNd->IsGrfNode())
809
	{
839
	{
810
		const SwGrfNode* pGrfNd = pNd->GetGrfNode();
840
		const SwGrfNode* pGrfNd = pNd->GetGrfNode();
811
		Write1Grf1( rStrm, pGrfNd, pFly, nWidth, nHeight );
841
		Write1Grf1( rStrm, pGrfNd, pFly, nWidth, nHeight );
812
	}
842
	}
813
	else if( pNd->IsOLENode() )
843
	else if (pNd->IsOLENode())
814
	{
844
	{
815
		// cast away const
845
		// cast away const
816
		SwOLENode *pOleNd = ((SwNoTxtNode*)pNd)->GetOLENode(); 
846
		SwOLENode *pOleNd = ((SwNoTxtNode*)pNd)->GetOLENode(); 
(-)ww8graf.cxx (-35 / +66 lines)
Lines 1764-1784 Link Here
1764
1764
1765
	const SfxItemSet& rOldSet = pSdrObj->GetItemSet();
1765
	const SfxItemSet& rOldSet = pSdrObj->GetItemSet();
1766
1766
1767
	// einige Items koennen direkt so uebernommen werden
1768
	const USHORT nDirectMatch = 2;
1769
	static RES_FRMATR __READONLY_DATA aDirectMatch[ nDirectMatch ] =
1770
	{
1771
		RES_LR_SPACE,	// Aussenabstand links/rechts: SvxLRSpaceItem
1772
		RES_UL_SPACE	// Aussenabstand Oben/unten:   SvxULSpaceItem
1773
	};
1774
	const SfxPoolItem* pPoolItem;
1775
	for(USHORT nItem = 0; nItem < nDirectMatch; ++nItem)
1776
		if( SFX_ITEM_SET == rOldSet.GetItemState( aDirectMatch[ nItem ], false,
1777
            &pPoolItem) )
1778
		{
1779
			rFlySet.Put( *pPoolItem );
1780
		}
1781
1767
1768
    /*
1769
    #i3958#, basically a winword bug here, in inline mode the left and right
1770
    spacing are ignored, (shown grayed out in word)
1771
    */
1772
    if (!IsInlineEscherHack())
1773
    {
1774
	    // einige Items koennen direkt so uebernommen werden
1775
	    const USHORT nDirectMatch = 2;
1776
	    static RES_FRMATR __READONLY_DATA aDirectMatch[ nDirectMatch ] =
1777
	    {
1778
		    RES_LR_SPACE,	// Aussenabstand links/rechts: SvxLRSpaceItem
1779
		    RES_UL_SPACE	// Aussenabstand Oben/unten:   SvxULSpaceItem
1780
	    };
1781
	    const SfxPoolItem* pPoolItem;
1782
	    for (USHORT nItem = 0; nItem < nDirectMatch; ++nItem)
1783
        {
1784
		    if (SFX_ITEM_SET == rOldSet.GetItemState(aDirectMatch[nItem], false,
1785
                &pPoolItem) )
1786
		    {
1787
			    rFlySet.Put(*pPoolItem);
1788
		    }
1789
        }
1790
    }
1782
1791
1783
    // jetzt die Umrandung berechnen und die Box bauen: Das Mass wird fuer die
1792
    // jetzt die Umrandung berechnen und die Box bauen: Das Mass wird fuer die
1784
    // Rahmen-GROESSE benoetigt!
1793
    // Rahmen-GROESSE benoetigt!
Lines 1867-1874 Link Here
1867
    }
1876
    }
1868
1877
1869
    //Sadly word puts escher borders outside the graphic, but orients the
1878
    //Sadly word puts escher borders outside the graphic, but orients the
1870
    //graphic in relation to the top left inside the border. We don't
1879
    //graphic in relation to the top left inside the border. We don't.
1871
    if (nOutside)
1880
    //Only relevent in the (normal) case of not being inside a shape field
1881
    if (nOutside && !IsInlineEscherHack())
1872
    {
1882
    {
1873
        SwFmtHoriOrient aHori = (const SwFmtHoriOrient &)(rFlySet.Get(
1883
        SwFmtHoriOrient aHori = (const SwFmtHoriOrient &)(rFlySet.Get(
1874
            RES_HORI_ORIENT));
1884
            RES_HORI_ORIENT));
Lines 2393-2429 Link Here
2393
				+ pWwFib->ccpHdr  + pWwFib->ccpMcr
2403
				+ pWwFib->ccpHdr  + pWwFib->ccpMcr
2394
				+ pWwFib->ccpAtn  + pWwFib->ccpEdn;
2404
				+ pWwFib->ccpAtn  + pWwFib->ccpEdn;
2395
2405
2396
	if( pPlcxMan->GetManType() == MAN_HDFT )
2406
	if (pPlcxMan->GetManType() == MAN_HDFT)
2397
        nDrawCpO += pWwFib->ccpTxbx;
2407
        nDrawCpO += pWwFib->ccpTxbx;
2398
2408
2399
    if( !pDrawModel )// 1. GrafikObjekt des Docs
2409
    if (!pDrawModel)// 1. GrafikObjekt des Docs
2400
	    GrafikCtor();
2410
	    GrafikCtor();
2401
2411
2402
    WW8PLCFspecial* pPF = pPlcxMan->GetFdoa();
2412
    WW8PLCFspecial* pPF = pPlcxMan->GetFdoa();
2403
	if( !pPF )
2413
	if (!pPF)
2404
    {
2414
    {
2405
		ASSERT( !this, "Where is the grapic (1) ?" );
2415
		ASSERT(!this, "Where is the grapic (1) ?");
2406
		return 0;
2416
		return 0;
2407
	}
2417
	}
2408
2418
2409
	if( bVer67 )
2419
	if (bVer67)
2410
	{
2420
	{
2411
		long nOldPos = pStrm->Tell();
2421
		long nOldPos = pStrm->Tell();
2412
2422
2413
		nDrawXOfs = nDrawYOfs = 0;
2423
		nDrawXOfs = nDrawYOfs = 0;
2414
		ReadGrafLayer1( pPF, nGrafAnchorCp );
2424
		ReadGrafLayer1(pPF, nGrafAnchorCp);
2415
2425
2416
		pStrm->Seek( nOldPos );
2426
		pStrm->Seek(nOldPos);
2417
        return 0;
2427
        return 0;
2418
	}
2428
	}
2419
2429
2420
    //Normal case of Word 8+ version stuff
2430
    //Normal case of Word 8+ version stuff
2421
    pPF->SeekPos( nGrafAnchorCp );
2431
    pPF->SeekPos(nGrafAnchorCp);
2422
2432
2423
    long nStartFc;
2433
    long nStartFc;
2424
    void* pF0;
2434
    void* pF0;
2425
    if( !pPF->Get( nStartFc, pF0 ) ){
2435
    if (!pPF->Get(nStartFc, pF0))
2426
        ASSERT( !this, "+Wo ist die Grafik (2) ?" );
2436
    {
2437
        ASSERT(!this, "+Wo ist die Grafik (2) ?");
2427
        return 0;
2438
        return 0;
2428
    }
2439
    }
2429
2440
Lines 2473-2479 Link Here
2473
            break;
2484
            break;
2474
        default:
2485
        default:
2475
            break;
2486
            break;
2476
2477
    }
2487
    }
2478
2488
2479
    // Umfluss-Modus ermitteln
2489
    // Umfluss-Modus ermitteln
Lines 2551-2566 Link Here
2551
        }
2561
        }
2552
2562
2553
        RndStdIds eAnchor = FLY_AT_CNTNT;
2563
        RndStdIds eAnchor = FLY_AT_CNTNT;
2554
        if (pF->nby != WW8_FSPA::RelText)
2564
2565
        /*
2566
        #i3958#
2567
        If we are in a shape field, then we are to be anchored as character
2568
        and ignore the actual anchoring information
2569
        */
2570
        if (IsInlineEscherHack())
2555
        {
2571
        {
2556
            if( bIsHeader || bIsFooter)
2572
            eAnchor = FLY_IN_CNTNT;
2557
                pNode_FLY_AT_CNTNT = &pPaM->GetPoint()->nNode.GetNode();
2573
            SwFmtAnchor aAnchor(eAnchor);
2558
            else
2574
            aAnchor.SetAnchor(pPaM->GetPoint());
2559
                eAnchor = FLY_PAGE;
2575
            aFlySet.Put(aAnchor);
2560
        }
2576
        }
2577
        else
2578
        {
2579
            if (pF->nby != WW8_FSPA::RelText)
2580
            {
2581
                if (bIsHeader || bIsFooter)
2582
                    pNode_FLY_AT_CNTNT = &pPaM->GetPoint()->nNode.GetNode();
2583
                else
2584
                    eAnchor = FLY_PAGE;
2585
            }
2561
2586
2562
        if (pRecord)
2587
            if (pRecord)
2563
            eAnchor = ProcessEscherAlign(pRecord, pF, aFlySet, bReplaceable);
2588
                eAnchor=ProcessEscherAlign(pRecord, pF, aFlySet, bReplaceable);
2589
        }
2564
2590
2565
        // Should we, and is it possible to make this into a writer textbox
2591
        // Should we, and is it possible to make this into a writer textbox
2566
        if( (!(nIniFlags1 & WW8FL_NO_FLY_FOR_TXBX)) &&
2592
        if( (!(nIniFlags1 & WW8FL_NO_FLY_FOR_TXBX)) &&
Lines 2809-2815 Link Here
2809
        ASSERT(pRetFrmFmt->GetAnchor().GetAnchorId() == eAnchor,
2835
        ASSERT(pRetFrmFmt->GetAnchor().GetAnchorId() == eAnchor,
2810
            "Not the anchor type requested!");
2836
            "Not the anchor type requested!");
2811
2837
2812
        MatchWrapDistancesIntoFlyFmt( pRecord, pRetFrmFmt );
2838
        /*
2839
        #i3958#, basically a winword bug here, in inline mode the left and right
2840
        spacing are ignored, (shown grayed out in word)
2841
        */
2842
        if (!IsInlineEscherHack())
2843
            MatchWrapDistancesIntoFlyFmt(pRecord, pRetFrmFmt);
2813
2844
2814
        // falls alles Ok, Zeiger auf neues Objekt ermitteln und Z-Order-Liste
2845
        // falls alles Ok, Zeiger auf neues Objekt ermitteln und Z-Order-Liste
2815
        // entsprechend korrigieren (oder Eintrag loeschen)
2846
        // entsprechend korrigieren (oder Eintrag loeschen)
(-)ww8par.cxx (-11 / +10 lines)
Lines 1840-1846 Link Here
1840
                    // reset the flags.
1840
                    // reset the flags.
1841
                    bObj = bEmbeddObj = false;
1841
                    bObj = bEmbeddObj = false;
1842
                    nObjLocFc = 0;
1842
                    nObjLocFc = 0;
1843
                    pFmtOfJustInsertedGraphicOrOLE = pResult;
1844
                    //##515## set nLastFlyNode so we can determine if a section
1843
                    //##515## set nLastFlyNode so we can determine if a section
1845
                    //has ended with this paragraph unclosed
1844
                    //has ended with this paragraph unclosed
1846
                    nLastFlyNode = (*pPaM->GetPoint()).nNode.GetIndex();
1845
                    nLastFlyNode = (*pPaM->GetPoint()).nNode.GetIndex();
Lines 1848-1854 Link Here
1848
            }
1847
            }
1849
            break;
1848
            break;
1850
        case 0x8:
1849
        case 0x8:
1851
            if( !bObj )
1850
            if (!bObj)
1852
            {
1851
            {
1853
                Read_GrafLayer( nPosCp );
1852
                Read_GrafLayer( nPosCp );
1854
                //##515##. Set nLastFlyNode so we can determine if a
1853
                //##515##. Set nLastFlyNode so we can determine if a
Lines 2074-2087 Link Here
2074
2073
2075
		bool b = pPlcxMan->Get(&aRes);	 // hole Attribut-Pos
2074
		bool b = pPlcxMan->Get(&aRes);	 // hole Attribut-Pos
2076
2075
2077
		if(    !b
2076
        // nur Attributenden noch bearbeiten,
2078
			&& (aRes.nSprmId >=  0)		// nur Attributenden noch bearbeiten,
2077
        if ((aRes.nSprmId > 0)	&& 
2079
			&& (    (aRes.nSprmId <     eFTN)
2078
            ((aRes.nSprmId < eFTN) || (aRes.nSprmId >= 0x0800)))
2080
				 || (aRes.nSprmId >= 0x0800) )
2079
        {
2081
			)
2080
		    if (b)
2082
		{															// Anfaenge gehoeren zum naechsten Spezialtext
2081
                ImportSprm(aRes.pMemPos, aRes.nSprmId);
2083
			EndSprm( aRes.nSprmId );								// Fussnoten und Felder ignorieren
2082
            else
2084
		}
2083
			    EndSprm(aRes.nSprmId );
2084
        }
2085
		(*pPlcxMan)++;
2085
		(*pPlcxMan)++;
2086
		rNext = pPlcxMan->Where();
2086
		rNext = pPlcxMan->Where();
2087
	}
2087
	}
Lines 2245-2251 Link Here
2245
	pWFlyPara		= 0;
2245
	pWFlyPara		= 0;
2246
	pSFlyPara		= 0;
2246
	pSFlyPara		= 0;
2247
    pFlyFmtOfJustInsertedGraphic   = 0;
2247
    pFlyFmtOfJustInsertedGraphic   = 0;
2248
	pFmtOfJustInsertedGraphicOrOLE = 0;
2249
	nColls = nAktColl = 0;
2248
	nColls = nAktColl = 0;
2250
	nObjLocFc = nPicLocFc = 0;
2249
	nObjLocFc = nPicLocFc = 0;
2251
    nTable=0;
2250
    nTable=0;
(-)ww8par.hxx (-4 / +7 lines)
Lines 667-673 Link Here
667
	SwMSConvertControls *pFormImpl;	// Control-Implementierung
667
	SwMSConvertControls *pFormImpl;	// Control-Implementierung
668
668
669
    SwFlyFrmFmt* pFlyFmtOfJustInsertedGraphic;
669
    SwFlyFrmFmt* pFlyFmtOfJustInsertedGraphic;
670
	SwFrmFmt* pFmtOfJustInsertedGraphicOrOLE;
671
670
672
	/*
671
	/*
673
    Keep track of generated Ruby character formats we we can minimize the
672
    Keep track of generated Ruby character formats we we can minimize the
Lines 833-839 Link Here
833
	bool bWWBugNormal;		// WW-Version nit Bug Dya in Style Normal
832
	bool bWWBugNormal;		// WW-Version nit Bug Dya in Style Normal
834
	bool bNoAttrImport;		// Attribute ignorieren zum Ignorieren v. Styles
833
	bool bNoAttrImport;		// Attribute ignorieren zum Ignorieren v. Styles
835
	bool bInHyperlink;      // Sonderfall zum einlesen eines 0x01
834
	bool bInHyperlink;      // Sonderfall zum einlesen eines 0x01
836
								   // siehe: SwWW8ImplReader::Read_F_Hyperlink()
835
							// siehe: SwWW8ImplReader::Read_F_Hyperlink()
837
    bool bVerticalEnviron;
836
    bool bVerticalEnviron;
838
    bool bWasParaEnd;
837
    bool bWasParaEnd;
839
838
Lines 1148-1153 Link Here
1148
1147
1149
    void SetOutLineStyles();
1148
    void SetOutLineStyles();
1150
1149
1150
    bool IsInlineEscherHack()
1151
        {return !maFieldStack.empty() ? maFieldStack.top() == 95 : false; };
1152
1151
    //No copying
1153
    //No copying
1152
    SwWW8ImplReader(const SwWW8ImplReader &);
1154
    SwWW8ImplReader(const SwWW8ImplReader &);
1153
    SwWW8ImplReader& operator=(const SwWW8ImplReader&);
1155
    SwWW8ImplReader& operator=(const SwWW8ImplReader&);
Lines 1291-1298 Link Here
1291
	eF_ResT Read_F_IncludeText(    WW8FieldDesc*, String& rStr );
1293
	eF_ResT Read_F_IncludeText(    WW8FieldDesc*, String& rStr );
1292
	eF_ResT Read_F_Seq( WW8FieldDesc*, String& rStr );
1294
	eF_ResT Read_F_Seq( WW8FieldDesc*, String& rStr );
1293
1295
1294
	eF_ResT Read_F_OCX( WW8FieldDesc*, String& );
1296
	eF_ResT Read_F_OCX(WW8FieldDesc*, String&);
1295
	eF_ResT Read_F_Hyperlink( WW8FieldDesc*, String& rStr );
1297
	eF_ResT Read_F_Hyperlink(WW8FieldDesc*, String& rStr);
1298
    eF_ResT Read_F_Shape(WW8FieldDesc* pF, String& rStr);
1296
1299
1297
	void DeleteFormImpl();
1300
	void DeleteFormImpl();
1298
1301
(-)ww8par5.cxx (-10 / +25 lines)
Lines 701-707 Link Here
701
long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes)
701
long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes)
702
{
702
{
703
    typedef eF_ResT (SwWW8ImplReader:: *FNReadField)( WW8FieldDesc*, String& );
703
    typedef eF_ResT (SwWW8ImplReader:: *FNReadField)( WW8FieldDesc*, String& );
704
    static FNReadField aWW8FieldTab[93] = 
704
    enum Limits {eMax = 96};
705
    static FNReadField aWW8FieldTab[eMax+1] = 
705
    {
706
    {
706
        0,
707
        0,
707
        0,
708
        0,
Lines 799-808 Link Here
799
        0,											// 89
800
        0,											// 89
800
        0,											// 90
801
        0,											// 90
801
        0,											// 91
802
        0,											// 91
802
        0 											// 92 - Dummy leer Methode
803
        0,											// 92
803
    };											// 92   == alle ueber 91
804
        0,											// 93
805
        0,											// 94
806
        &SwWW8ImplReader::Read_F_Shape,				// 95
807
        0 											// eMax - Dummy leer Methode
808
    };											// eMax   == alle ueber eMax-1
804
809
805
	ASSERT( ( sizeof( aWW8FieldTab ) / sizeof( *aWW8FieldTab ) == 93 ),
810
	ASSERT( ( sizeof( aWW8FieldTab ) / sizeof( *aWW8FieldTab ) == eMax+1 ),
806
			"FeldFunc-Tabelle stimmt nicht" );
811
			"FeldFunc-Tabelle stimmt nicht" );
807
	if( nIniFlags & WW8FL_NO_FLD )
812
	if( nIniFlags & WW8FL_NO_FLD )
808
		return 0;
813
		return 0;
Lines 820-842 Link Here
820
825
821
    maFieldStack.push(aF.nId);
826
    maFieldStack.push(aF.nId);
822
827
823
	USHORT n = ( aF.nId <= 91 ) ? aF.nId : 92; // alle > 91 werden 92
828
	USHORT n = (aF.nId < eMax) ? aF.nId : eMax; // alle > eMax-1 werden eMax
824
	USHORT nI = n / 32;						// # des UINT32
829
	USHORT nI = n / 32;						// # des UINT32
825
	ULONG nMask = 1 << ( n % 32 );			// Maske fuer Bits
830
	ULONG nMask = 1 << ( n % 32 );			// Maske fuer Bits
826
831
827
	if( nFieldTagAlways[nI] & nMask )		// Flag: Tag it
832
	if( nFieldTagAlways[nI] & nMask )		// Flag: Tag it
828
		return Read_F_Tag( &aF );			// Resultat nicht als Text
833
		return Read_F_Tag( &aF );			// Resultat nicht als Text
829
834
830
	if( !bOk || !aF.nId )                   // Feld kaputt
835
	if (!bOk || !aF.nId)                   // Feld kaputt
831
		return aF.nLen;						// -> ignorieren
836
		return aF.nLen;						// -> ignorieren
832
837
833
	if( aF.nId > 91
838
	if (aF.nId > eMax-1)
834
//		|| ( aF.nOpt & 0x40 )				// 0x40-Result Nest -> OK
839
    {
835
							 )				// WW: Nested Field
836
		if( nFieldTagBad[nI] & nMask )		// Flag: Tag it when bad
840
		if( nFieldTagBad[nI] & nMask )		// Flag: Tag it when bad
837
			return Read_F_Tag( &aF );		// Resultat nicht als Text
841
			return Read_F_Tag( &aF );		// Resultat nicht als Text
838
		else
842
		else
839
			return aF.nLen;
843
			return aF.nLen;
844
    }
840
845
841
	if( aWW8FieldTab[aF.nId] == 0			// keine Routine vorhanden
846
	if( aWW8FieldTab[aF.nId] == 0			// keine Routine vorhanden
842
		|| aF.bCodeNest )
847
		|| aF.bCodeNest )
Lines 2924-2930 Link Here
2924
	return FLD_OK;
2929
	return FLD_OK;
2925
}
2930
}
2926
2931
2927
eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* pF, String& rStr )
2932
eF_ResT SwWW8ImplReader::Read_F_Shape(WW8FieldDesc* pF, String& rStr)
2933
{
2934
    /*
2935
    #i3958# 0x8 followed by 0x1 where the shape is the 0x8 and its anchoring
2936
    to be ignored followed by a 0x1 with an empty drawing. Detect in inserting
2937
    the drawing that we are in the Shape field and respond accordingly
2938
    */
2939
    return FLD_TEXT;
2940
}
2941
2942
eF_ResT SwWW8ImplReader::Read_F_Hyperlink(WW8FieldDesc* pF, String& rStr)
2928
{
2943
{
2929
	eF_ResT eRet = FLD_OK;
2944
	eF_ResT eRet = FLD_OK;
2930
	String sURL, sTarget, sMark;
2945
	String sURL, sTarget, sMark;

Return to issue 3958