LCOV - code coverage report
Current view: top level - cui/source/inc - cuigrfflt.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 15 0.0 %
Date: 2012-08-25 Functions: 0 14 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 6 0.0 %

           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                 :            : 
      29                 :            : #ifndef _CUI_GRFFLT_HXX
      30                 :            : #define _CUI_GRFFLT_HXX
      31                 :            : 
      32                 :            : #include <vcl/fixed.hxx>
      33                 :            : #include <vcl/field.hxx>
      34                 :            : #include <vcl/button.hxx>
      35                 :            : #include <vcl/timer.hxx>
      36                 :            : #include <vcl/dialog.hxx>
      37                 :            : #include <vcl/group.hxx>
      38                 :            : #include <tools/helpers.hxx>
      39                 :            : #include <svtools/grfmgr.hxx>
      40                 :            : #include <svx/graphctl.hxx>
      41                 :            : #include <svx/dlgctrl.hxx>
      42                 :            : #include <svx/rectenum.hxx>
      43                 :            : 
      44                 :            : // -----------------------
      45                 :            : // - GraphicFilterDialog -
      46                 :            : // -----------------------
      47                 :            : 
      48                 :            : class GraphicFilterDialog : public ModalDialog
      49                 :            : {
      50                 :            : private:
      51                 :            : 
      52                 :            :     class PreviewWindow : public Control
      53                 :            :     {
      54                 :            :     private:
      55                 :            : 
      56                 :            :         Graphic   maGraphic;
      57                 :            : 
      58                 :            :         virtual void    Paint( const Rectangle& rRect );
      59                 :            : 
      60                 :            :     public:
      61                 :            : 
      62                 :            :                         PreviewWindow( Window* pParent, const ResId& rResId );
      63                 :            :                         ~PreviewWindow();
      64                 :            : 
      65                 :            :         void            SetGraphic( const Graphic& rGraphic );
      66                 :            :     };
      67                 :            : 
      68                 :            : private:
      69                 :            : 
      70                 :            :     Timer           maTimer;
      71                 :            :     Link            maModifyHdl;
      72                 :            :     Graphic         maGraphic;
      73                 :            :     double          mfScaleX;
      74                 :            :     double          mfScaleY;
      75                 :            :     Size            maSizePixel;
      76                 :            : 
      77                 :            :                     DECL_LINK(ImplPreviewTimeoutHdl, void *);
      78                 :            :                     DECL_LINK( ImplModifyHdl, void* p );
      79                 :            : 
      80                 :            : protected:
      81                 :            :     PreviewWindow   maPreview;
      82                 :            :     OKButton        maBtnOK;
      83                 :            :     CancelButton    maBtnCancel;
      84                 :            :     HelpButton      maBtnHelp;
      85                 :            :     FixedLine       maFlParameter;
      86                 :            : 
      87                 :          0 :     const Link&     GetModifyHdl() const { return maModifyHdl; }
      88                 :          0 :     const Size&     GetGraphicSizePixel() const { return maSizePixel; }
      89                 :            : 
      90                 :            : public:
      91                 :            : 
      92                 :            :                     GraphicFilterDialog( Window* pParent, const ResId& rResId, const Graphic& rGraphic );
      93                 :            :                     ~GraphicFilterDialog();
      94                 :            : 
      95                 :            :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) = 0;
      96                 :            : };
      97                 :            : 
      98                 :            : // -------------------------
      99                 :            : // - GraphicFilterSmooth -
     100                 :            : // -------------------------
     101                 :            : 
     102                 :            : class GraphicFilterSmooth : public GraphicFilterDialog
     103                 :            : {
     104                 :            : private:
     105                 :            : 
     106                 :            :     FixedText       maFtRadius;
     107                 :            :     NumericField    maMtrRadius;
     108                 :            : 
     109                 :            : public:
     110                 :            : 
     111                 :            :     GraphicFilterSmooth( Window* pParent, const Graphic& rGraphic, double nRadius);
     112                 :            :     ~GraphicFilterSmooth();
     113                 :            : 
     114                 :            :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY );
     115                 :          0 :     double          GetRadius() const { return maMtrRadius.GetValue() / 10.0; }
     116                 :            : };
     117                 :            : 
     118                 :            : // -----------------------
     119                 :            : // - GraphicFilterMosaic -
     120                 :            : // -----------------------
     121                 :            : 
     122                 :            : class GraphicFilterMosaic : public GraphicFilterDialog
     123                 :            : {
     124                 :            : private:
     125                 :            : 
     126                 :            :     FixedText       maFtWidth;
     127                 :            :     MetricField     maMtrWidth;
     128                 :            :     FixedText       maFtHeight;
     129                 :            :     MetricField     maMtrHeight;
     130                 :            :     CheckBox        maCbxEdges;
     131                 :            : 
     132                 :            : public:
     133                 :            : 
     134                 :            :                     GraphicFilterMosaic( Window* pParent, const Graphic& rGraphic,
     135                 :            :                                          sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, sal_Bool bEnhanceEdges );
     136                 :            :                     ~GraphicFilterMosaic();
     137                 :            : 
     138                 :            :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY );
     139                 :          0 :     long            GetTileWidth() const { return static_cast<long>(maMtrWidth.GetValue()); }
     140                 :          0 :     long            GetTileHeight() const { return static_cast<long>(maMtrHeight.GetValue()); }
     141                 :          0 :     sal_Bool            IsEnhanceEdges() const { return maCbxEdges.IsChecked(); }
     142                 :            : };
     143                 :            : 
     144                 :            : // -------------------------
     145                 :            : // - GraphicFilterSolarize -
     146                 :            : // -------------------------
     147                 :            : 
     148                 :            : class GraphicFilterSolarize : public GraphicFilterDialog
     149                 :            : {
     150                 :            : private:
     151                 :            : 
     152                 :            :     FixedText       maFtThreshold;
     153                 :            :     MetricField     maMtrThreshold;
     154                 :            :     CheckBox        maCbxInvert;
     155                 :            : 
     156                 :            : public:
     157                 :            : 
     158                 :            :                     GraphicFilterSolarize( Window* pParent, const Graphic& rGraphic,
     159                 :            :                                            sal_uInt8 nGreyThreshold, sal_Bool bInvert );
     160                 :            :                     ~GraphicFilterSolarize();
     161                 :            : 
     162                 :            :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY );
     163                 :          0 :     sal_uInt8           GetGreyThreshold() const { return( (sal_uInt8) FRound( maMtrThreshold.GetValue() * 2.55 ) ); }
     164                 :          0 :     sal_Bool            IsInvert() const { return maCbxInvert.IsChecked(); }
     165                 :            : };
     166                 :            : 
     167                 :            : // ----------------------
     168                 :            : // - GraphicFilterSepia -
     169                 :            : // ----------------------
     170                 :            : 
     171                 :            : class GraphicFilterSepia : public GraphicFilterDialog
     172                 :            : {
     173                 :            : private:
     174                 :            : 
     175                 :            :     FixedText       maFtSepia;
     176                 :            :     MetricField     maMtrSepia;
     177                 :            : 
     178                 :            : public:
     179                 :            : 
     180                 :            :                     GraphicFilterSepia( Window* pParent, const Graphic& rGraphic,
     181                 :            :                                         sal_uInt16 nSepiaPercent );
     182                 :            :                     ~GraphicFilterSepia();
     183                 :            : 
     184                 :            :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY );
     185                 :          0 :     sal_uInt16          GetSepiaPercent() const
     186                 :          0 :     { return sal::static_int_cast< sal_uInt16 >(maMtrSepia.GetValue()); }
     187                 :            : };
     188                 :            : 
     189                 :            : // -----------------------
     190                 :            : // - GraphicFilterPoster -
     191                 :            : // -----------------------
     192                 :            : 
     193                 :            : class GraphicFilterPoster : public GraphicFilterDialog
     194                 :            : {
     195                 :            : private:
     196                 :            : 
     197                 :            :     FixedText       maFtPoster;
     198                 :            :     NumericField    maNumPoster;
     199                 :            : 
     200                 :            : public:
     201                 :            : 
     202                 :            :                     GraphicFilterPoster( Window* pParent, const Graphic& rGraphic,
     203                 :            :                                          sal_uInt16 nPosterColorCount );
     204                 :            :                     ~GraphicFilterPoster();
     205                 :            : 
     206                 :            :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY );
     207                 :          0 :     sal_uInt16          GetPosterColorCount() const { return( (sal_uInt16) maNumPoster.GetValue() ); }
     208                 :            : };
     209                 :            : 
     210                 :            : // -----------------------
     211                 :            : // - GraphicFilterEmboss -
     212                 :            : // -----------------------
     213                 :            : 
     214                 :            : class GraphicFilterEmboss : public GraphicFilterDialog
     215                 :            : {
     216                 :            : private:
     217                 :            : 
     218         [ #  # ]:          0 :     class EmbossControl : public SvxRectCtl
     219                 :            :     {
     220                 :            :     private:
     221                 :            : 
     222                 :            :         Link            maModifyHdl;
     223                 :            : 
     224                 :            :         virtual void    MouseButtonDown( const MouseEvent& rEvt );
     225                 :            : 
     226                 :            :     public:
     227                 :            : 
     228                 :          0 :                         EmbossControl( Window* pParent, const ResId& rResId, RECT_POINT eRectPoint ) :
     229 [ #  # ][ #  # ]:          0 :                             SvxRectCtl( pParent, rResId ) { SetActualRP( eRectPoint ); }
     230                 :            : 
     231                 :          0 :         void            SetModifyHdl( const Link& rHdl ) { maModifyHdl = rHdl; }
     232                 :            :     };
     233                 :            : 
     234                 :            : private:
     235                 :            : 
     236                 :            :     FixedText       maFtLight;
     237                 :            :     EmbossControl   maCtlLight;
     238                 :            : 
     239                 :            : public:
     240                 :            : 
     241                 :            :                     GraphicFilterEmboss( Window* pParent, const Graphic& rGraphic,
     242                 :            :                                          RECT_POINT eLightSource );
     243                 :            :                     ~GraphicFilterEmboss();
     244                 :            : 
     245                 :            :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY );
     246                 :            :     RECT_POINT      GetLightSource() const { return maCtlLight.GetActualRP(); }
     247                 :            : };
     248                 :            : 
     249                 :            : #endif
     250                 :            : 
     251                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10