LCOV - code coverage report
Current view: top level - libreoffice/svx/inc/svx - dlgctrl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 19 0.0 %
Date: 2012-12-27 Functions: 0 28 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : #ifndef _SVX_DLG_CTRL_HXX
      20             : #define _SVX_DLG_CTRL_HXX
      21             : 
      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>
      28             : 
      29             : class XOBitmap;
      30             : class XOutdevItemPool;
      31             : 
      32             : namespace com { namespace sun { namespace star { namespace awt {
      33             :     struct Point;
      34             : } } } }
      35             : 
      36             : /*************************************************************************
      37             : |* Derived from SfxTabPage for being able to get notified through the
      38             : |* virtual method from the control.
      39             : \************************************************************************/
      40             : 
      41           0 : class SvxTabPage : public SfxTabPage
      42             : {
      43             : 
      44             : public:
      45             :     SvxTabPage( Window* pParent, ResId Id, const SfxItemSet& rInAttrs  ) :
      46             :         SfxTabPage( pParent, Id, rInAttrs ) {}
      47             : 
      48             :     virtual void PointChanged( Window* pWindow, RECT_POINT eRP ) = 0;
      49             : };
      50             : 
      51             : /*************************************************************************
      52             : |* Control for display and selection of the corner and center points of
      53             : |* an object
      54             : \************************************************************************/
      55             : 
      56             : typedef sal_uInt16 CTL_STATE;
      57             : #define CS_NOHORZ   1       // no horizontal input information is used
      58             : #define CS_NOVERT   2       // no vertikal input information is used
      59             : 
      60             : class SvxRectCtlAccessibleContext;
      61             : 
      62             : class SVX_DLLPUBLIC SvxRectCtl : public Control
      63             : {
      64             : private:
      65             :     SVX_DLLPRIVATE void             InitSettings( sal_Bool bForeground, sal_Bool bBackground );
      66             :     SVX_DLLPRIVATE void             InitRectBitmap( void );
      67             :     SVX_DLLPRIVATE Bitmap&          GetRectBitmap( void );
      68             :     SVX_DLLPRIVATE void             Resize_Impl();
      69             : 
      70             : protected:
      71             :     SvxRectCtlAccessibleContext*    pAccContext;
      72             :     sal_uInt16                          nBorderWidth;
      73             :     sal_uInt16                          nRadius;
      74             :     Size                            aSize;
      75             :     Point                           aPtLT, aPtMT, aPtRT;
      76             :     Point                           aPtLM, aPtMM, aPtRM;
      77             :     Point                           aPtLB, aPtMB, aPtRB;
      78             :     Point                           aPtNew;
      79             :     RECT_POINT                      eRP, eDefRP;
      80             :     CTL_STYLE                       eCS;
      81             :     Bitmap*                         pBitmap;
      82             :     CTL_STATE                       m_nState;
      83             : 
      84             :     sal_Bool                        mbCompleteDisable;
      85             : 
      86             :     RECT_POINT          GetRPFromPoint( Point ) const;
      87             :     Point               GetPointFromRP( RECT_POINT ) const;
      88             :     void                SetFocusRect( const Rectangle* pRect = NULL );      // pRect == NULL -> calculate rectangle in method
      89             :     Point               SetActualRPWithoutInvalidate( RECT_POINT eNewRP );  // returns the last point
      90             : 
      91             :     virtual void        GetFocus();
      92             :     virtual void        LoseFocus();
      93             : 
      94             :     Point               GetApproxLogPtFromPixPt( const Point& rRoughPixelPoint ) const;
      95             : public:
      96             :     SvxRectCtl( Window* pParent, const ResId& rResId, RECT_POINT eRpt = RP_MM,
      97             :                 sal_uInt16 nBorder = 200, sal_uInt16 nCircle = 80, CTL_STYLE eStyle = CS_RECT );
      98             :     virtual ~SvxRectCtl();
      99             : 
     100             :     virtual void        Paint( const Rectangle& rRect );
     101             :     virtual void        MouseButtonDown( const MouseEvent& rMEvt );
     102             :     virtual void        KeyInput( const KeyEvent& rKeyEvt );
     103             :     virtual void        StateChanged( StateChangedType nStateChange );
     104             :     virtual void        DataChanged( const DataChangedEvent& rDCEvt );
     105             :     virtual void        Resize();
     106             : 
     107             :     void                Reset();
     108             :     RECT_POINT          GetActualRP() const;
     109             :     void                SetActualRP( RECT_POINT eNewRP );
     110             : 
     111             :     void                SetState( CTL_STATE nState );
     112             : 
     113             :     sal_uInt8               GetNumOfChildren( void ) const;   // returns number of usable radio buttons
     114             : 
     115             :     Rectangle           CalculateFocusRectangle( void ) const;
     116             :     Rectangle           CalculateFocusRectangle( RECT_POINT eRectPoint ) const;
     117             : 
     118             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
     119             : 
     120             :     RECT_POINT          GetApproxRPFromPixPt( const ::com::sun::star::awt::Point& rPixelPoint ) const;
     121             : 
     122           0 :     sal_Bool IsCompletelyDisabled() const { return mbCompleteDisable; }
     123             :     void DoCompletelyDisable(sal_Bool bNew);
     124             : };
     125             : 
     126             : /*************************************************************************
     127             : |* Preview control for the display of bitmaps
     128             : \************************************************************************/
     129             : 
     130             : class SVX_DLLPUBLIC SvxBitmapCtl
     131             : {
     132             : protected:
     133             :     Size            aSize;
     134             :     sal_uInt16          nLines;
     135             :     Color           aPixelColor, aBackgroundColor;
     136             :     const sal_uInt16*   pBmpArray;
     137             : 
     138             : public:
     139             :             SvxBitmapCtl( Window* pParent, const Size& rSize );
     140             :             ~SvxBitmapCtl();
     141             : 
     142             :     XOBitmap GetXBitmap();
     143             : 
     144             :     void    SetBmpArray( const sal_uInt16* pPixel ) { pBmpArray = pPixel; }
     145             :     void    SetLines( sal_uInt16 nLns ) { nLines = nLns; }
     146             :     void    SetPixelColor( Color aColor ) { aPixelColor = aColor; }
     147             :     void    SetBackgroundColor( Color aColor ) { aBackgroundColor = aColor; }
     148             : };
     149             : 
     150             : /*************************************************************************
     151             : |* Control for editing bitmaps
     152             : \************************************************************************/
     153             : 
     154             : class SVX_DLLPUBLIC SvxPixelCtl : public Control
     155             : {
     156             : private:
     157             :     using OutputDevice::SetLineColor;
     158             : 
     159             : protected:
     160             :     sal_uInt16      nLines, nSquares;
     161             :     Color       aPixelColor;
     162             :     Color       aBackgroundColor;
     163             :     Color       aLineColor;
     164             :     Size        aRectSize;
     165             :     sal_uInt16*     pPixel;
     166             :     sal_Bool        bPaintable;
     167             : 
     168             :     void    ChangePixel( sal_uInt16 nPixel );
     169             : 
     170             : public:
     171             :             SvxPixelCtl( Window* pParent, const ResId& rResId,
     172             :                         sal_uInt16 nNumber = 8 );
     173             :             ~SvxPixelCtl();
     174             : 
     175             :     virtual void Paint( const Rectangle& rRect );
     176             :     virtual void MouseButtonDown( const MouseEvent& rMEvt );
     177             : 
     178             :     void    SetXBitmap( const XOBitmap& rXOBitmap );
     179             : 
     180           0 :     void    SetPixelColor( const Color& rCol ) { aPixelColor = rCol; }
     181           0 :     void    SetBackgroundColor( const Color& rCol ) { aBackgroundColor = rCol; }
     182           0 :     void    SetLineColor( const Color& rCol ) { aLineColor = rCol; }
     183             : 
     184             :     sal_uInt16  GetLineCount() const { return nLines; }
     185             :     Color   GetPixelColor() const { return aPixelColor; }
     186             :     Color   GetBackgroundColor() const { return aBackgroundColor; }
     187             : 
     188             :     sal_uInt16* GetBitmapPixelPtr() { return pPixel; }
     189             : 
     190             :     void    SetPaintable( sal_Bool bTmp ) { bPaintable = bTmp; }
     191             :     void    Reset();
     192             : };
     193             : 
     194             : /************************************************************************/
     195             : 
     196           0 : class SVX_DLLPUBLIC ColorLB : public ColorListBox
     197             : {
     198             : 
     199             : public:
     200           0 :          ColorLB( Window* pParent, ResId Id ) : ColorListBox( pParent, Id ) {}
     201           0 :          ColorLB( Window* pParent, WinBits aWB ) : ColorListBox( pParent, aWB ) {}
     202             : 
     203             :     virtual void Fill( const XColorListRef &pTab );
     204             : 
     205             :     void Append( XColorEntry* pEntry, Bitmap* pBmp = NULL );
     206             :     void Modify( XColorEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL );
     207             : };
     208             : 
     209             : /************************************************************************/
     210             : 
     211           0 : class SVX_DLLPUBLIC HatchingLB : public ListBox
     212             : {
     213             :     XHatchListRef mpList;
     214             :     sal_Bool      mbUserDraw;
     215             : public:
     216             :     HatchingLB( Window* pParent, ResId Id, sal_Bool bUserDraw = sal_True );
     217             : 
     218             :     virtual void Fill( const XHatchListRef &pList );
     219             :     virtual void UserDraw( const UserDrawEvent& rUDEvt );
     220             : 
     221             :     void    Append( XHatchEntry* pEntry, Bitmap* pBmp = NULL );
     222             :     void    Modify( XHatchEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL );
     223             : };
     224             : 
     225             : /************************************************************************/
     226             : 
     227           0 : class SVX_DLLPUBLIC GradientLB : public ListBox
     228             : {
     229             :     XGradientListRef mpList;
     230             :     sal_Bool         mbUserDraw;
     231             : public:
     232             :     GradientLB( Window* pParent, ResId Id, sal_Bool bUserDraw = sal_True );
     233             : 
     234             :     virtual void Fill( const XGradientListRef &pList );
     235             :     virtual void UserDraw( const UserDrawEvent& rUDEvt );
     236             : 
     237             :     void    Append( XGradientEntry* pEntry, Bitmap* pBmp = NULL );
     238             :     void    Modify( XGradientEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL );
     239             :     void    SelectEntryByList( const XGradientListRef &pList, const String& rStr,
     240             :                                const XGradient& rXGradient, sal_uInt16 nDist = 0 );
     241             : };
     242             : 
     243             : /************************************************************************/
     244             : 
     245           0 : class SVX_DLLPUBLIC BitmapLB : public ListBox
     246             : {
     247             : public:
     248             :     BitmapLB( Window* pParent, ResId Id, sal_Bool bUserDraw = sal_True );
     249             : 
     250             :     virtual void Fill( const XBitmapListRef &pList );
     251             :     virtual void UserDraw( const UserDrawEvent& rUDEvt );
     252             : 
     253             :     void    Append( XBitmapEntry* pEntry, Bitmap* pBmp = NULL );
     254             :     void    Modify( XBitmapEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL );
     255             : 
     256             : private:
     257             :     VirtualDevice   aVD;
     258             :     Bitmap          aBitmap;
     259             : 
     260             :     XBitmapListRef  mpList;
     261             :     sal_Bool        mbUserDraw;
     262             : 
     263             :     SVX_DLLPRIVATE void SetVirtualDevice();
     264             : };
     265             : 
     266             : /************************************************************************/
     267             : 
     268           0 : class FillAttrLB : public ColorListBox
     269             : {
     270             : private:
     271             :     VirtualDevice   aVD;
     272             :     Bitmap          aBitmap;
     273             : 
     274             :     void SetVirtualDevice();
     275             : 
     276             : public:
     277             :          FillAttrLB( Window* pParent, WinBits aWB );
     278             : 
     279             :     virtual void Fill( const XColorListRef    &pList );
     280             :     virtual void Fill( const XHatchListRef    &pList );
     281             :     virtual void Fill( const XGradientListRef &pList );
     282             :     virtual void Fill( const XBitmapListRef   &pList );
     283             : };
     284             : 
     285             : /************************************************************************/
     286             : 
     287           0 : class FillTypeLB : public ListBox
     288             : {
     289             : 
     290             : public:
     291             :          FillTypeLB( Window* pParent, ResId Id ) : ListBox( pParent, Id ) {}
     292           0 :          FillTypeLB( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {}
     293             : 
     294             :     virtual void Fill();
     295             : };
     296             : 
     297             : /************************************************************************/
     298             : 
     299           0 : class SVX_DLLPUBLIC LineLB : public ListBox
     300             : {
     301             : 
     302             : public:
     303             :          LineLB( Window* pParent, ResId Id ) : ListBox( pParent, Id ) {}
     304           0 :          LineLB( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {}
     305             : 
     306             :     virtual void Fill( const XDashListRef &pList );
     307             : 
     308             :     void Append( XDashEntry* pEntry, Bitmap* pBmp = NULL );
     309             :     void Modify( XDashEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL );
     310             :     void FillStyles();
     311             : };
     312             : 
     313             : /************************************************************************/
     314             : 
     315           0 : class SVX_DLLPUBLIC LineEndLB : public ListBox
     316             : {
     317             : 
     318             : public:
     319             :          LineEndLB( Window* pParent, ResId Id ) : ListBox( pParent, Id ) {}
     320             :          LineEndLB( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {}
     321             : 
     322             :     virtual void Fill( const XLineEndListRef &pList, sal_Bool bStart = sal_True );
     323             : 
     324             :     void    Append( XLineEndEntry* pEntry, Bitmap* pBmp = NULL,
     325             :                     sal_Bool bStart = sal_True );
     326             :     void    Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL,
     327             :                     sal_Bool bStart = sal_True );
     328             : };
     329             : 
     330             : //////////////////////////////////////////////////////////////////////////////
     331             : 
     332             : class SdrObject;
     333             : class SdrModel;
     334             : 
     335             : class SvxPreviewBase : public Control
     336             : {
     337             : private:
     338             :     SdrModel*                                       mpModel;
     339             :     VirtualDevice*                                  mpBufferDevice;
     340             : 
     341             : protected:
     342             :     void InitSettings(bool bForeground, bool bBackground);
     343             : 
     344             :     // prepare buffered paint
     345             :     void LocalPrePaint();
     346             : 
     347             :     // end and output buffered paint
     348             :     void LocalPostPaint();
     349             : 
     350             : public:
     351             :     SvxPreviewBase( Window* pParent, const ResId& rResId );
     352             :     virtual ~SvxPreviewBase();
     353             : 
     354             :     // change support
     355             :     virtual void StateChanged(StateChangedType nStateChange);
     356             :     virtual void DataChanged(const DataChangedEvent& rDCEvt);
     357             : 
     358             :     // dada read access
     359           0 :     SdrModel& getModel() const { return *mpModel; }
     360           0 :     OutputDevice& getBufferDevice() const { return *mpBufferDevice; }
     361             : };
     362             : 
     363             : /*************************************************************************
     364             : |*
     365             : |* SvxLinePreview
     366             : |*
     367             : \************************************************************************/
     368             : 
     369             : class SVX_DLLPUBLIC SvxXLinePreview : public SvxPreviewBase
     370             : {
     371             : private:
     372             :     SdrObject*                                      mpLineObjA;
     373             :     SdrObject*                                      mpLineObjB;
     374             :     SdrObject*                                      mpLineObjC;
     375             : 
     376             :     Graphic*                                        mpGraphic;
     377             :     sal_Bool                                        mbWithSymbol;
     378             :     Size                                            maSymbolSize;
     379             : 
     380             : public:
     381             :     SvxXLinePreview( Window* pParent, const ResId& rResId );
     382             :     virtual ~SvxXLinePreview();
     383             : 
     384             :     void SetLineAttributes(const SfxItemSet& rItemSet);
     385             : 
     386             :     void ShowSymbol( sal_Bool b ) { mbWithSymbol = b; };
     387             :     void SetSymbol( Graphic* p, const Size& s );
     388             :     void ResizeSymbol( const Size& s );
     389             : 
     390             :     virtual void Paint( const Rectangle& rRect );
     391             : };
     392             : 
     393             : /*************************************************************************
     394             : |*
     395             : |* SvxXRectPreview
     396             : |*
     397             : \************************************************************************/
     398             : 
     399             : class SVX_DLLPUBLIC SvxXRectPreview : public SvxPreviewBase
     400             : {
     401             : private:
     402             :     SdrObject*                                      mpRectangleObject;
     403             : 
     404             : public:
     405             :     SvxXRectPreview( Window* pParent, const ResId& rResId );
     406             :     virtual ~SvxXRectPreview();
     407             : 
     408             :     void SetAttributes(const SfxItemSet& rItemSet);
     409             : 
     410             :     virtual void    Paint( const Rectangle& rRect );
     411             : };
     412             : 
     413             : /*************************************************************************
     414             : |*
     415             : |* SvxXShadowPreview
     416             : |*
     417             : \************************************************************************/
     418             : 
     419             : class SVX_DLLPUBLIC SvxXShadowPreview : public SvxPreviewBase
     420             : {
     421             : private:
     422             :     SdrObject*                                      mpRectangleObject;
     423             :     SdrObject*                                      mpRectangleShadow;
     424             : 
     425             : public:
     426             :     SvxXShadowPreview( Window* pParent, const ResId& rResId );
     427             :     virtual ~SvxXShadowPreview();
     428             : 
     429             :     void SetRectangleAttributes(const SfxItemSet& rItemSet);
     430             :     void SetShadowAttributes(const SfxItemSet& rItemSet);
     431             :     void SetShadowPosition(const Point& rPos);
     432             : 
     433             :     virtual void    Paint( const Rectangle& rRect );
     434             : };
     435             : 
     436             : #endif // _SVX_DLG_CTRL_HXX
     437             : 
     438             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10