xref: /trunk/main/vcl/source/gdi/graph.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
19f62ea84SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
39f62ea84SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
49f62ea84SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
59f62ea84SAndrew Rist  * distributed with this work for additional information
69f62ea84SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
79f62ea84SAndrew Rist  * to you under the Apache License, Version 2.0 (the
89f62ea84SAndrew Rist  * "License"); you may not use this file except in compliance
99f62ea84SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
119f62ea84SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
139f62ea84SAndrew Rist  * Unless required by applicable law or agreed to in writing,
149f62ea84SAndrew Rist  * software distributed under the License is distributed on an
159f62ea84SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
169f62ea84SAndrew Rist  * KIND, either express or implied.  See the License for the
179f62ea84SAndrew Rist  * specific language governing permissions and limitations
189f62ea84SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
209f62ea84SAndrew Rist  *************************************************************/
219f62ea84SAndrew Rist 
229f62ea84SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_vcl.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vcl/outdev.hxx>
28cdf0e10cSrcweir #include <vcl/svapp.hxx>
29cdf0e10cSrcweir #include <vcl/graph.hxx>
30*ddde725dSArmin Le Grand #include <vcl/metaact.hxx>
31cdf0e10cSrcweir #include <impgraph.hxx>
32cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
33cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphicProvider.hpp>
35cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
36cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp>
37cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphic.hpp>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir // -----------------------
40cdf0e10cSrcweir // - Compression defines -
41cdf0e10cSrcweir // -----------------------
42cdf0e10cSrcweir 
43cdf0e10cSrcweir #define COMPRESS_OWN                ('S'|('D'<<8UL))
44cdf0e10cSrcweir #define COMPRESS_NONE               ( 0UL )
45cdf0e10cSrcweir #define RLE_8                       ( 1UL )
46cdf0e10cSrcweir #define RLE_4                       ( 2UL )
47cdf0e10cSrcweir #define BITFIELDS                   ( 3UL )
48cdf0e10cSrcweir #define ZCOMPRESS                   ( COMPRESS_OWN | 0x01000000UL ) /* == 'SD01' (binary) */
49cdf0e10cSrcweir 
50cdf0e10cSrcweir using namespace ::com::sun::star;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir // -----------------------
53cdf0e10cSrcweir // - Default-Drawmethode -
54cdf0e10cSrcweir // -----------------------
55cdf0e10cSrcweir 
ImplDrawDefault(OutputDevice * pOutDev,const UniString * pText,Font * pFont,const Bitmap * pBitmap,const BitmapEx * pBitmapEx,const Point & rDestPt,const Size & rDestSize)56cdf0e10cSrcweir static void ImplDrawDefault( OutputDevice* pOutDev, const UniString* pText,
57cdf0e10cSrcweir                              Font* pFont, const Bitmap* pBitmap, const BitmapEx* pBitmapEx,
58cdf0e10cSrcweir                              const Point& rDestPt, const Size& rDestSize )
59cdf0e10cSrcweir {
60cdf0e10cSrcweir     sal_uInt16      nPixel = (sal_uInt16) pOutDev->PixelToLogic( Size( 1, 1 ) ).Width();
61cdf0e10cSrcweir     sal_uInt16      nPixelWidth = nPixel;
62cdf0e10cSrcweir     Point       aPoint( rDestPt.X() + nPixelWidth, rDestPt.Y() + nPixelWidth );
63cdf0e10cSrcweir     Size        aSize( rDestSize.Width() - ( nPixelWidth << 1 ), rDestSize.Height() - ( nPixelWidth << 1 ) );
64cdf0e10cSrcweir     sal_Bool        bFilled = ( pBitmap != NULL || pBitmapEx != NULL || pFont != NULL );
65cdf0e10cSrcweir     Rectangle   aBorderRect( aPoint, aSize );
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     pOutDev->Push();
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     pOutDev->SetFillColor();
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     // Auf dem Drucker ein schwarzes Rechteck und auf dem Bildschirm eins mit 3D-Effekt
72cdf0e10cSrcweir     if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER )
73cdf0e10cSrcweir         pOutDev->SetLineColor( COL_BLACK );
74cdf0e10cSrcweir     else
75cdf0e10cSrcweir     {
76cdf0e10cSrcweir         aBorderRect.Left() += nPixel;
77cdf0e10cSrcweir         aBorderRect.Top() += nPixel;
78cdf0e10cSrcweir 
79cdf0e10cSrcweir         pOutDev->SetLineColor( COL_LIGHTGRAY );
80cdf0e10cSrcweir         pOutDev->DrawRect( aBorderRect );
81cdf0e10cSrcweir 
82cdf0e10cSrcweir         aBorderRect.Left() -= nPixel;
83cdf0e10cSrcweir         aBorderRect.Top() -= nPixel;
84cdf0e10cSrcweir         aBorderRect.Right() -= nPixel;
85cdf0e10cSrcweir         aBorderRect.Bottom() -= nPixel;
86cdf0e10cSrcweir         pOutDev->SetLineColor( COL_GRAY );
87cdf0e10cSrcweir     }
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     pOutDev->DrawRect( aBorderRect );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     aPoint.X() += nPixelWidth + 2*nPixel;
92cdf0e10cSrcweir     aPoint.Y() += nPixelWidth + 2*nPixel;
93cdf0e10cSrcweir     aSize.Width() -= 2*nPixelWidth + 4*nPixel;
94cdf0e10cSrcweir     aSize.Height() -= 2*nPixelWidth + 4*nPixel;
95cdf0e10cSrcweir 
96cdf0e10cSrcweir     if( aSize.Width() > 0 && aSize.Height() > 0
97cdf0e10cSrcweir         && (  ( pBitmap && !!*pBitmap ) || ( pBitmapEx && !!*pBitmapEx ) ) )
98cdf0e10cSrcweir     {
99cdf0e10cSrcweir         Size aBitmapSize( pOutDev->PixelToLogic( pBitmap ? pBitmap->GetSizePixel() : pBitmapEx->GetSizePixel() ) );
100cdf0e10cSrcweir 
101cdf0e10cSrcweir         if( aSize.Height() > aBitmapSize.Height() && aSize.Width() > aBitmapSize.Width() )
102cdf0e10cSrcweir         {
103cdf0e10cSrcweir             if ( pBitmap )
104cdf0e10cSrcweir                 pOutDev->DrawBitmap( aPoint, *pBitmap );
105cdf0e10cSrcweir             else
106cdf0e10cSrcweir                 pOutDev->DrawBitmapEx( aPoint, *pBitmapEx );
107cdf0e10cSrcweir             aPoint.X() += aBitmapSize.Width() + 2*nPixel;
108cdf0e10cSrcweir             aSize.Width() -= aBitmapSize.Width() + 2*nPixel;
109cdf0e10cSrcweir         }
110cdf0e10cSrcweir     }
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     if ( aSize.Width() > 0 && aSize.Height() > 0 && pFont && pText && pText->Len()
113cdf0e10cSrcweir          && !(!pOutDev->IsOutputEnabled() /*&& pOutDev->GetConnectMetaFile() */) )
114cdf0e10cSrcweir     {
115cdf0e10cSrcweir         MapMode aMapMode( MAP_POINT );
116cdf0e10cSrcweir         Size    aSz = pOutDev->LogicToLogic( Size( 0, 12 ), &aMapMode, NULL );
117cdf0e10cSrcweir         long    nThreshold = aSz.Height() / 2;
118cdf0e10cSrcweir         long    nStep = nThreshold / 3;
119cdf0e10cSrcweir 
120cdf0e10cSrcweir         if ( !nStep )
121cdf0e10cSrcweir             nStep = aSz.Height() - nThreshold;
122cdf0e10cSrcweir 
123cdf0e10cSrcweir         for(;; aSz.Height() -= nStep )
124cdf0e10cSrcweir         {
125cdf0e10cSrcweir             pFont->SetSize( aSz );
126cdf0e10cSrcweir             pOutDev->SetFont( *pFont );
127cdf0e10cSrcweir 
128cdf0e10cSrcweir             long nTextHeight = pOutDev->GetTextHeight();
129cdf0e10cSrcweir             long nTextWidth = pOutDev->GetTextWidth( *pText );
130cdf0e10cSrcweir             if ( nTextHeight )
131cdf0e10cSrcweir             {
132cdf0e10cSrcweir                 // Die N"aherung ber"ucksichtigt keine Ungenauigkeiten durch
133cdf0e10cSrcweir                 // Wortumbr"uche
134cdf0e10cSrcweir                 long nLines = aSize.Height() / nTextHeight;
135cdf0e10cSrcweir                 long nWidth = aSize.Width() * nLines; // N"aherung!!!
136cdf0e10cSrcweir 
137cdf0e10cSrcweir                 if ( nTextWidth <= nWidth || aSz.Height() <= nThreshold )
138cdf0e10cSrcweir                 {
139cdf0e10cSrcweir                     sal_uInt16 nStart = 0;
140cdf0e10cSrcweir                     sal_uInt16 nLen = 0;
141cdf0e10cSrcweir 
142cdf0e10cSrcweir                     while( nStart < pText->Len() && pText->GetChar( nStart ) == ' ' )
143cdf0e10cSrcweir                         nStart++;
144cdf0e10cSrcweir                     while( nStart+nLen < pText->Len() && pText->GetChar( nStart+nLen ) != ' ' )
145cdf0e10cSrcweir                         nLen++;
146cdf0e10cSrcweir                     while( nStart < pText->Len() && nLines-- )
147cdf0e10cSrcweir                     {
148cdf0e10cSrcweir                         sal_uInt16 nNext = nLen;
149cdf0e10cSrcweir                         do
150cdf0e10cSrcweir                         {
151cdf0e10cSrcweir                             while ( nStart+nNext < pText->Len() && pText->GetChar( nStart+nNext ) == ' ' )
152cdf0e10cSrcweir                                 nNext++;
153cdf0e10cSrcweir                             while ( nStart+nNext < pText->Len() && pText->GetChar( nStart+nNext ) != ' ' )
154cdf0e10cSrcweir                                 nNext++;
155cdf0e10cSrcweir                             nTextWidth = pOutDev->GetTextWidth( *pText, nStart, nNext );
156cdf0e10cSrcweir                             if ( nTextWidth > aSize.Width() )
157cdf0e10cSrcweir                                 break;
158cdf0e10cSrcweir                             nLen = nNext;
159cdf0e10cSrcweir                         }
160cdf0e10cSrcweir                         while ( nStart+nNext < pText->Len() );
161cdf0e10cSrcweir 
162cdf0e10cSrcweir                         sal_uInt16 n = nLen;
163cdf0e10cSrcweir                         nTextWidth = pOutDev->GetTextWidth( *pText, nStart, n );
164cdf0e10cSrcweir                         while( nTextWidth > aSize.Width() )
165cdf0e10cSrcweir                             nTextWidth = pOutDev->GetTextWidth( *pText, nStart, --n );
166cdf0e10cSrcweir                         pOutDev->DrawText( aPoint, *pText, nStart, n );
167cdf0e10cSrcweir 
168cdf0e10cSrcweir                         aPoint.Y() += nTextHeight;
169cdf0e10cSrcweir                         nStart      = sal::static_int_cast<sal_uInt16>(nStart + nLen);
170cdf0e10cSrcweir                         nLen        = nNext-nLen;
171cdf0e10cSrcweir                         while( nStart < pText->Len() && pText->GetChar( nStart ) == ' ' )
172cdf0e10cSrcweir                         {
173cdf0e10cSrcweir                             nStart++;
174cdf0e10cSrcweir                             nLen--;
175cdf0e10cSrcweir                         }
176cdf0e10cSrcweir                     }
177cdf0e10cSrcweir                     break;
178cdf0e10cSrcweir                 }
179cdf0e10cSrcweir             }
180cdf0e10cSrcweir             else
181cdf0e10cSrcweir                 break;
182cdf0e10cSrcweir         }
183cdf0e10cSrcweir     }
184cdf0e10cSrcweir 
185cdf0e10cSrcweir     // Falls die Default-Graphik keinen Inhalt hat,
186cdf0e10cSrcweir     // malen wir ein rotes Kreuz
187cdf0e10cSrcweir     if( !bFilled )
188cdf0e10cSrcweir     {
189cdf0e10cSrcweir         aBorderRect.Left()++;
190cdf0e10cSrcweir         aBorderRect.Top()++;
191cdf0e10cSrcweir         aBorderRect.Right()--;
192cdf0e10cSrcweir         aBorderRect.Bottom()--;
193cdf0e10cSrcweir 
194cdf0e10cSrcweir         pOutDev->SetLineColor( COL_LIGHTRED );
195cdf0e10cSrcweir         pOutDev->DrawLine( aBorderRect.TopLeft(), aBorderRect.BottomRight() );
196cdf0e10cSrcweir         pOutDev->DrawLine( aBorderRect.TopRight(), aBorderRect.BottomLeft() );
197cdf0e10cSrcweir     }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir     pOutDev->Pop();
200cdf0e10cSrcweir }
201cdf0e10cSrcweir 
202cdf0e10cSrcweir // -----------
203cdf0e10cSrcweir // - Graphic -
204cdf0e10cSrcweir // -----------
205cdf0e10cSrcweir 
206cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY( Graphic, SvDataCopyStream );
207cdf0e10cSrcweir 
208cdf0e10cSrcweir // ------------------------------------------------------------------------
209cdf0e10cSrcweir 
Graphic()210cdf0e10cSrcweir Graphic::Graphic()
211cdf0e10cSrcweir {
212cdf0e10cSrcweir     mpImpGraphic = new ImpGraphic;
213cdf0e10cSrcweir }
214cdf0e10cSrcweir 
215cdf0e10cSrcweir // ------------------------------------------------------------------------
216cdf0e10cSrcweir 
Graphic(const Graphic & rGraphic)217cdf0e10cSrcweir Graphic::Graphic( const Graphic& rGraphic ) :
218cdf0e10cSrcweir SvDataCopyStream()
219cdf0e10cSrcweir {
220cdf0e10cSrcweir     if( rGraphic.IsAnimated() )
221cdf0e10cSrcweir         mpImpGraphic = new ImpGraphic( *rGraphic.mpImpGraphic );
222cdf0e10cSrcweir     else
223cdf0e10cSrcweir     {
224cdf0e10cSrcweir         mpImpGraphic = rGraphic.mpImpGraphic;
225cdf0e10cSrcweir         mpImpGraphic->mnRefCount++;
226cdf0e10cSrcweir     }
227cdf0e10cSrcweir }
228cdf0e10cSrcweir 
229cdf0e10cSrcweir // ------------------------------------------------------------------------
230cdf0e10cSrcweir 
Graphic(const Bitmap & rBmp)231cdf0e10cSrcweir Graphic::Graphic( const Bitmap& rBmp )
232cdf0e10cSrcweir {
233cdf0e10cSrcweir     mpImpGraphic = new ImpGraphic( rBmp );
234cdf0e10cSrcweir }
235cdf0e10cSrcweir 
236cdf0e10cSrcweir // ------------------------------------------------------------------------
237cdf0e10cSrcweir 
Graphic(const BitmapEx & rBmpEx)238cdf0e10cSrcweir Graphic::Graphic( const BitmapEx& rBmpEx )
239cdf0e10cSrcweir {
240cdf0e10cSrcweir     mpImpGraphic = new ImpGraphic( rBmpEx );
241cdf0e10cSrcweir }
242cdf0e10cSrcweir 
243cdf0e10cSrcweir // ------------------------------------------------------------------------
244cdf0e10cSrcweir 
Graphic(const SvgDataPtr & rSvgDataPtr)245*ddde725dSArmin Le Grand Graphic::Graphic(const SvgDataPtr& rSvgDataPtr)
246*ddde725dSArmin Le Grand {
247*ddde725dSArmin Le Grand     mpImpGraphic = new ImpGraphic(rSvgDataPtr);
248*ddde725dSArmin Le Grand }
249*ddde725dSArmin Le Grand 
250*ddde725dSArmin Le Grand // ------------------------------------------------------------------------
251*ddde725dSArmin Le Grand 
Graphic(const Animation & rAnimation)252cdf0e10cSrcweir Graphic::Graphic( const Animation& rAnimation )
253cdf0e10cSrcweir {
254cdf0e10cSrcweir     mpImpGraphic = new ImpGraphic( rAnimation );
255cdf0e10cSrcweir }
256cdf0e10cSrcweir 
257cdf0e10cSrcweir // ------------------------------------------------------------------------
258cdf0e10cSrcweir 
Graphic(const GDIMetaFile & rMtf)259cdf0e10cSrcweir Graphic::Graphic( const GDIMetaFile& rMtf )
260cdf0e10cSrcweir {
261cdf0e10cSrcweir     mpImpGraphic = new ImpGraphic( rMtf );
262cdf0e10cSrcweir }
263cdf0e10cSrcweir 
264cdf0e10cSrcweir // ------------------------------------------------------------------------
265cdf0e10cSrcweir 
Graphic(const::com::sun::star::uno::Reference<::com::sun::star::graphic::XGraphic> & rxGraphic)266cdf0e10cSrcweir Graphic::Graphic( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic )
267cdf0e10cSrcweir {
268cdf0e10cSrcweir     uno::Reference< lang::XUnoTunnel >      xTunnel( rxGraphic, uno::UNO_QUERY );
269cdf0e10cSrcweir     uno::Reference< lang::XTypeProvider >   xProv( rxGraphic, uno::UNO_QUERY );
270cdf0e10cSrcweir     const ::Graphic*                        pGraphic = ( ( xTunnel.is() && xProv.is() ) ?
271cdf0e10cSrcweir                                                          reinterpret_cast< ::Graphic* >( xTunnel->getSomething( xProv->getImplementationId() ) ) :
272cdf0e10cSrcweir                                                          NULL );
273cdf0e10cSrcweir 
274cdf0e10cSrcweir     if( pGraphic )
275cdf0e10cSrcweir     {
276cdf0e10cSrcweir         if( pGraphic->IsAnimated() )
277cdf0e10cSrcweir             mpImpGraphic = new ImpGraphic( *pGraphic->mpImpGraphic );
278cdf0e10cSrcweir         else
279cdf0e10cSrcweir         {
280cdf0e10cSrcweir             mpImpGraphic = pGraphic->mpImpGraphic;
281cdf0e10cSrcweir             mpImpGraphic->mnRefCount++;
282cdf0e10cSrcweir         }
283cdf0e10cSrcweir     }
284cdf0e10cSrcweir     else
285cdf0e10cSrcweir         mpImpGraphic = new ImpGraphic;
286cdf0e10cSrcweir }
287cdf0e10cSrcweir 
288cdf0e10cSrcweir // ------------------------------------------------------------------------
289cdf0e10cSrcweir 
~Graphic()290cdf0e10cSrcweir Graphic::~Graphic()
291cdf0e10cSrcweir {
292cdf0e10cSrcweir     if( mpImpGraphic->mnRefCount == 1UL )
293cdf0e10cSrcweir         delete mpImpGraphic;
294cdf0e10cSrcweir     else
295cdf0e10cSrcweir         mpImpGraphic->mnRefCount--;
296cdf0e10cSrcweir }
297cdf0e10cSrcweir 
298cdf0e10cSrcweir // ------------------------------------------------------------------------
299cdf0e10cSrcweir 
ImplTestRefCount()300cdf0e10cSrcweir void Graphic::ImplTestRefCount()
301cdf0e10cSrcweir {
302cdf0e10cSrcweir     if( mpImpGraphic->mnRefCount > 1UL )
303cdf0e10cSrcweir     {
304cdf0e10cSrcweir         mpImpGraphic->mnRefCount--;
305cdf0e10cSrcweir         mpImpGraphic = new ImpGraphic( *mpImpGraphic );
306cdf0e10cSrcweir     }
307cdf0e10cSrcweir }
308cdf0e10cSrcweir 
309cdf0e10cSrcweir // ------------------------------------------------------------------------
310cdf0e10cSrcweir 
operator =(const Graphic & rGraphic)311cdf0e10cSrcweir Graphic& Graphic::operator=( const Graphic& rGraphic )
312cdf0e10cSrcweir {
313cdf0e10cSrcweir     if( &rGraphic != this )
314cdf0e10cSrcweir     {
315cdf0e10cSrcweir         if( rGraphic.IsAnimated() )
316cdf0e10cSrcweir         {
317cdf0e10cSrcweir             if( mpImpGraphic->mnRefCount == 1UL )
318cdf0e10cSrcweir                 delete mpImpGraphic;
319cdf0e10cSrcweir             else
320cdf0e10cSrcweir                 mpImpGraphic->mnRefCount--;
321cdf0e10cSrcweir 
322cdf0e10cSrcweir             mpImpGraphic = new ImpGraphic( *rGraphic.mpImpGraphic );
323cdf0e10cSrcweir         }
324cdf0e10cSrcweir         else
325cdf0e10cSrcweir         {
326cdf0e10cSrcweir             rGraphic.mpImpGraphic->mnRefCount++;
327cdf0e10cSrcweir 
328cdf0e10cSrcweir             if( mpImpGraphic->mnRefCount == 1UL )
329cdf0e10cSrcweir                 delete mpImpGraphic;
330cdf0e10cSrcweir             else
331cdf0e10cSrcweir                 mpImpGraphic->mnRefCount--;
332cdf0e10cSrcweir 
333cdf0e10cSrcweir             mpImpGraphic = rGraphic.mpImpGraphic;
334cdf0e10cSrcweir         }
335cdf0e10cSrcweir     }
336cdf0e10cSrcweir 
337cdf0e10cSrcweir     return *this;
338cdf0e10cSrcweir }
339cdf0e10cSrcweir 
340cdf0e10cSrcweir // ------------------------------------------------------------------------
341cdf0e10cSrcweir 
operator ==(const Graphic & rGraphic) const342cdf0e10cSrcweir sal_Bool Graphic::operator==( const Graphic& rGraphic ) const
343cdf0e10cSrcweir {
344cdf0e10cSrcweir     return( *mpImpGraphic == *rGraphic.mpImpGraphic );
345cdf0e10cSrcweir }
346cdf0e10cSrcweir 
347cdf0e10cSrcweir // ------------------------------------------------------------------------
348cdf0e10cSrcweir 
operator !=(const Graphic & rGraphic) const349cdf0e10cSrcweir sal_Bool Graphic::operator!=( const Graphic& rGraphic ) const
350cdf0e10cSrcweir {
351cdf0e10cSrcweir     return( *mpImpGraphic != *rGraphic.mpImpGraphic );
352cdf0e10cSrcweir }
353cdf0e10cSrcweir 
354cdf0e10cSrcweir // ------------------------------------------------------------------------
355cdf0e10cSrcweir 
operator !() const356cdf0e10cSrcweir sal_Bool Graphic::operator!() const
357cdf0e10cSrcweir {
358cdf0e10cSrcweir     return( GRAPHIC_NONE == mpImpGraphic->ImplGetType() );
359cdf0e10cSrcweir }
360cdf0e10cSrcweir 
361cdf0e10cSrcweir // ------------------------------------------------------------------------
362cdf0e10cSrcweir 
Load(SvStream & rIStm)363cdf0e10cSrcweir void Graphic::Load( SvStream& rIStm )
364cdf0e10cSrcweir {
365cdf0e10cSrcweir     rIStm >> *this;
366cdf0e10cSrcweir }
367cdf0e10cSrcweir 
368cdf0e10cSrcweir // ------------------------------------------------------------------------
369cdf0e10cSrcweir 
Save(SvStream & rOStm)370cdf0e10cSrcweir void Graphic::Save( SvStream& rOStm )
371cdf0e10cSrcweir {
372cdf0e10cSrcweir     rOStm << *this;
373cdf0e10cSrcweir }
374cdf0e10cSrcweir 
375cdf0e10cSrcweir // ------------------------------------------------------------------------
376cdf0e10cSrcweir 
Assign(const SvDataCopyStream & rCopyStream)377cdf0e10cSrcweir void Graphic::Assign( const SvDataCopyStream& rCopyStream )
378cdf0e10cSrcweir {
379cdf0e10cSrcweir     *this = (const Graphic& ) rCopyStream;
380cdf0e10cSrcweir }
381cdf0e10cSrcweir 
382cdf0e10cSrcweir // ------------------------------------------------------------------------
383cdf0e10cSrcweir 
Clear()384cdf0e10cSrcweir void Graphic::Clear()
385cdf0e10cSrcweir {
386cdf0e10cSrcweir     ImplTestRefCount();
387cdf0e10cSrcweir     mpImpGraphic->ImplClear();
388cdf0e10cSrcweir }
389cdf0e10cSrcweir 
390cdf0e10cSrcweir // ------------------------------------------------------------------------
391cdf0e10cSrcweir 
GetType() const392cdf0e10cSrcweir GraphicType Graphic::GetType() const
393cdf0e10cSrcweir {
394cdf0e10cSrcweir     return mpImpGraphic->ImplGetType();
395cdf0e10cSrcweir }
396cdf0e10cSrcweir 
397cdf0e10cSrcweir // ------------------------------------------------------------------------
398cdf0e10cSrcweir 
SetDefaultType()399cdf0e10cSrcweir void Graphic::SetDefaultType()
400cdf0e10cSrcweir {
401cdf0e10cSrcweir     ImplTestRefCount();
402cdf0e10cSrcweir     mpImpGraphic->ImplSetDefaultType();
403cdf0e10cSrcweir }
404cdf0e10cSrcweir 
405cdf0e10cSrcweir // ------------------------------------------------------------------------
406cdf0e10cSrcweir 
IsSupportedGraphic() const407cdf0e10cSrcweir sal_Bool Graphic::IsSupportedGraphic() const
408cdf0e10cSrcweir {
409cdf0e10cSrcweir     return mpImpGraphic->ImplIsSupportedGraphic();
410cdf0e10cSrcweir }
411cdf0e10cSrcweir 
412cdf0e10cSrcweir // ------------------------------------------------------------------------
413cdf0e10cSrcweir 
IsTransparent() const414cdf0e10cSrcweir sal_Bool Graphic::IsTransparent() const
415cdf0e10cSrcweir {
416cdf0e10cSrcweir     return mpImpGraphic->ImplIsTransparent();
417cdf0e10cSrcweir }
418cdf0e10cSrcweir 
419cdf0e10cSrcweir // ------------------------------------------------------------------------
420cdf0e10cSrcweir 
IsAlpha() const421cdf0e10cSrcweir sal_Bool Graphic::IsAlpha() const
422cdf0e10cSrcweir {
423cdf0e10cSrcweir     return mpImpGraphic->ImplIsAlpha();
424cdf0e10cSrcweir }
425cdf0e10cSrcweir 
426cdf0e10cSrcweir // ------------------------------------------------------------------------
427cdf0e10cSrcweir 
IsAnimated() const428cdf0e10cSrcweir sal_Bool Graphic::IsAnimated() const
429cdf0e10cSrcweir {
430cdf0e10cSrcweir     return mpImpGraphic->ImplIsAnimated();
431cdf0e10cSrcweir }
432cdf0e10cSrcweir 
433cdf0e10cSrcweir // ------------------------------------------------------------------------
434cdf0e10cSrcweir 
IsEPS() const435cdf0e10cSrcweir sal_Bool Graphic::IsEPS() const
436cdf0e10cSrcweir {
437cdf0e10cSrcweir     return mpImpGraphic->ImplIsEPS();
438cdf0e10cSrcweir }
439cdf0e10cSrcweir 
440cdf0e10cSrcweir // ------------------------------------------------------------------------
441cdf0e10cSrcweir 
GetBitmap(const GraphicConversionParameters & rParameters) const442cdf0e10cSrcweir Bitmap Graphic::GetBitmap(const GraphicConversionParameters& rParameters) const
443cdf0e10cSrcweir {
444cdf0e10cSrcweir     return mpImpGraphic->ImplGetBitmap(rParameters);
445cdf0e10cSrcweir }
446cdf0e10cSrcweir 
447cdf0e10cSrcweir // ------------------------------------------------------------------------
448cdf0e10cSrcweir 
GetBitmapEx(const GraphicConversionParameters & rParameters) const449cdf0e10cSrcweir BitmapEx Graphic::GetBitmapEx(const GraphicConversionParameters& rParameters) const
450cdf0e10cSrcweir {
451cdf0e10cSrcweir     return mpImpGraphic->ImplGetBitmapEx(rParameters);
452cdf0e10cSrcweir }
453cdf0e10cSrcweir 
454cdf0e10cSrcweir // ------------------------------------------------------------------------
455cdf0e10cSrcweir 
GetAnimation() const456cdf0e10cSrcweir Animation Graphic::GetAnimation() const
457cdf0e10cSrcweir {
458cdf0e10cSrcweir     return mpImpGraphic->ImplGetAnimation();
459cdf0e10cSrcweir }
460cdf0e10cSrcweir 
461cdf0e10cSrcweir // ------------------------------------------------------------------------
462cdf0e10cSrcweir 
GetGDIMetaFile() const463cdf0e10cSrcweir const GDIMetaFile& Graphic::GetGDIMetaFile() const
464cdf0e10cSrcweir {
465cdf0e10cSrcweir     return mpImpGraphic->ImplGetGDIMetaFile();
466cdf0e10cSrcweir }
467cdf0e10cSrcweir 
468cdf0e10cSrcweir // ------------------------------------------------------------------------
469cdf0e10cSrcweir 
GetXGraphic() const470cdf0e10cSrcweir uno::Reference< graphic::XGraphic > Graphic::GetXGraphic() const
471cdf0e10cSrcweir {
472cdf0e10cSrcweir     uno::Reference< graphic::XGraphic > xRet;
473cdf0e10cSrcweir 
474cdf0e10cSrcweir     if( GetType() != GRAPHIC_NONE )
475cdf0e10cSrcweir     {
476cdf0e10cSrcweir         uno::Reference < lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
477cdf0e10cSrcweir 
478cdf0e10cSrcweir         if( xMSF.is() )
479cdf0e10cSrcweir         {
480cdf0e10cSrcweir             uno::Reference< graphic::XGraphicProvider > xProv( xMSF->createInstance(
481cdf0e10cSrcweir                 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ),
482cdf0e10cSrcweir                 uno::UNO_QUERY );
483cdf0e10cSrcweir 
484cdf0e10cSrcweir             if( xProv.is() )
485cdf0e10cSrcweir             {
486cdf0e10cSrcweir                 uno::Sequence< beans::PropertyValue >   aLoadProps( 1 );
487cdf0e10cSrcweir                 ::rtl::OUString                         aURL( RTL_CONSTASCII_USTRINGPARAM( "private:memorygraphic/" ) );
488cdf0e10cSrcweir 
489cdf0e10cSrcweir                 aLoadProps[ 0 ].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
490cdf0e10cSrcweir                 aLoadProps[ 0 ].Value <<= ( aURL += ::rtl::OUString::valueOf( reinterpret_cast< sal_Int64 >( this ) ) );
491cdf0e10cSrcweir 
492cdf0e10cSrcweir                 xRet = xProv->queryGraphic( aLoadProps );
493cdf0e10cSrcweir             }
494cdf0e10cSrcweir         }
495cdf0e10cSrcweir     }
496cdf0e10cSrcweir 
497cdf0e10cSrcweir     return xRet;
498cdf0e10cSrcweir }
499cdf0e10cSrcweir 
500cdf0e10cSrcweir // ------------------------------------------------------------------------
501cdf0e10cSrcweir 
GetPrefSize() const502cdf0e10cSrcweir Size Graphic::GetPrefSize() const
503cdf0e10cSrcweir {
504cdf0e10cSrcweir     return mpImpGraphic->ImplGetPrefSize();
505cdf0e10cSrcweir }
506cdf0e10cSrcweir 
507cdf0e10cSrcweir // ------------------------------------------------------------------------
508cdf0e10cSrcweir 
SetPrefSize(const Size & rPrefSize)509cdf0e10cSrcweir void Graphic::SetPrefSize( const Size& rPrefSize )
510cdf0e10cSrcweir {
511cdf0e10cSrcweir     ImplTestRefCount();
512cdf0e10cSrcweir     mpImpGraphic->ImplSetPrefSize( rPrefSize );
513cdf0e10cSrcweir }
514cdf0e10cSrcweir 
515cdf0e10cSrcweir // ------------------------------------------------------------------------
516cdf0e10cSrcweir 
GetPrefMapMode() const517cdf0e10cSrcweir MapMode Graphic::GetPrefMapMode() const
518cdf0e10cSrcweir {
519cdf0e10cSrcweir     return mpImpGraphic->ImplGetPrefMapMode();
520cdf0e10cSrcweir }
521cdf0e10cSrcweir 
522cdf0e10cSrcweir // ------------------------------------------------------------------------
523cdf0e10cSrcweir 
SetPrefMapMode(const MapMode & rPrefMapMode)524cdf0e10cSrcweir void Graphic::SetPrefMapMode( const MapMode& rPrefMapMode )
525cdf0e10cSrcweir {
526cdf0e10cSrcweir     ImplTestRefCount();
527cdf0e10cSrcweir     mpImpGraphic->ImplSetPrefMapMode( rPrefMapMode );
528cdf0e10cSrcweir }
529cdf0e10cSrcweir 
530cdf0e10cSrcweir // ------------------------------------------------------------------
531cdf0e10cSrcweir 
GetSizePixel(const OutputDevice * pRefDevice) const532cdf0e10cSrcweir Size Graphic::GetSizePixel( const OutputDevice* pRefDevice ) const
533cdf0e10cSrcweir {
534cdf0e10cSrcweir     Size aRet;
535cdf0e10cSrcweir 
536cdf0e10cSrcweir     if( GRAPHIC_BITMAP == mpImpGraphic->ImplGetType() )
537cdf0e10cSrcweir         aRet = mpImpGraphic->ImplGetBitmapEx(GraphicConversionParameters()).GetSizePixel();
538cdf0e10cSrcweir     else
539cdf0e10cSrcweir         aRet = ( pRefDevice ? pRefDevice : Application::GetDefaultDevice() )->LogicToPixel( GetPrefSize(), GetPrefMapMode() );
540cdf0e10cSrcweir 
541cdf0e10cSrcweir     return aRet;
542cdf0e10cSrcweir }
543cdf0e10cSrcweir 
544cdf0e10cSrcweir // ------------------------------------------------------------------
545cdf0e10cSrcweir 
GetSizeBytes() const546cdf0e10cSrcweir sal_uLong Graphic::GetSizeBytes() const
547cdf0e10cSrcweir {
548cdf0e10cSrcweir     return mpImpGraphic->ImplGetSizeBytes();
549cdf0e10cSrcweir }
550cdf0e10cSrcweir 
551cdf0e10cSrcweir // ------------------------------------------------------------------------
552cdf0e10cSrcweir 
Draw(OutputDevice * pOutDev,const Point & rDestPt) const553cdf0e10cSrcweir void Graphic::Draw( OutputDevice* pOutDev, const Point& rDestPt ) const
554cdf0e10cSrcweir {
555cdf0e10cSrcweir     mpImpGraphic->ImplDraw( pOutDev, rDestPt );
556cdf0e10cSrcweir }
557cdf0e10cSrcweir 
558cdf0e10cSrcweir // ------------------------------------------------------------------------
559cdf0e10cSrcweir 
Draw(OutputDevice * pOutDev,const Point & rDestPt,const Size & rDestSz) const560cdf0e10cSrcweir void Graphic::Draw( OutputDevice* pOutDev,
561cdf0e10cSrcweir                     const Point& rDestPt, const Size& rDestSz ) const
562cdf0e10cSrcweir {
563cdf0e10cSrcweir     if( GRAPHIC_DEFAULT == mpImpGraphic->ImplGetType() )
564cdf0e10cSrcweir         ImplDrawDefault( pOutDev, NULL, NULL, NULL, NULL, rDestPt, rDestSz );
565cdf0e10cSrcweir     else
566cdf0e10cSrcweir         mpImpGraphic->ImplDraw( pOutDev, rDestPt, rDestSz );
567cdf0e10cSrcweir }
568cdf0e10cSrcweir 
569cdf0e10cSrcweir // ------------------------------------------------------------------------
570cdf0e10cSrcweir 
Draw(OutputDevice * pOutDev,const String & rText,Font & rFont,const Bitmap & rBitmap,const Point & rDestPt,const Size & rDestSz)571cdf0e10cSrcweir void Graphic::Draw( OutputDevice* pOutDev, const String& rText,
572cdf0e10cSrcweir                     Font& rFont, const Bitmap& rBitmap,
573cdf0e10cSrcweir                     const Point& rDestPt, const Size& rDestSz )
574cdf0e10cSrcweir {
575cdf0e10cSrcweir     ImplDrawDefault( pOutDev, &rText, &rFont, &rBitmap, NULL, rDestPt, rDestSz );
576cdf0e10cSrcweir }
577cdf0e10cSrcweir 
578cdf0e10cSrcweir // ------------------------------------------------------------------------
579cdf0e10cSrcweir 
DrawEx(OutputDevice * pOutDev,const String & rText,Font & rFont,const BitmapEx & rBitmap,const Point & rDestPt,const Size & rDestSz)580cdf0e10cSrcweir void Graphic::DrawEx( OutputDevice* pOutDev, const String& rText,
581cdf0e10cSrcweir                     Font& rFont, const BitmapEx& rBitmap,
582cdf0e10cSrcweir                     const Point& rDestPt, const Size& rDestSz )
583cdf0e10cSrcweir {
584cdf0e10cSrcweir     ImplDrawDefault( pOutDev, &rText, &rFont, NULL, &rBitmap, rDestPt, rDestSz );
585cdf0e10cSrcweir }
586cdf0e10cSrcweir 
587cdf0e10cSrcweir // ------------------------------------------------------------------------
588cdf0e10cSrcweir 
StartAnimation(OutputDevice * pOutDev,const Point & rDestPt,long nExtraData,OutputDevice * pFirstFrameOutDev)589cdf0e10cSrcweir void Graphic::StartAnimation( OutputDevice* pOutDev, const Point& rDestPt, long nExtraData,
590cdf0e10cSrcweir                               OutputDevice* pFirstFrameOutDev )
591cdf0e10cSrcweir {
592cdf0e10cSrcweir     ImplTestRefCount();
593cdf0e10cSrcweir     mpImpGraphic->ImplStartAnimation( pOutDev, rDestPt, nExtraData, pFirstFrameOutDev );
594cdf0e10cSrcweir }
595cdf0e10cSrcweir 
596cdf0e10cSrcweir // ------------------------------------------------------------------------
597cdf0e10cSrcweir 
StartAnimation(OutputDevice * pOutDev,const Point & rDestPt,const Size & rDestSz,long nExtraData,OutputDevice * pFirstFrameOutDev)598cdf0e10cSrcweir void Graphic::StartAnimation( OutputDevice* pOutDev, const Point& rDestPt,
599cdf0e10cSrcweir                               const Size& rDestSz, long nExtraData,
600cdf0e10cSrcweir                               OutputDevice* pFirstFrameOutDev )
601cdf0e10cSrcweir {
602cdf0e10cSrcweir     ImplTestRefCount();
603cdf0e10cSrcweir     mpImpGraphic->ImplStartAnimation( pOutDev, rDestPt, rDestSz, nExtraData, pFirstFrameOutDev );
604cdf0e10cSrcweir }
605cdf0e10cSrcweir 
606cdf0e10cSrcweir // ------------------------------------------------------------------------
607cdf0e10cSrcweir 
StopAnimation(OutputDevice * pOutDev,long nExtraData)608cdf0e10cSrcweir void Graphic::StopAnimation( OutputDevice* pOutDev, long nExtraData )
609cdf0e10cSrcweir {
610cdf0e10cSrcweir     ImplTestRefCount();
611cdf0e10cSrcweir     mpImpGraphic->ImplStopAnimation( pOutDev, nExtraData );
612cdf0e10cSrcweir }
613cdf0e10cSrcweir 
614cdf0e10cSrcweir // ------------------------------------------------------------------------
615cdf0e10cSrcweir 
SetAnimationNotifyHdl(const Link & rLink)616cdf0e10cSrcweir void Graphic::SetAnimationNotifyHdl( const Link& rLink )
617cdf0e10cSrcweir {
618cdf0e10cSrcweir     mpImpGraphic->ImplSetAnimationNotifyHdl( rLink );
619cdf0e10cSrcweir }
620cdf0e10cSrcweir 
621cdf0e10cSrcweir // ------------------------------------------------------------------------
622cdf0e10cSrcweir 
GetAnimationNotifyHdl() const623cdf0e10cSrcweir Link Graphic::GetAnimationNotifyHdl() const
624cdf0e10cSrcweir {
625cdf0e10cSrcweir     return mpImpGraphic->ImplGetAnimationNotifyHdl();
626cdf0e10cSrcweir }
627cdf0e10cSrcweir 
628cdf0e10cSrcweir // ------------------------------------------------------------------------
629cdf0e10cSrcweir 
GetAnimationLoopCount() const630cdf0e10cSrcweir sal_uLong Graphic::GetAnimationLoopCount() const
631cdf0e10cSrcweir {
632cdf0e10cSrcweir     return mpImpGraphic->ImplGetAnimationLoopCount();
633cdf0e10cSrcweir }
634cdf0e10cSrcweir 
635cdf0e10cSrcweir // ------------------------------------------------------------------------
636cdf0e10cSrcweir 
ResetAnimationLoopCount()637cdf0e10cSrcweir void Graphic::ResetAnimationLoopCount()
638cdf0e10cSrcweir {
639cdf0e10cSrcweir     mpImpGraphic->ImplResetAnimationLoopCount();
640cdf0e10cSrcweir }
641cdf0e10cSrcweir 
642cdf0e10cSrcweir // ------------------------------------------------------------------------
643cdf0e10cSrcweir 
GetAnimationInfoList() const644cdf0e10cSrcweir List* Graphic::GetAnimationInfoList() const
645cdf0e10cSrcweir {
646cdf0e10cSrcweir     return mpImpGraphic->ImplGetAnimationInfoList();
647cdf0e10cSrcweir }
648cdf0e10cSrcweir 
649cdf0e10cSrcweir // ------------------------------------------------------------------------
650cdf0e10cSrcweir 
GetContext()651cdf0e10cSrcweir GraphicReader* Graphic::GetContext()
652cdf0e10cSrcweir {
653cdf0e10cSrcweir     return mpImpGraphic->ImplGetContext();
654cdf0e10cSrcweir }
655cdf0e10cSrcweir 
656cdf0e10cSrcweir // ------------------------------------------------------------------------
657cdf0e10cSrcweir 
SetContext(GraphicReader * pReader)658cdf0e10cSrcweir void Graphic::SetContext( GraphicReader* pReader )
659cdf0e10cSrcweir {
660cdf0e10cSrcweir     mpImpGraphic->ImplSetContext( pReader );
661cdf0e10cSrcweir }
662cdf0e10cSrcweir 
663cdf0e10cSrcweir // ------------------------------------------------------------------------
664cdf0e10cSrcweir 
GetGraphicsCompressMode(SvStream & rIStm)665cdf0e10cSrcweir sal_uInt16 Graphic::GetGraphicsCompressMode( SvStream& rIStm )
666cdf0e10cSrcweir {
667cdf0e10cSrcweir     const sal_uLong     nPos = rIStm.Tell();
668cdf0e10cSrcweir     const sal_uInt16    nOldFormat = rIStm.GetNumberFormatInt();
669cdf0e10cSrcweir     sal_uInt32          nTmp32;
670cdf0e10cSrcweir     sal_uInt16          nTmp16;
671cdf0e10cSrcweir     sal_uInt16          nCompressMode = COMPRESSMODE_NONE;
672cdf0e10cSrcweir 
673cdf0e10cSrcweir     rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
674cdf0e10cSrcweir 
675cdf0e10cSrcweir     rIStm >> nTmp32;
676cdf0e10cSrcweir 
677cdf0e10cSrcweir     // is it a swapped graphic with a bitmap?
678cdf0e10cSrcweir     rIStm.SeekRel( (nTmp32 == (sal_uInt32) GRAPHIC_BITMAP ) ? 40 : -4 );
679cdf0e10cSrcweir 
680cdf0e10cSrcweir     // try to read bitmap id
681cdf0e10cSrcweir     rIStm >> nTmp16;
682cdf0e10cSrcweir 
683cdf0e10cSrcweir     // check id of BitmapFileHeader
684cdf0e10cSrcweir     if( 0x4D42 == nTmp16 )
685cdf0e10cSrcweir     {
686cdf0e10cSrcweir         // seek to compress field of BitmapInfoHeader
687cdf0e10cSrcweir         rIStm.SeekRel( 28 );
688cdf0e10cSrcweir         rIStm >> nTmp32;
689cdf0e10cSrcweir 
690cdf0e10cSrcweir         // Compare with our own compressmode
691cdf0e10cSrcweir         if( ZCOMPRESS == nTmp32 )
692cdf0e10cSrcweir             nCompressMode = COMPRESSMODE_ZBITMAP;
693cdf0e10cSrcweir     }
694cdf0e10cSrcweir 
695cdf0e10cSrcweir     rIStm.SetNumberFormatInt( nOldFormat );
696cdf0e10cSrcweir     rIStm.Seek( nPos );
697cdf0e10cSrcweir 
698cdf0e10cSrcweir     return nCompressMode;
699cdf0e10cSrcweir }
700cdf0e10cSrcweir 
701cdf0e10cSrcweir // ------------------------------------------------------------------------
702cdf0e10cSrcweir 
SetDocFileName(const String & rName,sal_uLong nFilePos)703cdf0e10cSrcweir void Graphic::SetDocFileName( const String& rName, sal_uLong nFilePos )
704cdf0e10cSrcweir {
705cdf0e10cSrcweir     mpImpGraphic->ImplSetDocFileName( rName, nFilePos );
706cdf0e10cSrcweir }
707cdf0e10cSrcweir 
708cdf0e10cSrcweir // ------------------------------------------------------------------------
709cdf0e10cSrcweir 
GetDocFileName() const710cdf0e10cSrcweir const String& Graphic::GetDocFileName() const
711cdf0e10cSrcweir {
712cdf0e10cSrcweir     return mpImpGraphic->ImplGetDocFileName();
713cdf0e10cSrcweir }
714cdf0e10cSrcweir 
715cdf0e10cSrcweir // ------------------------------------------------------------------------
716cdf0e10cSrcweir 
GetDocFilePos() const717cdf0e10cSrcweir sal_uLong Graphic::GetDocFilePos() const
718cdf0e10cSrcweir {
719cdf0e10cSrcweir     return mpImpGraphic->ImplGetDocFilePos();
720cdf0e10cSrcweir }
721cdf0e10cSrcweir 
722cdf0e10cSrcweir // ------------------------------------------------------------------------
723cdf0e10cSrcweir 
ReadEmbedded(SvStream & rIStream,sal_Bool bSwap)724cdf0e10cSrcweir sal_Bool Graphic::ReadEmbedded( SvStream& rIStream, sal_Bool bSwap )
725cdf0e10cSrcweir {
726cdf0e10cSrcweir     ImplTestRefCount();
727cdf0e10cSrcweir     return mpImpGraphic->ImplReadEmbedded( rIStream, bSwap );
728cdf0e10cSrcweir }
729cdf0e10cSrcweir 
730cdf0e10cSrcweir // ------------------------------------------------------------------------
731cdf0e10cSrcweir 
WriteEmbedded(SvStream & rOStream)732cdf0e10cSrcweir sal_Bool Graphic::WriteEmbedded( SvStream& rOStream )
733cdf0e10cSrcweir {
734cdf0e10cSrcweir     ImplTestRefCount();
735cdf0e10cSrcweir     return mpImpGraphic->ImplWriteEmbedded( rOStream );
736cdf0e10cSrcweir }
737cdf0e10cSrcweir 
738cdf0e10cSrcweir // ------------------------------------------------------------------------
739cdf0e10cSrcweir 
SwapOut()740cdf0e10cSrcweir sal_Bool Graphic::SwapOut()
741cdf0e10cSrcweir {
742cdf0e10cSrcweir     ImplTestRefCount();
743cdf0e10cSrcweir     return mpImpGraphic->ImplSwapOut();
744cdf0e10cSrcweir }
745cdf0e10cSrcweir 
746cdf0e10cSrcweir // ------------------------------------------------------------------------
747cdf0e10cSrcweir 
SwapOut(SvStream * pOStream)748cdf0e10cSrcweir sal_Bool Graphic::SwapOut( SvStream* pOStream )
749cdf0e10cSrcweir {
750cdf0e10cSrcweir     ImplTestRefCount();
751cdf0e10cSrcweir     return mpImpGraphic->ImplSwapOut( pOStream );
752cdf0e10cSrcweir }
753cdf0e10cSrcweir 
754cdf0e10cSrcweir // ------------------------------------------------------------------------
755cdf0e10cSrcweir 
SwapIn()756cdf0e10cSrcweir sal_Bool Graphic::SwapIn()
757cdf0e10cSrcweir {
758cdf0e10cSrcweir     ImplTestRefCount();
759cdf0e10cSrcweir     return mpImpGraphic->ImplSwapIn();
760cdf0e10cSrcweir }
761cdf0e10cSrcweir 
762cdf0e10cSrcweir // ------------------------------------------------------------------------
763cdf0e10cSrcweir 
SwapIn(SvStream * pStrm)764cdf0e10cSrcweir sal_Bool Graphic::SwapIn( SvStream* pStrm )
765cdf0e10cSrcweir {
766cdf0e10cSrcweir     ImplTestRefCount();
767cdf0e10cSrcweir     return mpImpGraphic->ImplSwapIn( pStrm );
768cdf0e10cSrcweir }
769cdf0e10cSrcweir 
770cdf0e10cSrcweir // ------------------------------------------------------------------------
771cdf0e10cSrcweir 
IsSwapOut() const772cdf0e10cSrcweir sal_Bool Graphic::IsSwapOut() const
773cdf0e10cSrcweir {
774cdf0e10cSrcweir     return mpImpGraphic->ImplIsSwapOut();
775cdf0e10cSrcweir }
776cdf0e10cSrcweir 
777cdf0e10cSrcweir // ------------------------------------------------------------------------
778cdf0e10cSrcweir 
SetLink(const GfxLink & rGfxLink)779cdf0e10cSrcweir void Graphic::SetLink( const GfxLink& rGfxLink )
780cdf0e10cSrcweir {
781cdf0e10cSrcweir     ImplTestRefCount();
782cdf0e10cSrcweir     mpImpGraphic->ImplSetLink( rGfxLink );
783cdf0e10cSrcweir }
784cdf0e10cSrcweir 
785cdf0e10cSrcweir // ------------------------------------------------------------------------
786cdf0e10cSrcweir 
GetLink() const787cdf0e10cSrcweir GfxLink Graphic::GetLink() const
788cdf0e10cSrcweir {
789cdf0e10cSrcweir     return mpImpGraphic->ImplGetLink();
790cdf0e10cSrcweir }
791cdf0e10cSrcweir 
792cdf0e10cSrcweir // ------------------------------------------------------------------------
793cdf0e10cSrcweir 
IsLink() const794cdf0e10cSrcweir sal_Bool Graphic::IsLink() const
795cdf0e10cSrcweir {
796cdf0e10cSrcweir     return mpImpGraphic->ImplIsLink();
797cdf0e10cSrcweir }
798cdf0e10cSrcweir 
799cdf0e10cSrcweir // ------------------------------------------------------------------------
800cdf0e10cSrcweir 
GetChecksum() const801cdf0e10cSrcweir sal_uLong Graphic::GetChecksum() const
802cdf0e10cSrcweir {
803cdf0e10cSrcweir     return mpImpGraphic->ImplGetChecksum();
804cdf0e10cSrcweir }
805cdf0e10cSrcweir 
806cdf0e10cSrcweir // ------------------------------------------------------------------------
807cdf0e10cSrcweir 
ExportNative(SvStream & rOStream) const808cdf0e10cSrcweir sal_Bool Graphic::ExportNative( SvStream& rOStream ) const
809cdf0e10cSrcweir {
810cdf0e10cSrcweir     return mpImpGraphic->ImplExportNative( rOStream );
811cdf0e10cSrcweir }
812cdf0e10cSrcweir 
813cdf0e10cSrcweir // ------------------------------------------------------------------------
814cdf0e10cSrcweir 
operator >>(SvStream & rIStream,Graphic & rGraphic)815cdf0e10cSrcweir SvStream& operator>>( SvStream& rIStream, Graphic& rGraphic )
816cdf0e10cSrcweir {
817cdf0e10cSrcweir     rGraphic.ImplTestRefCount();
818cdf0e10cSrcweir     return rIStream >> *rGraphic.mpImpGraphic;
819cdf0e10cSrcweir }
820cdf0e10cSrcweir 
821cdf0e10cSrcweir // ------------------------------------------------------------------------
822cdf0e10cSrcweir 
operator <<(SvStream & rOStream,const Graphic & rGraphic)823cdf0e10cSrcweir SvStream& operator<<( SvStream& rOStream, const Graphic& rGraphic )
824cdf0e10cSrcweir {
825cdf0e10cSrcweir     return rOStream << *rGraphic.mpImpGraphic;
826cdf0e10cSrcweir }
827*ddde725dSArmin Le Grand 
getSvgData() const828*ddde725dSArmin Le Grand const SvgDataPtr& Graphic::getSvgData() const
829*ddde725dSArmin Le Grand {
830*ddde725dSArmin Le Grand     return mpImpGraphic->getSvgData();
831*ddde725dSArmin Le Grand }
832