bump product version to 4.1.6.2
[LibreOffice.git] / include / svx / dlgctrl.hxx
bloba3c56cec39ec4f390389d7367f0d7bf2926ae79a
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 _SVX_DLG_CTRL_HXX
20 #define _SVX_DLG_CTRL_HXX
22 #include <svtools/ctrlbox.hxx>
23 #include <sfx2/tabdlg.hxx>
24 #include "svx/svxdllapi.h"
25 #include <svx/rectenum.hxx>
26 #include <vcl/graph.hxx>
27 #include <svx/xtable.hxx>
29 class XOBitmap;
30 class XOutdevItemPool;
32 namespace com { namespace sun { namespace star { namespace awt {
33 struct Point;
34 } } } }
36 /*************************************************************************
37 |* Derived from SfxTabPage for being able to get notified through the
38 |* virtual method from the control.
39 \************************************************************************/
41 class SvxTabPage : public SfxTabPage
44 public:
45 SvxTabPage(Window* pParent, ResId Id, const SfxItemSet& rInAttrs)
46 : SfxTabPage(pParent, Id, rInAttrs)
49 SvxTabPage(Window *pParent, const OString& rID, const OUString& rUIXMLDescription, const SfxItemSet &rAttrSet)
50 : SfxTabPage(pParent, rID, rUIXMLDescription, rAttrSet)
53 virtual void PointChanged( Window* pWindow, RECT_POINT eRP ) = 0;
56 /*************************************************************************
57 |* Control for display and selection of the corner and center points of
58 |* an object
59 \************************************************************************/
61 typedef sal_uInt16 CTL_STATE;
62 #define CS_NOHORZ 1 // no horizontal input information is used
63 #define CS_NOVERT 2 // no vertikal input information is used
65 class SvxRectCtlAccessibleContext;
67 class SVX_DLLPUBLIC SvxRectCtl : public Control
69 private:
70 SVX_DLLPRIVATE void InitSettings( sal_Bool bForeground, sal_Bool bBackground );
71 SVX_DLLPRIVATE void InitRectBitmap( void );
72 SVX_DLLPRIVATE Bitmap& GetRectBitmap( void );
73 SVX_DLLPRIVATE void Resize_Impl();
75 protected:
76 SvxRectCtlAccessibleContext* pAccContext;
77 sal_uInt16 nBorderWidth;
78 sal_uInt16 nRadius;
79 Size aSize;
80 Point aPtLT, aPtMT, aPtRT;
81 Point aPtLM, aPtMM, aPtRM;
82 Point aPtLB, aPtMB, aPtRB;
83 Point aPtNew;
84 RECT_POINT eRP, eDefRP;
85 CTL_STYLE eCS;
86 Bitmap* pBitmap;
87 CTL_STATE m_nState;
89 sal_Bool mbCompleteDisable;
91 RECT_POINT GetRPFromPoint( Point ) const;
92 Point GetPointFromRP( RECT_POINT ) const;
93 void SetFocusRect( const Rectangle* pRect = NULL ); // pRect == NULL -> calculate rectangle in method
94 Point SetActualRPWithoutInvalidate( RECT_POINT eNewRP ); // returns the last point
96 virtual void GetFocus();
97 virtual void LoseFocus();
99 Point GetApproxLogPtFromPixPt( const Point& rRoughPixelPoint ) const;
100 public:
101 SvxRectCtl( Window* pParent, const ResId& rResId, RECT_POINT eRpt = RP_MM,
102 sal_uInt16 nBorder = 200, sal_uInt16 nCircle = 80, CTL_STYLE eStyle = CS_RECT );
103 SvxRectCtl( Window* pParent, RECT_POINT eRpt = RP_MM,
104 sal_uInt16 nBorder = 200, sal_uInt16 nCircle = 80, CTL_STYLE eStyle = CS_RECT );
105 virtual ~SvxRectCtl();
107 virtual void Paint( const Rectangle& rRect );
108 virtual void MouseButtonDown( const MouseEvent& rMEvt );
109 virtual void KeyInput( const KeyEvent& rKeyEvt );
110 virtual void StateChanged( StateChangedType nStateChange );
111 virtual void DataChanged( const DataChangedEvent& rDCEvt );
112 virtual void Resize();
114 void Reset();
115 RECT_POINT GetActualRP() const;
116 void SetActualRP( RECT_POINT eNewRP );
118 void SetState( CTL_STATE nState );
120 sal_uInt8 GetNumOfChildren( void ) const; // returns number of usable radio buttons
122 Rectangle CalculateFocusRectangle( void ) const;
123 Rectangle CalculateFocusRectangle( RECT_POINT eRectPoint ) const;
125 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
127 RECT_POINT GetApproxRPFromPixPt( const ::com::sun::star::awt::Point& rPixelPoint ) const;
129 sal_Bool IsCompletelyDisabled() const { return mbCompleteDisable; }
130 void DoCompletelyDisable(sal_Bool bNew);
133 /*************************************************************************
134 |* Preview control for the display of bitmaps
135 \************************************************************************/
137 class SVX_DLLPUBLIC SvxBitmapCtl
139 protected:
140 Size aSize;
141 sal_uInt16 nLines;
142 Color aPixelColor, aBackgroundColor;
143 const sal_uInt16* pBmpArray;
145 public:
146 SvxBitmapCtl( Window* pParent, const Size& rSize );
147 ~SvxBitmapCtl();
149 BitmapEx GetBitmapEx();
151 void SetBmpArray( const sal_uInt16* pPixel ) { pBmpArray = pPixel; }
152 void SetLines( sal_uInt16 nLns ) { nLines = nLns; }
153 void SetPixelColor( Color aColor ) { aPixelColor = aColor; }
154 void SetBackgroundColor( Color aColor ) { aBackgroundColor = aColor; }
157 /*************************************************************************
158 |* Control for editing bitmaps
159 \************************************************************************/
161 class SVX_DLLPUBLIC SvxPixelCtl : public Control
163 private:
164 using OutputDevice::SetLineColor;
166 protected:
167 sal_uInt16 nLines, nSquares;
168 Color aPixelColor;
169 Color aBackgroundColor;
170 Color aLineColor;
171 Size aRectSize;
172 sal_uInt16* pPixel;
173 sal_Bool bPaintable;
175 void ChangePixel( sal_uInt16 nPixel );
177 public:
178 SvxPixelCtl( Window* pParent, const ResId& rResId,
179 sal_uInt16 nNumber = 8 );
180 ~SvxPixelCtl();
182 virtual void Paint( const Rectangle& rRect );
183 virtual void MouseButtonDown( const MouseEvent& rMEvt );
185 void SetXBitmap( const BitmapEx& rBitmapEx );
187 void SetPixelColor( const Color& rCol ) { aPixelColor = rCol; }
188 void SetBackgroundColor( const Color& rCol ) { aBackgroundColor = rCol; }
189 void SetLineColor( const Color& rCol ) { aLineColor = rCol; }
191 sal_uInt16 GetLineCount() const { return nLines; }
192 Color GetPixelColor() const { return aPixelColor; }
193 Color GetBackgroundColor() const { return aBackgroundColor; }
195 sal_uInt16* GetBitmapPixelPtr() { return pPixel; }
197 void SetPaintable( sal_Bool bTmp ) { bPaintable = bTmp; }
198 void Reset();
201 /************************************************************************/
203 class SVX_DLLPUBLIC ColorLB : public ColorListBox
206 public:
207 ColorLB( Window* pParent, ResId Id ) : ColorListBox( pParent, Id ) {}
208 ColorLB( Window* pParent, WinBits aWB ) : ColorListBox( pParent, aWB ) {}
210 virtual void Fill( const XColorListRef &pTab );
212 void Append( XColorEntry* pEntry, Bitmap* pBmp = NULL );
213 void Modify( XColorEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL );
216 /************************************************************************/
218 class SVX_DLLPUBLIC HatchingLB : public ListBox
220 XHatchListRef mpList;
221 public:
222 explicit HatchingLB(Window* pParent, ResId Id);
224 virtual void Fill( const XHatchListRef &pList );
226 void Append( XHatchEntry* pEntry, Bitmap* pBmp = NULL );
227 void Modify( XHatchEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL );
230 /************************************************************************/
232 class SVX_DLLPUBLIC GradientLB : public ListBox
234 XGradientListRef mpList;
235 public:
236 explicit GradientLB(Window* pParent, ResId Id);
237 explicit GradientLB(Window* pParent, WinBits aWB);
239 virtual void Fill( const XGradientListRef &pList );
241 void Append( XGradientEntry* pEntry, Bitmap* pBmp = NULL );
242 void Modify( XGradientEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL );
243 void SelectEntryByList( const XGradientListRef &pList, const String& rStr,
244 const XGradient& rXGradient, sal_uInt16 nDist = 0 );
247 /************************************************************************/
249 class SVX_DLLPUBLIC BitmapLB : public ListBox
251 public:
252 explicit BitmapLB(Window* pParent, ResId Id);
254 virtual void Fill(const XBitmapListRef &pList);
256 void Append(const Size& rSize, const XBitmapEntry& rEntry, BitmapEx* pBmpEx = 0);
257 void Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_uInt16 nPos, BitmapEx* pBmpEx = 0);
258 void SelectEntryByList(const XBitmapList* pList, const String& rStr);
260 private:
261 BitmapEx maBitmapEx;
263 XBitmapListRef mpList;
266 /************************************************************************/
268 class FillAttrLB : public ColorListBox
270 private:
271 BitmapEx maBitmapEx;
273 public:
274 FillAttrLB( Window* pParent, WinBits aWB );
276 virtual void Fill( const XColorListRef &pList );
277 virtual void Fill( const XHatchListRef &pList );
278 virtual void Fill( const XGradientListRef &pList );
279 virtual void Fill( const XBitmapListRef &pList );
282 /************************************************************************/
284 class FillTypeLB : public ListBox
287 public:
288 FillTypeLB( Window* pParent, ResId Id ) : ListBox( pParent, Id ) {}
289 FillTypeLB( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {}
291 virtual void Fill();
294 /************************************************************************/
296 class SVX_DLLPUBLIC LineLB : public ListBox
298 private:
299 /// bitfield
300 /// defines if standard fields (none, solid) are added, default is true
301 bool mbAddStandardFields : 1;
303 public:
304 LineLB(Window* pParent, ResId Id);
305 LineLB(Window* pParent, WinBits aWB);
306 virtual ~LineLB();
308 virtual void Fill(const XDashListRef &pList);
309 bool getAddStandardFields() const { return mbAddStandardFields; }
310 void setAddStandardFields(bool bNew);
312 void Append(XDashEntry* pEntry, const Bitmap* pBmp = 0);
313 void Modify(XDashEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp = 0);
314 void SelectEntryByList(const XDashList* pList, const String& rStr, const XDash& rDash, sal_uInt16 nDist = 0);
317 /************************************************************************/
319 class SVX_DLLPUBLIC LineEndLB : public ListBox
322 public:
323 LineEndLB( Window* pParent, ResId Id );
324 LineEndLB( Window* pParent, WinBits aWB );
325 virtual ~LineEndLB (void);
327 virtual void Fill( const XLineEndListRef &pList, sal_Bool bStart = sal_True );
329 void Append( XLineEndEntry* pEntry, const Bitmap* pBmp = NULL,
330 sal_Bool bStart = sal_True );
331 void Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp = NULL,
332 sal_Bool bStart = sal_True );
335 //////////////////////////////////////////////////////////////////////////////
337 class SdrObject;
338 class SdrModel;
340 class SvxPreviewBase : public Control
342 private:
343 SdrModel* mpModel;
344 VirtualDevice* mpBufferDevice;
346 protected:
347 void InitSettings(bool bForeground, bool bBackground);
349 // prepare buffered paint
350 void LocalPrePaint();
352 // end and output buffered paint
353 void LocalPostPaint();
355 public:
356 SvxPreviewBase(Window* pParent, const ResId& rResId);
357 SvxPreviewBase(Window* pParent);
358 virtual ~SvxPreviewBase();
360 // change support
361 virtual void StateChanged(StateChangedType nStateChange);
362 virtual void DataChanged(const DataChangedEvent& rDCEvt);
364 // dada read access
365 SdrModel& getModel() const { return *mpModel; }
366 OutputDevice& getBufferDevice() const { return *mpBufferDevice; }
369 /*************************************************************************
371 |* SvxLinePreview
373 \************************************************************************/
375 class SVX_DLLPUBLIC SvxXLinePreview : public SvxPreviewBase
377 private:
378 SdrObject* mpLineObjA;
379 SdrObject* mpLineObjB;
380 SdrObject* mpLineObjC;
382 Graphic* mpGraphic;
383 sal_Bool mbWithSymbol;
384 Size maSymbolSize;
386 public:
387 SvxXLinePreview( Window* pParent, const ResId& rResId );
388 virtual ~SvxXLinePreview();
390 void SetLineAttributes(const SfxItemSet& rItemSet);
392 void ShowSymbol( sal_Bool b ) { mbWithSymbol = b; };
393 void SetSymbol( Graphic* p, const Size& s );
394 void ResizeSymbol( const Size& s );
396 virtual void Paint( const Rectangle& rRect );
399 /*************************************************************************
401 |* SvxXRectPreview
403 \************************************************************************/
405 class SVX_DLLPUBLIC SvxXRectPreview : public SvxPreviewBase
407 private:
408 SdrObject* mpRectangleObject;
410 public:
411 SvxXRectPreview(Window* pParent, const ResId& rResId);
412 SvxXRectPreview(Window* pParent);
413 virtual ~SvxXRectPreview();
415 void SetAttributes(const SfxItemSet& rItemSet);
417 virtual void Paint( const Rectangle& rRect );
418 virtual void Resize();
421 /*************************************************************************
423 |* SvxXShadowPreview
425 \************************************************************************/
427 class SVX_DLLPUBLIC SvxXShadowPreview : public SvxPreviewBase
429 private:
430 SdrObject* mpRectangleObject;
431 SdrObject* mpRectangleShadow;
433 public:
434 SvxXShadowPreview( Window* pParent, const ResId& rResId );
435 virtual ~SvxXShadowPreview();
437 void SetRectangleAttributes(const SfxItemSet& rItemSet);
438 void SetShadowAttributes(const SfxItemSet& rItemSet);
439 void SetShadowPosition(const Point& rPos);
441 virtual void Paint( const Rectangle& rRect );
444 #endif // _SVX_DLG_CTRL_HXX
446 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */