LCOV - code coverage report
Current view: top level - svx/inc/svx - dlgctrl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 19 36.8 %
Date: 2012-08-25 Functions: 7 28 25.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 26 23.1 %

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

Generated by: LCOV version 1.10