xref: /aoo41x/main/sw/source/core/doc/notxtfrm.cxx (revision f8c074b1)
1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5efeef26fSAndrew Rist  * distributed with this work for additional information
6efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10efeef26fSAndrew Rist  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist  *
13efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17efeef26fSAndrew Rist  * specific language governing permissions and limitations
18efeef26fSAndrew Rist  * under the License.
19efeef26fSAndrew Rist  *
20efeef26fSAndrew Rist  *************************************************************/
21efeef26fSAndrew Rist 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_sw.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <hintids.hxx>
26cdf0e10cSrcweir #include <tools/urlobj.hxx>
27cdf0e10cSrcweir #include <vcl/print.hxx>
28cdf0e10cSrcweir #include <vcl/virdev.hxx>
29cdf0e10cSrcweir #include <vcl/svapp.hxx>
30cdf0e10cSrcweir #include <svtools/imapobj.hxx>
31cdf0e10cSrcweir #include <svtools/imap.hxx>
32cdf0e10cSrcweir #include <svl/urihelper.hxx>
33cdf0e10cSrcweir #include <svtools/soerr.hxx>
34cdf0e10cSrcweir #include <sfx2/progress.hxx>
35cdf0e10cSrcweir #include <sfx2/docfile.hxx>
36*f8c074b1SArrigo Marchiori #include <sfx2/linkmgr.hxx>
37cdf0e10cSrcweir #include <sfx2/printer.hxx>
38cdf0e10cSrcweir #include <editeng/udlnitem.hxx>
39cdf0e10cSrcweir #include <editeng/colritem.hxx>
40cdf0e10cSrcweir #include <svx/xoutbmp.hxx>
41cdf0e10cSrcweir #include <vcl/window.hxx>
42cdf0e10cSrcweir #include <fmturl.hxx>
43cdf0e10cSrcweir #include <fmtsrnd.hxx>
44cdf0e10cSrcweir #include <frmfmt.hxx>
45cdf0e10cSrcweir #include <swrect.hxx>
46cdf0e10cSrcweir #include <fesh.hxx>
47cdf0e10cSrcweir #include <doc.hxx>
48cdf0e10cSrcweir #include <flyfrm.hxx>
49cdf0e10cSrcweir #include <frmtool.hxx>
50cdf0e10cSrcweir #include <viewopt.hxx>
51cdf0e10cSrcweir #include <viewimp.hxx>
52cdf0e10cSrcweir #include <pam.hxx>
53cdf0e10cSrcweir #include <hints.hxx>
54cdf0e10cSrcweir #include <rootfrm.hxx>
55cdf0e10cSrcweir #include <dflyobj.hxx>
56cdf0e10cSrcweir #include <pagefrm.hxx>
57cdf0e10cSrcweir #include <notxtfrm.hxx>
58cdf0e10cSrcweir #include <grfatr.hxx>
59cdf0e10cSrcweir #include <charatr.hxx>
60cdf0e10cSrcweir #include <fmtornt.hxx>
61cdf0e10cSrcweir #include <ndnotxt.hxx>
62cdf0e10cSrcweir #include <ndgrf.hxx>
63cdf0e10cSrcweir #include <ndole.hxx>
64cdf0e10cSrcweir #include <swregion.hxx>
65cdf0e10cSrcweir #include <poolfmt.hxx>
66cdf0e10cSrcweir #include <mdiexp.hxx>
67cdf0e10cSrcweir #include <swwait.hxx>
68cdf0e10cSrcweir #include <comcore.hrc>
69cdf0e10cSrcweir #include <accessibilityoptions.hxx>
70cdf0e10cSrcweir #include <com/sun/star/embed/EmbedMisc.hpp>
71cdf0e10cSrcweir #include <com/sun/star/embed/EmbedStates.hpp>
72cdf0e10cSrcweir #include <svtools/embedhlp.hxx>
7378d93489SArmin Le Grand #include <svx/charthelper.hxx>
74cdf0e10cSrcweir #include <dview.hxx>
75ddde725dSArmin Le Grand #include <basegfx/matrix/b2dhommatrix.hxx>
76ddde725dSArmin Le Grand #include <drawinglayer/processor2d/baseprocessor2d.hxx>
77ddde725dSArmin Le Grand #include <basegfx/matrix/b2dhommatrixtools.hxx>
78a7185797SArmin Le Grand #include <drawinglayer/processor2d/processor2dtools.hxx>
79bb7f1afcSArmin Le Grand #include <basegfx/matrix/b2dhommatrixtools.hxx>
80f7809f79SArmin Le Grand #include <drawinglayer/primitive2d/graphicprimitive2d.hxx>
81314db743SHerbert Dürr #include <vcl/pdfextoutdevdata.hxx>
82314db743SHerbert Dürr #include <svtools/filter.hxx>
83ddde725dSArmin Le Grand 
84cdf0e10cSrcweir using namespace com::sun::star;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir #define DEFTEXTSIZE  12
87cdf0e10cSrcweir 
88cdf0e10cSrcweir extern void ClrContourCache( const SdrObject *pObj ); // TxtFly.Cxx
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 
GetRealURL(const SwGrfNode & rNd,String & rTxt)91cdf0e10cSrcweir inline sal_Bool GetRealURL( const SwGrfNode& rNd, String& rTxt )
92cdf0e10cSrcweir {
93cdf0e10cSrcweir 	sal_Bool bRet = rNd.GetFileFilterNms( &rTxt, 0 );
94cdf0e10cSrcweir 	if( bRet )
95cdf0e10cSrcweir 		rTxt = URIHelper::removePassword( rTxt, INetURLObject::WAS_ENCODED,
96cdf0e10cSrcweir 			   							INetURLObject::DECODE_UNAMBIGUOUS);
97cdf0e10cSrcweir 	return bRet;
98cdf0e10cSrcweir }
99cdf0e10cSrcweir 
lcl_PaintReplacement(const SwRect & rRect,const String & rText,const ViewShell & rSh,const SwNoTxtFrm * pFrm,sal_Bool bDefect)100cdf0e10cSrcweir void lcl_PaintReplacement( const SwRect &rRect, const String &rText,
101cdf0e10cSrcweir 						   const ViewShell &rSh, const SwNoTxtFrm *pFrm,
102cdf0e10cSrcweir 						   sal_Bool bDefect )
103cdf0e10cSrcweir {
104cdf0e10cSrcweir 	static Font *pFont = 0;
105cdf0e10cSrcweir 	if ( !pFont )
106cdf0e10cSrcweir 	{
107cdf0e10cSrcweir 		pFont = new Font();
108cdf0e10cSrcweir 		pFont->SetWeight( WEIGHT_BOLD );
109cdf0e10cSrcweir 		pFont->SetStyleName( aEmptyStr );
110cdf0e10cSrcweir 		pFont->SetName( String::CreateFromAscii(
111cdf0e10cSrcweir                             RTL_CONSTASCII_STRINGPARAM( "Arial Unicode" )));
112cdf0e10cSrcweir 		pFont->SetFamily( FAMILY_SWISS );
113cdf0e10cSrcweir 		pFont->SetTransparent( sal_True );
114cdf0e10cSrcweir 	}
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	Color aCol( COL_RED );
117cdf0e10cSrcweir 	FontUnderline eUnderline = UNDERLINE_NONE;
118cdf0e10cSrcweir 	const SwFmtURL &rURL = pFrm->FindFlyFrm()->GetFmt()->GetURL();
119cdf0e10cSrcweir 	if( rURL.GetURL().Len() || rURL.GetMap() )
120cdf0e10cSrcweir 	{
121cdf0e10cSrcweir 		sal_Bool bVisited = sal_False;
122cdf0e10cSrcweir 		if ( rURL.GetMap() )
123cdf0e10cSrcweir 		{
124cdf0e10cSrcweir 			ImageMap *pMap = (ImageMap*)rURL.GetMap();
125cdf0e10cSrcweir 			for( sal_uInt16 i = 0; i < pMap->GetIMapObjectCount(); i++ )
126cdf0e10cSrcweir 			{
127cdf0e10cSrcweir 				IMapObject *pObj = pMap->GetIMapObject( i );
128cdf0e10cSrcweir 				if( rSh.GetDoc()->IsVisitedURL( pObj->GetURL() ) )
129cdf0e10cSrcweir 				{
130cdf0e10cSrcweir 					bVisited = sal_True;
131cdf0e10cSrcweir 					break;
132cdf0e10cSrcweir 				}
133cdf0e10cSrcweir 			}
134cdf0e10cSrcweir 		}
135cdf0e10cSrcweir 		else if ( rURL.GetURL().Len() )
136cdf0e10cSrcweir 			bVisited = rSh.GetDoc()->IsVisitedURL( rURL.GetURL() );
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 		SwFmt *pFmt = rSh.GetDoc()->GetFmtFromPool( static_cast<sal_uInt16>
139cdf0e10cSrcweir             (bVisited ? RES_POOLCHR_INET_VISIT : RES_POOLCHR_INET_NORMAL ) );
140cdf0e10cSrcweir 		aCol = pFmt->GetColor().GetValue();
141cdf0e10cSrcweir 		eUnderline = pFmt->GetUnderline().GetLineStyle();
142cdf0e10cSrcweir 	}
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 	pFont->SetUnderline( eUnderline );
145cdf0e10cSrcweir 	pFont->SetColor( aCol );
146cdf0e10cSrcweir 
147cdf0e10cSrcweir     const BitmapEx& rBmp = ViewShell::GetReplacementBitmap( bDefect != sal_False );
148cdf0e10cSrcweir     Graphic::DrawEx( rSh.GetOut(), rText, *pFont, rBmp, rRect.Pos(), rRect.SSize() );
149cdf0e10cSrcweir }
150cdf0e10cSrcweir 
151cdf0e10cSrcweir /*************************************************************************
152cdf0e10cSrcweir |*
153cdf0e10cSrcweir |*	  SwGrfFrm::SwGrfFrm(ViewShell * const,SwGrfNode *)
154cdf0e10cSrcweir |*
155cdf0e10cSrcweir |*	  Beschreibung
156cdf0e10cSrcweir |*	  Ersterstellung	JP 05.03.91
157cdf0e10cSrcweir |*	  Letzte Aenderung	MA 03. Mar. 93
158cdf0e10cSrcweir |*
159cdf0e10cSrcweir *************************************************************************/
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 
SwNoTxtFrm(SwNoTxtNode * const pNode,SwFrm * pSib)162cdf0e10cSrcweir SwNoTxtFrm::SwNoTxtFrm(SwNoTxtNode * const pNode, SwFrm* pSib )
163cdf0e10cSrcweir 	: SwCntntFrm( pNode, pSib )
164cdf0e10cSrcweir {
165cdf0e10cSrcweir 	InitCtor();
166cdf0e10cSrcweir }
167cdf0e10cSrcweir 
168cdf0e10cSrcweir // Initialisierung: z.Zt. Eintragen des Frames im Cache
169cdf0e10cSrcweir 
170cdf0e10cSrcweir 
InitCtor()171cdf0e10cSrcweir void SwNoTxtFrm::InitCtor()
172cdf0e10cSrcweir {
173cdf0e10cSrcweir     nType = FRMC_NOTXT;
174cdf0e10cSrcweir 	// Das Gewicht der Grafik ist 0, wenn sie noch nicht
175cdf0e10cSrcweir 	// gelesen ist, < 0, wenn ein Lesefehler auftrat und
176cdf0e10cSrcweir 	// Ersatzdarstellung angewendet werden musste und >0,
177cdf0e10cSrcweir 	// wenn sie zur Verfuegung steht.
178cdf0e10cSrcweir 	nWeight = 0;
179cdf0e10cSrcweir }
180cdf0e10cSrcweir 
181cdf0e10cSrcweir /*************************************************************************
182cdf0e10cSrcweir |*
183cdf0e10cSrcweir |*	  SwNoTxtNode::MakeFrm()
184cdf0e10cSrcweir |*
185cdf0e10cSrcweir |*	  Beschreibung
186cdf0e10cSrcweir |*	  Ersterstellung	JP 05.03.91
187cdf0e10cSrcweir |*	  Letzte Aenderung	MA 03. Mar. 93
188cdf0e10cSrcweir |*
189cdf0e10cSrcweir *************************************************************************/
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 
MakeFrm(SwFrm * pSib)192cdf0e10cSrcweir SwCntntFrm *SwNoTxtNode::MakeFrm( SwFrm* pSib )
193cdf0e10cSrcweir {
194cdf0e10cSrcweir 	return new SwNoTxtFrm(this, pSib);
195cdf0e10cSrcweir }
196cdf0e10cSrcweir 
197cdf0e10cSrcweir /*************************************************************************
198cdf0e10cSrcweir |*
199cdf0e10cSrcweir |*	  SwNoTxtFrm::~SwNoTxtFrm()
200cdf0e10cSrcweir |*
201cdf0e10cSrcweir |*	  Beschreibung
202cdf0e10cSrcweir |*	  Ersterstellung	JP 05.03.91
203cdf0e10cSrcweir |*	  Letzte Aenderung	MA 30. Apr. 96
204cdf0e10cSrcweir |*
205cdf0e10cSrcweir *************************************************************************/
206cdf0e10cSrcweir 
~SwNoTxtFrm()207cdf0e10cSrcweir SwNoTxtFrm::~SwNoTxtFrm()
208cdf0e10cSrcweir {
209cdf0e10cSrcweir 	StopAnimation();
210cdf0e10cSrcweir }
211cdf0e10cSrcweir 
212cdf0e10cSrcweir /*************************************************************************
213cdf0e10cSrcweir |*
214cdf0e10cSrcweir |*	  void SwNoTxtFrm::Modify( SwHint * pOld, SwHint * pNew )
215cdf0e10cSrcweir |*
216cdf0e10cSrcweir |*	  Beschreibung
217cdf0e10cSrcweir |*	  Ersterstellung	JP 05.03.91
218cdf0e10cSrcweir |*	  Letzte Aenderung	JP 05.03.91
219cdf0e10cSrcweir |*
220cdf0e10cSrcweir *************************************************************************/
221cdf0e10cSrcweir 
SetOutDev(ViewShell * pSh,OutputDevice * pOut)222cdf0e10cSrcweir void SetOutDev( ViewShell *pSh, OutputDevice *pOut )
223cdf0e10cSrcweir {
224cdf0e10cSrcweir 	pSh->pOut = pOut;
225cdf0e10cSrcweir }
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 
229cdf0e10cSrcweir 
lcl_ClearArea(const SwFrm & rFrm,OutputDevice & rOut,const SwRect & rPtArea,const SwRect & rGrfArea)230cdf0e10cSrcweir void lcl_ClearArea( const SwFrm &rFrm,
231cdf0e10cSrcweir 					OutputDevice &rOut, const SwRect& rPtArea,
232cdf0e10cSrcweir 					const SwRect &rGrfArea )
233cdf0e10cSrcweir {
234cdf0e10cSrcweir 	SwRegionRects aRegion( rPtArea, 4, 4 );
235cdf0e10cSrcweir 	aRegion -= rGrfArea;
236cdf0e10cSrcweir 
237cdf0e10cSrcweir 	if ( aRegion.Count() )
238cdf0e10cSrcweir 	{
239cdf0e10cSrcweir 		const SvxBrushItem *pItem; const Color *pCol; SwRect aOrigRect;
240cdf0e10cSrcweir 		if ( rFrm.GetBackgroundBrush( pItem, pCol, aOrigRect, sal_False ) )
241cdf0e10cSrcweir 			for( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
242cdf0e10cSrcweir 				::DrawGraphic( pItem, &rOut, aOrigRect, aRegion[i] );
243cdf0e10cSrcweir 		else
244cdf0e10cSrcweir 		{
245cdf0e10cSrcweir             // OD 2004-04-23 #116347#
246cdf0e10cSrcweir             rOut.Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
247cdf0e10cSrcweir 			rOut.SetFillColor( rFrm.getRootFrm()->GetCurrShell()->Imp()->GetRetoucheColor());
248cdf0e10cSrcweir 			rOut.SetLineColor();
249cdf0e10cSrcweir 			for( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
250cdf0e10cSrcweir 				rOut.DrawRect( aRegion[i].SVRect() );
251cdf0e10cSrcweir 			rOut.Pop();
252cdf0e10cSrcweir 		}
253cdf0e10cSrcweir 	}
254cdf0e10cSrcweir }
255cdf0e10cSrcweir 
256cdf0e10cSrcweir /*************************************************************************
257cdf0e10cSrcweir |*
258cdf0e10cSrcweir |*	  void SwNoTxtFrm::Paint()
259cdf0e10cSrcweir |*
260cdf0e10cSrcweir |*	  Beschreibung
261cdf0e10cSrcweir |*	  Ersterstellung	JP 05.03.91
262cdf0e10cSrcweir |*	  Letzte Aenderung	MA 10. Jan. 97
263cdf0e10cSrcweir |*
264cdf0e10cSrcweir *************************************************************************/
265cdf0e10cSrcweir 
Paint(SwRect const & rRect,SwPrintData const * const) const266cdf0e10cSrcweir void SwNoTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
267cdf0e10cSrcweir {
268cdf0e10cSrcweir 	if ( Frm().IsEmpty() )
269cdf0e10cSrcweir 		return;
270cdf0e10cSrcweir 
271cdf0e10cSrcweir 	const ViewShell* pSh = getRootFrm()->GetCurrShell();
272cdf0e10cSrcweir 	if( !pSh->GetViewOptions()->IsGraphic() )
273cdf0e10cSrcweir 	{
274cdf0e10cSrcweir 		StopAnimation();
275cdf0e10cSrcweir         // OD 10.01.2003 #i6467# - no paint of placeholder for page preview
276cdf0e10cSrcweir         if ( pSh->GetWin() && !pSh->IsPreView() )
277cdf0e10cSrcweir 		{
278cdf0e10cSrcweir 			const SwNoTxtNode* pNd = GetNode()->GetNoTxtNode();
279cdf0e10cSrcweir             String aTxt( pNd->GetTitle() );
280cdf0e10cSrcweir 			if ( !aTxt.Len() && pNd->IsGrfNode() )
281cdf0e10cSrcweir 				GetRealURL( *(SwGrfNode*)pNd, aTxt );
282cdf0e10cSrcweir 			if( !aTxt.Len() )
283cdf0e10cSrcweir 				aTxt = FindFlyFrm()->GetFmt()->GetName();
284cdf0e10cSrcweir 			lcl_PaintReplacement( Frm(), aTxt, *pSh, this, sal_False );
285cdf0e10cSrcweir 		}
286cdf0e10cSrcweir 		return;
287cdf0e10cSrcweir 	}
288cdf0e10cSrcweir 
289cdf0e10cSrcweir     if( pSh->GetAccessibilityOptions()->IsStopAnimatedGraphics() ||
290cdf0e10cSrcweir     // --> FME 2004-06-21 #i9684# Stop animation during printing/pdf export
291cdf0e10cSrcweir        !pSh->GetWin() )
292cdf0e10cSrcweir     // <--
293cdf0e10cSrcweir         StopAnimation();
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 	SfxProgress::EnterLock(); //Keine Progress-Reschedules im Paint (SwapIn)
296cdf0e10cSrcweir 
297cdf0e10cSrcweir 	OutputDevice *pOut = pSh->GetOut();
298cdf0e10cSrcweir 	pOut->Push();
299cdf0e10cSrcweir 	sal_Bool bClip = sal_True;
300cdf0e10cSrcweir 	PolyPolygon aPoly;
301cdf0e10cSrcweir 
302cdf0e10cSrcweir     SwNoTxtNode& rNoTNd = *(SwNoTxtNode*)GetNode();
303cdf0e10cSrcweir 	SwGrfNode* pGrfNd = rNoTNd.GetGrfNode();
304cdf0e10cSrcweir     if( pGrfNd )
305cdf0e10cSrcweir 		pGrfNd->SetFrameInPaint( sal_True );
306cdf0e10cSrcweir 
307cdf0e10cSrcweir     // OD 16.04.2003 #i13147# - add 2nd parameter with value <sal_True> to
308cdf0e10cSrcweir     // method call <FindFlyFrm().GetContour(..)> to indicate that it is called
309cdf0e10cSrcweir     // for paint in order to avoid load of the intrinsic graphic.
310cdf0e10cSrcweir     if ( ( !pOut->GetConnectMetaFile() ||
311cdf0e10cSrcweir            !pSh->GetWin() ) &&
312cdf0e10cSrcweir          FindFlyFrm()->GetContour( aPoly, sal_True )
313cdf0e10cSrcweir        )
314cdf0e10cSrcweir 	{
315cdf0e10cSrcweir 		pOut->SetClipRegion( aPoly );
316cdf0e10cSrcweir 		bClip = sal_False;
317cdf0e10cSrcweir 	}
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 	SwRect aOrigPaint( rRect );
320cdf0e10cSrcweir 	if ( HasAnimation() && pSh->GetWin() )
321cdf0e10cSrcweir 	{
322cdf0e10cSrcweir 		aOrigPaint = Frm(); aOrigPaint += Prt().Pos();
323cdf0e10cSrcweir 	}
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 	SwRect aGrfArea( Frm() );
326cdf0e10cSrcweir 	SwRect aPaintArea( aGrfArea );
327cdf0e10cSrcweir 	aPaintArea._Intersection( aOrigPaint );
328cdf0e10cSrcweir 
329cdf0e10cSrcweir 	SwRect aNormal( Frm().Pos() + Prt().Pos(), Prt().SSize() );
330cdf0e10cSrcweir 	aNormal.Justify(); //Normalisiertes Rechteck fuer die Vergleiche
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 	if( aPaintArea.IsOver( aNormal ) )
333cdf0e10cSrcweir 	{
334cdf0e10cSrcweir 		// berechne die 4 zu loeschenden Rechtecke
335cdf0e10cSrcweir 		if( pSh->GetWin() )
336cdf0e10cSrcweir 			::lcl_ClearArea( *this, *pSh->GetOut(), aPaintArea, aNormal );
337cdf0e10cSrcweir 
338cdf0e10cSrcweir 		// in der Schnittmenge vom PaintBereich und der Bitmap liegt
339cdf0e10cSrcweir 		// der absolut sichtbare Bereich vom Frame
340cdf0e10cSrcweir 		aPaintArea._Intersection( aNormal );
341cdf0e10cSrcweir 
342cdf0e10cSrcweir 		if ( bClip )
343cdf0e10cSrcweir 			pOut->IntersectClipRegion( aPaintArea.SVRect() );
344cdf0e10cSrcweir         /// OD 25.09.2002 #99739# - delete unused 3rd parameter
345cdf0e10cSrcweir         PaintPicture( pOut, aGrfArea );
346cdf0e10cSrcweir 	}
347cdf0e10cSrcweir 	else
348cdf0e10cSrcweir 		// wenn nicht sichtbar, loesche einfach den angegebenen Bereich
349cdf0e10cSrcweir 		lcl_ClearArea( *this, *pSh->GetOut(), aPaintArea, SwRect() );
350cdf0e10cSrcweir     if( pGrfNd )
351cdf0e10cSrcweir 		pGrfNd->SetFrameInPaint( sal_False );
352cdf0e10cSrcweir 
353cdf0e10cSrcweir 	pOut->Pop();
354cdf0e10cSrcweir 	SfxProgress::LeaveLock();
355cdf0e10cSrcweir }
356cdf0e10cSrcweir 
357cdf0e10cSrcweir /*************************************************************************
358cdf0e10cSrcweir |*
359cdf0e10cSrcweir |*    void lcl_CalcRect( Point & aPt, Size & aDim,
360cdf0e10cSrcweir |*                   sal_uInt16 nMirror )
361cdf0e10cSrcweir |*
362cdf0e10cSrcweir |*    Beschreibung      Errechne die Position und die Groesse der Grafik im
363cdf0e10cSrcweir |*                      Frame, entsprechen der aktuellen Grafik-Attribute
364cdf0e10cSrcweir |*
365cdf0e10cSrcweir |*    Parameter         Point&  die Position im Frame  ( auch Return-Wert )
366cdf0e10cSrcweir |*                      Size&   die Groesse der Grafik ( auch Return-Wert )
367cdf0e10cSrcweir |*                      MirrorGrf   akt. Spiegelungs-Attribut
368cdf0e10cSrcweir |*    Ersterstellung    JP 04.03.91
369cdf0e10cSrcweir |*    Letzte Aenderung  JP 31.08.94
370cdf0e10cSrcweir |*
371cdf0e10cSrcweir *************************************************************************/
372cdf0e10cSrcweir 
373cdf0e10cSrcweir 
lcl_CalcRect(Point & rPt,Size & rDim,sal_uInt16 nMirror)374cdf0e10cSrcweir void lcl_CalcRect( Point& rPt, Size& rDim, sal_uInt16 nMirror )
375cdf0e10cSrcweir {
376cdf0e10cSrcweir     if( nMirror == RES_MIRROR_GRAPH_VERT || nMirror == RES_MIRROR_GRAPH_BOTH )
377cdf0e10cSrcweir     {
378cdf0e10cSrcweir         rPt.X() += rDim.Width() -1;
379cdf0e10cSrcweir         rDim.Width() = -rDim.Width();
380cdf0e10cSrcweir     }
381cdf0e10cSrcweir 
382cdf0e10cSrcweir     if( nMirror == RES_MIRROR_GRAPH_HOR || nMirror == RES_MIRROR_GRAPH_BOTH )
383cdf0e10cSrcweir     {
384cdf0e10cSrcweir         rPt.Y() += rDim.Height() -1;
385cdf0e10cSrcweir         rDim.Height() = -rDim.Height();
386cdf0e10cSrcweir     }
387cdf0e10cSrcweir }
388cdf0e10cSrcweir 
389cdf0e10cSrcweir /*************************************************************************
390cdf0e10cSrcweir |*
391cdf0e10cSrcweir |*	  void SwNoTxtFrm::GetGrfArea()
392cdf0e10cSrcweir |*
393cdf0e10cSrcweir |*	  Beschreibung		Errechne die Position und die Groesse der Bitmap
394cdf0e10cSrcweir |*						innerhalb des uebergebenem Rechtecks.
395cdf0e10cSrcweir |*
396cdf0e10cSrcweir |*	  Ersterstellung	JP 03.09.91
397cdf0e10cSrcweir |*	  Letzte Aenderung	MA 11. Oct. 94
398cdf0e10cSrcweir |*
399cdf0e10cSrcweir *************************************************************************/
400cdf0e10cSrcweir 
GetGrfArea(SwRect & rRect,SwRect * pOrigRect,sal_Bool) const401cdf0e10cSrcweir void SwNoTxtFrm::GetGrfArea( SwRect &rRect, SwRect* pOrigRect,
402cdf0e10cSrcweir 							 sal_Bool ) const
403cdf0e10cSrcweir {
404cdf0e10cSrcweir     // JP 23.01.2001: currently only used for scaling, cropping and mirroring
405cdf0e10cSrcweir     // the contour of graphics!
406cdf0e10cSrcweir 	//					all other is handled by the GraphicObject
407cdf0e10cSrcweir 
408cdf0e10cSrcweir 	//In rRect wird das sichbare Rechteck der Grafik gesteckt.
409cdf0e10cSrcweir 	//In pOrigRect werden Pos+Size der Gesamtgrafik gesteck.
410cdf0e10cSrcweir 
411cdf0e10cSrcweir 	const SwAttrSet& rAttrSet = GetNode()->GetSwAttrSet();
412cdf0e10cSrcweir 	const SwCropGrf& rCrop = rAttrSet.GetCropGrf();
413cdf0e10cSrcweir     sal_uInt16 nMirror = rAttrSet.GetMirrorGrf().GetValue();
414cdf0e10cSrcweir 
415cdf0e10cSrcweir     if( rAttrSet.GetMirrorGrf().IsGrfToggle() )
416cdf0e10cSrcweir     {
417cdf0e10cSrcweir         if( !(FindPageFrm()->GetVirtPageNum() % 2) )
418cdf0e10cSrcweir         {
419cdf0e10cSrcweir             switch ( nMirror )
420cdf0e10cSrcweir             {
421cdf0e10cSrcweir                 case RES_MIRROR_GRAPH_DONT: nMirror = RES_MIRROR_GRAPH_VERT; break;
422cdf0e10cSrcweir                 case RES_MIRROR_GRAPH_VERT: nMirror = RES_MIRROR_GRAPH_DONT; break;
423cdf0e10cSrcweir                 case RES_MIRROR_GRAPH_HOR: nMirror = RES_MIRROR_GRAPH_BOTH; break;
424cdf0e10cSrcweir                 default: nMirror = RES_MIRROR_GRAPH_HOR; break;
425cdf0e10cSrcweir             }
426cdf0e10cSrcweir         }
427cdf0e10cSrcweir     }
428cdf0e10cSrcweir 
429cdf0e10cSrcweir 	//Grafik wird vom Node eingelesen falls notwendig. Kann aber schiefgehen.
430cdf0e10cSrcweir 	long nLeftCrop, nRightCrop, nTopCrop, nBottomCrop;
431cdf0e10cSrcweir 	Size aOrigSz( ((SwNoTxtNode*)GetNode())->GetTwipSize() );
432cdf0e10cSrcweir 	if ( !aOrigSz.Width() )
433cdf0e10cSrcweir 	{
434cdf0e10cSrcweir 		aOrigSz.Width() = Prt().Width();
435cdf0e10cSrcweir 		nLeftCrop  = -rCrop.GetLeft();
436cdf0e10cSrcweir 		nRightCrop = -rCrop.GetRight();
437cdf0e10cSrcweir 	}
438cdf0e10cSrcweir 	else
439cdf0e10cSrcweir 	{
440cdf0e10cSrcweir 		nLeftCrop = Max( aOrigSz.Width() -
441cdf0e10cSrcweir 							(rCrop.GetRight() + rCrop.GetLeft()), long(1) );
442cdf0e10cSrcweir 		const double nScale = double(Prt().Width())  / double(nLeftCrop);
443cdf0e10cSrcweir 		nLeftCrop  = long(nScale * -rCrop.GetLeft() );
444cdf0e10cSrcweir 		nRightCrop = long(nScale * -rCrop.GetRight() );
445cdf0e10cSrcweir 	}
446cdf0e10cSrcweir 
447cdf0e10cSrcweir     // crop values have to be mirrored too
448cdf0e10cSrcweir     if( nMirror == RES_MIRROR_GRAPH_VERT || nMirror == RES_MIRROR_GRAPH_BOTH )
449cdf0e10cSrcweir     {
450cdf0e10cSrcweir         long nTmpCrop = nLeftCrop;
451cdf0e10cSrcweir         nLeftCrop = nRightCrop;
452cdf0e10cSrcweir         nRightCrop= nTmpCrop;
453cdf0e10cSrcweir     }
454cdf0e10cSrcweir 
455cdf0e10cSrcweir 	if( !aOrigSz.Height() )
456cdf0e10cSrcweir 	{
457cdf0e10cSrcweir 		aOrigSz.Height() = Prt().Height();
458cdf0e10cSrcweir 		nTopCrop   = -rCrop.GetTop();
459cdf0e10cSrcweir 		nBottomCrop= -rCrop.GetBottom();
460cdf0e10cSrcweir 	}
461cdf0e10cSrcweir 	else
462cdf0e10cSrcweir 	{
463cdf0e10cSrcweir 		nTopCrop = Max( aOrigSz.Height() - (rCrop.GetTop() + rCrop.GetBottom()), long(1) );
464cdf0e10cSrcweir 		const double nScale = double(Prt().Height()) / double(nTopCrop);
465cdf0e10cSrcweir 		nTopCrop   = long(nScale * -rCrop.GetTop() );
466cdf0e10cSrcweir 		nBottomCrop= long(nScale * -rCrop.GetBottom() );
467cdf0e10cSrcweir 	}
468cdf0e10cSrcweir 
469cdf0e10cSrcweir     // crop values have to be mirrored too
470cdf0e10cSrcweir     if( nMirror == RES_MIRROR_GRAPH_HOR || nMirror == RES_MIRROR_GRAPH_BOTH )
471cdf0e10cSrcweir     {
472cdf0e10cSrcweir         long nTmpCrop = nTopCrop;
473cdf0e10cSrcweir         nTopCrop   = nBottomCrop;
474cdf0e10cSrcweir         nBottomCrop= nTmpCrop;
475cdf0e10cSrcweir     }
476cdf0e10cSrcweir 
477cdf0e10cSrcweir 	Size  aVisSz( Prt().SSize() );
478cdf0e10cSrcweir 	Size  aGrfSz( aVisSz );
479cdf0e10cSrcweir 	Point aVisPt( Frm().Pos() + Prt().Pos() );
480cdf0e10cSrcweir 	Point aGrfPt( aVisPt );
481cdf0e10cSrcweir 
482cdf0e10cSrcweir 	//Erst das 'sichtbare' Rect einstellen.
483cdf0e10cSrcweir 	if ( nLeftCrop > 0 )
484cdf0e10cSrcweir 	{
485cdf0e10cSrcweir 		aVisPt.X() 	+= nLeftCrop;
486cdf0e10cSrcweir 		aVisSz.Width() -= nLeftCrop;
487cdf0e10cSrcweir 	}
488cdf0e10cSrcweir 	if ( nTopCrop > 0 )
489cdf0e10cSrcweir 	{
490cdf0e10cSrcweir 		aVisPt.Y() 	 += nTopCrop;
491cdf0e10cSrcweir 		aVisSz.Height() -= nTopCrop;
492cdf0e10cSrcweir 	}
493cdf0e10cSrcweir 	if ( nRightCrop > 0 )
494cdf0e10cSrcweir 		aVisSz.Width() -= nRightCrop;
495cdf0e10cSrcweir 	if ( nBottomCrop > 0 )
496cdf0e10cSrcweir 		aVisSz.Height() -= nBottomCrop;
497cdf0e10cSrcweir 
498cdf0e10cSrcweir 	rRect.Pos  ( aVisPt );
499cdf0e10cSrcweir 	rRect.SSize( aVisSz );
500cdf0e10cSrcweir 
501cdf0e10cSrcweir 	//Ggf. Die Gesamtgrafik berechnen
502cdf0e10cSrcweir 	if ( pOrigRect )
503cdf0e10cSrcweir 	{
504cdf0e10cSrcweir 		Size aTmpSz( aGrfSz );
505cdf0e10cSrcweir 		aGrfPt.X()    += nLeftCrop;
506cdf0e10cSrcweir 		aTmpSz.Width() -= nLeftCrop + nRightCrop;
507cdf0e10cSrcweir 		aGrfPt.Y()	    += nTopCrop;
508cdf0e10cSrcweir 		aTmpSz.Height()-= nTopCrop + nBottomCrop;
509cdf0e10cSrcweir 
510cdf0e10cSrcweir         if( RES_MIRROR_GRAPH_DONT != nMirror )
511cdf0e10cSrcweir             lcl_CalcRect( aGrfPt, aTmpSz, nMirror );
512cdf0e10cSrcweir 
513cdf0e10cSrcweir 		pOrigRect->Pos  ( aGrfPt );
514cdf0e10cSrcweir 		pOrigRect->SSize( aTmpSz );
515cdf0e10cSrcweir 	}
516cdf0e10cSrcweir }
517cdf0e10cSrcweir 
518cdf0e10cSrcweir /*************************************************************************
519cdf0e10cSrcweir |*
520cdf0e10cSrcweir |*	  Size SwNoTxtFrm::GetSize()
521cdf0e10cSrcweir |*
522cdf0e10cSrcweir |*	  Beschreibung		Gebe die Groesse des umgebenen FLys und
523cdf0e10cSrcweir |*						damit die der Grafik zurueck.
524cdf0e10cSrcweir |*	  Ersterstellung	JP 04.03.91
525cdf0e10cSrcweir |*	  Letzte Aenderung	JP 31.08.94
526cdf0e10cSrcweir |*
527cdf0e10cSrcweir *************************************************************************/
528cdf0e10cSrcweir 
529cdf0e10cSrcweir 
GetSize() const530cdf0e10cSrcweir const Size& SwNoTxtFrm::GetSize() const
531cdf0e10cSrcweir {
532cdf0e10cSrcweir 	// gebe die Groesse des Frames zurueck
533cdf0e10cSrcweir 	const SwFrm *pFly = FindFlyFrm();
534cdf0e10cSrcweir 	if( !pFly )
535cdf0e10cSrcweir 		pFly = this;
536cdf0e10cSrcweir 	return pFly->Prt().SSize();
537cdf0e10cSrcweir }
538cdf0e10cSrcweir 
539cdf0e10cSrcweir /*************************************************************************
540cdf0e10cSrcweir |*
541cdf0e10cSrcweir |*	  SwNoTxtFrm::MakeAll()
542cdf0e10cSrcweir |*
543cdf0e10cSrcweir |*	  Ersterstellung	MA 29. Nov. 96
544cdf0e10cSrcweir |*	  Letzte Aenderung	MA 29. Nov. 96
545cdf0e10cSrcweir |*
546cdf0e10cSrcweir *************************************************************************/
547cdf0e10cSrcweir 
548cdf0e10cSrcweir 
MakeAll()549cdf0e10cSrcweir void SwNoTxtFrm::MakeAll()
550cdf0e10cSrcweir {
551cdf0e10cSrcweir 	SwCntntNotify aNotify( this );
552cdf0e10cSrcweir 	SwBorderAttrAccess aAccess( SwFrm::GetCache(), this );
553cdf0e10cSrcweir 	const SwBorderAttrs &rAttrs = *aAccess.Get();
554cdf0e10cSrcweir 
555cdf0e10cSrcweir 	while ( !bValidPos || !bValidSize || !bValidPrtArea )
556cdf0e10cSrcweir 	{
557cdf0e10cSrcweir 		MakePos();
558cdf0e10cSrcweir 
559cdf0e10cSrcweir 		if ( !bValidSize )
560cdf0e10cSrcweir 			Frm().Width( GetUpper()->Prt().Width() );
561cdf0e10cSrcweir 
562cdf0e10cSrcweir 		MakePrtArea( rAttrs );
563cdf0e10cSrcweir 
564cdf0e10cSrcweir 		if ( !bValidSize )
565cdf0e10cSrcweir 		{	bValidSize = sal_True;
566cdf0e10cSrcweir 			Format();
567cdf0e10cSrcweir 		}
568cdf0e10cSrcweir 	}
569cdf0e10cSrcweir }
570cdf0e10cSrcweir 
571cdf0e10cSrcweir /*************************************************************************
572cdf0e10cSrcweir |*
573cdf0e10cSrcweir |*	  SwNoTxtFrm::Format()
574cdf0e10cSrcweir |*
575cdf0e10cSrcweir |*	  Beschreibung		Errechne die Groesse der Bitmap, wenn noetig
576cdf0e10cSrcweir |*	  Ersterstellung	JP 11.03.91
577cdf0e10cSrcweir |*	  Letzte Aenderung	MA 13. Mar. 96
578cdf0e10cSrcweir |*
579cdf0e10cSrcweir *************************************************************************/
580cdf0e10cSrcweir 
581cdf0e10cSrcweir 
Format(const SwBorderAttrs *)582cdf0e10cSrcweir void SwNoTxtFrm::Format( const SwBorderAttrs * )
583cdf0e10cSrcweir {
584cdf0e10cSrcweir 	const Size aNewSize( GetSize() );
585cdf0e10cSrcweir 
586cdf0e10cSrcweir 	// hat sich die Hoehe geaendert?
587cdf0e10cSrcweir 	SwTwips nChgHght = IsVertical() ?
588cdf0e10cSrcweir 		(SwTwips)(aNewSize.Width() - Prt().Width()) :
589cdf0e10cSrcweir 		(SwTwips)(aNewSize.Height() - Prt().Height());
590cdf0e10cSrcweir     if( nChgHght > 0)
591cdf0e10cSrcweir         Grow( nChgHght );
592cdf0e10cSrcweir 	else if( nChgHght < 0)
593cdf0e10cSrcweir         Shrink( Min(Prt().Height(), -nChgHght) );
594cdf0e10cSrcweir }
595cdf0e10cSrcweir 
596cdf0e10cSrcweir /*************************************************************************
597cdf0e10cSrcweir |*
598cdf0e10cSrcweir |*	  SwNoTxtFrm::GetCharRect()
599cdf0e10cSrcweir |*
600cdf0e10cSrcweir |*	  Beschreibung
601cdf0e10cSrcweir |*	  Ersterstellung	SS 29-Apr-1991
602cdf0e10cSrcweir |*	  Letzte Aenderung	MA 10. Oct. 94
603cdf0e10cSrcweir |*
604cdf0e10cSrcweir |*************************************************************************/
605cdf0e10cSrcweir 
606cdf0e10cSrcweir 
GetCharRect(SwRect & rRect,const SwPosition & rPos,SwCrsrMoveState * pCMS) const607cdf0e10cSrcweir sal_Bool SwNoTxtFrm::GetCharRect( SwRect &rRect, const SwPosition& rPos,
608cdf0e10cSrcweir 							  SwCrsrMoveState *pCMS ) const
609cdf0e10cSrcweir {
610cdf0e10cSrcweir 	if ( &rPos.nNode.GetNode() != (SwNode*)GetNode() )
611cdf0e10cSrcweir 		return sal_False;
612cdf0e10cSrcweir 
613cdf0e10cSrcweir 	Calc();
614cdf0e10cSrcweir 	SwRect aFrameRect( Frm() );
615cdf0e10cSrcweir 	rRect = aFrameRect;
616cdf0e10cSrcweir 	rRect.Pos( Frm().Pos() + Prt().Pos() );
617cdf0e10cSrcweir 	rRect.SSize( Prt().SSize() );
618cdf0e10cSrcweir 
619cdf0e10cSrcweir 	rRect.Justify();
620cdf0e10cSrcweir 
621cdf0e10cSrcweir 	// liegt die Bitmap ueberhaupt im sichtbaren Berich ?
622cdf0e10cSrcweir 	if( !aFrameRect.IsOver( rRect ) )
623cdf0e10cSrcweir 	{
624cdf0e10cSrcweir 		// wenn nicht dann steht der Cursor auf dem Frame
625cdf0e10cSrcweir 		rRect = aFrameRect;
626cdf0e10cSrcweir 		rRect.Width( 1 );
627cdf0e10cSrcweir 	}
628cdf0e10cSrcweir 	else
629cdf0e10cSrcweir 		rRect._Intersection( aFrameRect );
630cdf0e10cSrcweir 
631cdf0e10cSrcweir 	if ( pCMS )
632cdf0e10cSrcweir 	{
633cdf0e10cSrcweir 		if ( pCMS->bRealHeight )
634cdf0e10cSrcweir 		{
635cdf0e10cSrcweir 			pCMS->aRealHeight.Y() = rRect.Height();
636cdf0e10cSrcweir 			pCMS->aRealHeight.X() = 0;
637cdf0e10cSrcweir 		}
638cdf0e10cSrcweir 	}
639cdf0e10cSrcweir 
640cdf0e10cSrcweir 	return sal_True;
641cdf0e10cSrcweir }
642cdf0e10cSrcweir 
643cdf0e10cSrcweir 
GetCrsrOfst(SwPosition * pPos,Point &,SwCrsrMoveState *) const644cdf0e10cSrcweir sal_Bool SwNoTxtFrm::GetCrsrOfst(SwPosition* pPos, Point& ,
645cdf0e10cSrcweir                              SwCrsrMoveState* ) const
646cdf0e10cSrcweir {
647cdf0e10cSrcweir 	SwCntntNode* pCNd = (SwCntntNode*)GetNode();
648cdf0e10cSrcweir 	pPos->nNode = *pCNd;
649cdf0e10cSrcweir 	pPos->nContent.Assign( pCNd, 0 );
650cdf0e10cSrcweir 	return sal_True;
651cdf0e10cSrcweir }
652cdf0e10cSrcweir 
653cdf0e10cSrcweir #define CLEARCACHE( pNd ) {\
654172c67b2SArmin Le Grand 	(pNd)->ReleaseGraphicFromCache();\
655cdf0e10cSrcweir 	SwFlyFrm* pFly = FindFlyFrm();\
656cdf0e10cSrcweir 	if( pFly && pFly->GetFmt()->GetSurround().IsContour() )\
657cdf0e10cSrcweir 	{\
658cdf0e10cSrcweir 		ClrContourCache( pFly->GetVirtDrawObj() );\
659cdf0e10cSrcweir 		pFly->NotifyBackground( FindPageFrm(), Prt(), PREP_FLY_ATTR_CHG );\
660cdf0e10cSrcweir 	}\
661cdf0e10cSrcweir }
662cdf0e10cSrcweir 
Modify(const SfxPoolItem * pOld,const SfxPoolItem * pNew)663cdf0e10cSrcweir void SwNoTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
664cdf0e10cSrcweir {
665cdf0e10cSrcweir 	sal_uInt16 nWhich = pNew ? pNew->Which() : pOld ? pOld->Which() : 0;
666cdf0e10cSrcweir 
667cdf0e10cSrcweir     // --> OD 2007-03-06 #i73788#
668cdf0e10cSrcweir     // no <SwCntntFrm::Modify(..)> for RES_LINKED_GRAPHIC_STREAM_ARRIVED
669cdf0e10cSrcweir     if ( RES_GRAPHIC_PIECE_ARRIVED != nWhich &&
670cdf0e10cSrcweir 		 RES_GRAPHIC_ARRIVED != nWhich &&
671cdf0e10cSrcweir          RES_GRF_REREAD_AND_INCACHE != nWhich &&
672cdf0e10cSrcweir          RES_LINKED_GRAPHIC_STREAM_ARRIVED != nWhich )
673cdf0e10cSrcweir     // <--
674cdf0e10cSrcweir     {
675cdf0e10cSrcweir 		SwCntntFrm::Modify( pOld, pNew );
676cdf0e10cSrcweir     }
677cdf0e10cSrcweir 
678cdf0e10cSrcweir 	sal_Bool bComplete = sal_True;
679cdf0e10cSrcweir 
680cdf0e10cSrcweir 	switch( nWhich )
681cdf0e10cSrcweir 	{
682cdf0e10cSrcweir 	case RES_OBJECTDYING:
683cdf0e10cSrcweir 		break;
684cdf0e10cSrcweir 
685cdf0e10cSrcweir 	case RES_GRF_REREAD_AND_INCACHE:
686cdf0e10cSrcweir 		if( ND_GRFNODE == GetNode()->GetNodeType() )
687cdf0e10cSrcweir 		{
688cdf0e10cSrcweir 			bComplete = sal_False;
689cdf0e10cSrcweir 			SwGrfNode* pNd = (SwGrfNode*) GetNode();
690cdf0e10cSrcweir 
691cdf0e10cSrcweir 			ViewShell *pVSh = 0;
692cdf0e10cSrcweir 			pNd->GetDoc()->GetEditShell( &pVSh );
693cdf0e10cSrcweir 			if( pVSh )
694cdf0e10cSrcweir 			{
695cdf0e10cSrcweir 				GraphicAttr aAttr;
696cdf0e10cSrcweir 				if( pNd->GetGrfObj().IsCached( pVSh->GetOut(), Point(),
697cdf0e10cSrcweir 							Prt().SSize(), &pNd->GetGraphicAttr( aAttr, this ) ))
698cdf0e10cSrcweir 				{
699cdf0e10cSrcweir 					ViewShell *pSh = pVSh;
700cdf0e10cSrcweir 					do {
701cdf0e10cSrcweir 						SET_CURR_SHELL( pSh );
702cdf0e10cSrcweir 						if( pSh->GetWin() )
703cdf0e10cSrcweir 						{
704cdf0e10cSrcweir 							if( pSh->IsPreView() )
705cdf0e10cSrcweir 								::RepaintPagePreview( pSh, Frm().SVRect() );
706cdf0e10cSrcweir 							else
707cdf0e10cSrcweir 								pSh->GetWin()->Invalidate( Frm().SVRect() );
708cdf0e10cSrcweir 						}
709cdf0e10cSrcweir 					} while( pVSh != (pSh = (ViewShell*)pSh->GetNext() ));
710cdf0e10cSrcweir 				}
711cdf0e10cSrcweir 				else
712cdf0e10cSrcweir 					pNd->SwapIn();
713cdf0e10cSrcweir 			}
714cdf0e10cSrcweir 		}
715cdf0e10cSrcweir 		break;
716cdf0e10cSrcweir 
717cdf0e10cSrcweir 	case RES_UPDATE_ATTR:
718cdf0e10cSrcweir 	case RES_FMT_CHG:
719cdf0e10cSrcweir 		CLEARCACHE( (SwGrfNode*) GetNode() )
720cdf0e10cSrcweir 		break;
721cdf0e10cSrcweir 
722cdf0e10cSrcweir 	case RES_ATTRSET_CHG:
723cdf0e10cSrcweir 		{
724cdf0e10cSrcweir 			sal_uInt16 n;
725cdf0e10cSrcweir 			for( n = RES_GRFATR_BEGIN; n < RES_GRFATR_END; ++n )
726cdf0e10cSrcweir 				if( SFX_ITEM_SET == ((SwAttrSetChg*)pOld)->GetChgSet()->
727cdf0e10cSrcweir 								GetItemState( n, sal_False ))
728cdf0e10cSrcweir 				{
729cdf0e10cSrcweir 					CLEARCACHE( (SwGrfNode*) GetNode() )
730cdf0e10cSrcweir 					break;
731cdf0e10cSrcweir 				}
732cdf0e10cSrcweir 			if( RES_GRFATR_END == n )			// not found
733cdf0e10cSrcweir 				return ;
734cdf0e10cSrcweir 		}
735cdf0e10cSrcweir 		break;
736cdf0e10cSrcweir 
737cdf0e10cSrcweir 	case RES_GRAPHIC_PIECE_ARRIVED:
738cdf0e10cSrcweir 	case RES_GRAPHIC_ARRIVED:
739cdf0e10cSrcweir     // --> OD 2007-03-06 #i73788#
740cdf0e10cSrcweir     // handle RES_LINKED_GRAPHIC_STREAM_ARRIVED as RES_GRAPHIC_ARRIVED
741cdf0e10cSrcweir     case RES_LINKED_GRAPHIC_STREAM_ARRIVED:
742cdf0e10cSrcweir     // <--
743cdf0e10cSrcweir 		if ( GetNode()->GetNodeType() == ND_GRFNODE )
744cdf0e10cSrcweir 		{
745cdf0e10cSrcweir 			bComplete = sal_False;
746cdf0e10cSrcweir 			SwGrfNode* pNd = (SwGrfNode*) GetNode();
747cdf0e10cSrcweir 
748cdf0e10cSrcweir 			CLEARCACHE( pNd )
749cdf0e10cSrcweir 
750cdf0e10cSrcweir 			SwRect aRect( Frm() );
751cdf0e10cSrcweir 
752cdf0e10cSrcweir 			ViewShell *pVSh = 0;
753cdf0e10cSrcweir 			pNd->GetDoc()->GetEditShell( &pVSh );
754cdf0e10cSrcweir             if( !pVSh )
755cdf0e10cSrcweir 				break;
756cdf0e10cSrcweir 
757cdf0e10cSrcweir 			ViewShell *pSh = pVSh;
758cdf0e10cSrcweir 			do {
759cdf0e10cSrcweir 				SET_CURR_SHELL( pSh );
760cdf0e10cSrcweir 				if( pSh->IsPreView() )
761cdf0e10cSrcweir 				{
762cdf0e10cSrcweir 					if( pSh->GetWin() )
763cdf0e10cSrcweir 						::RepaintPagePreview( pSh, aRect );
764cdf0e10cSrcweir 				}
765cdf0e10cSrcweir                 else if ( pSh->VisArea().IsOver( aRect ) &&
766cdf0e10cSrcweir                    OUTDEV_WINDOW == pSh->GetOut()->GetOutDevType() )
767cdf0e10cSrcweir 				{
768cdf0e10cSrcweir                     // OD 27.11.2002 #105519# - invalidate instead of painting
769cdf0e10cSrcweir                     pSh->GetWin()->Invalidate( aRect.SVRect() );
770cdf0e10cSrcweir 				}
771cdf0e10cSrcweir 
772cdf0e10cSrcweir 				pSh = (ViewShell *)pSh->GetNext();
773cdf0e10cSrcweir 			} while( pSh != pVSh );
774cdf0e10cSrcweir 		}
775cdf0e10cSrcweir 		break;
776cdf0e10cSrcweir 
777cdf0e10cSrcweir 	default:
778cdf0e10cSrcweir         if ( !pNew || !isGRFATR(nWhich) )
779cdf0e10cSrcweir 			return;
780cdf0e10cSrcweir 	}
781cdf0e10cSrcweir 
782cdf0e10cSrcweir 	if( bComplete )
783cdf0e10cSrcweir 	{
784cdf0e10cSrcweir 		InvalidatePrt();
785cdf0e10cSrcweir 		SetCompletePaint();
786cdf0e10cSrcweir 	}
787cdf0e10cSrcweir }
788cdf0e10cSrcweir 
lcl_correctlyAlignRect(SwRect & rAlignedGrfArea,const SwRect & rInArea,OutputDevice * pOut)789cdf0e10cSrcweir void lcl_correctlyAlignRect( SwRect& rAlignedGrfArea, const SwRect& rInArea, OutputDevice* pOut )
790cdf0e10cSrcweir {
791cdf0e10cSrcweir 
792cdf0e10cSrcweir     if(!pOut)
793cdf0e10cSrcweir         return;
794cdf0e10cSrcweir     Rectangle aPxRect = pOut->LogicToPixel( rInArea.SVRect() );
795cdf0e10cSrcweir     Rectangle aNewPxRect( aPxRect );
796cdf0e10cSrcweir     while( aNewPxRect.Left() < aPxRect.Left() )
797cdf0e10cSrcweir     {
798cdf0e10cSrcweir         rAlignedGrfArea.Left( rAlignedGrfArea.Left()+1 );
799cdf0e10cSrcweir         aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
800cdf0e10cSrcweir     }
801cdf0e10cSrcweir     while( aNewPxRect.Top() < aPxRect.Top() )
802cdf0e10cSrcweir     {
803cdf0e10cSrcweir         rAlignedGrfArea.Top( rAlignedGrfArea.Top()+1 );
804cdf0e10cSrcweir         aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
805cdf0e10cSrcweir     }
806cdf0e10cSrcweir     while( aNewPxRect.Bottom() > aPxRect.Bottom() )
807cdf0e10cSrcweir     {
808cdf0e10cSrcweir         rAlignedGrfArea.Bottom( rAlignedGrfArea.Bottom()-1 );
809cdf0e10cSrcweir         aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
810cdf0e10cSrcweir     }
811cdf0e10cSrcweir     while( aNewPxRect.Right() > aPxRect.Right() )
812cdf0e10cSrcweir     {
813cdf0e10cSrcweir         rAlignedGrfArea.Right( rAlignedGrfArea.Right()-1 );
814cdf0e10cSrcweir         aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
815cdf0e10cSrcweir     }
816cdf0e10cSrcweir }
817cdf0e10cSrcweir 
paintUsingPrimitivesHelper(OutputDevice & rOutputDevice,const drawinglayer::primitive2d::Primitive2DSequence & rSequence,const basegfx::B2DRange & rSourceRange,const basegfx::B2DRange & rTargetRange)81878d93489SArmin Le Grand bool paintUsingPrimitivesHelper(
81978d93489SArmin Le Grand     OutputDevice& rOutputDevice,
82078d93489SArmin Le Grand     const drawinglayer::primitive2d::Primitive2DSequence& rSequence,
82178d93489SArmin Le Grand     const basegfx::B2DRange& rSourceRange,
822f7809f79SArmin Le Grand     const basegfx::B2DRange& rTargetRange)
82378d93489SArmin Le Grand {
824f7809f79SArmin Le Grand     if(rSequence.hasElements() && !basegfx::fTools::equalZero(rSourceRange.getWidth()) && !basegfx::fTools::equalZero(rSourceRange.getHeight()))
82578d93489SArmin Le Grand     {
826f7809f79SArmin Le Grand         if(!basegfx::fTools::equalZero(rTargetRange.getWidth()) && !basegfx::fTools::equalZero(rTargetRange.getHeight()))
82778d93489SArmin Le Grand         {
828f7809f79SArmin Le Grand             // map graphic range to target range. This will e.g. automatically include
829f7809f79SArmin Le Grand             // tme mapping from 1/100th mm content to twips if needed when the target
830f7809f79SArmin Le Grand             // range is defined in twips
831f7809f79SArmin Le Grand             const basegfx::B2DHomMatrix aMappingTransform(
832f7809f79SArmin Le Grand                 basegfx::tools::createSourceRangeTargetRangeTransform(
833f7809f79SArmin Le Grand                     rSourceRange,
834f7809f79SArmin Le Grand                     rTargetRange));
83578d93489SArmin Le Grand 
83678d93489SArmin Le Grand             // Fill ViewInformation. Use MappingTransform here, so there is no need to
83778d93489SArmin Le Grand             // embed the primitives to it. Use original TargetRange here so there is also
83878d93489SArmin Le Grand             // no need to embed the primitives to a MaskPrimitive for cropping. This works
83978d93489SArmin Le Grand             // only in this case where the graphic object cannot be rotated, though.
84078d93489SArmin Le Grand             const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
84178d93489SArmin Le Grand                 aMappingTransform,
84278d93489SArmin Le Grand                 rOutputDevice.GetViewTransformation(),
843f7809f79SArmin Le Grand                 rTargetRange,
84478d93489SArmin Le Grand                 0,
84578d93489SArmin Le Grand                 0.0,
84678d93489SArmin Le Grand                 uno::Sequence< beans::PropertyValue >());
84778d93489SArmin Le Grand 
84878d93489SArmin Le Grand             // get a primitive processor for rendering
849a7185797SArmin Le Grand             drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createProcessor2DFromOutputDevice(
85078d93489SArmin Le Grand                 rOutputDevice,
85178d93489SArmin Le Grand                 aViewInformation2D);
85278d93489SArmin Le Grand 
85378d93489SArmin Le Grand             if(pProcessor2D)
85478d93489SArmin Le Grand             {
85578d93489SArmin Le Grand                 // render and cleanup
85678d93489SArmin Le Grand                 pProcessor2D->process(rSequence);
85778d93489SArmin Le Grand                 delete pProcessor2D;
85878d93489SArmin Le Grand                 return true;
85978d93489SArmin Le Grand             }
86078d93489SArmin Le Grand         }
86178d93489SArmin Le Grand     }
86278d93489SArmin Le Grand 
86378d93489SArmin Le Grand     return false;
86478d93489SArmin Le Grand }
86578d93489SArmin Le Grand 
866cdf0e10cSrcweir // Ausgabe der Grafik. Hier wird entweder eine QuickDraw-Bmp oder
867cdf0e10cSrcweir // eine Grafik vorausgesetzt. Ist nichts davon vorhanden, wird
868cdf0e10cSrcweir // eine Ersatzdarstellung ausgegeben.
869cdf0e10cSrcweir /// OD 25.09.2002 #99739# - delete unused 3rd parameter.
870cdf0e10cSrcweir /// OD 25.09.2002 #99739# - use aligned rectangle for drawing graphic.
871cdf0e10cSrcweir /// OD 25.09.2002 #99739# - pixel-align coordinations for drawing graphic.
PaintPicture(OutputDevice * pOut,const SwRect & rGrfArea) const872cdf0e10cSrcweir void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) const
873cdf0e10cSrcweir {
874cdf0e10cSrcweir 	ViewShell* pShell = getRootFrm()->GetCurrShell();
875cdf0e10cSrcweir 
876cdf0e10cSrcweir 	SwNoTxtNode& rNoTNd = *(SwNoTxtNode*)GetNode();
877cdf0e10cSrcweir 	SwGrfNode* pGrfNd = rNoTNd.GetGrfNode();
878cdf0e10cSrcweir 	SwOLENode* pOLENd = rNoTNd.GetOLENode();
879cdf0e10cSrcweir 
880cdf0e10cSrcweir     const sal_Bool bPrn = pOut == rNoTNd.getIDocumentDeviceAccess()->getPrinter( false ) ||
881cdf0e10cSrcweir                           pOut->GetConnectMetaFile();
882cdf0e10cSrcweir 
88378d93489SArmin Le Grand     const bool bIsChart = pOLENd && ChartHelper::IsChart( pOLENd->GetOLEObj().GetObject() );
884cdf0e10cSrcweir 
885cdf0e10cSrcweir     /// OD 25.09.2002 #99739# - calculate aligned rectangle from parameter <rGrfArea>.
886cdf0e10cSrcweir     ///     Use aligned rectangle <aAlignedGrfArea> instead of <rGrfArea> in
887cdf0e10cSrcweir     ///     the following code.
888cdf0e10cSrcweir     SwRect aAlignedGrfArea = rGrfArea;
889cdf0e10cSrcweir     ::SwAlignRect( aAlignedGrfArea,  pShell );
890cdf0e10cSrcweir 
891cdf0e10cSrcweir     if( !bIsChart )
892cdf0e10cSrcweir     {
893cdf0e10cSrcweir         /// OD 25.09.2002 #99739#
894cdf0e10cSrcweir         /// Because for drawing a graphic left-top-corner and size coordinations are
895cdf0e10cSrcweir         /// used, these coordinations have to be determined on pixel level.
896cdf0e10cSrcweir         ::SwAlignGrfRect( &aAlignedGrfArea, *pOut );
897cdf0e10cSrcweir     }
898cdf0e10cSrcweir     else //if( bIsChart )
899cdf0e10cSrcweir     {
900cdf0e10cSrcweir         //#i78025# charts own borders are not completely visible
901cdf0e10cSrcweir         //the above pixel correction is not correct - at least not for charts
902cdf0e10cSrcweir         //so a different pixel correction is choosen here
903cdf0e10cSrcweir         //this might be a good idea for all other OLE objects also,
904cdf0e10cSrcweir         //but as I cannot oversee the consequences I fix it only for charts for now
905cdf0e10cSrcweir         lcl_correctlyAlignRect( aAlignedGrfArea, rGrfArea, pOut );
906cdf0e10cSrcweir     }
907cdf0e10cSrcweir 
908cdf0e10cSrcweir     if( pGrfNd )
909cdf0e10cSrcweir 	{
910cdf0e10cSrcweir 		sal_Bool bForceSwap = sal_False, bContinue = sal_True;
911172c67b2SArmin Le Grand 		const GraphicObject& rGrfObj = pGrfNd->GetGrfObj();
912cdf0e10cSrcweir 
913cdf0e10cSrcweir 		GraphicAttr aGrfAttr;
914cdf0e10cSrcweir 		pGrfNd->GetGraphicAttr( aGrfAttr, this );
915cdf0e10cSrcweir 
916cdf0e10cSrcweir 		if( !bPrn )
917cdf0e10cSrcweir 		{
918cdf0e10cSrcweir             // --> OD 2007-01-02 #i73788#
919cdf0e10cSrcweir             if ( pGrfNd->IsLinkedInputStreamReady() )
920cdf0e10cSrcweir             {
921cdf0e10cSrcweir                 pGrfNd->UpdateLinkWithInputStream();
922cdf0e10cSrcweir             }
923cdf0e10cSrcweir             // <--
924cdf0e10cSrcweir             // --> OD 2008-01-30 #i85717#
925cdf0e10cSrcweir             // --> OD 2008-07-21 #i90395# - check, if asynchronous retrieval
926cdf0e10cSrcweir             // if input stream for the graphic is possible
927cdf0e10cSrcweir //            else if( GRAPHIC_DEFAULT == rGrfObj.GetType() &&
928cdf0e10cSrcweir             else if ( ( rGrfObj.GetType() == GRAPHIC_DEFAULT ||
929cdf0e10cSrcweir                         rGrfObj.GetType() == GRAPHIC_NONE ) &&
930cdf0e10cSrcweir                       pGrfNd->IsLinkedFile() &&
931cdf0e10cSrcweir                       pGrfNd->IsAsyncRetrieveInputStreamPossible() )
932cdf0e10cSrcweir             // <--
933cdf0e10cSrcweir 			{
934cdf0e10cSrcweir 				Size aTmpSz;
935cdf0e10cSrcweir                 ::sfx2::SvLinkSource* pGrfObj = pGrfNd->GetLink()->GetObj();
936cdf0e10cSrcweir 				if( !pGrfObj ||
937cdf0e10cSrcweir 					!pGrfObj->IsDataComplete() ||
938cdf0e10cSrcweir 					!(aTmpSz = pGrfNd->GetTwipSize()).Width() ||
939cdf0e10cSrcweir 					!aTmpSz.Height() || !pGrfNd->GetAutoFmtLvl() )
940cdf0e10cSrcweir 				{
941*f8c074b1SArrigo Marchiori                     if (pShell->GetDoc()->GetLinkManager().GetUserAllowsLinkUpdate(pShell->GetWin())) {
942*f8c074b1SArrigo Marchiori                         // --> OD 2006-12-22 #i73788#
943*f8c074b1SArrigo Marchiori                         pGrfNd->TriggerAsyncRetrieveInputStream();
944*f8c074b1SArrigo Marchiori                         // <--
945*f8c074b1SArrigo Marchiori                     }
946cdf0e10cSrcweir 				}
947cdf0e10cSrcweir                 String aTxt( pGrfNd->GetTitle() );
948cdf0e10cSrcweir 				if ( !aTxt.Len() )
949cdf0e10cSrcweir 					GetRealURL( *pGrfNd, aTxt );
950cdf0e10cSrcweir                 ::lcl_PaintReplacement( aAlignedGrfArea, aTxt, *pShell, this, sal_False );
951cdf0e10cSrcweir 				bContinue = sal_False;
952cdf0e10cSrcweir 			}
953cdf0e10cSrcweir 		}
954cdf0e10cSrcweir 
955cdf0e10cSrcweir 		if( bContinue )
956cdf0e10cSrcweir 		{
957cdf0e10cSrcweir 			const sal_Bool bSwapped = rGrfObj.IsSwappedOut();
958cdf0e10cSrcweir 			const sal_Bool bSwappedIn = 0 != pGrfNd->SwapIn( bPrn );
959cdf0e10cSrcweir 			if( bSwappedIn && rGrfObj.GetGraphic().IsSupportedGraphic())
960cdf0e10cSrcweir 			{
961cdf0e10cSrcweir                 const sal_Bool bAnimate = rGrfObj.IsAnimated() &&
962cdf0e10cSrcweir                                          !pShell->IsPreView() &&
963cdf0e10cSrcweir                                          !pShell->GetAccessibilityOptions()->IsStopAnimatedGraphics() &&
964cdf0e10cSrcweir                 // --> FME 2004-06-21 #i9684# Stop animation during printing/pdf export
965cdf0e10cSrcweir                                           pShell->GetWin();
966cdf0e10cSrcweir                 // <--
967cdf0e10cSrcweir 
968cdf0e10cSrcweir 				if( bAnimate &&
969cdf0e10cSrcweir 					FindFlyFrm() != ::GetFlyFromMarked( 0, pShell ))
970cdf0e10cSrcweir 				{
971cdf0e10cSrcweir 					OutputDevice* pVout;
972cdf0e10cSrcweir 					if( pOut == pShell->GetOut() && SwRootFrm::FlushVout() )
973cdf0e10cSrcweir 						pVout = pOut, pOut = pShell->GetOut();
974cdf0e10cSrcweir 					else if( pShell->GetWin() &&
975cdf0e10cSrcweir 							 OUTDEV_VIRDEV == pOut->GetOutDevType() )
976cdf0e10cSrcweir 						pVout = pOut, pOut = pShell->GetWin();
977cdf0e10cSrcweir 					else
978cdf0e10cSrcweir 						pVout = 0;
979cdf0e10cSrcweir 
980cdf0e10cSrcweir                     ASSERT( OUTDEV_VIRDEV != pOut->GetOutDevType() ||
981cdf0e10cSrcweir                             pShell->GetViewOptions()->IsPDFExport(),
982cdf0e10cSrcweir                             "pOut sollte kein virtuelles Device sein" );
983cdf0e10cSrcweir 
984172c67b2SArmin Le Grand                     pGrfNd->StartGraphicAnimation(pOut, aAlignedGrfArea.Pos(),
985cdf0e10cSrcweir                                         aAlignedGrfArea.SSize(), long(this),
986cdf0e10cSrcweir 										0, GRFMGR_DRAW_STANDARD, pVout );
987cdf0e10cSrcweir 				}
988ddde725dSArmin Le Grand                 else
989ddde725dSArmin Le Grand                 {
990f7809f79SArmin Le Grand                     // unify using GraphicPrimitive2D
991f7809f79SArmin Le Grand                     // -> the primitive handles all crop and mirror stuff
992f7809f79SArmin Le Grand                     // -> the primitive renderer will create the needed pdf export data
993f7809f79SArmin Le Grand                     // -> if bitmap conent, it will be cached system-dependent
994f7809f79SArmin Le Grand                     const basegfx::B2DRange aTargetRange(
995f7809f79SArmin Le Grand                         aAlignedGrfArea.Left(), aAlignedGrfArea.Top(),
996f7809f79SArmin Le Grand                         aAlignedGrfArea.Right(), aAlignedGrfArea.Bottom());
997f7809f79SArmin Le Grand                     const basegfx::B2DHomMatrix aTargetTransform(
998f7809f79SArmin Le Grand                         basegfx::tools::createScaleTranslateB2DHomMatrix(
999f7809f79SArmin Le Grand                             aTargetRange.getRange(),
1000f7809f79SArmin Le Grand                             aTargetRange.getMinimum()));
100106447d42SArmin Le Grand                     drawinglayer::primitive2d::Primitive2DSequence aContent(1);
100206447d42SArmin Le Grand                     bool bDone(false);
100306447d42SArmin Le Grand 
100406447d42SArmin Le Grand                     // #i125171# The mechanism to get lossless jpegs into pdf is based on having the original
100506447d42SArmin Le Grand                     // file data (not the bitmap data) at the Graphic in the GfxLink (which has *nothing* to
100606447d42SArmin Le Grand                     // do with the graphic being linked). This works well for DrawingLayer GraphicObjects (linked
100706447d42SArmin Le Grand                     // and unlinked) but fails for linked Writer GraphicObjects. These have the URL in the
100806447d42SArmin Le Grand                     // GraphicObject, but no GfxLink with the original file data when it's a linked graphic.
100906447d42SArmin Le Grand                     // Since this blows up PDF size by a factor of 10 (the graphics get embedded as pixel maps
101006447d42SArmin Le Grand                     // then) it is okay to add this workarund: In the needed case, load the graphic in a way to
101106447d42SArmin Le Grand                     // get the GfxLink in the needed form and use that Graphic temporarily. Do this only when
101206447d42SArmin Le Grand                     // - we have PDF export
101306447d42SArmin Le Grand                     // - the GraphicObject is linked
101406447d42SArmin Le Grand                     // - the Graphic has no GfxLink
101506447d42SArmin Le Grand                     // - LosslessCompression is activated
101606447d42SArmin Le Grand                     // - it's indeed a jpeg graphic (could be checked by the url ending, but is more reliable to check later)
101706447d42SArmin Le Grand                     // In all other cases (normal repaint, print, etc...) use the available Graphic with the
101806447d42SArmin Le Grand                     // already loaded pixel graphic as before this change.
101906447d42SArmin Le Grand                     if(pOut->GetExtOutDevData() && rGrfObj.HasLink() && !rGrfObj.GetGraphic().IsLink())
102006447d42SArmin Le Grand                     {
102106447d42SArmin Le Grand                         const vcl::PDFExtOutDevData* pPDFExt = dynamic_cast< const vcl::PDFExtOutDevData* >(pOut->GetExtOutDevData());
102206447d42SArmin Le Grand 
102306447d42SArmin Le Grand                         if(pPDFExt && pPDFExt->GetIsLosslessCompression())
102406447d42SArmin Le Grand                         {
102506447d42SArmin Le Grand                             Graphic aTempGraphic;
102606447d42SArmin Le Grand                             INetURLObject aURL(rGrfObj.GetLink());
102706447d42SArmin Le Grand 
102806447d42SArmin Le Grand                             if(GRFILTER_OK == GraphicFilter::GetGraphicFilter()->ImportGraphic(aTempGraphic, aURL))
102906447d42SArmin Le Grand                             {
103006447d42SArmin Le Grand                                 if(aTempGraphic.IsLink() && GFX_LINK_TYPE_NATIVE_JPG == aTempGraphic.GetLink().GetType())
103106447d42SArmin Le Grand                                 {
103206447d42SArmin Le Grand                                     aContent[0] = new drawinglayer::primitive2d::GraphicPrimitive2D(
103306447d42SArmin Le Grand                                         aTargetTransform,
103406447d42SArmin Le Grand                                         aTempGraphic,
103506447d42SArmin Le Grand                                         aGrfAttr);
103606447d42SArmin Le Grand                                     bDone = true;
103706447d42SArmin Le Grand                                 }
103806447d42SArmin Le Grand                             }
103906447d42SArmin Le Grand                         }
104006447d42SArmin Le Grand                     }
104106447d42SArmin Le Grand 
104206447d42SArmin Le Grand                     if(!bDone)
104306447d42SArmin Le Grand                     {
104406447d42SArmin Le Grand                         aContent[0] = new drawinglayer::primitive2d::GraphicPrimitive2D(
104506447d42SArmin Le Grand                             aTargetTransform,
104606447d42SArmin Le Grand                             rGrfObj.GetGraphic(),
104706447d42SArmin Le Grand                             aGrfAttr);
104806447d42SArmin Le Grand                     }
1049f7809f79SArmin Le Grand 
1050f7809f79SArmin Le Grand                     paintUsingPrimitivesHelper(
1051f7809f79SArmin Le Grand                         *pOut,
1052f7809f79SArmin Le Grand                         aContent,
1053f7809f79SArmin Le Grand                         aTargetRange,
1054f7809f79SArmin Le Grand                         aTargetRange);
1055d327e58aSArmin Le Grand 
1056d327e58aSArmin Le Grand                     // need to reset the timer manually (was in original paints at GraphicManager)
1057d327e58aSArmin Le Grand                     rGrfObj.restartSwapOutTimer();
1058ddde725dSArmin Le Grand                 }
1059cdf0e10cSrcweir 			}
1060cdf0e10cSrcweir 			else
1061cdf0e10cSrcweir 			{
1062cdf0e10cSrcweir 				sal_uInt16 nResId = 0;
1063cdf0e10cSrcweir 				if( bSwappedIn )
1064cdf0e10cSrcweir 				{
1065cdf0e10cSrcweir 					if( GRAPHIC_NONE == rGrfObj.GetType() )
1066cdf0e10cSrcweir 						nResId = STR_COMCORE_READERROR;
1067cdf0e10cSrcweir 					else if ( !rGrfObj.GetGraphic().IsSupportedGraphic() )
1068cdf0e10cSrcweir 						nResId = STR_COMCORE_CANT_SHOW;
1069cdf0e10cSrcweir 				}
1070cdf0e10cSrcweir 				((SwNoTxtFrm*)this)->nWeight = -1;
1071cdf0e10cSrcweir 				String aText;
1072cdf0e10cSrcweir 				if ( !nResId &&
1073cdf0e10cSrcweir                      !(aText = pGrfNd->GetTitle()).Len() &&
1074cdf0e10cSrcweir 					 (!GetRealURL( *pGrfNd, aText ) || !aText.Len()))
1075cdf0e10cSrcweir 				{
1076cdf0e10cSrcweir 					nResId = STR_COMCORE_READERROR;
1077cdf0e10cSrcweir 				}
1078cdf0e10cSrcweir 				if ( nResId )
1079cdf0e10cSrcweir 					aText = SW_RESSTR( nResId );
1080cdf0e10cSrcweir 
1081cdf0e10cSrcweir                 ::lcl_PaintReplacement( aAlignedGrfArea, aText, *pShell, this, sal_True );
1082cdf0e10cSrcweir 			}
1083cdf0e10cSrcweir 
1084cdf0e10cSrcweir 			//Beim Drucken duerfen wir nicht die Grafiken sammeln...
1085cdf0e10cSrcweir 			if( bSwapped && bPrn )
1086cdf0e10cSrcweir 				bForceSwap = sal_True;
1087cdf0e10cSrcweir 		}
1088cdf0e10cSrcweir 		if( bForceSwap )
1089cdf0e10cSrcweir 			pGrfNd->SwapOut();
1090cdf0e10cSrcweir 	}
109178d93489SArmin Le Grand     else // bIsChart || pOLENd
1092cdf0e10cSrcweir     {
1093cdf0e10cSrcweir         // --> OD 2009-03-05 #i99665#
1094cdf0e10cSrcweir         // Adjust AntiAliasing mode at output device for chart OLE
1095cdf0e10cSrcweir         const sal_uInt16 nFormerAntialiasingAtOutput( pOut->GetAntialiasing() );
1096cdf0e10cSrcweir         if ( pOLENd->IsChart() &&
109778d93489SArmin Le Grand                 pShell->Imp()->GetDrawView()->IsAntiAliasing() )
1098cdf0e10cSrcweir         {
1099cdf0e10cSrcweir             const sal_uInt16 nAntialiasingForChartOLE =
1100cdf0e10cSrcweir                     nFormerAntialiasingAtOutput | ANTIALIASING_PIXELSNAPHAIRLINE;
1101cdf0e10cSrcweir             pOut->SetAntialiasing( nAntialiasingForChartOLE );
1102cdf0e10cSrcweir         }
1103cdf0e10cSrcweir         // <--
1104cdf0e10cSrcweir 
110578d93489SArmin Le Grand         bool bDone(false);
1106cdf0e10cSrcweir 
110778d93489SArmin Le Grand         if(bIsChart)
110878d93489SArmin Le Grand         {
110978d93489SArmin Le Grand             const uno::Reference< frame::XModel > aXModel(pOLENd->GetOLEObj().GetOleRef()->getComponent(), uno::UNO_QUERY);
1110cdf0e10cSrcweir 
111178d93489SArmin Le Grand             if(aXModel.is())
111278d93489SArmin Le Grand             {
111378d93489SArmin Le Grand                 basegfx::B2DRange aSourceRange;
1114cdf0e10cSrcweir 
111578d93489SArmin Le Grand                 const drawinglayer::primitive2d::Primitive2DSequence aSequence(
111678d93489SArmin Le Grand                     ChartHelper::tryToGetChartContentAsPrimitive2DSequence(
111778d93489SArmin Le Grand                         aXModel,
111878d93489SArmin Le Grand                         aSourceRange));
1119cdf0e10cSrcweir 
112078d93489SArmin Le Grand                 if(aSequence.hasElements() && !aSourceRange.isEmpty())
112178d93489SArmin Le Grand                 {
112278d93489SArmin Le Grand                     const basegfx::B2DRange aTargetRange(
112378d93489SArmin Le Grand                         aAlignedGrfArea.Left(), aAlignedGrfArea.Top(),
112478d93489SArmin Le Grand                         aAlignedGrfArea.Right(), aAlignedGrfArea.Bottom());
112578d93489SArmin Le Grand 
112678d93489SArmin Le Grand                     bDone = paintUsingPrimitivesHelper(
112778d93489SArmin Le Grand                         *pOut,
112878d93489SArmin Le Grand                         aSequence,
112978d93489SArmin Le Grand                         aSourceRange,
113078d93489SArmin Le Grand                         aTargetRange);
113178d93489SArmin Le Grand                 }
113278d93489SArmin Le Grand             }
113378d93489SArmin Le Grand         }
1134cdf0e10cSrcweir 
113578d93489SArmin Le Grand         if(!bDone && pOLENd)
113678d93489SArmin Le Grand 	    {
113778d93489SArmin Le Grand             Point aPosition(aAlignedGrfArea.Pos());
113878d93489SArmin Le Grand             Size aSize(aAlignedGrfArea.SSize());
113978d93489SArmin Le Grand 
114078d93489SArmin Le Grand             // Im BrowseModus gibt es nicht unbedingt einen Drucker und
114178d93489SArmin Le Grand             // damit kein JobSetup, also legen wir eines an ...
114278d93489SArmin Le Grand             const JobSetup* pJobSetup = pOLENd->getIDocumentDeviceAccess()->getJobsetup();
114378d93489SArmin Le Grand             sal_Bool bDummyJobSetup = 0 == pJobSetup;
114478d93489SArmin Le Grand             if( bDummyJobSetup )
114578d93489SArmin Le Grand                 pJobSetup = new JobSetup();
114678d93489SArmin Le Grand 
114778d93489SArmin Le Grand 		    // #i42323#
114878d93489SArmin Le Grand 		    // The reason for #114233# is gone, so i remove it again
114978d93489SArmin Le Grand             //TODO/LATER: is it a problem that the JopSetup isn't used?
115078d93489SArmin Le Grand             //xRef->DoDraw( pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), *pJobSetup );
115178d93489SArmin Le Grand 
115278d93489SArmin Le Grand             // get hi-contrast image, but never for printing
115378d93489SArmin Le Grand 		    Graphic* pGraphic = NULL;
115478d93489SArmin Le Grand             if (pOut && !bPrn && Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
115578d93489SArmin Le Grand 			    pGraphic = pOLENd->GetHCGraphic();
115678d93489SArmin Le Grand 
115778d93489SArmin Le Grand 		    // when it is not possible to get HC-representation, the original image should be used
115878d93489SArmin Le Grand 		    if ( !pGraphic )
115978d93489SArmin Le Grand            	    pGraphic = pOLENd->GetGraphic();
116078d93489SArmin Le Grand 
116178d93489SArmin Le Grand             if ( pGraphic && pGraphic->GetType() != GRAPHIC_NONE )
116278d93489SArmin Le Grand 		    {
116378d93489SArmin Le Grand 			    pGraphic->Draw( pOut, aPosition, aSize );
116478d93489SArmin Le Grand 
116578d93489SArmin Le Grand 			    // shade the representation if the object is activated outplace
116678d93489SArmin Le Grand 			    uno::Reference < embed::XEmbeddedObject > xObj = pOLENd->GetOLEObj().GetOleRef();
116778d93489SArmin Le Grand 			    if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::ACTIVE )
116878d93489SArmin Le Grand 			    {
116978d93489SArmin Le Grand 				    ::svt::EmbeddedObjectRef::DrawShading( Rectangle( aPosition, aSize ), pOut );
117078d93489SArmin Le Grand 			    }
117178d93489SArmin Le Grand 		    }
117278d93489SArmin Le Grand             else
117378d93489SArmin Le Grand                 ::svt::EmbeddedObjectRef::DrawPaintReplacement( Rectangle( aPosition, aSize ), pOLENd->GetOLEObj().GetCurrentPersistName(), pOut );
117478d93489SArmin Le Grand 
117578d93489SArmin Le Grand             if( bDummyJobSetup )
117678d93489SArmin Le Grand                 delete pJobSetup;  // ... und raeumen wieder auf.
117778d93489SArmin Le Grand 
117878d93489SArmin Le Grand             sal_Int64 nMiscStatus = pOLENd->GetOLEObj().GetOleRef()->getStatus( pOLENd->GetAspect() );
117978d93489SArmin Le Grand             if ( !bPrn && pShell->ISA( SwCrsrShell ) &&
118078d93489SArmin Le Grand                     nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
118178d93489SArmin Le Grand             {
118278d93489SArmin Le Grand                 const SwFlyFrm *pFly = FindFlyFrm();
118378d93489SArmin Le Grand                 ASSERT( pFly, "OLE not in FlyFrm" );
118478d93489SArmin Le Grand                 ((SwFEShell*)pShell)->ConnectObj( pOLENd->GetOLEObj().GetObject(), pFly->Prt(), pFly->Frm());
118578d93489SArmin Le Grand             }
1186cdf0e10cSrcweir         }
1187cdf0e10cSrcweir 
1188cdf0e10cSrcweir         // --> OD 2009-03-05 #i99665#
1189cdf0e10cSrcweir         if ( pOLENd->IsChart() &&
119078d93489SArmin Le Grand                 pShell->Imp()->GetDrawView()->IsAntiAliasing() )
1191cdf0e10cSrcweir         {
1192cdf0e10cSrcweir             pOut->SetAntialiasing( nFormerAntialiasingAtOutput );
1193cdf0e10cSrcweir         }
1194cdf0e10cSrcweir         // <--
119578d93489SArmin Le Grand     }
1196cdf0e10cSrcweir }
1197cdf0e10cSrcweir 
1198cdf0e10cSrcweir 
IsTransparent() const1199cdf0e10cSrcweir sal_Bool SwNoTxtFrm::IsTransparent() const
1200cdf0e10cSrcweir {
1201cdf0e10cSrcweir 	const ViewShell* pSh = getRootFrm()->GetCurrShell();
1202cdf0e10cSrcweir 	if ( !pSh || !pSh->GetViewOptions()->IsGraphic() )
1203cdf0e10cSrcweir 		return sal_True;
1204cdf0e10cSrcweir 
1205cdf0e10cSrcweir 	const SwGrfNode *pNd;
1206cdf0e10cSrcweir 	if( 0 != (pNd = GetNode()->GetGrfNode()) )
1207cdf0e10cSrcweir 		return pNd->IsTransparent();
1208cdf0e10cSrcweir 
1209cdf0e10cSrcweir 	//#29381# OLE sind immer Transparent.
1210cdf0e10cSrcweir 	return sal_True;
1211cdf0e10cSrcweir }
1212cdf0e10cSrcweir 
1213cdf0e10cSrcweir 
StopAnimation(OutputDevice * pOut) const1214cdf0e10cSrcweir void SwNoTxtFrm::StopAnimation( OutputDevice* pOut ) const
1215cdf0e10cSrcweir {
1216cdf0e10cSrcweir 	//animierte Grafiken anhalten
1217172c67b2SArmin Le Grand 	const SwGrfNode* pGrfNd = dynamic_cast< const SwGrfNode* >(GetNode()->GetGrfNode());
1218172c67b2SArmin Le Grand 
1219172c67b2SArmin Le Grand     if( pGrfNd && pGrfNd->IsAnimated() )
1220172c67b2SArmin Le Grand     {
1221172c67b2SArmin Le Grand 		const_cast< SwGrfNode* >(pGrfNd)->StopGraphicAnimation( pOut, long(this) );
1222172c67b2SArmin Le Grand     }
1223cdf0e10cSrcweir }
1224cdf0e10cSrcweir 
1225cdf0e10cSrcweir 
HasAnimation() const1226cdf0e10cSrcweir sal_Bool SwNoTxtFrm::HasAnimation() const
1227cdf0e10cSrcweir {
1228cdf0e10cSrcweir 	const SwGrfNode* pGrfNd = GetNode()->GetGrfNode();
1229cdf0e10cSrcweir 	return pGrfNd && pGrfNd->IsAnimated();
1230cdf0e10cSrcweir }
1231cdf0e10cSrcweir 
1232cdf0e10cSrcweir 
1233cdf0e10cSrcweir 
1234