1f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
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
10cdf0e10cSrcweir *
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.
19cdf0e10cSrcweir *
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
31*c1114679SMechtilde // reference strings
32cdf0e10cSrcweir sal_Unicode __FAR_DATA pszStandard[] = { 's', 't', 'a', 'n', 'd', 'a', 'r', 'd', 0 };
33cdf0e10cSrcweir
34*c1114679SMechtilde // Convert to real RGB colors, so that you can
35*c1114679SMechtilde // at last select correctly in the listboxes.
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
433e407bd8SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
443e407bd8SArmin Le Grand // class XColorEntry
453e407bd8SArmin Le Grand
XColorEntry(const Color & rColor,const String & rName)463e407bd8SArmin Le Grand XColorEntry::XColorEntry(const Color& rColor, const String& rName)
473e407bd8SArmin Le Grand : XPropertyEntry(rName),
483e407bd8SArmin Le Grand aColor(rColor)
493e407bd8SArmin Le Grand {
503e407bd8SArmin Le Grand }
513e407bd8SArmin Le Grand
XColorEntry(const XColorEntry & rOther)523e407bd8SArmin Le Grand XColorEntry::XColorEntry(const XColorEntry& rOther)
533e407bd8SArmin Le Grand : XPropertyEntry(rOther),
543e407bd8SArmin Le Grand aColor(rOther.aColor)
553e407bd8SArmin Le Grand {
563e407bd8SArmin Le Grand }
573e407bd8SArmin Le Grand
583e407bd8SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
593e407bd8SArmin Le Grand // class XLineEndEntry
603e407bd8SArmin Le Grand
XLineEndEntry(const basegfx::B2DPolyPolygon & rB2DPolyPolygon,const String & rName)613e407bd8SArmin Le Grand XLineEndEntry::XLineEndEntry(const basegfx::B2DPolyPolygon& rB2DPolyPolygon, const String& rName)
623e407bd8SArmin Le Grand : XPropertyEntry(rName),
633e407bd8SArmin Le Grand aB2DPolyPolygon(rB2DPolyPolygon)
643e407bd8SArmin Le Grand {
653e407bd8SArmin Le Grand }
663e407bd8SArmin Le Grand
XLineEndEntry(const XLineEndEntry & rOther)673e407bd8SArmin Le Grand XLineEndEntry::XLineEndEntry(const XLineEndEntry& rOther)
683e407bd8SArmin Le Grand : XPropertyEntry(rOther),
693e407bd8SArmin Le Grand aB2DPolyPolygon(rOther.aB2DPolyPolygon)
703e407bd8SArmin Le Grand {
713e407bd8SArmin Le Grand }
723e407bd8SArmin Le Grand
733e407bd8SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
743e407bd8SArmin Le Grand // class XDashEntry
753e407bd8SArmin Le Grand
XDashEntry(const XDash & rDash,const String & rName)763e407bd8SArmin Le Grand XDashEntry::XDashEntry(const XDash& rDash, const String& rName)
773e407bd8SArmin Le Grand : XPropertyEntry(rName),
783e407bd8SArmin Le Grand aDash(rDash)
793e407bd8SArmin Le Grand {
803e407bd8SArmin Le Grand }
813e407bd8SArmin Le Grand
XDashEntry(const XDashEntry & rOther)823e407bd8SArmin Le Grand XDashEntry::XDashEntry(const XDashEntry& rOther)
833e407bd8SArmin Le Grand : XPropertyEntry(rOther),
843e407bd8SArmin Le Grand aDash(rOther.aDash)
853e407bd8SArmin Le Grand {
863e407bd8SArmin Le Grand }
873e407bd8SArmin Le Grand
883e407bd8SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
893e407bd8SArmin Le Grand // class XHatchEntry
903e407bd8SArmin Le Grand
XHatchEntry(const XHatch & rHatch,const String & rName)913e407bd8SArmin Le Grand XHatchEntry::XHatchEntry(const XHatch& rHatch, const String& rName)
923e407bd8SArmin Le Grand : XPropertyEntry(rName),
933e407bd8SArmin Le Grand aHatch(rHatch)
943e407bd8SArmin Le Grand {
953e407bd8SArmin Le Grand }
963e407bd8SArmin Le Grand
XHatchEntry(const XHatchEntry & rOther)973e407bd8SArmin Le Grand XHatchEntry::XHatchEntry(const XHatchEntry& rOther)
983e407bd8SArmin Le Grand : XPropertyEntry(rOther),
993e407bd8SArmin Le Grand aHatch(rOther.aHatch)
1003e407bd8SArmin Le Grand {
1013e407bd8SArmin Le Grand }
1023e407bd8SArmin Le Grand
1033e407bd8SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
1043e407bd8SArmin Le Grand // class XGradientEntry
1053e407bd8SArmin Le Grand
XGradientEntry(const XGradient & rGradient,const String & rName)1063e407bd8SArmin Le Grand XGradientEntry::XGradientEntry(const XGradient& rGradient, const String& rName)
1073e407bd8SArmin Le Grand : XPropertyEntry(rName),
1083e407bd8SArmin Le Grand aGradient(rGradient)
1093e407bd8SArmin Le Grand {
1103e407bd8SArmin Le Grand }
1113e407bd8SArmin Le Grand
XGradientEntry(const XGradientEntry & rOther)1123e407bd8SArmin Le Grand XGradientEntry::XGradientEntry(const XGradientEntry& rOther)
1133e407bd8SArmin Le Grand : XPropertyEntry(rOther),
1143e407bd8SArmin Le Grand aGradient(rOther.aGradient)
1153e407bd8SArmin Le Grand {
1163e407bd8SArmin Le Grand }
1173e407bd8SArmin Le Grand
1183e407bd8SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
1193e407bd8SArmin Le Grand // class XBitmapEntry
1203e407bd8SArmin Le Grand
XBitmapEntry(const GraphicObject & rGraphicObject,const String & rName)1213e407bd8SArmin Le Grand XBitmapEntry::XBitmapEntry(const GraphicObject& rGraphicObject, const String& rName)
1223e407bd8SArmin Le Grand : XPropertyEntry(rName),
1233e407bd8SArmin Le Grand maGraphicObject(rGraphicObject)
1243e407bd8SArmin Le Grand {
1253e407bd8SArmin Le Grand }
1263e407bd8SArmin Le Grand
XBitmapEntry(const XBitmapEntry & rOther)1273e407bd8SArmin Le Grand XBitmapEntry::XBitmapEntry(const XBitmapEntry& rOther)
1283e407bd8SArmin Le Grand : XPropertyEntry(rOther),
1293e407bd8SArmin Le Grand maGraphicObject(rOther.maGraphicObject)
1303e407bd8SArmin Le Grand {
1313e407bd8SArmin Le Grand }
1323e407bd8SArmin Le Grand
1333e407bd8SArmin 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())
147cdf0e10cSrcweir {
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 {
16497e8a929SArmin Le Grand if( mbListDirty )
165cdf0e10cSrcweir {
1666e1a87e1SArmin Le Grand if(!const_cast< XPropertyList* >(this)->Load())
1676e1a87e1SArmin Le Grand {
1686e1a87e1SArmin Le Grand const_cast< XPropertyList* >(this)->Create();
1696e1a87e1SArmin Le Grand }
170cdf0e10cSrcweir }
171c7be74b1SArmin Le Grand
172c7be74b1SArmin Le Grand return maContent.size();
173cdf0e10cSrcweir }
174cdf0e10cSrcweir
Get(long nIndex) const175c7be74b1SArmin Le Grand XPropertyEntry* XPropertyList::Get( long nIndex ) const
176cdf0e10cSrcweir {
17797e8a929SArmin Le Grand if( mbListDirty )
178cdf0e10cSrcweir {
1796e1a87e1SArmin Le Grand if(!const_cast< XPropertyList* >(this)->Load())
1806e1a87e1SArmin Le Grand {
1816e1a87e1SArmin Le Grand const_cast< XPropertyList* >(this)->Create();
1826e1a87e1SArmin Le Grand }
183cdf0e10cSrcweir }
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 {
19797e8a929SArmin Le Grand if( mbListDirty )
198cdf0e10cSrcweir {
1996e1a87e1SArmin Le Grand if(!const_cast< XPropertyList* >(this)->Load())
2006e1a87e1SArmin Le Grand {
2016e1a87e1SArmin Le Grand const_cast< XPropertyList* >(this)->Create();
2026e1a87e1SArmin Le Grand }
203cdf0e10cSrcweir }
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++)
209cdf0e10cSrcweir {
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;
215cdf0e10cSrcweir }
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)
227cdf0e10cSrcweir {
22897e8a929SArmin Le Grand aRetval = pEntry->GetUiBitmap();
22997e8a929SArmin Le Grand
23097e8a929SArmin Le Grand if(aRetval.IsEmpty())
231cdf0e10cSrcweir {
23297e8a929SArmin Le Grand aRetval = const_cast< XPropertyList* >(this)->CreateBitmapForUI(nIndex);
23397e8a929SArmin Le Grand pEntry->SetUiBitmap(aRetval);
234cdf0e10cSrcweir }
235cdf0e10cSrcweir }
23697e8a929SArmin Le Grand
23797e8a929SArmin 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
24667abfbd7SPavel Janík 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