LCOV - code coverage report
Current view: top level - cui/source/inc - cuigrfflt.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 31 0.0 %
Date: 2014-11-03 Functions: 0 34 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(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           0 : class GraphicFilterDialog : public ModalDialog
      68             : {
      69             : private:
      70             : 
      71             :     Timer           maTimer;
      72             :     Link            maModifyHdl;
      73             :     Size            maSizePixel;
      74             :     bool            bIsBitmap;
      75             : 
      76             :     DECL_LINK(ImplPreviewTimeoutHdl, void *);
      77             :     DECL_LINK( ImplModifyHdl, void* p );
      78             : 
      79             : protected:
      80             :     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 OString& rID, const OUString& rUIXMLDescription, const Graphic& rGraphic);
      88             : 
      89             :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) = 0;
      90             : };
      91             : 
      92             : 
      93             : 
      94             : // - GraphicFilterSmooth -
      95             : 
      96             : 
      97           0 : class GraphicFilterSmooth : public GraphicFilterDialog
      98             : {
      99             : private:
     100             :     NumericField*   mpMtrRadius;
     101             : 
     102             : public:
     103             : 
     104             :     GraphicFilterSmooth( vcl::Window* pParent, const Graphic& rGraphic, double nRadius);
     105             : 
     106             :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
     107           0 :     double          GetRadius() const { return mpMtrRadius->GetValue() / 10.0; }
     108             : };
     109             : 
     110             : 
     111             : // - GraphicFilterMosaic -
     112             : 
     113             : 
     114           0 : class GraphicFilterMosaic : public GraphicFilterDialog
     115             : {
     116             : private:
     117             :     MetricField*    mpMtrWidth;
     118             :     MetricField*    mpMtrHeight;
     119             :     CheckBox*       mpCbxEdges;
     120             : 
     121             : public:
     122             : 
     123             :     GraphicFilterMosaic(vcl::Window* pParent, const Graphic& rGraphic,
     124             :         sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, bool bEnhanceEdges);
     125             : 
     126             :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
     127           0 :     long            GetTileWidth() const { return static_cast<long>(mpMtrWidth->GetValue()); }
     128           0 :     long            GetTileHeight() const { return static_cast<long>(mpMtrHeight->GetValue()); }
     129           0 :     bool        IsEnhanceEdges() const { return mpCbxEdges->IsChecked(); }
     130             : };
     131             : 
     132             : 
     133             : // - GraphicFilterSolarize -
     134             : 
     135             : 
     136           0 : class GraphicFilterSolarize : public GraphicFilterDialog
     137             : {
     138             : private:
     139             :     MetricField*    mpMtrThreshold;
     140             :     CheckBox*       mpCbxInvert;
     141             : 
     142             : public:
     143             : 
     144             :     GraphicFilterSolarize( vcl::Window* pParent, const Graphic& rGraphic,
     145             :                                            sal_uInt8 nGreyThreshold, bool bInvert );
     146             : 
     147             :     virtual Graphic     GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
     148           0 :     sal_uInt8           GetGreyThreshold() const { return( (sal_uInt8) FRound( mpMtrThreshold->GetValue() * 2.55 ) ); }
     149           0 :     bool            IsInvert() const { return mpCbxInvert->IsChecked(); }
     150             : };
     151             : 
     152             : 
     153             : // - GraphicFilterSepia -
     154             : 
     155             : 
     156           0 : class GraphicFilterSepia : public GraphicFilterDialog
     157             : {
     158             : private:
     159             :     MetricField*    mpMtrSepia;
     160             : public:
     161             :     GraphicFilterSepia( vcl::Window* pParent, const Graphic& rGraphic,
     162             :                         sal_uInt16 nSepiaPercent );
     163             :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
     164           0 :     sal_uInt16 GetSepiaPercent() const
     165             :     {
     166           0 :         return sal::static_int_cast< sal_uInt16 >(mpMtrSepia->GetValue());
     167             :     }
     168             : };
     169             : 
     170             : 
     171             : // - GraphicFilterPoster -
     172             : 
     173             : 
     174           0 : class GraphicFilterPoster : public GraphicFilterDialog
     175             : {
     176             : private:
     177             :     NumericField*   mpNumPoster;
     178             : public:
     179             :     GraphicFilterPoster( vcl::Window* pParent, const Graphic& rGraphic,
     180             :                          sal_uInt16 nPosterColorCount );
     181             : 
     182             :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
     183           0 :     sal_uInt16      GetPosterColorCount() const { return( (sal_uInt16) mpNumPoster->GetValue() ); }
     184             : };
     185             : 
     186             : 
     187             : // - GraphicFilterEmboss -
     188             : 
     189             : 
     190           0 : class EmbossControl : public SvxRectCtl
     191             : {
     192             : private:
     193             :     Link            maModifyHdl;
     194             :     virtual void    MouseButtonDown( const MouseEvent& rEvt ) SAL_OVERRIDE;
     195             :     virtual Size    GetOptimalSize() const SAL_OVERRIDE;
     196             : public:
     197           0 :     EmbossControl(vcl::Window* pParent)
     198           0 :         : SvxRectCtl(pParent) {}
     199             : 
     200           0 :     void            SetModifyHdl( const Link& rHdl ) { maModifyHdl = rHdl; }
     201             : };
     202             : 
     203           0 : class GraphicFilterEmboss : public GraphicFilterDialog
     204             : {
     205             : private:
     206             :     EmbossControl*  mpCtlLight;
     207             : public:
     208             :     GraphicFilterEmboss( vcl::Window* pParent, const Graphic& rGraphic,
     209             :                          RECT_POINT eLightSource );
     210             : 
     211             :     virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
     212             :     RECT_POINT      GetLightSource() const { return mpCtlLight->GetActualRP(); }
     213             : };
     214             : 
     215             : #endif
     216             : 
     217             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10