diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-02-01 12:29:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-01 13:14:55 +0000 |
commit | 44f85f3804d69cd437a5baeae2d1aeadf1873f74 (patch) | |
tree | 8eeefee3faf2ba14c6eb366a33de21ea37244e03 /cui/source | |
parent | b26f6cdbd0de34cceb1dd8fc382490860f45a66f (diff) |
convert emboss dialog to .ui
Change-Id: I16883023ba7386437ff1cc9cd7d3393db8fb4654
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/dialogs/cuigrfflt.cxx | 144 | ||||
-rw-r--r-- | cui/source/dialogs/grfflt.hrc | 42 | ||||
-rw-r--r-- | cui/source/dialogs/grfflt.src | 88 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 13 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 12 | ||||
-rw-r--r-- | cui/source/inc/cuigrfflt.hxx | 88 | ||||
-rw-r--r-- | cui/source/inc/helpid.hrc | 1 |
7 files changed, 36 insertions, 352 deletions
diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx index d3420139a728..c67d06439f47 100644 --- a/cui/source/dialogs/cuigrfflt.cxx +++ b/cui/source/dialogs/cuigrfflt.cxx @@ -26,124 +26,9 @@ #include <sfx2/request.hxx> #include <dialmgr.hxx> #include "cuigrfflt.hxx" -#include "grfflt.hrc" #include <cuires.hrc> #include <svx/dialogs.hrc> -oldGraphicFilterDialog::PreviewWindow::PreviewWindow( Window* pParent, const ResId& rResId ) : - Control( pParent, rResId ) -{ -} - -// ----------------------------------------------------------------------------- - -void oldGraphicFilterDialog::PreviewWindow::Paint( const Rectangle& rRect ) -{ - Control::Paint( rRect ); - - const Size aOutputSize( GetOutputSizePixel() ); - - if( maGraphic.IsAnimated() ) - { - const Size aGraphicSize( LogicToPixel( maGraphic.GetPrefSize(), maGraphic.GetPrefMapMode() ) ); - const Point aGraphicPosition( ( aOutputSize.Width() - aGraphicSize.Width() ) >> 1, - ( aOutputSize.Height() - aGraphicSize.Height() ) >> 1 ); - maGraphic.StartAnimation( this, aGraphicPosition, aGraphicSize ); - } - else - { - const Size aGraphicSize( maGraphic.GetSizePixel() ); - const Point aGraphicPosition( ( aOutputSize.Width() - aGraphicSize.Width() ) >> 1, - ( aOutputSize.Height() - aGraphicSize.Height() ) >> 1 ); - maGraphic.Draw( this, aGraphicPosition, aGraphicSize ); - } -} - -// ----------------------------------------------------------------------------- - -void oldGraphicFilterDialog::PreviewWindow::SetGraphic( const Graphic& rGraphic ) -{ - maGraphic = rGraphic; - - if( maGraphic.IsAnimated() || maGraphic.IsTransparent() ) - Invalidate(); - else - Paint( Rectangle( Point(), GetOutputSizePixel() ) ); -} - -oldGraphicFilterDialog::oldGraphicFilterDialog( Window* pParent, const ResId& rResId, const Graphic& rGraphic ) : - ModalDialog ( pParent, rResId ), - maModifyHdl ( LINK( this, oldGraphicFilterDialog, ImplModifyHdl ) ), - mfScaleX ( 0.0 ), - mfScaleY ( 0.0 ), - maSizePixel ( LogicToPixel( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode() ) ), - maPreview ( this, CUI_RES( CTL_PREVIEW ) ), - maBtnOK ( this, CUI_RES( BTN_OK ) ), - maBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - maBtnHelp ( this, CUI_RES( BTN_HELP ) ), - maFlParameter ( this, CUI_RES( FL_PARAMETER ) ) -{ - const Size aPreviewSize( maPreview.GetOutputSizePixel() ); - Size aGrfSize( maSizePixel ); - - if( rGraphic.GetType() == GRAPHIC_BITMAP && - aPreviewSize.Width() && aPreviewSize.Height() && - aGrfSize.Width() && aGrfSize.Height() ) - { - const double fGrfWH = (double) aGrfSize.Width() / aGrfSize.Height(); - const double fPreWH = (double) aPreviewSize.Width() / aPreviewSize.Height(); - - if( fGrfWH < fPreWH ) - { - aGrfSize.Width() = (long) ( aPreviewSize.Height() * fGrfWH ); - aGrfSize.Height() = aPreviewSize.Height(); - } - else - { - aGrfSize.Width() = aPreviewSize.Width(); - aGrfSize.Height() = (long) ( aPreviewSize.Width() / fGrfWH ); - } - - mfScaleX = (double) aGrfSize.Width() / maSizePixel.Width(); - mfScaleY = (double) aGrfSize.Height() / maSizePixel.Height(); - - if( !rGraphic.IsAnimated() ) - { - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - - if( aBmpEx.Scale( aGrfSize, BMP_SCALE_DEFAULT ) ) - maGraphic = aBmpEx; - } - } - - maTimer.SetTimeoutHdl( LINK( this, oldGraphicFilterDialog, ImplPreviewTimeoutHdl ) ); - maTimer.SetTimeout( 100 ); - ImplModifyHdl( NULL ); -} - -// ----------------------------------------------------------------------------- - -IMPL_LINK_NOARG(oldGraphicFilterDialog, ImplPreviewTimeoutHdl) -{ - maTimer.Stop(); - maPreview.SetGraphic( GetFilteredGraphic( maGraphic, mfScaleX, mfScaleY ) ); - - return 0; -} - -// ----------------------------------------------------------------------------- - -IMPL_LINK_NOARG(oldGraphicFilterDialog, ImplModifyHdl) -{ - if( maGraphic.GetType() == GRAPHIC_BITMAP ) - { - maTimer.Stop(); - maTimer.Start(); - } - - return 0; -} - GraphicPreviewWindow::GraphicPreviewWindow(Window* pParent, const WinBits nStyle) : Control(pParent, nStyle) @@ -545,7 +430,7 @@ Graphic GraphicFilterPoster::GetFilteredGraphic( const Graphic& rGraphic, // - GraphicFilterEmboss - // ----------------------- -void GraphicFilterEmboss::EmbossControl::MouseButtonDown( const MouseEvent& rEvt ) +void EmbossControl::MouseButtonDown( const MouseEvent& rEvt ) { const RECT_POINT eOldRP = GetActualRP(); @@ -555,24 +440,27 @@ void GraphicFilterEmboss::EmbossControl::MouseButtonDown( const MouseEvent& rEvt maModifyHdl.Call( this ); } -// ----------------------------------------------------------------------------- - -GraphicFilterEmboss::GraphicFilterEmboss( Window* pParent, const Graphic& rGraphic, - RECT_POINT eLightSource ) : - oldGraphicFilterDialog ( pParent, CUI_RES( RID_SVX_GRFFILTER_DLG_EMBOSS ), rGraphic ), - maFtLight ( this, CUI_RES( DLG_FILTEREMBOSS_FT_LIGHT ) ), - maCtlLight ( this, CUI_RES( DLG_FILTEREMBOSS_CTL_LIGHT ), eLightSource ) +Size EmbossControl::GetOptimalSize() const { - FreeResource(); + return LogicToPixel(Size(77, 60), MAP_APPFONT); +} - maCtlLight.SetModifyHdl( GetModifyHdl() ); - maCtlLight.GrabFocus(); +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeEmbossControl(Window *pParent, VclBuilder::stringmap &) +{ + return new EmbossControl(pParent); } // ----------------------------------------------------------------------------- -GraphicFilterEmboss::~GraphicFilterEmboss() +GraphicFilterEmboss::GraphicFilterEmboss(Window* pParent, + const Graphic& rGraphic, RECT_POINT eLightSource) + : GraphicFilterDialog (pParent, "EmbossDialog", + "cui/ui/embossdialog.ui", rGraphic) { + get(mpCtlLight, "lightsource"); + mpCtlLight->SetActualRP(eLightSource); + mpCtlLight->SetModifyHdl( GetModifyHdl() ); + mpCtlLight->GrabFocus(); } // ----------------------------------------------------------------------------- @@ -583,7 +471,7 @@ Graphic GraphicFilterEmboss::GetFilteredGraphic( const Graphic& rGraphic, Graphic aRet; sal_uInt16 nAzim, nElev; - switch( maCtlLight.GetActualRP() ) + switch( mpCtlLight->GetActualRP() ) { default: OSL_FAIL("svx::GraphicFilterEmboss::GetFilteredGraphic(), unknown Reference Point!" ); /* Fall through */ diff --git a/cui/source/dialogs/grfflt.hrc b/cui/source/dialogs/grfflt.hrc deleted file mode 100644 index df4a92983076..000000000000 --- a/cui/source/dialogs/grfflt.hrc +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _SVX_DLGFLT_HRC -#define _SVX_DLGFLT_HRC - -// ---------- -// - Common - -// ---------- - -#define BTN_OK 101 -#define BTN_CANCEL 102 -#define BTN_HELP 103 -#define CTL_PREVIEW 105 -#define FL_PARAMETER 106 - -// -------------------- -// - DLG_FILTEREMBOSS - -// -------------------- - -#define DLG_FILTEREMBOSS_FT_LIGHT 1 -#define DLG_FILTEREMBOSS_CTL_LIGHT 2 - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/grfflt.src b/cui/source/dialogs/grfflt.src deleted file mode 100644 index 275f5b6863a0..000000000000 --- a/cui/source/dialogs/grfflt.src +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <svtools/controldims.hrc> -#include <cuires.hrc> -#include "helpid.hrc" -#include "grfflt.hrc" -#include <svx/dialogs.hrc> - -// -------------------- -// - DLG_FILTEREMBOSS - -// -------------------- - -ModalDialog RID_SVX_GRFFILTER_DLG_EMBOSS -{ - HelpID = CMD_SID_GRFFILTER_EMBOSS; - OutputSize = TRUE ; - Moveable = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 250, 100 ) ; - - Text [ en-US ] = "Relief" ; - - FixedLine FL_PARAMETER - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Parameters"; - }; - Control CTL_PREVIEW - { - Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ; - Size = MAP_APPFONT ( 81, 73 ) ; - }; -#define MA_Y12 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP - FixedText DLG_FILTEREMBOSS_FT_LIGHT - { - Pos = MAP_APPFONT ( 12 , MA_Y12 ) ; - Size = MAP_APPFONT ( 77 , 10 ) ; - Text [ en-US ] = "Light source" ; - }; -#define MA_Y13 MA_Y12 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y - Control DLG_FILTEREMBOSS_CTL_LIGHT - { - HelpID = HID_GRFFILTER_EMBOSS_LIGHT ; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , MA_Y13 ) ; - Size = MAP_APPFONT ( 77 , 60 ) ; - TabStop = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 194, 6 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 194, 23 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 194, 43 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 11fc55c685cf..a75e482d1142 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -140,7 +140,6 @@ IMPL_ABSTDLG_BASE(AbstractSvxMultiFileDialog_Impl); IMPL_ABSTDLG_BASE(AbstractSvxHpLinkDlg_Impl); IMPL_ABSTDLG_BASE(AbstractFmSearchDialog_Impl); IMPL_ABSTDLG_BASE(AbstractGraphicFilterDialog_Impl); -IMPL_ABSTDLG_BASE(oldAbstractGraphicFilterDialog_Impl); IMPL_ABSTDLG_BASE(AbstractSvxAreaTabDialog_Impl); IMPL_ABSTDLG_BASE(AbstractPasteDialog_Impl); IMPL_ABSTDLG_BASE(AbstractInsertObjectDialog_Impl); @@ -878,11 +877,6 @@ Graphic AbstractGraphicFilterDialog_Impl::GetFilteredGraphic( const Graphic& rGr return pDlg->GetFilteredGraphic( rGraphic, fScaleX, fScaleY ); } -Graphic oldAbstractGraphicFilterDialog_Impl::GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) -{ - return pDlg->GetFilteredGraphic( rGraphic, fScaleX, fScaleY ); -} - // AbstractSvxAreaTabDialog implementations just forwards everything to the dialog void AbstractSvxAreaTabDialog_Impl::SetCurPageId( sal_uInt16 nId ) { @@ -1505,11 +1499,10 @@ AbstractFmSearchDialog* AbstractDialogFactory_Impl::CreateFmSearchDialog(Window AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterEmboss (Window* pParent, const Graphic& rGraphic, - RECT_POINT eLightSource, - sal_uInt32) + RECT_POINT eLightSource) { - oldGraphicFilterDialog* pDlg = new GraphicFilterEmboss( pParent, rGraphic, eLightSource ); - return new oldAbstractGraphicFilterDialog_Impl( pDlg ); + GraphicFilterDialog* pDlg = new GraphicFilterEmboss( pParent, rGraphic, eLightSource ); + return new AbstractGraphicFilterDialog_Impl( pDlg ); } AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterPoster(Window* pParent, diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 58e921a680d1..4f90936e35e1 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -46,7 +46,6 @@ class SvxMultiFileDialog; class SvxHpLinkDlg; class FmSearchDialog; class Graphic; -class oldGraphicFilterDialog; class GraphicFilterDialog; class SvxAreaTabDialog; class InsertObjectDialog_Impl; @@ -443,12 +442,6 @@ class AbstractGraphicFilterDialog_Impl :public AbstractGraphicFilterDialog virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ); }; -class oldAbstractGraphicFilterDialog_Impl :public AbstractGraphicFilterDialog -{ - DECL_ABSTDLG_BASE(oldAbstractGraphicFilterDialog_Impl,oldGraphicFilterDialog) - virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ); -}; - class SvxAreaTabDialog; class AbstractSvxAreaTabDialog_Impl :public AbstractSvxAreaTabDialog { @@ -660,9 +653,8 @@ public: const ::std::vector< OUString >& _rContexts, sal_Int16 nInitialContext, const Link& lnkContextSupplier); - virtual AbstractGraphicFilterDialog * CreateGraphicFilterEmboss (Window* pParent, - const Graphic& rGraphic, RECT_POINT eLightSource, - sal_uInt32 nResId); + virtual AbstractGraphicFilterDialog * CreateGraphicFilterEmboss(Window* pParent, + const Graphic& rGraphic, RECT_POINT eLightSource); virtual AbstractGraphicFilterDialog * CreateGraphicFilterPoster(Window* pParent, const Graphic& rGraphic, sal_uInt16 nCount); virtual AbstractGraphicFilterDialog * CreateGraphicFilterSepia (Window* pParent, diff --git a/cui/source/inc/cuigrfflt.hxx b/cui/source/inc/cuigrfflt.hxx index 60304b714a08..60912c0c5e7e 100644 --- a/cui/source/inc/cuigrfflt.hxx +++ b/cui/source/inc/cuigrfflt.hxx @@ -32,54 +32,6 @@ #include <svx/dlgctrl.hxx> #include <svx/rectenum.hxx> -class oldGraphicFilterDialog : public ModalDialog -{ -private: - - class PreviewWindow : public Control - { - private: - - Graphic maGraphic; - - virtual void Paint( const Rectangle& rRect ); - - public: - - PreviewWindow( Window* pParent, const ResId& rResId ); - - void SetGraphic( const Graphic& rGraphic ); - }; - -private: - - Timer maTimer; - Link maModifyHdl; - Graphic maGraphic; - double mfScaleX; - double mfScaleY; - Size maSizePixel; - - DECL_LINK(ImplPreviewTimeoutHdl, void *); - DECL_LINK( ImplModifyHdl, void* p ); - -protected: - PreviewWindow maPreview; - OKButton maBtnOK; - CancelButton maBtnCancel; - HelpButton maBtnHelp; - FixedLine maFlParameter; - - const Link& GetModifyHdl() const { return maModifyHdl; } - const Size& GetGraphicSizePixel() const { return maSizePixel; } - -public: - - oldGraphicFilterDialog( Window* pParent, const ResId& rResId, const Graphic& rGraphic ); - - virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) = 0; -}; - class GraphicPreviewWindow : public Control { private: @@ -235,39 +187,29 @@ public: // - GraphicFilterEmboss - // ----------------------- -class GraphicFilterEmboss : public oldGraphicFilterDialog +class EmbossControl : public SvxRectCtl { private: + Link maModifyHdl; + virtual void MouseButtonDown( const MouseEvent& rEvt ); + virtual Size GetOptimalSize() const; +public: + EmbossControl(Window* pParent) + : SvxRectCtl(pParent) {} - class EmbossControl : public SvxRectCtl - { - private: - - Link maModifyHdl; - - virtual void MouseButtonDown( const MouseEvent& rEvt ); - - public: - - EmbossControl( Window* pParent, const ResId& rResId, RECT_POINT eRectPoint ) : - SvxRectCtl( pParent, rResId ) { SetActualRP( eRectPoint ); } - - void SetModifyHdl( const Link& rHdl ) { maModifyHdl = rHdl; } - }; + void SetModifyHdl( const Link& rHdl ) { maModifyHdl = rHdl; } +}; +class GraphicFilterEmboss : public GraphicFilterDialog +{ private: - - FixedText maFtLight; - EmbossControl maCtlLight; - + EmbossControl* mpCtlLight; public: - - GraphicFilterEmboss( Window* pParent, const Graphic& rGraphic, - RECT_POINT eLightSource ); - ~GraphicFilterEmboss(); + GraphicFilterEmboss( Window* pParent, const Graphic& rGraphic, + RECT_POINT eLightSource ); virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ); - RECT_POINT GetLightSource() const { return maCtlLight.GetActualRP(); } + RECT_POINT GetLightSource() const { return mpCtlLight->GetActualRP(); } }; #endif diff --git a/cui/source/inc/helpid.hrc b/cui/source/inc/helpid.hrc index 50e7475a7d4b..df92b8a170ed 100644 --- a/cui/source/inc/helpid.hrc +++ b/cui/source/inc/helpid.hrc @@ -224,7 +224,6 @@ #define HID_HYPERLINK_MARKWND_APPLY "CUI_HID_HYPERLINK_MARKWND_APPLY" #define HID_HYPERLINK_MARKWND_CLOSE "CUI_HID_HYPERLINK_MARKWND_CLOSE" #define HID_HYPERLINK_MARKWND_TREE "CUI_HID_HYPERLINK_MARKWND_TREE" -#define HID_GRFFILTER_EMBOSS_LIGHT "CUI_HID_GRFFILTER_EMBOSS_LIGHT" #define HID_LINKDLG_TABLB "CUI_HID_LINKDLG_TABLB" #define HID_MACRO_HEADERTABLISTBOX "CUI_HID_MACRO_HEADERTABLISTBOX" |