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

Generated by: LCOV version 1.10