1f6e50924SAndrew Rist /**************************************************************
2f6e50924SAndrew Rist *
3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file
5f6e50924SAndrew Rist * distributed with this work for additional information
6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at
10f6e50924SAndrew Rist *
11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist * software distributed under the License is distributed on an
15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the
17f6e50924SAndrew Rist * specific language governing permissions and limitations
18f6e50924SAndrew Rist * under the License.
19f6e50924SAndrew Rist *
20f6e50924SAndrew Rist *************************************************************/
21f6e50924SAndrew Rist
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_svx.hxx"
24cdf0e10cSrcweir
25cdf0e10cSrcweir #include <svx/xtable.hxx>
26cdf0e10cSrcweir #include <svx/xpool.hxx>
2797e8a929SArmin Le Grand #include <svx/svdpool.hxx>
28cdf0e10cSrcweir
29cdf0e10cSrcweir #define GLOBALOVERFLOW
30cdf0e10cSrcweir
31cdf0e10cSrcweir // Vergleichsstrings
32cdf0e10cSrcweir sal_Unicode __FAR_DATA pszStandard[] = { 's', 't', 'a', 'n', 'd', 'a', 'r', 'd', 0 };
33cdf0e10cSrcweir
34cdf0e10cSrcweir // Konvertiert in echte RGB-Farben, damit in den Listboxen
35cdf0e10cSrcweir // endlich mal richtig selektiert werden kann.
RGB_Color(ColorData nColorName)36cdf0e10cSrcweir Color RGB_Color( ColorData nColorName )
37cdf0e10cSrcweir {
38cdf0e10cSrcweir Color aColor( nColorName );
39cdf0e10cSrcweir Color aRGBColor( aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue() );
40cdf0e10cSrcweir return aRGBColor;
41cdf0e10cSrcweir }
42cdf0e10cSrcweir
43*3e407bd8SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
44*3e407bd8SArmin Le Grand // class XColorEntry
45*3e407bd8SArmin Le Grand
XColorEntry(const Color & rColor,const String & rName)46*3e407bd8SArmin Le Grand XColorEntry::XColorEntry(const Color& rColor, const String& rName)
47*3e407bd8SArmin Le Grand : XPropertyEntry(rName),
48*3e407bd8SArmin Le Grand aColor(rColor)
49*3e407bd8SArmin Le Grand {
50*3e407bd8SArmin Le Grand }
51*3e407bd8SArmin Le Grand
XColorEntry(const XColorEntry & rOther)52*3e407bd8SArmin Le Grand XColorEntry::XColorEntry(const XColorEntry& rOther)
53*3e407bd8SArmin Le Grand : XPropertyEntry(rOther),
54*3e407bd8SArmin Le Grand aColor(rOther.aColor)
55*3e407bd8SArmin Le Grand {
56*3e407bd8SArmin Le Grand }
57*3e407bd8SArmin Le Grand
58*3e407bd8SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
59*3e407bd8SArmin Le Grand // class XLineEndEntry
60*3e407bd8SArmin Le Grand
XLineEndEntry(const basegfx::B2DPolyPolygon & rB2DPolyPolygon,const String & rName)61*3e407bd8SArmin Le Grand XLineEndEntry::XLineEndEntry(const basegfx::B2DPolyPolygon& rB2DPolyPolygon, const String& rName)
62*3e407bd8SArmin Le Grand : XPropertyEntry(rName),
63*3e407bd8SArmin Le Grand aB2DPolyPolygon(rB2DPolyPolygon)
64*3e407bd8SArmin Le Grand {
65*3e407bd8SArmin Le Grand }
66*3e407bd8SArmin Le Grand
XLineEndEntry(const XLineEndEntry & rOther)67*3e407bd8SArmin Le Grand XLineEndEntry::XLineEndEntry(const XLineEndEntry& rOther)
68*3e407bd8SArmin Le Grand : XPropertyEntry(rOther),
69*3e407bd8SArmin Le Grand aB2DPolyPolygon(rOther.aB2DPolyPolygon)
70*3e407bd8SArmin Le Grand {
71*3e407bd8SArmin Le Grand }
72*3e407bd8SArmin Le Grand
73*3e407bd8SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
74*3e407bd8SArmin Le Grand // class XDashEntry
75*3e407bd8SArmin Le Grand
XDashEntry(const XDash & rDash,const String & rName)76*3e407bd8SArmin Le Grand XDashEntry::XDashEntry(const XDash& rDash, const String& rName)
77*3e407bd8SArmin Le Grand : XPropertyEntry(rName),
78*3e407bd8SArmin Le Grand aDash(rDash)
79*3e407bd8SArmin Le Grand {
80*3e407bd8SArmin Le Grand }
81*3e407bd8SArmin Le Grand
XDashEntry(const XDashEntry & rOther)82*3e407bd8SArmin Le Grand XDashEntry::XDashEntry(const XDashEntry& rOther)
83*3e407bd8SArmin Le Grand : XPropertyEntry(rOther),
84*3e407bd8SArmin Le Grand aDash(rOther.aDash)
85*3e407bd8SArmin Le Grand {
86*3e407bd8SArmin Le Grand }
87*3e407bd8SArmin Le Grand
88*3e407bd8SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
89*3e407bd8SArmin Le Grand // class XHatchEntry
90*3e407bd8SArmin Le Grand
XHatchEntry(const XHatch & rHatch,const String & rName)91*3e407bd8SArmin Le Grand XHatchEntry::XHatchEntry(const XHatch& rHatch, const String& rName)
92*3e407bd8SArmin Le Grand : XPropertyEntry(rName),
93*3e407bd8SArmin Le Grand aHatch(rHatch)
94*3e407bd8SArmin Le Grand {
95*3e407bd8SArmin Le Grand }
96*3e407bd8SArmin Le Grand
XHatchEntry(const XHatchEntry & rOther)97*3e407bd8SArmin Le Grand XHatchEntry::XHatchEntry(const XHatchEntry& rOther)
98*3e407bd8SArmin Le Grand : XPropertyEntry(rOther),
99*3e407bd8SArmin Le Grand aHatch(rOther.aHatch)
100*3e407bd8SArmin Le Grand {
101*3e407bd8SArmin Le Grand }
102*3e407bd8SArmin Le Grand
103*3e407bd8SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
104*3e407bd8SArmin Le Grand // class XGradientEntry
105*3e407bd8SArmin Le Grand
XGradientEntry(const XGradient & rGradient,const String & rName)106*3e407bd8SArmin Le Grand XGradientEntry::XGradientEntry(const XGradient& rGradient, const String& rName)
107*3e407bd8SArmin Le Grand : XPropertyEntry(rName),
108*3e407bd8SArmin Le Grand aGradient(rGradient)
109*3e407bd8SArmin Le Grand {
110*3e407bd8SArmin Le Grand }
111*3e407bd8SArmin Le Grand
XGradientEntry(const XGradientEntry & rOther)112*3e407bd8SArmin Le Grand XGradientEntry::XGradientEntry(const XGradientEntry& rOther)
113*3e407bd8SArmin Le Grand : XPropertyEntry(rOther),
114*3e407bd8SArmin Le Grand aGradient(rOther.aGradient)
115*3e407bd8SArmin Le Grand {
116*3e407bd8SArmin Le Grand }
117*3e407bd8SArmin Le Grand
118*3e407bd8SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
119*3e407bd8SArmin Le Grand // class XBitmapEntry
120*3e407bd8SArmin Le Grand
XBitmapEntry(const GraphicObject & rGraphicObject,const String & rName)121*3e407bd8SArmin Le Grand XBitmapEntry::XBitmapEntry(const GraphicObject& rGraphicObject, const String& rName)
122*3e407bd8SArmin Le Grand : XPropertyEntry(rName),
123*3e407bd8SArmin Le Grand maGraphicObject(rGraphicObject)
124*3e407bd8SArmin Le Grand {
125*3e407bd8SArmin Le Grand }
126*3e407bd8SArmin Le Grand
XBitmapEntry(const XBitmapEntry & rOther)127*3e407bd8SArmin Le Grand XBitmapEntry::XBitmapEntry(const XBitmapEntry& rOther)
128*3e407bd8SArmin Le Grand : XPropertyEntry(rOther),
129*3e407bd8SArmin Le Grand maGraphicObject(rOther.maGraphicObject)
130*3e407bd8SArmin Le Grand {
131*3e407bd8SArmin Le Grand }
132*3e407bd8SArmin Le Grand
133*3e407bd8SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
134cdf0e10cSrcweir // class XPropertyList
135cdf0e10cSrcweir
XPropertyList(const String & rPath)136c7be74b1SArmin Le Grand XPropertyList::XPropertyList( const String& rPath ) :
13797e8a929SArmin Le Grand maName ( pszStandard, 8 ),
13897e8a929SArmin Le Grand maPath ( rPath ),
139c7be74b1SArmin Le Grand maContent(),
14097e8a929SArmin Le Grand mbListDirty (true)
141cdf0e10cSrcweir {
142cdf0e10cSrcweir }
143cdf0e10cSrcweir
~XPropertyList()144cdf0e10cSrcweir XPropertyList::~XPropertyList()
145cdf0e10cSrcweir {
146c7be74b1SArmin Le Grand while(!maContent.empty())
147c7be74b1SArmin Le Grand {
148c7be74b1SArmin Le Grand delete maContent.back();
149c7be74b1SArmin Le Grand maContent.pop_back();
150c7be74b1SArmin Le Grand }
151cdf0e10cSrcweir }
152cdf0e10cSrcweir
Clear()153cdf0e10cSrcweir void XPropertyList::Clear()
154cdf0e10cSrcweir {
155c7be74b1SArmin Le Grand while(!maContent.empty())
156c7be74b1SArmin Le Grand {
157c7be74b1SArmin Le Grand delete maContent.back();
158c7be74b1SArmin Le Grand maContent.pop_back();
159c7be74b1SArmin Le Grand }
160cdf0e10cSrcweir }
161cdf0e10cSrcweir
Count() const162cdf0e10cSrcweir long XPropertyList::Count() const
163cdf0e10cSrcweir {
1646e1a87e1SArmin Le Grand if( mbListDirty )
1656e1a87e1SArmin Le Grand {
1666e1a87e1SArmin Le Grand if(!const_cast< XPropertyList* >(this)->Load())
1676e1a87e1SArmin Le Grand {
1686e1a87e1SArmin Le Grand const_cast< XPropertyList* >(this)->Create();
1696e1a87e1SArmin Le Grand }
1706e1a87e1SArmin Le Grand }
171c7be74b1SArmin Le Grand
172c7be74b1SArmin Le Grand return maContent.size();
173cdf0e10cSrcweir }
174cdf0e10cSrcweir
Get(long nIndex) const175c7be74b1SArmin Le Grand XPropertyEntry* XPropertyList::Get( long nIndex ) const
176cdf0e10cSrcweir {
177c7be74b1SArmin Le Grand if( mbListDirty )
178c7be74b1SArmin Le Grand {
1796e1a87e1SArmin Le Grand if(!const_cast< XPropertyList* >(this)->Load())
1806e1a87e1SArmin Le Grand {
1816e1a87e1SArmin Le Grand const_cast< XPropertyList* >(this)->Create();
1826e1a87e1SArmin Le Grand }
183c7be74b1SArmin Le Grand }
184c7be74b1SArmin Le Grand
1856e1a87e1SArmin Le Grand const long nObjectCount(maContent.size());
1866e1a87e1SArmin Le Grand
1876e1a87e1SArmin Le Grand if(nIndex >= nObjectCount)
188c7be74b1SArmin Le Grand {
189c7be74b1SArmin Le Grand return 0;
190c7be74b1SArmin Le Grand }
191c7be74b1SArmin Le Grand
192c7be74b1SArmin Le Grand return maContent[nIndex];
193cdf0e10cSrcweir }
194cdf0e10cSrcweir
GetIndex(const XubString & rName) const195c7be74b1SArmin Le Grand long XPropertyList::GetIndex(const XubString& rName) const
196cdf0e10cSrcweir {
197c7be74b1SArmin Le Grand if( mbListDirty )
198c7be74b1SArmin Le Grand {
1996e1a87e1SArmin Le Grand if(!const_cast< XPropertyList* >(this)->Load())
2006e1a87e1SArmin Le Grand {
2016e1a87e1SArmin Le Grand const_cast< XPropertyList* >(this)->Create();
2026e1a87e1SArmin Le Grand }
203c7be74b1SArmin Le Grand }
204c7be74b1SArmin Le Grand
205c7be74b1SArmin Le Grand ::std::vector< XPropertyEntry* >::const_iterator aStart(maContent.begin());
206c7be74b1SArmin Le Grand const ::std::vector< XPropertyEntry* >::const_iterator aEnd(maContent.end());
207c7be74b1SArmin Le Grand
208c7be74b1SArmin Le Grand for(long a(0); aStart != aEnd; a++, aStart++)
209c7be74b1SArmin Le Grand {
210c7be74b1SArmin Le Grand const XPropertyEntry* pEntry = *aStart;
211c7be74b1SArmin Le Grand
212c7be74b1SArmin Le Grand if(pEntry && pEntry->GetName() == rName)
213c7be74b1SArmin Le Grand {
214c7be74b1SArmin Le Grand return a;
215c7be74b1SArmin Le Grand }
216c7be74b1SArmin Le Grand }
217c7be74b1SArmin Le Grand
218c7be74b1SArmin Le Grand return -1;
219cdf0e10cSrcweir }
220cdf0e10cSrcweir
GetUiBitmap(long nIndex) const22197e8a929SArmin Le Grand Bitmap XPropertyList::GetUiBitmap( long nIndex ) const
222cdf0e10cSrcweir {
22397e8a929SArmin Le Grand Bitmap aRetval;
224c7be74b1SArmin Le Grand XPropertyEntry* pEntry = Get(nIndex);
22597e8a929SArmin Le Grand
22697e8a929SArmin Le Grand if(pEntry)
22797e8a929SArmin Le Grand {
22897e8a929SArmin Le Grand aRetval = pEntry->GetUiBitmap();
22997e8a929SArmin Le Grand
23097e8a929SArmin Le Grand if(aRetval.IsEmpty())
23197e8a929SArmin Le Grand {
23297e8a929SArmin Le Grand aRetval = const_cast< XPropertyList* >(this)->CreateBitmapForUI(nIndex);
23397e8a929SArmin Le Grand pEntry->SetUiBitmap(aRetval);
23497e8a929SArmin Le Grand }
23597e8a929SArmin Le Grand }
23697e8a929SArmin Le Grand
237c7be74b1SArmin Le Grand return aRetval;
238cdf0e10cSrcweir }
239cdf0e10cSrcweir
Insert(XPropertyEntry * pEntry,long nIndex)240cdf0e10cSrcweir void XPropertyList::Insert( XPropertyEntry* pEntry, long nIndex )
241cdf0e10cSrcweir {
242c7be74b1SArmin Le Grand if(pEntry)
243c7be74b1SArmin Le Grand {
2446e1a87e1SArmin Le Grand const long nObjectCount(maContent.size());
2456e1a87e1SArmin Le Grand
24635726d9dSArmin Le Grand if(static_cast< long >(LIST_APPEND) == nIndex || nIndex >= nObjectCount)
247c7be74b1SArmin Le Grand {
248c7be74b1SArmin Le Grand maContent.push_back(pEntry);
249c7be74b1SArmin Le Grand }
250c7be74b1SArmin Le Grand else
251c7be74b1SArmin Le Grand {
252c7be74b1SArmin Le Grand maContent.insert(maContent.begin() + nIndex, pEntry);
253c7be74b1SArmin Le Grand }
254c7be74b1SArmin Le Grand }
255cdf0e10cSrcweir }
256cdf0e10cSrcweir
Replace(XPropertyEntry * pEntry,long nIndex)257cdf0e10cSrcweir XPropertyEntry* XPropertyList::Replace( XPropertyEntry* pEntry, long nIndex )
258cdf0e10cSrcweir {
259c7be74b1SArmin Le Grand XPropertyEntry* pRetval = 0;
260c7be74b1SArmin Le Grand
261c7be74b1SArmin Le Grand if(pEntry)
262c7be74b1SArmin Le Grand {
2636e1a87e1SArmin Le Grand const long nObjectCount(maContent.size());
2646e1a87e1SArmin Le Grand
2656e1a87e1SArmin Le Grand if(nIndex < nObjectCount)
266c7be74b1SArmin Le Grand {
267c7be74b1SArmin Le Grand pRetval = maContent[nIndex];
268c7be74b1SArmin Le Grand maContent[nIndex] = pEntry;
269c7be74b1SArmin Le Grand }
270c7be74b1SArmin Le Grand }
271c7be74b1SArmin Le Grand
272c7be74b1SArmin Le Grand return pRetval;
273cdf0e10cSrcweir }
274cdf0e10cSrcweir
Remove(long nIndex)275c7be74b1SArmin Le Grand XPropertyEntry* XPropertyList::Remove( long nIndex )
276cdf0e10cSrcweir {
277c7be74b1SArmin Le Grand XPropertyEntry* pRetval = 0;
2786e1a87e1SArmin Le Grand const long nObjectCount(maContent.size());
279c7be74b1SArmin Le Grand
2806e1a87e1SArmin Le Grand if(nIndex < nObjectCount)
281c7be74b1SArmin Le Grand {
2826e1a87e1SArmin Le Grand if(nIndex + 1 == nObjectCount)
283c7be74b1SArmin Le Grand {
284c7be74b1SArmin Le Grand pRetval = maContent.back();
285c7be74b1SArmin Le Grand maContent.pop_back();
286c7be74b1SArmin Le Grand }
287c7be74b1SArmin Le Grand else
288c7be74b1SArmin Le Grand {
289c7be74b1SArmin Le Grand pRetval = maContent[nIndex];
290c7be74b1SArmin Le Grand maContent.erase(maContent.begin() + nIndex);
291c7be74b1SArmin Le Grand }
292c7be74b1SArmin Le Grand }
293c7be74b1SArmin Le Grand
294c7be74b1SArmin Le Grand return pRetval;
295cdf0e10cSrcweir }
296cdf0e10cSrcweir
SetName(const String & rString)297cdf0e10cSrcweir void XPropertyList::SetName( const String& rString )
298cdf0e10cSrcweir {
299cdf0e10cSrcweir if(rString.Len())
300cdf0e10cSrcweir {
30197e8a929SArmin Le Grand maName = rString;
302cdf0e10cSrcweir }
303cdf0e10cSrcweir }
304cdf0e10cSrcweir
305c7be74b1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
306c7be74b1SArmin Le Grand
CreateSharedXColorList(const String & rPath)307c7be74b1SArmin Le Grand XColorListSharedPtr XPropertyListFactory::CreateSharedXColorList( const String& rPath )
308c7be74b1SArmin Le Grand {
309c7be74b1SArmin Le Grand return XColorListSharedPtr(new XColorList(rPath));
310c7be74b1SArmin Le Grand }
311c7be74b1SArmin Le Grand
CreateSharedXLineEndList(const String & rPath)312c7be74b1SArmin Le Grand XLineEndListSharedPtr XPropertyListFactory::CreateSharedXLineEndList( const String& rPath )
313c7be74b1SArmin Le Grand {
314c7be74b1SArmin Le Grand return XLineEndListSharedPtr(new XLineEndList(rPath));
315c7be74b1SArmin Le Grand }
316c7be74b1SArmin Le Grand
CreateSharedXDashList(const String & rPath)317c7be74b1SArmin Le Grand XDashListSharedPtr XPropertyListFactory::CreateSharedXDashList( const String& rPath )
318c7be74b1SArmin Le Grand {
319c7be74b1SArmin Le Grand return XDashListSharedPtr(new XDashList(rPath));
320c7be74b1SArmin Le Grand }
321c7be74b1SArmin Le Grand
CreateSharedXHatchList(const String & rPath)322c7be74b1SArmin Le Grand XHatchListSharedPtr XPropertyListFactory::CreateSharedXHatchList( const String& rPath )
323c7be74b1SArmin Le Grand {
324c7be74b1SArmin Le Grand return XHatchListSharedPtr(new XHatchList(rPath));
325c7be74b1SArmin Le Grand }
326c7be74b1SArmin Le Grand
CreateSharedXGradientList(const String & rPath)327c7be74b1SArmin Le Grand XGradientListSharedPtr XPropertyListFactory::CreateSharedXGradientList( const String& rPath )
328c7be74b1SArmin Le Grand {
329c7be74b1SArmin Le Grand return XGradientListSharedPtr(new XGradientList(rPath));
330c7be74b1SArmin Le Grand }
331c7be74b1SArmin Le Grand
CreateSharedXBitmapList(const String & rPath)332c7be74b1SArmin Le Grand XBitmapListSharedPtr XPropertyListFactory::CreateSharedXBitmapList( const String& rPath )
333c7be74b1SArmin Le Grand {
334c7be74b1SArmin Le Grand return XBitmapListSharedPtr(new XBitmapList(rPath));
335c7be74b1SArmin Le Grand }
336c7be74b1SArmin Le Grand
337c7be74b1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
33897e8a929SArmin Le Grand // eof
339