fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / svx / xtable.hxx
blob9ac5b2e75287edf20e66ebdc6f46c50995349de6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _XTABLE_HXX
20 #define _XTABLE_HXX
22 #include <rtl/ref.hxx>
23 #include <svx/xpoly.hxx>
24 #include <svx/xdash.hxx>
25 #include <svx/xhatch.hxx>
26 #include <svx/xgrad.hxx>
27 #include <svx/xflasit.hxx>
28 #include <svx/xlnasit.hxx>
30 #include <tools/color.hxx>
31 #include <tools/string.hxx>
32 #include <tools/contnr.hxx>
34 #include <cppuhelper/weak.hxx>
36 #include <svx/svxdllapi.h>
37 #include <com/sun/star/embed/XStorage.hpp>
38 #include <basegfx/polygon/b2dpolypolygon.hxx>
39 #include <com/sun/star/container/XNameContainer.hpp>
40 #include <svtools/grfmgr.hxx>
41 #include <svx/XPropertyEntry.hxx>
43 class Color;
44 class Bitmap;
45 class VirtualDevice;
46 class XOutdevItemPool;
48 // Standard-Vergleichsstring
49 extern sal_Unicode pszStandard[]; // "standard"
51 // Funktion zum Konvertieren in echte RGB-Farben, da mit
52 // enum COL_NAME nicht verglichen werden kann.
53 SVX_DLLPUBLIC Color RGB_Color( ColorData nColorName );
55 // ------------------
56 // class XColorEntry
57 // ------------------
59 class XColorEntry : public XPropertyEntry
61 Color aColor;
63 public:
64 XColorEntry(const Color& rColor, const String& rName)
65 : XPropertyEntry(rName)
66 , aColor(rColor)
69 void SetColor(const Color& rColor) { aColor = rColor; }
70 const Color& GetColor() const { return aColor; }
73 // --------------------
74 // class XLineEndEntry
75 // --------------------
77 class XLineEndEntry : public XPropertyEntry
79 basegfx::B2DPolyPolygon aB2DPolyPolygon;
81 public:
82 XLineEndEntry(const basegfx::B2DPolyPolygon& rB2DPolyPolygon, const String& rName)
83 : XPropertyEntry(rName),
84 aB2DPolyPolygon(rB2DPolyPolygon)
87 void SetLineEnd(const basegfx::B2DPolyPolygon& rB2DPolyPolygon)
89 aB2DPolyPolygon = rB2DPolyPolygon;
92 const basegfx::B2DPolyPolygon& GetLineEnd() const
94 return aB2DPolyPolygon;
98 // ------------------
99 // class XDashEntry
100 // ------------------
102 class XDashEntry : public XPropertyEntry
104 XDash aDash;
106 public:
107 XDashEntry(const XDash& rDash, const String& rName) :
108 XPropertyEntry(rName), aDash(rDash) {}
110 void SetDash(const XDash& rDash) { aDash = rDash; }
111 const XDash& GetDash() const { return aDash; }
114 // ------------------
115 // class XHatchEntry
116 // ------------------
118 class XHatchEntry : public XPropertyEntry
120 XHatch aHatch;
122 public:
123 XHatchEntry(const XHatch& rHatch, const String& rName) :
124 XPropertyEntry(rName), aHatch(rHatch) {}
126 void SetHatch(const XHatch& rHatch) { aHatch = rHatch; }
127 const XHatch& GetHatch() const { return aHatch; }
130 // ---------------------
131 // class XGradientEntry
132 // ---------------------
134 class XGradientEntry : public XPropertyEntry
136 XGradient aGradient;
138 public:
139 XGradientEntry(const XGradient& rGradient, const String& rName):
140 XPropertyEntry(rName), aGradient(rGradient) {}
142 void SetGradient(const XGradient& rGrad) { aGradient = rGrad; }
143 const XGradient& GetGradient() const { return aGradient; }
146 // ---------------------
147 // class XBitmapEntry
148 // ---------------------
150 class XBitmapEntry : public XPropertyEntry
152 private:
153 GraphicObject maGraphicObject;
155 public:
156 XBitmapEntry(const GraphicObject& rGraphicObject, const String& rName)
157 : XPropertyEntry(rName),
158 maGraphicObject(rGraphicObject)
162 XBitmapEntry(const XBitmapEntry& rOther)
163 : XPropertyEntry(rOther),
164 maGraphicObject(rOther.maGraphicObject)
168 const GraphicObject& GetGraphicObject() const
170 return maGraphicObject;
173 void SetGraphicObject(const GraphicObject& rGraphicObject)
175 maGraphicObject = rGraphicObject;
179 // --------------------
180 // class XPropertyList
181 // --------------------
183 enum XPropertyListType {
184 XCOLOR_LIST,
185 XLINE_END_LIST,
186 XDASH_LIST,
187 XHATCH_LIST,
188 XGRADIENT_LIST,
189 XBITMAP_LIST,
190 XPROPERTY_LIST_COUNT
193 typedef rtl::Reference< class XPropertyList > XPropertyListRef;
195 class XDashList ; typedef rtl::Reference< class XDashList > XDashListRef;
196 class XHatchList ; typedef rtl::Reference< class XHatchList > XHatchListRef;
197 class XColorList ; typedef rtl::Reference< class XColorList > XColorListRef;
198 class XBitmapList ; typedef rtl::Reference< class XBitmapList > XBitmapListRef;
199 class XLineEndList ; typedef rtl::Reference< class XLineEndList > XLineEndListRef;
200 class XGradientList ; typedef rtl::Reference< class XGradientList > XGradientListRef;
202 class SVX_DLLPUBLIC XPropertyList : public cppu::OWeakObject
204 private:
205 SAL_DLLPRIVATE void* operator new(size_t);
206 protected:
207 SAL_DLLPRIVATE void operator delete(void *);
208 protected:
209 typedef ::std::vector< XPropertyEntry* > XPropertyEntryList_impl;
210 typedef ::std::vector< Bitmap* > BitmapList_impl;
212 XPropertyListType meType;
213 String maName; // not persistent
214 String maPath;
215 XOutdevItemPool* mpXPool;
217 XPropertyEntryList_impl maList;
219 bool mbListDirty;
220 bool mbEmbedInDocument;
222 XPropertyList( XPropertyListType t, const String& rPath,
223 XOutdevItemPool* pXPool = NULL );
225 virtual Bitmap CreateBitmapForUI( long nIndex ) = 0;
227 public:
228 virtual ~XPropertyList();
230 XPropertyListType Type() const { return meType; }
231 long Count() const;
233 void Insert( XPropertyEntry* pEntry, long nIndex = CONTAINER_APPEND );
234 XPropertyEntry* Replace( XPropertyEntry* pEntry, long nIndex );
235 XPropertyEntry* Remove( long nIndex );
237 // Note: Get(long) & Get( String& ) are ambiguous
238 XPropertyEntry* Get( long nIndex, sal_uInt16 nDummy ) const;
239 long Get(const String& rName);
240 Bitmap GetUiBitmap( long nIndex ) const;
242 const String& GetName() const { return maName; }
243 void SetName( const String& rString );
244 const String& GetPath() const { return maPath; }
245 void SetPath( const String& rString ) { maPath = rString; }
246 bool IsDirty() const { return mbListDirty; }
247 void SetDirty( bool bDirty = sal_True )
248 { mbListDirty = bDirty; }
249 bool IsEmbedInDocument() const { return mbEmbedInDocument; }
250 void SetEmbedInDocument(bool b) { mbEmbedInDocument = b; }
252 static OUString GetDefaultExt(XPropertyListType t);
253 static OUString GetDefaultExtFilter(XPropertyListType t);
254 OUString GetDefaultExt() const { return GetDefaultExt( meType ); }
256 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
257 createInstance() = 0;
258 bool Load();
259 bool LoadFrom( const ::com::sun::star::uno::Reference<
260 ::com::sun::star::embed::XStorage > &xStorage,
261 const OUString &rURL );
262 bool Save();
263 bool SaveTo ( const ::com::sun::star::uno::Reference<
264 ::com::sun::star::embed::XStorage > &xStorage,
265 const OUString &rURL,
266 OUString *pOptName );
267 virtual sal_Bool Create() = 0;
269 // Factory method for sub-classes
270 static XPropertyListRef CreatePropertyList( XPropertyListType t,
271 const String& rPath,
272 XOutdevItemPool* pXPool = NULL );
273 // as above but initializes name as expected
274 static XPropertyListRef CreatePropertyListFromURL( XPropertyListType t,
275 const OUString & rUrl,
276 XOutdevItemPool* pXPool = NULL );
278 // helper accessors
279 inline XDashListRef AsDashList();
280 inline XHatchListRef AsHatchList();
281 inline XColorListRef AsColorList();
282 inline XBitmapListRef AsBitmapList();
283 inline XLineEndListRef AsLineEndList();
284 inline XGradientListRef AsGradientList();
287 // ------------------
288 // class XColorList
289 // ------------------
291 class SVX_DLLPUBLIC XColorList : public XPropertyList
293 protected:
294 virtual Bitmap CreateBitmapForUI( long nIndex );
296 public:
297 explicit XColorList( const String& rPath,
298 XOutdevItemPool* pXInPool = NULL ) :
299 XPropertyList( XCOLOR_LIST, rPath, pXInPool ) {}
301 using XPropertyList::Replace;
302 using XPropertyList::Remove;
303 using XPropertyList::Get;
305 XColorEntry* Replace(long nIndex, XColorEntry* pEntry );
306 XColorEntry* Remove(long nIndex);
307 XColorEntry* GetColor(long nIndex) const;
308 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance();
309 virtual sal_Bool Create();
311 static XColorListRef CreateStdColorList();
312 static XColorListRef GetStdColorList(); // returns a singleton
315 // -------------------
316 // class XLineEndList
317 // -------------------
318 class impXLineEndList;
320 class SVX_DLLPUBLIC XLineEndList : public XPropertyList
322 private:
323 impXLineEndList* mpData;
325 void impCreate();
326 void impDestroy();
328 protected:
329 virtual Bitmap CreateBitmapForUI(long nIndex);
331 public:
332 explicit XLineEndList(
333 const String& rPath,
334 XOutdevItemPool* pXPool = 0
336 virtual ~XLineEndList();
338 using XPropertyList::Remove;
339 XLineEndEntry* Remove(long nIndex);
340 using XPropertyList::Get;
341 XLineEndEntry* GetLineEnd(long nIndex) const;
343 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance();
344 virtual sal_Bool Create();
347 // -------------------
348 // class XDashList
349 // -------------------
350 class impXDashList;
352 class SVX_DLLPUBLIC XDashList : public XPropertyList
354 private:
355 impXDashList* mpData;
356 Bitmap maBitmapSolidLine;
357 String maStringSolidLine;
358 String maStringNoLine;
360 void impCreate();
361 void impDestroy();
363 protected:
364 Bitmap ImpCreateBitmapForXDash(const XDash* pDash);
365 virtual Bitmap CreateBitmapForUI(long nIndex);
367 public:
368 explicit XDashList(
369 const String& rPath,
370 XOutdevItemPool* pXPool = 0
372 virtual ~XDashList();
374 using XPropertyList::Replace;
375 XDashEntry* Replace(XDashEntry* pEntry, long nIndex);
376 using XPropertyList::Remove;
377 XDashEntry* Remove(long nIndex);
378 using XPropertyList::Get;
379 XDashEntry* GetDash(long nIndex) const;
381 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance();
382 virtual sal_Bool Create();
384 // Special call to get a bitmap for the solid line representation. It
385 // creates a bitmap fitting in size and style to the ones you get by
386 // using GetUiBitmap for existing entries.
387 Bitmap GetBitmapForUISolidLine() const;
389 // Special calls to get the translated strings for the UI entry for no
390 // line style (XLINE_NONE) and solid line style (XLINE_SOLID) for dialogs
391 String GetStringForUiSolidLine() const;
392 String GetStringForUiNoLine() const;
395 // -------------------
396 // class XHatchList
397 // -------------------
398 class impXHatchList;
400 class SVX_DLLPUBLIC XHatchList : public XPropertyList
402 private:
403 impXHatchList* mpData;
405 void impCreate();
406 void impDestroy();
408 protected:
409 virtual Bitmap CreateBitmapForUI(long nIndex);
411 public:
412 explicit XHatchList( const String& rPath,
413 XOutdevItemPool* pXPool = 0 );
414 virtual ~XHatchList();
416 using XPropertyList::Replace;
417 XHatchEntry* Replace(XHatchEntry* pEntry, long nIndex);
418 using XPropertyList::Remove;
419 XHatchEntry* Remove(long nIndex);
420 using XPropertyList::Get;
421 XHatchEntry* GetHatch(long nIndex) const;
423 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance();
424 virtual sal_Bool Create();
427 // -------------------
428 // class XGradientList
429 // -------------------
430 class impXGradientList;
432 class SVX_DLLPUBLIC XGradientList : public XPropertyList
434 private:
435 impXGradientList* mpData;
437 void impCreate();
438 void impDestroy();
440 protected:
441 virtual Bitmap CreateBitmapForUI(long nIndex);
443 public:
444 explicit XGradientList(
445 const String& rPath,
446 XOutdevItemPool* pXPool = 0
448 virtual ~XGradientList();
450 using XPropertyList::Replace;
451 XGradientEntry* Replace(XGradientEntry* pEntry, long nIndex);
452 using XPropertyList::Remove;
453 XGradientEntry* Remove(long nIndex);
454 using XPropertyList::Get;
455 XGradientEntry* GetGradient(long nIndex) const;
457 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance();
458 virtual sal_Bool Create();
461 // -------------------
462 // class XBitmapList
463 // -------------------
465 class SVX_DLLPUBLIC XBitmapList : public XPropertyList
467 protected:
468 virtual Bitmap CreateBitmapForUI( long nIndex );
470 public:
471 explicit XBitmapList( const String& rPath,
472 XOutdevItemPool* pXInPool = NULL )
473 : XPropertyList( XBITMAP_LIST, rPath, pXInPool ) {}
475 using XPropertyList::Replace;
476 using XPropertyList::Remove;
477 XBitmapEntry* Remove(long nIndex);
478 using XPropertyList::Get;
479 XBitmapEntry* GetBitmap(long nIndex) const;
481 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance();
482 virtual sal_Bool Create();
486 // FIXME: could add type checking too ...
487 inline XDashListRef XPropertyList::AsDashList() { return XDashListRef( static_cast<XDashList *> (this) ); }
488 inline XHatchListRef XPropertyList::AsHatchList() { return XHatchListRef( static_cast<XHatchList *> (this) ); }
489 inline XColorListRef XPropertyList::AsColorList() { return XColorListRef( static_cast<XColorList *> (this) ); }
490 inline XBitmapListRef XPropertyList::AsBitmapList() { return XBitmapListRef( static_cast<XBitmapList *> (this) ); }
491 inline XLineEndListRef XPropertyList::AsLineEndList() { return XLineEndListRef( static_cast<XLineEndList *> (this) ); }
492 inline XGradientListRef XPropertyList::AsGradientList() { return XGradientListRef( static_cast<XGradientList *> (this) ); }
494 #endif // _XTABLE_HXX
496 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */