xref: /trunk/main/svx/source/xoutdev/xtablend.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svx.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir // include ---------------------------------------------------------------
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #ifndef SVX_LIGHT
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
36*cdf0e10cSrcweir #include "svx/XPropertyTable.hxx"
37*cdf0e10cSrcweir #include <unotools/ucbstreamhelper.hxx>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include "xmlxtexp.hxx"
40*cdf0e10cSrcweir #include "xmlxtimp.hxx"
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #endif
43*cdf0e10cSrcweir #include <tools/urlobj.hxx>
44*cdf0e10cSrcweir #include <vcl/virdev.hxx>
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir #ifndef _SV_APP_HXX
47*cdf0e10cSrcweir #include <vcl/svapp.hxx>
48*cdf0e10cSrcweir #endif
49*cdf0e10cSrcweir #include <svl/itemset.hxx>
50*cdf0e10cSrcweir #include <sfx2/docfile.hxx>
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir #include <svx/dialogs.hrc>
53*cdf0e10cSrcweir #include <svx/dialmgr.hxx>
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir #include <svx/xtable.hxx>
56*cdf0e10cSrcweir #include <svx/xpool.hxx>
57*cdf0e10cSrcweir #include <svx/xfillit0.hxx>
58*cdf0e10cSrcweir #include <svx/xflclit.hxx>
59*cdf0e10cSrcweir #include <svx/xlnstwit.hxx>
60*cdf0e10cSrcweir #include <svx/xlnedwit.hxx>
61*cdf0e10cSrcweir #include <svx/xlnclit.hxx>
62*cdf0e10cSrcweir #include <svx/xlineit0.hxx>
63*cdf0e10cSrcweir #include <svx/xlnstit.hxx>
64*cdf0e10cSrcweir #include <svx/xlnedit.hxx>
65*cdf0e10cSrcweir #include <basegfx/point/b2dpoint.hxx>
66*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
67*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx>
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir #include <svx/svdorect.hxx>
70*cdf0e10cSrcweir #include <svx/svdopath.hxx>
71*cdf0e10cSrcweir #include <svx/svdmodel.hxx>
72*cdf0e10cSrcweir #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
73*cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx>
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir #define GLOBALOVERFLOW
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir using namespace com::sun::star;
78*cdf0e10cSrcweir using namespace rtl;
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir sal_Unicode const pszExtLineEnd[]   = {'s','o','e'};
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir static char const aChckLEnd[]  = { 0x04, 0x00, 'S','O','E','L'};    // < 5.2
83*cdf0e10cSrcweir static char const aChckLEnd0[] = { 0x04, 0x00, 'S','O','E','0'};    // = 5.2
84*cdf0e10cSrcweir static char const aChckXML[]   = { '<', '?', 'x', 'm', 'l' };       // = 6.0
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir // --------------------
87*cdf0e10cSrcweir // class XLineEndTable
88*cdf0e10cSrcweir // --------------------
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir /*************************************************************************
91*cdf0e10cSrcweir |*
92*cdf0e10cSrcweir |* XLineEndTable::XLineEndTable()
93*cdf0e10cSrcweir |*
94*cdf0e10cSrcweir *************************************************************************/
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir XLineEndTable::XLineEndTable( const String& rPath,
97*cdf0e10cSrcweir                             XOutdevItemPool* pInPool,
98*cdf0e10cSrcweir                             sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
99*cdf0e10cSrcweir                 XPropertyTable( rPath, pInPool, nInitSize, nReSize)
100*cdf0e10cSrcweir {
101*cdf0e10cSrcweir     pBmpTable = new Table( nInitSize, nReSize );
102*cdf0e10cSrcweir }
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir /************************************************************************/
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir XLineEndTable::~XLineEndTable()
107*cdf0e10cSrcweir {
108*cdf0e10cSrcweir }
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir /************************************************************************/
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir XLineEndEntry* XLineEndTable::Replace(long nIndex, XLineEndEntry* pEntry )
113*cdf0e10cSrcweir {
114*cdf0e10cSrcweir     return (XLineEndEntry*) XPropertyTable::Replace(nIndex, pEntry);
115*cdf0e10cSrcweir }
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir /************************************************************************/
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir XLineEndEntry* XLineEndTable::Remove(long nIndex)
120*cdf0e10cSrcweir {
121*cdf0e10cSrcweir     return (XLineEndEntry*) XPropertyTable::Remove(nIndex, 0);
122*cdf0e10cSrcweir }
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir /************************************************************************/
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir XLineEndEntry* XLineEndTable::GetLineEnd(long nIndex) const
127*cdf0e10cSrcweir {
128*cdf0e10cSrcweir     return (XLineEndEntry*) XPropertyTable::Get(nIndex, 0);
129*cdf0e10cSrcweir }
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir /************************************************************************/
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir sal_Bool XLineEndTable::Load()
134*cdf0e10cSrcweir {
135*cdf0e10cSrcweir     return( sal_False );
136*cdf0e10cSrcweir }
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir /************************************************************************/
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir sal_Bool XLineEndTable::Save()
141*cdf0e10cSrcweir {
142*cdf0e10cSrcweir     return( sal_False );
143*cdf0e10cSrcweir }
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir /************************************************************************/
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir sal_Bool XLineEndTable::Create()
148*cdf0e10cSrcweir {
149*cdf0e10cSrcweir     return( sal_False );
150*cdf0e10cSrcweir }
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir /************************************************************************/
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir Bitmap* XLineEndTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
155*cdf0e10cSrcweir {
156*cdf0e10cSrcweir     return( NULL );
157*cdf0e10cSrcweir }
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir /************************************************************************/
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir sal_Bool XLineEndTable::CreateBitmapsForUI()
162*cdf0e10cSrcweir {
163*cdf0e10cSrcweir     return( sal_False );
164*cdf0e10cSrcweir }
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir // --------------------
167*cdf0e10cSrcweir // class XLineEndList
168*cdf0e10cSrcweir // --------------------
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir class impXLineEndList
171*cdf0e10cSrcweir {
172*cdf0e10cSrcweir private:
173*cdf0e10cSrcweir     VirtualDevice*          mpVirtualDevice;
174*cdf0e10cSrcweir     SdrModel*               mpSdrModel;
175*cdf0e10cSrcweir     SdrObject*              mpBackgroundObject;
176*cdf0e10cSrcweir     SdrObject*              mpLineObject;
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir public:
179*cdf0e10cSrcweir     impXLineEndList(VirtualDevice* pV, SdrModel* pM, SdrObject* pB, SdrObject* pL)
180*cdf0e10cSrcweir     :   mpVirtualDevice(pV),
181*cdf0e10cSrcweir         mpSdrModel(pM),
182*cdf0e10cSrcweir         mpBackgroundObject(pB),
183*cdf0e10cSrcweir         mpLineObject(pL)
184*cdf0e10cSrcweir     {}
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir     ~impXLineEndList()
187*cdf0e10cSrcweir     {
188*cdf0e10cSrcweir         delete mpVirtualDevice;
189*cdf0e10cSrcweir         SdrObject::Free(mpBackgroundObject);
190*cdf0e10cSrcweir         SdrObject::Free(mpLineObject);
191*cdf0e10cSrcweir         delete mpSdrModel;
192*cdf0e10cSrcweir     }
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir     VirtualDevice* getVirtualDevice() const { return mpVirtualDevice; }
195*cdf0e10cSrcweir     SdrObject* getBackgroundObject() const { return mpBackgroundObject; }
196*cdf0e10cSrcweir     SdrObject* getLineObject() const { return mpLineObject; }
197*cdf0e10cSrcweir };
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir void XLineEndList::impCreate()
200*cdf0e10cSrcweir {
201*cdf0e10cSrcweir     if(!mpData)
202*cdf0e10cSrcweir     {
203*cdf0e10cSrcweir         const Point aZero(0, 0);
204*cdf0e10cSrcweir         const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir         VirtualDevice* pVirDev = new VirtualDevice;
207*cdf0e10cSrcweir         OSL_ENSURE(0 != pVirDev, "XLineEndList: no VirtualDevice created!" );
208*cdf0e10cSrcweir         pVirDev->SetMapMode(MAP_100TH_MM);
209*cdf0e10cSrcweir         const Size aSize(pVirDev->PixelToLogic(Size(BITMAP_WIDTH * 2, BITMAP_HEIGHT)));
210*cdf0e10cSrcweir         pVirDev->SetOutputSize(aSize);
211*cdf0e10cSrcweir         pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
212*cdf0e10cSrcweir             ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
213*cdf0e10cSrcweir             : DRAWMODE_DEFAULT);
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir         SdrModel* pSdrModel = new SdrModel();
216*cdf0e10cSrcweir         OSL_ENSURE(0 != pSdrModel, "XLineEndList: no SdrModel created!" );
217*cdf0e10cSrcweir         pSdrModel->GetItemPool().FreezeIdRanges();
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir         const Rectangle aBackgroundSize(aZero, aSize);
220*cdf0e10cSrcweir         SdrObject* pBackgroundObject = new SdrRectObj(aBackgroundSize);
221*cdf0e10cSrcweir         OSL_ENSURE(0 != pBackgroundObject, "XLineEndList: no BackgroundObject created!" );
222*cdf0e10cSrcweir         pBackgroundObject->SetModel(pSdrModel);
223*cdf0e10cSrcweir         pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_SOLID));
224*cdf0e10cSrcweir         pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
225*cdf0e10cSrcweir         pBackgroundObject->SetMergedItem(XFillColorItem(String(), rStyleSettings.GetFieldColor()));
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir         const basegfx::B2DPoint aStart(0, aSize.Height() / 2);
228*cdf0e10cSrcweir         const basegfx::B2DPoint aEnd(aSize.Width(), aSize.Height() / 2);
229*cdf0e10cSrcweir         basegfx::B2DPolygon aPolygon;
230*cdf0e10cSrcweir         aPolygon.append(aStart);
231*cdf0e10cSrcweir         aPolygon.append(aEnd);
232*cdf0e10cSrcweir         SdrObject* pLineObject = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygon));
233*cdf0e10cSrcweir         OSL_ENSURE(0 != pLineObject, "XLineEndList: no LineObject created!" );
234*cdf0e10cSrcweir         pLineObject->SetModel(pSdrModel);
235*cdf0e10cSrcweir         pLineObject->SetMergedItem(XLineStartWidthItem(aSize.Height()));
236*cdf0e10cSrcweir         pLineObject->SetMergedItem(XLineEndWidthItem(aSize.Height()));
237*cdf0e10cSrcweir         pLineObject->SetMergedItem(XLineColorItem(String(), rStyleSettings.GetFieldTextColor()));
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir         mpData = new impXLineEndList(pVirDev, pSdrModel, pBackgroundObject, pLineObject);
240*cdf0e10cSrcweir         OSL_ENSURE(0 != mpData, "XLineEndList: data creation went wrong!" );
241*cdf0e10cSrcweir     }
242*cdf0e10cSrcweir }
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir void XLineEndList::impDestroy()
245*cdf0e10cSrcweir {
246*cdf0e10cSrcweir     if(mpData)
247*cdf0e10cSrcweir     {
248*cdf0e10cSrcweir         delete mpData;
249*cdf0e10cSrcweir         mpData = 0;
250*cdf0e10cSrcweir     }
251*cdf0e10cSrcweir }
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir XLineEndList::XLineEndList(const String& rPath, XOutdevItemPool* _pXPool, sal_uInt16 nInitSize, sal_uInt16 nReSize)
254*cdf0e10cSrcweir :   XPropertyList(rPath, _pXPool, nInitSize, nReSize),
255*cdf0e10cSrcweir     mpData(0)
256*cdf0e10cSrcweir {
257*cdf0e10cSrcweir     pBmpList = new List(nInitSize, nReSize);
258*cdf0e10cSrcweir }
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir XLineEndList::~XLineEndList()
261*cdf0e10cSrcweir {
262*cdf0e10cSrcweir     impDestroy();
263*cdf0e10cSrcweir }
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir XLineEndEntry* XLineEndList::Replace(XLineEndEntry* pEntry, long nIndex )
266*cdf0e10cSrcweir {
267*cdf0e10cSrcweir     return (XLineEndEntry*) XPropertyList::Replace(pEntry, nIndex);
268*cdf0e10cSrcweir }
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir XLineEndEntry* XLineEndList::Remove(long nIndex)
271*cdf0e10cSrcweir {
272*cdf0e10cSrcweir     return (XLineEndEntry*) XPropertyList::Remove(nIndex, 0);
273*cdf0e10cSrcweir }
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir XLineEndEntry* XLineEndList::GetLineEnd(long nIndex) const
276*cdf0e10cSrcweir {
277*cdf0e10cSrcweir     return (XLineEndEntry*) XPropertyList::Get(nIndex, 0);
278*cdf0e10cSrcweir }
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir sal_Bool XLineEndList::Load()
281*cdf0e10cSrcweir {
282*cdf0e10cSrcweir     if( bListDirty )
283*cdf0e10cSrcweir     {
284*cdf0e10cSrcweir         bListDirty = sal_False;
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir         INetURLObject aURL( aPath );
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir         if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
289*cdf0e10cSrcweir         {
290*cdf0e10cSrcweir             DBG_ASSERT( !aPath.Len(), "invalid URL" );
291*cdf0e10cSrcweir             return sal_False;
292*cdf0e10cSrcweir         }
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir         aURL.Append( aName );
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir         if( !aURL.getExtension().getLength() )
297*cdf0e10cSrcweir             aURL.setExtension( rtl::OUString( pszExtLineEnd, 3 ) );
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir         uno::Reference< container::XNameContainer > xTable( SvxUnoXLineEndTable_createInstance( this ), uno::UNO_QUERY );
300*cdf0e10cSrcweir         return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
301*cdf0e10cSrcweir     }
302*cdf0e10cSrcweir     return( sal_False );
303*cdf0e10cSrcweir }
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir sal_Bool XLineEndList::Save()
306*cdf0e10cSrcweir {
307*cdf0e10cSrcweir     INetURLObject aURL( aPath );
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir     if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
310*cdf0e10cSrcweir     {
311*cdf0e10cSrcweir         DBG_ASSERT( !aPath.Len(), "invalid URL" );
312*cdf0e10cSrcweir         return sal_False;
313*cdf0e10cSrcweir     }
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir     aURL.Append( aName );
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir     if( !aURL.getExtension().getLength() )
318*cdf0e10cSrcweir         aURL.setExtension( rtl::OUString( pszExtLineEnd, 3 ) );
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir     uno::Reference< container::XNameContainer > xTable( SvxUnoXLineEndTable_createInstance( this ), uno::UNO_QUERY );
321*cdf0e10cSrcweir     return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
322*cdf0e10cSrcweir }
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir sal_Bool XLineEndList::Create()
325*cdf0e10cSrcweir {
326*cdf0e10cSrcweir     basegfx::B2DPolygon aTriangle;
327*cdf0e10cSrcweir     aTriangle.append(basegfx::B2DPoint(10.0, 0.0));
328*cdf0e10cSrcweir     aTriangle.append(basegfx::B2DPoint(0.0, 30.0));
329*cdf0e10cSrcweir     aTriangle.append(basegfx::B2DPoint(20.0, 30.0));
330*cdf0e10cSrcweir     aTriangle.setClosed(true);
331*cdf0e10cSrcweir     Insert( new XLineEndEntry( basegfx::B2DPolyPolygon(aTriangle), SVX_RESSTR( RID_SVXSTR_ARROW ) ) );
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir     basegfx::B2DPolygon aSquare;
334*cdf0e10cSrcweir     aSquare.append(basegfx::B2DPoint(0.0, 0.0));
335*cdf0e10cSrcweir     aSquare.append(basegfx::B2DPoint(10.0, 0.0));
336*cdf0e10cSrcweir     aSquare.append(basegfx::B2DPoint(10.0, 10.0));
337*cdf0e10cSrcweir     aSquare.append(basegfx::B2DPoint(0.0, 10.0));
338*cdf0e10cSrcweir     aSquare.setClosed(true);
339*cdf0e10cSrcweir     Insert( new XLineEndEntry( basegfx::B2DPolyPolygon(aSquare), SVX_RESSTR( RID_SVXSTR_SQUARE ) ) );
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir     basegfx::B2DPolygon aCircle(basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0.0, 0.0), 100.0));
342*cdf0e10cSrcweir     Insert( new XLineEndEntry( basegfx::B2DPolyPolygon(aCircle), SVX_RESSTR( RID_SVXSTR_CIRCLE ) ) );
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir     return( sal_True );
345*cdf0e10cSrcweir }
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir sal_Bool XLineEndList::CreateBitmapsForUI()
348*cdf0e10cSrcweir {
349*cdf0e10cSrcweir     impCreate();
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir     for( long i = 0; i < Count(); i++)
352*cdf0e10cSrcweir     {
353*cdf0e10cSrcweir         Bitmap* pBmp = CreateBitmapForUI( i, sal_False );
354*cdf0e10cSrcweir         OSL_ENSURE(0 != pBmp, "XLineEndList: Bitmap(UI) could not be created!" );
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir         if( pBmp )
357*cdf0e10cSrcweir             pBmpList->Insert( pBmp, i );
358*cdf0e10cSrcweir     }
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir     impDestroy();
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir     return( sal_True );
363*cdf0e10cSrcweir }
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir Bitmap* XLineEndList::CreateBitmapForUI( long nIndex, sal_Bool bDelete )
366*cdf0e10cSrcweir {
367*cdf0e10cSrcweir     impCreate();
368*cdf0e10cSrcweir     VirtualDevice* pVD = mpData->getVirtualDevice();
369*cdf0e10cSrcweir     SdrObject* pLine = mpData->getLineObject();
370*cdf0e10cSrcweir 
371*cdf0e10cSrcweir     pLine->SetMergedItem(XLineStyleItem(XLINE_SOLID));
372*cdf0e10cSrcweir     pLine->SetMergedItem(XLineStartItem(String(), GetLineEnd(nIndex)->GetLineEnd()));
373*cdf0e10cSrcweir     pLine->SetMergedItem(XLineEndItem(String(), GetLineEnd(nIndex)->GetLineEnd()));
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir     sdr::contact::SdrObjectVector aObjectVector;
376*cdf0e10cSrcweir     aObjectVector.push_back(mpData->getBackgroundObject());
377*cdf0e10cSrcweir     aObjectVector.push_back(pLine);
378*cdf0e10cSrcweir     sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0);
379*cdf0e10cSrcweir     sdr::contact::DisplayInfo aDisplayInfo;
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir     aPainter.ProcessDisplay(aDisplayInfo);
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir     const Point aZero(0, 0);
384*cdf0e10cSrcweir     Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize()));
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir     if(bDelete)
387*cdf0e10cSrcweir     {
388*cdf0e10cSrcweir         impDestroy();
389*cdf0e10cSrcweir     }
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir     return pBitmap;
392*cdf0e10cSrcweir }
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
395*cdf0e10cSrcweir // eof
396