LCOV - code coverage report
Current view: top level - include/svx - dlgctrl.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 6 31 19.4 %
Date: 2014-04-11 Functions: 6 36 16.7 %
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 INCLUDED_SVX_DLGCTRL_HXX
      20             : #define INCLUDED_SVX_DLGCTRL_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             :     }
      49           0 :     SvxTabPage(Window *pParent, const OString& rID, const OUString& rUIXMLDescription, const SfxItemSet &rAttrSet)
      50           0 :         : SfxTabPage(pParent, rID, rUIXMLDescription, rAttrSet)
      51             :     {
      52           0 :     }
      53             :     virtual void PointChanged( Window* pWindow, RECT_POINT eRP ) = 0;
      54             : };
      55             : 
      56             : /*************************************************************************
      57             : |* Control for display and selection of the corner and center points of
      58             : |* an object
      59             : \************************************************************************/
      60             : 
      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
      64             : 
      65             : class SvxRectCtlAccessibleContext;
      66             : class SvxPixelCtlAccessible;
      67             : 
      68             : class SVX_DLLPUBLIC SvxRectCtl : public Control
      69             : {
      70             : private:
      71             :     SVX_DLLPRIVATE void             InitSettings( bool bForeground, bool bBackground );
      72             :     SVX_DLLPRIVATE void             InitRectBitmap( void );
      73             :     SVX_DLLPRIVATE Bitmap&          GetRectBitmap( void );
      74             :     SVX_DLLPRIVATE void             Resize_Impl();
      75             : 
      76             : protected:
      77             :     SvxRectCtlAccessibleContext*    pAccContext;
      78             :     sal_uInt16                          nBorderWidth;
      79             :     sal_uInt16                          nRadius;
      80             :     Size                            aSize;
      81             :     Point                           aPtLT, aPtMT, aPtRT;
      82             :     Point                           aPtLM, aPtMM, aPtRM;
      83             :     Point                           aPtLB, aPtMB, aPtRB;
      84             :     Point                           aPtNew;
      85             :     RECT_POINT                      eRP, eDefRP;
      86             :     CTL_STYLE                       eCS;
      87             :     Bitmap*                         pBitmap;
      88             :     CTL_STATE                       m_nState;
      89             : 
      90             :     bool                            mbCompleteDisable;
      91             : 
      92             :     RECT_POINT          GetRPFromPoint( Point, bool bRTL = false ) const;
      93             :     Point               GetPointFromRP( RECT_POINT ) const;
      94             :     void                SetFocusRect( const Rectangle* pRect = NULL );      // pRect == NULL -> calculate rectangle in method
      95             :     Point               SetActualRPWithoutInvalidate( RECT_POINT eNewRP );  // returns the last point
      96             : 
      97             :     virtual void        GetFocus() SAL_OVERRIDE;
      98             :     virtual void        LoseFocus() SAL_OVERRIDE;
      99             : 
     100             :     Point               GetApproxLogPtFromPixPt( const Point& rRoughPixelPoint ) const;
     101             : public:
     102             :     SvxRectCtl( Window* pParent, RECT_POINT eRpt = RP_MM,
     103             :                 sal_uInt16 nBorder = 200, sal_uInt16 nCircle = 80, CTL_STYLE eStyle = CS_RECT );
     104             :     void SetControlSettings(RECT_POINT eRpt = RP_MM, sal_uInt16 nBorder = 200,
     105             :         sal_uInt16 nCircle = 80, CTL_STYLE eStyle = CS_RECT);
     106             :     virtual ~SvxRectCtl();
     107             : 
     108             :     virtual void        Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     109             :     virtual void        MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     110             :     virtual void        KeyInput( const KeyEvent& rKeyEvt ) SAL_OVERRIDE;
     111             :     virtual void        StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
     112             :     virtual void        DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     113             :     virtual void        Resize() SAL_OVERRIDE;
     114             :     virtual Size        GetOptimalSize() const SAL_OVERRIDE;
     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() SAL_OVERRIDE;
     128             : 
     129             :     RECT_POINT          GetApproxRPFromPixPt( const ::com::sun::star::awt::Point& rPixelPoint ) const;
     130             : 
     131           0 :     bool IsCompletelyDisabled() const { return mbCompleteDisable; }
     132             :     void DoCompletelyDisable(bool bNew);
     133             :     void SetCS(CTL_STYLE eNew);
     134             : };
     135             : 
     136             : /*************************************************************************
     137             : |* Preview control for the display of bitmaps
     138             : \************************************************************************/
     139             : 
     140             : class SVX_DLLPUBLIC SvxBitmapCtl
     141             : {
     142             : protected:
     143             :     Size            aSize;
     144             :     sal_uInt16      nLines;
     145             :     Color           aPixelColor, aBackgroundColor;
     146             :     const sal_uInt16*   pBmpArray;
     147             : 
     148             : public:
     149             :             SvxBitmapCtl( Window* pParent, const Size& rSize );
     150             :             ~SvxBitmapCtl();
     151             : 
     152             :     BitmapEx GetBitmapEx();
     153             : 
     154           0 :     void    SetBmpArray( const sal_uInt16* pPixel ) { pBmpArray = pPixel; }
     155           0 :     void    SetLines( sal_uInt16 nLns ) { nLines = nLns; }
     156           0 :     void    SetPixelColor( Color aColor ) { aPixelColor = aColor; }
     157           0 :     void    SetBackgroundColor( Color aColor ) { aBackgroundColor = aColor; }
     158             : };
     159             : 
     160             : /*************************************************************************
     161             : |* Control for editing bitmaps
     162             : \************************************************************************/
     163             : 
     164             : class SVX_DLLPUBLIC SvxPixelCtl : public Control
     165             : {
     166             : private:
     167             :     using OutputDevice::SetLineColor;
     168             : 
     169             : protected:
     170             :     sal_uInt16      nLines, nSquares;
     171             :     Color       aPixelColor;
     172             :     Color       aBackgroundColor;
     173             :     Color       aLineColor;
     174             :     Size        aRectSize;
     175             :     sal_uInt16* pPixel;
     176             :     bool        bPaintable;
     177             :     //Add member identifying position
     178             :     Point       aFocusPosition;
     179             :     Rectangle   implCalFocusRect( const Point& aPosition );
     180             :     void    ChangePixel( sal_uInt16 nPixel );
     181             : 
     182             : public:
     183             :     SvxPixelCtl( Window* pParent, sal_uInt16 nNumber = 8 );
     184             : 
     185             :     virtual ~SvxPixelCtl();
     186             : 
     187             :     virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     188             :     virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     189             :     virtual void Resize() SAL_OVERRIDE;
     190             :     virtual Size GetOptimalSize() const SAL_OVERRIDE;
     191             : 
     192             :     void    SetXBitmap( const BitmapEx& rBitmapEx );
     193             : 
     194           0 :     void    SetPixelColor( const Color& rCol ) { aPixelColor = rCol; }
     195           0 :     void    SetBackgroundColor( const Color& rCol ) { aBackgroundColor = rCol; }
     196           0 :     void    SetLineColor( const Color& rCol ) { aLineColor = rCol; }
     197             : 
     198           0 :     sal_uInt16  GetLineCount() const { return nLines; }
     199             :     Color   GetPixelColor() const { return aPixelColor; }
     200             :     Color   GetBackgroundColor() const { return aBackgroundColor; }
     201             : 
     202             :     sal_uInt16  GetBitmapPixel( const sal_uInt16 nPixelNumber );
     203           0 :     sal_uInt16* GetBitmapPixelPtr() { return pPixel; }
     204             : 
     205           0 :     void    SetPaintable( bool bTmp ) { bPaintable = bTmp; }
     206             :     void    Reset();
     207             :     SvxPixelCtlAccessible*  m_pAccess;
     208             :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >        m_xAccess;
     209             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
     210           0 :     long GetSquares() const { return nSquares ; }
     211           0 :     long GetWidth() const { return aRectSize.getWidth() ; }
     212           0 :     long GetHeight() const { return aRectSize.getHeight() ; }
     213             : 
     214             :     //Device Pixel .
     215             :     long ShowPosition( const Point &pt);
     216             : 
     217             :     long PointToIndex(const Point &pt) const;
     218             :     Point IndexToPoint(long nIndex) const ;
     219             :     long GetFoucsPosIndex() const ;
     220             :     //Keyboard function for key input and focus handling function
     221             :     virtual void        KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
     222             :     virtual void        GetFocus() SAL_OVERRIDE;
     223             :     virtual void        LoseFocus() SAL_OVERRIDE;
     224             : };
     225             : 
     226             : /************************************************************************/
     227             : 
     228          63 : class SVX_DLLPUBLIC ColorLB : public ColorListBox
     229             : {
     230             : 
     231             : public:
     232           0 :          ColorLB( Window* pParent, ResId Id ) : ColorListBox( pParent, Id ) {}
     233          63 :          ColorLB( Window* pParent, WinBits aWB ) : ColorListBox( pParent, aWB ) {}
     234             : 
     235             :     virtual void Fill( const XColorListRef &pTab );
     236             : 
     237             :     void Append( const XColorEntry& rEntry );
     238             :     void Modify( const XColorEntry& rEntry, sal_Int32 nPos );
     239             : };
     240             : 
     241             : /************************************************************************/
     242             : 
     243           0 : class SVX_DLLPUBLIC HatchingLB : public ListBox
     244             : {
     245             :     XHatchListRef mpList;
     246             : public:
     247             :     explicit HatchingLB(Window* pParent, WinBits aWB);
     248             : 
     249             :     virtual void Fill( const XHatchListRef &pList );
     250             : 
     251             :     void    Append( const XHatchEntry& rEntry, const Bitmap& rBitmap );
     252             :     void    Modify( const XHatchEntry& rEntry, sal_Int32 nPos, const Bitmap& rBitmap );
     253             : };
     254             : 
     255             : /************************************************************************/
     256             : 
     257           0 : class SVX_DLLPUBLIC GradientLB : public ListBox
     258             : {
     259             :     XGradientListRef mpList;
     260             : public:
     261             :     explicit GradientLB(Window* pParent, WinBits aWB);
     262             : 
     263             :     virtual void Fill( const XGradientListRef &pList );
     264             : 
     265             :     void    Append( const XGradientEntry& rEntry, const Bitmap& rBitmap );
     266             :     void    Modify( const XGradientEntry& rEntry, sal_Int32 nPos, const Bitmap& rBitmap );
     267             :     void    SelectEntryByList( const XGradientListRef &pList, const OUString& rStr,
     268             :                                const XGradient& rXGradient, sal_uInt16 nDist = 0 );
     269             : };
     270             : 
     271             : /************************************************************************/
     272             : 
     273           0 : class SVX_DLLPUBLIC BitmapLB : public ListBox
     274             : {
     275             : public:
     276             :     explicit BitmapLB(Window* pParent, WinBits aWB);
     277             : 
     278             :     virtual void Fill(const XBitmapListRef &pList);
     279             : 
     280             :     void Append(const Size& rSize, const XBitmapEntry& rEntry);
     281             :     void Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_Int32 nPos);
     282             :     void SelectEntryByList(const XBitmapList* pList, const OUString& rStr);
     283             : 
     284             : private:
     285             :     BitmapEx        maBitmapEx;
     286             : 
     287             :     XBitmapListRef  mpList;
     288             : };
     289             : 
     290             : /************************************************************************/
     291             : 
     292          63 : class FillAttrLB : public ColorListBox
     293             : {
     294             : private:
     295             :     BitmapEx        maBitmapEx;
     296             : 
     297             : public:
     298             :     FillAttrLB( Window* pParent, WinBits aWB );
     299             : 
     300             :     virtual void Fill( const XColorListRef    &pList );
     301             :     virtual void Fill( const XHatchListRef    &pList );
     302             :     virtual void Fill( const XGradientListRef &pList );
     303             :     virtual void Fill( const XBitmapListRef   &pList );
     304             : };
     305             : 
     306             : /************************************************************************/
     307             : 
     308          63 : class FillTypeLB : public ListBox
     309             : {
     310             : 
     311             : public:
     312             :          FillTypeLB( Window* pParent, ResId Id ) : ListBox( pParent, Id ) {}
     313          63 :          FillTypeLB( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {}
     314             : 
     315             :     virtual void Fill();
     316             : };
     317             : 
     318             : /************************************************************************/
     319             : 
     320             : class SVX_DLLPUBLIC LineLB : public ListBox
     321             : {
     322             : private:
     323             :     /// bitfield
     324             :     /// defines if standard fields (none, solid) are added, default is true
     325             :     bool        mbAddStandardFields : 1;
     326             : 
     327             : public:
     328             :     LineLB(Window* pParent, WinBits aWB);
     329             :     virtual ~LineLB();
     330             : 
     331             :     virtual void Fill(const XDashListRef &pList);
     332          62 :     bool getAddStandardFields() const { return mbAddStandardFields; }
     333             :     void setAddStandardFields(bool bNew);
     334             : 
     335             :     void Append(const XDashEntry& rEntry, const Bitmap& rBitmap );
     336             :     void Modify(const XDashEntry& rEntry, sal_Int32 nPos, const Bitmap& rBitmap );
     337             :     void SelectEntryByList(const XDashList* pList, const OUString& rStr, const XDash& rDash, sal_uInt16 nDist = 0);
     338             : };
     339             : 
     340             : 
     341             : /************************************************************************/
     342             : 
     343             : class SVX_DLLPUBLIC LineEndLB : public ListBox
     344             : {
     345             : 
     346             : public:
     347             :     LineEndLB( Window* pParent, WinBits aWB );
     348             :     virtual ~LineEndLB (void);
     349             : 
     350             :     virtual void Fill( const XLineEndListRef &pList, bool bStart = true );
     351             : 
     352             :     void    Append( const XLineEndEntry& rEntry, const Bitmap& rBitmap, bool bStart = true );
     353             :     void    Modify( const XLineEndEntry& rEntry, sal_Int32 nPos, const Bitmap& rBitmap, bool bStart = true );
     354             : };
     355             : 
     356             : 
     357             : 
     358             : class SdrObject;
     359             : class SdrPathObj;
     360             : class SdrModel;
     361             : 
     362             : class SvxPreviewBase : public Control
     363             : {
     364             : private:
     365             :     SdrModel*                                       mpModel;
     366             :     VirtualDevice*                                  mpBufferDevice;
     367             : 
     368             : protected:
     369             :     void InitSettings(bool bForeground, bool bBackground);
     370             : 
     371             :     // prepare buffered paint
     372             :     void LocalPrePaint();
     373             : 
     374             :     // end and output buffered paint
     375             :     void LocalPostPaint();
     376             : 
     377             : public:
     378             :     SvxPreviewBase(Window* pParent);
     379             :     virtual ~SvxPreviewBase();
     380             : 
     381             :     // change support
     382             :     virtual void StateChanged(StateChangedType nStateChange) SAL_OVERRIDE;
     383             :     virtual void DataChanged(const DataChangedEvent& rDCEvt) SAL_OVERRIDE;
     384             : 
     385             :     // dada read access
     386           0 :     SdrModel& getModel() const { return *mpModel; }
     387           0 :     OutputDevice& getBufferDevice() const { return *mpBufferDevice; }
     388             : };
     389             : 
     390             : /*************************************************************************
     391             : |*
     392             : |* SvxLinePreview
     393             : |*
     394             : \************************************************************************/
     395             : 
     396             : class SVX_DLLPUBLIC SvxXLinePreview : public SvxPreviewBase
     397             : {
     398             : private:
     399             :     SdrPathObj*                                     mpLineObjA;
     400             :     SdrPathObj*                                     mpLineObjB;
     401             :     SdrPathObj*                                     mpLineObjC;
     402             : 
     403             :     Graphic*                                        mpGraphic;
     404             :     bool                                            mbWithSymbol;
     405             :     Size                                            maSymbolSize;
     406             : 
     407             : public:
     408             :     SvxXLinePreview( Window* pParent );
     409             :     virtual ~SvxXLinePreview();
     410             : 
     411             :     void SetLineAttributes(const SfxItemSet& rItemSet);
     412             : 
     413           0 :     void ShowSymbol( bool b ) { mbWithSymbol = b; };
     414             :     void SetSymbol( Graphic* p, const Size& s );
     415             :     void ResizeSymbol( const Size& s );
     416             : 
     417             :     virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     418             :     virtual void Resize() SAL_OVERRIDE;
     419             :     virtual Size GetOptimalSize() const SAL_OVERRIDE;
     420             : };
     421             : 
     422             : /*************************************************************************
     423             : |*
     424             : |* SvxXRectPreview
     425             : |*
     426             : \************************************************************************/
     427             : 
     428             : class SVX_DLLPUBLIC SvxXRectPreview : public SvxPreviewBase
     429             : {
     430             : private:
     431             :     SdrObject*                                      mpRectangleObject;
     432             : 
     433             : public:
     434             :     SvxXRectPreview(Window* pParent);
     435             :     virtual ~SvxXRectPreview();
     436             : 
     437             :     void SetAttributes(const SfxItemSet& rItemSet);
     438             : 
     439             :     virtual void    Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     440             :     virtual void Resize() SAL_OVERRIDE;
     441             : };
     442             : 
     443             : /*************************************************************************
     444             : |*
     445             : |* SvxXShadowPreview
     446             : |*
     447             : \************************************************************************/
     448             : 
     449             : class SVX_DLLPUBLIC SvxXShadowPreview : public SvxPreviewBase
     450             : {
     451             : private:
     452             :     Point maShadowOffset;
     453             : 
     454             :     SdrObject* mpRectangleObject;
     455             :     SdrObject* mpRectangleShadow;
     456             : 
     457             : public:
     458             :     SvxXShadowPreview(Window *pParent);
     459             : 
     460             :     virtual ~SvxXShadowPreview();
     461             : 
     462             :     void SetRectangleAttributes(const SfxItemSet& rItemSet);
     463             :     void SetShadowAttributes(const SfxItemSet& rItemSet);
     464             :     void SetShadowPosition(const Point& rPos);
     465             : 
     466             :     virtual void    Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     467             : };
     468             : 
     469             : #endif // INCLUDED_SVX_DLGCTRL_HXX
     470             : 
     471             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10