summaryrefslogtreecommitdiff
path: root/sd/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-11-15 12:49:18 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-11-15 12:52:00 +0000
commit2dec3d1d4f3e91ce005bb3b5362b826e7c7590c8 (patch)
treee7d4f4278cd003d740323ea4379edeb4ac2df56a /sd/source
parent9013a3a76dd773cf3f292267c9aac8046f19f0aa (diff)
convert 500th dialog (vectorize) to .ui
Change-Id: Ib1a8716091a16eb970c9f218f4a8e496de72ff51
Diffstat (limited to 'sd/source')
-rw-r--r--sd/source/ui/dlg/vectdlg.cxx114
-rw-r--r--sd/source/ui/dlg/vectdlg.src206
-rw-r--r--sd/source/ui/inc/vectdlg.hrc47
-rw-r--r--sd/source/ui/inc/vectdlg.hxx36
4 files changed, 69 insertions, 334 deletions
diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx
index de8ce7c2a0b0..5abbec90594d 100644
--- a/sd/source/ui/dlg/vectdlg.cxx
+++ b/sd/source/ui/dlg/vectdlg.cxx
@@ -26,49 +26,45 @@
#include "sdmod.hxx"
#include "sdiocmpt.hxx"
#include "vectdlg.hxx"
-#include "vectdlg.hrc"
#include <vcl/bmpacc.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/metaact.hxx>
#define VECTORIZE_MAX_EXTENT 512
-SdVectorizeDlg::SdVectorizeDlg(
- Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell ) :
- ModalDialog ( pParent, SdResId( DLG_VECTORIZE ) ),
- mpDocSh ( pDocShell ),
- aGrpSettings ( this, SdResId( GRP_SETTINGS ) ),
- aFtLayers ( this, SdResId( FT_LAYERS ) ),
- aNmLayers ( this, SdResId( NM_LAYERS ) ),
- aFtReduce ( this, SdResId( FT_REDUCE ) ),
- aMtReduce ( this, SdResId( MT_REDUCE ) ),
- aFtFillHoles ( this, SdResId( FT_FILLHOLES ) ),
- aMtFillHoles ( this, SdResId( MT_FILLHOLES ) ),
- aCbFillHoles ( this, SdResId( CB_FILLHOLES ) ),
- aFtOriginal ( this, SdResId( FT_ORIGINAL ) ),
- aBmpWin ( this, SdResId( CTL_BMP ) ),
- aFtVectorized ( this, SdResId( FT_VECTORIZED ) ),
- aMtfWin ( this, SdResId( CTL_WMF ) ),
- aGrpPrgs ( this, SdResId( GRP_PRGS ) ),
- aPrgs ( this, SdResId( WND_PRGS ) ),
- aBtnOK ( this, SdResId( BTN_OK ) ),
- aBtnCancel ( this, SdResId( BTN_CANCEL ) ),
- aBtnHelp ( this, SdResId( BTN_HELP ) ),
- aBtnPreview ( this, SdResId( BTN_PREVIEW ) ),
- aBmp ( rBmp )
+SdVectorizeDlg::SdVectorizeDlg(Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell)
+ : ModalDialog(pParent, "VectorizeDialog", "modules/sdraw/ui/vectorize.ui")
+ , mpDocSh(pDocShell)
+ , aBmp(rBmp)
{
- FreeResource();
-
- aBtnPreview.SetClickHdl( LINK( this, SdVectorizeDlg, ClickPreviewHdl ) );
- aBtnOK.SetClickHdl( LINK( this, SdVectorizeDlg, ClickOKHdl ) );
- aNmLayers.SetModifyHdl( LINK( this, SdVectorizeDlg, ModifyHdl ) );
- aMtReduce.SetModifyHdl( LINK( this, SdVectorizeDlg, ModifyHdl ) );
- aMtFillHoles.SetModifyHdl( LINK( this, SdVectorizeDlg, ModifyHdl ) );
- aCbFillHoles.SetToggleHdl( LINK( this, SdVectorizeDlg, ToggleHdl ) );
+ get(m_pNmLayers, "colors");
+ get(m_pMtReduce, "points");
+ get(m_pCbFillHoles, "fillholes");
+ get(m_pFtFillHoles, "tilesft");
+ get(m_pMtFillHoles, "tiles");
+ get(m_pBmpWin, "source");
+ get(m_pMtfWin, "vectorized");
+
+ Size aSize(LogicToPixel(Size(92, 100), MAP_APPFONT));
+ m_pBmpWin->set_width_request(aSize.Width());
+ m_pMtfWin->set_width_request(aSize.Width());
+ m_pBmpWin->set_height_request(aSize.Height());
+ m_pMtfWin->set_height_request(aSize.Height());
+
+ get(m_pPrgs, "progressbar");
+ get(m_pBtnPreview, "preview");
+ get(m_pBtnOK, "ok");
+
+ m_pBtnPreview->SetClickHdl( LINK( this, SdVectorizeDlg, ClickPreviewHdl ) );
+ m_pBtnOK->SetClickHdl( LINK( this, SdVectorizeDlg, ClickOKHdl ) );
+ m_pNmLayers->SetModifyHdl( LINK( this, SdVectorizeDlg, ModifyHdl ) );
+ m_pMtReduce->SetModifyHdl( LINK( this, SdVectorizeDlg, ModifyHdl ) );
+ m_pMtFillHoles->SetModifyHdl( LINK( this, SdVectorizeDlg, ModifyHdl ) );
+ m_pCbFillHoles->SetToggleHdl( LINK( this, SdVectorizeDlg, ToggleHdl ) );
// disable 3D border
- aBmpWin.SetBorderStyle(WINDOW_BORDER_MONO);
- aMtfWin.SetBorderStyle(WINDOW_BORDER_MONO);
+ m_pBmpWin->SetBorderStyle(WINDOW_BORDER_MONO);
+ m_pMtfWin->SetBorderStyle(WINDOW_BORDER_MONO);
LoadSettings();
InitPreviewBmp();
@@ -110,11 +106,11 @@ Rectangle SdVectorizeDlg::GetRect( const Size& rDispSize, const Size& rBmpSize )
void SdVectorizeDlg::InitPreviewBmp()
{
- const Rectangle aRect( GetRect( aBmpWin.GetSizePixel(), aBmp.GetSizePixel() ) );
+ const Rectangle aRect( GetRect( m_pBmpWin->GetSizePixel(), aBmp.GetSizePixel() ) );
aPreviewBmp = aBmp;
aPreviewBmp.Scale( aRect.GetSize() );
- aBmpWin.SetGraphic( aPreviewBmp );
+ m_pBmpWin->SetGraphic( aPreviewBmp );
}
Bitmap SdVectorizeDlg::GetPreparedBitmap( Bitmap& rBmp, Fraction& rScale )
@@ -131,7 +127,7 @@ Bitmap SdVectorizeDlg::GetPreparedBitmap( Bitmap& rBmp, Fraction& rScale )
else
rScale = Fraction( 1, 1 );
- aNew.ReduceColors( (sal_uInt16) aNmLayers.GetValue(), BMP_REDUCE_SIMPLE );
+ aNew.ReduceColors( (sal_uInt16) m_pNmLayers->GetValue(), BMP_REDUCE_SIMPLE );
return aNew;
}
@@ -139,7 +135,7 @@ Bitmap SdVectorizeDlg::GetPreparedBitmap( Bitmap& rBmp, Fraction& rScale )
void SdVectorizeDlg::Calculate( Bitmap& rBmp, GDIMetaFile& rMtf )
{
mpDocSh->SetWaitCursor( sal_True );
- aPrgs.SetValue( 0 );
+ m_pPrgs->SetValue( 0 );
Fraction aScale;
Bitmap aTmp( GetPreparedBitmap( rBmp, aScale ) );
@@ -147,9 +143,9 @@ void SdVectorizeDlg::Calculate( Bitmap& rBmp, GDIMetaFile& rMtf )
if( !!aTmp )
{
const Link aPrgsHdl( LINK( this, SdVectorizeDlg, ProgressHdl ) );
- aTmp.Vectorize( rMtf, (sal_uInt8) aMtReduce.GetValue(), BMP_VECTORIZE_OUTER | BMP_VECTORIZE_REDUCE_EDGES, &aPrgsHdl );
+ aTmp.Vectorize( rMtf, (sal_uInt8) m_pMtReduce->GetValue(), BMP_VECTORIZE_OUTER | BMP_VECTORIZE_REDUCE_EDGES, &aPrgsHdl );
- if( aCbFillHoles.IsChecked() )
+ if( m_pCbFillHoles->IsChecked() )
{
GDIMetaFile aNewMtf;
BitmapReadAccess* pRAcc = aTmp.AcquireReadAccess();
@@ -158,8 +154,8 @@ void SdVectorizeDlg::Calculate( Bitmap& rBmp, GDIMetaFile& rMtf )
{
const long nWidth = pRAcc->Width();
const long nHeight = pRAcc->Height();
- const long nTileX = static_cast<long>(aMtFillHoles.GetValue());
- const long nTileY = static_cast<long>(aMtFillHoles.GetValue());
+ const long nTileX = static_cast<long>(m_pMtFillHoles->GetValue());
+ const long nTileY = static_cast<long>(m_pMtFillHoles->GetValue());
const long nCountX = nWidth / nTileX;
const long nCountY = nHeight / nTileY;
const long nRestX = nWidth % nTileX;
@@ -205,7 +201,7 @@ void SdVectorizeDlg::Calculate( Bitmap& rBmp, GDIMetaFile& rMtf )
}
}
- aPrgs.SetValue( 0 );
+ m_pPrgs->SetValue( 0 );
mpDocSh->SetWaitCursor( sal_False );
}
@@ -251,22 +247,22 @@ void SdVectorizeDlg::AddTile( BitmapReadAccess* pRAcc, GDIMetaFile& rMtf,
IMPL_LINK( SdVectorizeDlg, ProgressHdl, void*, pData )
{
- aPrgs.SetValue( (sal_uInt16)(sal_uLong) pData );
+ m_pPrgs->SetValue( (sal_uInt16)(sal_uLong) pData );
return 0L;
}
IMPL_LINK_NOARG(SdVectorizeDlg, ClickPreviewHdl)
{
Calculate( aBmp, aMtf );
- aMtfWin.SetGraphic( aMtf );
- aBtnPreview.Disable();
+ m_pMtfWin->SetGraphic( aMtf );
+ m_pBtnPreview->Disable();
return 0L;
}
IMPL_LINK_NOARG(SdVectorizeDlg, ClickOKHdl)
{
- if( aBtnPreview.IsEnabled() )
+ if( m_pBtnPreview->IsEnabled() )
Calculate( aBmp, aMtf );
SaveSettings();
@@ -279,13 +275,13 @@ IMPL_LINK( SdVectorizeDlg, ToggleHdl, CheckBox*, pCb )
{
if( pCb->IsChecked() )
{
- aFtFillHoles.Enable();
- aMtFillHoles.Enable();
+ m_pFtFillHoles->Enable();
+ m_pMtFillHoles->Enable();
}
else
{
- aFtFillHoles.Disable();
- aMtFillHoles.Disable();
+ m_pFtFillHoles->Disable();
+ m_pMtFillHoles->Disable();
}
ModifyHdl( NULL );
@@ -295,7 +291,7 @@ IMPL_LINK( SdVectorizeDlg, ToggleHdl, CheckBox*, pCb )
IMPL_LINK_NOARG(SdVectorizeDlg, ModifyHdl)
{
- aBtnPreview.Enable();
+ m_pBtnPreview->Enable();
return 0L;
}
@@ -322,12 +318,12 @@ void SdVectorizeDlg::LoadSettings()
bFillHoles = sal_False;
}
- aNmLayers.SetValue( nLayers );
- aMtReduce.SetValue( nReduce );
- aMtFillHoles.SetValue( nFillHoles );
- aCbFillHoles.Check( bFillHoles );
+ m_pNmLayers->SetValue( nLayers );
+ m_pMtReduce->SetValue( nReduce );
+ m_pMtFillHoles->SetValue( nFillHoles );
+ m_pCbFillHoles->Check( bFillHoles );
- ToggleHdl( &aCbFillHoles );
+ ToggleHdl(m_pCbFillHoles);
}
void SdVectorizeDlg::SaveSettings() const
@@ -339,8 +335,8 @@ void SdVectorizeDlg::SaveSettings() const
if( xOStm.Is() )
{
SdIOCompat aCompat( *xOStm, STREAM_WRITE, 1 );
- *xOStm << (sal_uInt16) aNmLayers.GetValue() << (sal_uInt16) aMtReduce.GetValue();
- *xOStm << (sal_uInt16) aMtFillHoles.GetValue() << aCbFillHoles.IsChecked();
+ *xOStm << (sal_uInt16) m_pNmLayers->GetValue() << (sal_uInt16) m_pMtReduce->GetValue();
+ *xOStm << (sal_uInt16) m_pMtFillHoles->GetValue() << m_pCbFillHoles->IsChecked();
}
}
diff --git a/sd/source/ui/dlg/vectdlg.src b/sd/source/ui/dlg/vectdlg.src
deleted file mode 100644
index f95ea8c8a66f..000000000000
--- a/sd/source/ui/dlg/vectdlg.src
+++ /dev/null
@@ -1,206 +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 "app.hrc"
-#include "vectdlg.hrc"
-#include "helpids.h"
-
-ModalDialog DLG_VECTORIZE
-{
- HelpID = HID_VECTORIZE_DLG;
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 200, 237 ) ;
- Moveable = TRUE ;
- Closeable = TRUE ;
-
- Text [ en-US ] = "Convert to Polygon" ;
-
- OKButton BTN_OK
- {
- Pos = MAP_APPFONT ( 144 , 6 );
- Size = MAP_APPFONT ( 50 , 14 );
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
-
- CancelButton BTN_CANCEL
- {
- Pos = MAP_APPFONT ( 144 , 23 );
- Size = MAP_APPFONT ( 50 , 14 );
- TabStop = TRUE ;
- };
-
- HelpButton BTN_HELP
- {
- Pos = MAP_APPFONT ( 144 , 43 );
- Size = MAP_APPFONT ( 50 , 14 );
- TabStop = TRUE ;
- };
-
- PushButton BTN_PREVIEW
- {
- HelpID = "sd:PushButton:DLG_VECTORIZE:BTN_PREVIEW";
- Pos = MAP_APPFONT ( 144 , 63 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Preview" ;
- };
-
- FixedLine GRP_SETTINGS
- {
- Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 132 , 8 ) ;
- Text [ en-US ] = "Settings" ;
- };
-
- FixedText FT_LAYERS
- {
- Pos = MAP_APPFONT ( 12 , 14 );
- Size = MAP_APPFONT ( 79 , 12 );
- Text [ en-US ] = "Number of colors:";
- };
-
- NumericField NM_LAYERS
- {
- HelpID = "sd:NumericField:DLG_VECTORIZE:NM_LAYERS";
- Border = TRUE ;
- Pos = MAP_APPFONT ( 92 , 14 ) ;
- Size = MAP_APPFONT ( 40 , 12 ) ;
- TabStop = TRUE ;
- Repeat = TRUE ;
- Spin = TRUE ;
- Minimum = 8;
- Maximum = 32 ;
- StrictFormat = TRUE ;
- First = 8;
- Last = 32 ;
- SpinSize = 1 ;
- };
-
- FixedText FT_REDUCE
- {
- Pos = MAP_APPFONT ( 12 , 29 );
- Size = MAP_APPFONT ( 79 , 12 );
- Text [ en-US ] = "Point reduction:";
- };
-
- MetricField MT_REDUCE
- {
- HelpID = "sd:MetricField:DLG_VECTORIZE:MT_REDUCE";
- Border = TRUE ;
- Pos = MAP_APPFONT ( 92 , 29 ) ;
- Size = MAP_APPFONT ( 40 , 12 ) ;
- TabStop = TRUE ;
- Repeat = TRUE ;
- Spin = TRUE ;
- Minimum = 0;
- Maximum = 32 ;
- StrictFormat = TRUE ;
- First = 0;
- Last = 32 ;
- SpinSize = 1 ;
- Unit = FUNIT_CUSTOM ;
- CustomUnitText [ en-US ] = " Pixel" ;
- };
-
- CheckBox CB_FILLHOLES
- {
- HelpID = "sd:CheckBox:DLG_VECTORIZE:CB_FILLHOLES";
- Pos = MAP_APPFONT ( 12 , 44 ) ;
- Size = MAP_APPFONT ( 79 , 12 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "~Fill holes:";
- };
-
- FixedText FT_FILLHOLES
- {
- Pos = MAP_APPFONT ( 12 , 59 );
- Size = MAP_APPFONT ( 79 , 12 );
- Text [ en-US ] = "Tile size:";
- };
-
- MetricField MT_FILLHOLES
- {
- HelpID = "sd:MetricField:DLG_VECTORIZE:MT_FILLHOLES";
- Border = TRUE ;
- Pos = MAP_APPFONT ( 92 , 59 ) ;
- Size = MAP_APPFONT ( 40 , 12 ) ;
- TabStop = TRUE ;
- Repeat = TRUE ;
- Spin = TRUE ;
- Minimum = 8;
- Maximum = 128;
- StrictFormat = TRUE ;
- First = 8;
- Last = 128;
- SpinSize = 1;
- Unit = FUNIT_CUSTOM ;
- CustomUnitText [ en-US ] = " Pixel" ;
- };
-
- FixedText FT_ORIGINAL
- {
- Pos = MAP_APPFONT ( 6 , 87 );
- Size = MAP_APPFONT ( 92 , 12 );
- Text [ en-US ] = "Source picture:";
- };
-
- Control CTL_BMP
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 6, 98 ) ;
- Size = MAP_APPFONT ( 92, 100 ) ;
- Text [ en-US ] = "Source picture" ;
- };
-
- FixedText FT_VECTORIZED
- {
- Pos = MAP_APPFONT ( 101 , 87 );
- Size = MAP_APPFONT ( 92 , 12 );
- Text [ en-US ] = "Vectorized image:";
- };
-
- Control CTL_WMF
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 101, 98 ) ;
- Size = MAP_APPFONT ( 93, 100 ) ;
- Text [ en-US ] = "Vectorized image" ;
- };
-
- FixedText GRP_PRGS
- {
- Pos = MAP_APPFONT ( 6, 204 );
- Size = MAP_APPFONT( 188, 8 );
- Text [ en-US ] = "Progress";
- };
-
- Window WND_PRGS
- {
- Border = TRUE ;
- SVLook = TRUE ;
- Pos = MAP_APPFONT ( 6, 215 ) ;
- Size = MAP_APPFONT ( 188, 10 ) ;
- Text [ en-US ] = "Progress" ;
- };
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/vectdlg.hrc b/sd/source/ui/inc/vectdlg.hrc
deleted file mode 100644
index 2ea70d2d6083..000000000000
--- a/sd/source/ui/inc/vectdlg.hrc
+++ /dev/null
@@ -1,47 +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 .
- */
-
-#define DLG_VECTORIZE 654
-
-#define BTN_OK 1
-#define BTN_CANCEL 1
-#define BTN_HELP 1
-
-#define BTN_PREVIEW 1
-
-#define GRP_SETTINGS 1
-#define GRP_PRGS 2
-
-#define CTL_BMP 1
-#define CTL_WMF 2
-#define WND_PRGS 3
-
-#define FT_LAYERS 1
-#define FT_REDUCE 3
-#define FT_FILLHOLES 4
-#define FT_ORIGINAL 5
-#define FT_VECTORIZED 6
-
-#define NM_LAYERS 1
-#define MT_REDUCE 3
-#define MT_FILLHOLES 4
-
-#define CB_FILLHOLES 1
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/vectdlg.hxx b/sd/source/ui/inc/vectdlg.hxx
index f05422f2b8c4..3429dfd73cf9 100644
--- a/sd/source/ui/inc/vectdlg.hxx
+++ b/sd/source/ui/inc/vectdlg.hxx
@@ -43,28 +43,20 @@ class DrawDocShell;
class SdVectorizeDlg : public ModalDialog
{
::sd::DrawDocShell * mpDocSh;
- FixedLine aGrpSettings;
- FixedText aFtLayers;
- NumericField aNmLayers;
- FixedText aFtReduce;
- MetricField aMtReduce;
- FixedText aFtFillHoles;
- MetricField aMtFillHoles;
- CheckBox aCbFillHoles;
-
- FixedText aFtOriginal;
- GraphCtrl aBmpWin;
-
- FixedText aFtVectorized;
- GraphCtrl aMtfWin;
-
- FixedText aGrpPrgs;
- ProgressBar aPrgs;
-
- OKButton aBtnOK;
- CancelButton aBtnCancel;
- HelpButton aBtnHelp;
- PushButton aBtnPreview;
+ NumericField* m_pNmLayers;
+ MetricField* m_pMtReduce;
+ FixedText* m_pFtFillHoles;
+ MetricField* m_pMtFillHoles;
+ CheckBox* m_pCbFillHoles;
+
+ GraphCtrl* m_pBmpWin;
+
+ GraphCtrl* m_pMtfWin;
+
+ ProgressBar* m_pPrgs;
+
+ OKButton* m_pBtnOK;
+ PushButton* m_pBtnPreview;
Bitmap aBmp;
Bitmap aPreviewBmp;