LCOV - code coverage report
Current view: top level - cui/source/inc - cuigrfflt.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 24 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 20 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_CUI_SOURCE_INC_CUIGRFFLT_HXX
      21             : #define INCLUDED_CUI_SOURCE_INC_CUIGRFFLT_HXX
      22             : 
      23             : #include <vcl/fixed.hxx>
      24             : #include <vcl/field.hxx>
      25             : #include <vcl/button.hxx>
      26             : #include <vcl/timer.hxx>
      27             : #include <vcl/dialog.hxx>
      28             : #include <vcl/group.hxx>
      29             : #include <tools/helpers.hxx>
      30             : #include <svtools/grfmgr.hxx>
      31             : #include <svx/graphctl.hxx>
      32             : #include <svx/dlgctrl.hxx>
      33             : #include <svx/rectenum.hxx>
      34             : 
      35           0 : class GraphicPreviewWindow : public Control
      36             : {
      37             : private:
      38             :     const Graphic* mpOrigGraphic;
      39             :     Link<>    maModifyHdl;
      40             :     Graphic   maScaledOrig;
      41             :     Graphic   maPreview;
      42             :     double    mfScaleX;
      43             :     double    mfScaleY;
      44             : 
      45             :     virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
      46             :     virtual void Resize() SAL_OVERRIDE;
      47             :     virtual Size GetOptimalSize() const SAL_OVERRIDE;
      48             : 
      49             :     void ScaleImageToFit();
      50             : 
      51             : public:
      52             : 
      53             :     GraphicPreviewWindow(vcl::Window* pParent, WinBits nStyle);
      54           0 :     void init(const Graphic* pOrigGraphic, const Link<>& rLink)
      55             :     {
      56           0 :         mpOrigGraphic = pOrigGraphic;
      57           0 :         maModifyHdl = rLink;
      58           0 :         ScaleImageToFit();
      59           0 :     }
      60             : 
      61             :     void            SetPreview(const Graphic& rGraphic);
      62           0 :     const Graphic&  GetScaledOriginal() const { return maScaledOrig; }
      63           0 :     double          GetScaleX() const { return mfScaleX; }
      64           0 :     double          GetScaleY() const { return mfScaleY; }
      65             : };
      66             : 
      67             : class GraphicFilterDialog : public ModalDialog
      68             : {
      69             : private:
      70             : 
      71             :     Timer           maTimer;
      72             :     Link<>          maModifyHdl;
      73             :     Size            maSizePixel;
      74             :     bool            bIsBitmap;
      75             : 
      76             :     DECL_LINK_TYPED(ImplPreviewTimeoutHdl, Timer *, void);
      77             :     DECL_LINK( ImplModifyHdl, void* p );
      78             : 
      79             : protected:
      80             :     VclPtr<GraphicPreviewWindow>  mpPreview;
      81             : 
      82           0 :     const Link<>&   GetModifyHdl() const { return maModifyHdl; }
      83           0 :     const Size&     GetGraphicSizePixel() const { return maSizePixel; }
      84             : 
      85             : public:
      86             : 
      87             :     GraphicFilterDialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, const Graphic& rGraphic);
      88             :     virtual ~GraphicFilterDialog();
      89             :     virtual void dispose() SAL_OVERRIDE;
      90             : 
      91             :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) = 0;
      92             : };
      93             : 
      94             : class GraphicFilterSmooth : public GraphicFilterDialog
      95             : {
      96             : private:
      97             :     VclPtr<NumericField>   mpMtrRadius;
      98             : 
      99             : public:
     100             : 
     101             :     GraphicFilterSmooth( vcl::Window* pParent, const Graphic& rGraphic, double nRadius);
     102             :     virtual ~GraphicFilterSmooth();
     103             :     virtual void dispose() SAL_OVERRIDE;
     104             : 
     105             :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
     106           0 :     double          GetRadius() const { return mpMtrRadius->GetValue() / 10.0; }
     107             : };
     108             : 
     109             : class GraphicFilterMosaic : public GraphicFilterDialog
     110             : {
     111             : private:
     112             :     VclPtr<MetricField>    mpMtrWidth;
     113             :     VclPtr<MetricField>    mpMtrHeight;
     114             :     VclPtr<CheckBox>       mpCbxEdges;
     115             : 
     116             : public:
     117             : 
     118             :     GraphicFilterMosaic(vcl::Window* pParent, const Graphic& rGraphic,
     119             :         sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, bool bEnhanceEdges);
     120             :     virtual ~GraphicFilterMosaic();
     121             :     virtual void dispose() SAL_OVERRIDE;
     122             : 
     123             :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
     124           0 :     long            GetTileWidth() const { return static_cast<long>(mpMtrWidth->GetValue()); }
     125           0 :     long            GetTileHeight() const { return static_cast<long>(mpMtrHeight->GetValue()); }
     126           0 :     bool        IsEnhanceEdges() const { return mpCbxEdges->IsChecked(); }
     127             : };
     128             : 
     129             : class GraphicFilterSolarize : public GraphicFilterDialog
     130             : {
     131             : private:
     132             :     VclPtr<MetricField>    mpMtrThreshold;
     133             :     VclPtr<CheckBox>       mpCbxInvert;
     134             : 
     135             : public:
     136             : 
     137             :     GraphicFilterSolarize( vcl::Window* pParent, const Graphic& rGraphic,
     138             :                                            sal_uInt8 nGreyThreshold, bool bInvert );
     139             :     virtual ~GraphicFilterSolarize();
     140             :     virtual void dispose() SAL_OVERRIDE;
     141             : 
     142             :     virtual Graphic     GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
     143           0 :     sal_uInt8           GetGreyThreshold() const { return( (sal_uInt8) FRound( mpMtrThreshold->GetValue() * 2.55 ) ); }
     144           0 :     bool            IsInvert() const { return mpCbxInvert->IsChecked(); }
     145             : };
     146             : 
     147             : class GraphicFilterSepia : public GraphicFilterDialog
     148             : {
     149             : private:
     150             :     VclPtr<MetricField>    mpMtrSepia;
     151             : public:
     152             :     GraphicFilterSepia( vcl::Window* pParent, const Graphic& rGraphic,
     153             :                         sal_uInt16 nSepiaPercent );
     154             :     virtual ~GraphicFilterSepia();
     155             :     virtual void dispose() SAL_OVERRIDE;
     156             :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
     157           0 :     sal_uInt16 GetSepiaPercent() const
     158             :     {
     159           0 :         return sal::static_int_cast< sal_uInt16 >(mpMtrSepia->GetValue());
     160             :     }
     161             : };
     162             : 
     163             : class GraphicFilterPoster : public GraphicFilterDialog
     164             : {
     165             : private:
     166             :     VclPtr<NumericField>   mpNumPoster;
     167             : public:
     168             :     GraphicFilterPoster( vcl::Window* pParent, const Graphic& rGraphic,
     169             :                          sal_uInt16 nPosterColorCount );
     170             :     virtual ~GraphicFilterPoster();
     171             :     virtual void dispose() SAL_OVERRIDE;
     172             : 
     173             :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
     174           0 :     sal_uInt16      GetPosterColorCount() const { return( (sal_uInt16) mpNumPoster->GetValue() ); }
     175             : };
     176             : 
     177           0 : class EmbossControl : public SvxRectCtl
     178             : {
     179             : private:
     180             :     Link<>          maModifyHdl;
     181             :     virtual void    MouseButtonDown( const MouseEvent& rEvt ) SAL_OVERRIDE;
     182             :     virtual Size    GetOptimalSize() const SAL_OVERRIDE;
     183             : public:
     184           0 :     EmbossControl(vcl::Window* pParent)
     185           0 :         : SvxRectCtl(pParent) {}
     186             : 
     187           0 :     void            SetModifyHdl( const Link<>& rHdl ) { maModifyHdl = rHdl; }
     188             : };
     189             : 
     190             : class GraphicFilterEmboss : public GraphicFilterDialog
     191             : {
     192             : private:
     193             :     VclPtr<EmbossControl>  mpCtlLight;
     194             : public:
     195             :     GraphicFilterEmboss( vcl::Window* pParent, const Graphic& rGraphic,
     196             :                          RECT_POINT eLightSource );
     197             :     virtual ~GraphicFilterEmboss();
     198             :     virtual void dispose() SAL_OVERRIDE;
     199             : 
     200             :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
     201             :     RECT_POINT      GetLightSource() const { return mpCtlLight->GetActualRP(); }
     202             : };
     203             : 
     204             : #endif
     205             : 
     206             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11