summaryrefslogtreecommitdiff
path: root/sd/source/ui/dlg/copydlg.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/ui/dlg/copydlg.cxx')
-rw-r--r--sd/source/ui/dlg/copydlg.cxx192
1 files changed, 88 insertions, 104 deletions
diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx
index b6a674c08822..caf6956b87ee 100644
--- a/sd/source/ui/dlg/copydlg.cxx
+++ b/sd/source/ui/dlg/copydlg.cxx
@@ -33,7 +33,6 @@
#include "sdattr.hxx"
-#include "copydlg.hrc"
#include "View.hxx"
#include "sdresid.hxx"
#include "drawdoc.hxx"
@@ -43,62 +42,47 @@ namespace sd {
#define TOKEN (sal_Unicode(';'))
-CopyDlg::CopyDlg(
- ::Window* pWindow,
- const SfxItemSet& rInAttrs,
- const XColorListRef &pColList,
- ::sd::View* pInView )
- : SfxModalDialog ( pWindow, SdResId( DLG_COPY ) ),
- maFtCopies ( this, SdResId( FT_COPIES ) ),
- maNumFldCopies ( this, SdResId( NUM_FLD_COPIES ) ),
- maBtnSetViewData ( this, SdResId( BTN_SET_VIEWDATA ) ),
- maGrpMovement ( this, SdResId( GRP_MOVEMENT ) ),
- maFtMoveX ( this, SdResId( FT_MOVE_X ) ),
- maMtrFldMoveX ( this, SdResId( MTR_FLD_MOVE_X ) ),
- maFtMoveY ( this, SdResId( FT_MOVE_Y ) ),
- maMtrFldMoveY ( this, SdResId( MTR_FLD_MOVE_Y ) ),
- maFtAngle ( this, SdResId( FT_ANGLE ) ),
- maMtrFldAngle ( this, SdResId( MTR_FLD_ANGLE ) ),
- maGrpEnlargement ( this, SdResId( GRP_ENLARGEMENT ) ),
- maFtWidth ( this, SdResId( FT_WIDTH ) ),
- maMtrFldWidth ( this, SdResId( MTR_FLD_WIDTH ) ),
- maFtHeight ( this, SdResId( FT_HEIGHT ) ),
- maMtrFldHeight ( this, SdResId( MTR_FLD_HEIGHT ) ),
- maGrpColor ( this, SdResId( GRP_COLOR ) ),
- maFtStartColor ( this, SdResId( FT_START_COLOR ) ),
- maLbStartColor ( this, SdResId( LB_START_COLOR ) ),
- maFtEndColor ( this, SdResId( FT_END_COLOR ) ),
- maLbEndColor ( this, SdResId( LB_END_COLOR ) ),
- maBtnOK ( this, SdResId( BTN_OK ) ),
- maBtnCancel ( this, SdResId( BTN_CANCEL ) ),
- maBtnHelp ( this, SdResId( BTN_HELP ) ),
- maBtnSetDefault ( this, SdResId( BTN_SET_DEFAULT ) ),
- mrOutAttrs ( rInAttrs ),
- mpColorList ( pColList ),
- maUIScale(pInView->GetDoc().GetUIScale()),
- mpView ( pInView )
+CopyDlg::CopyDlg(::Window* pWindow, const SfxItemSet& rInAttrs,
+ const XColorListRef &pColList, ::sd::View* pInView)
+ : SfxModalDialog(pWindow, "DuplicateDialog", "modules/sdraw/ui/copydlg.ui")
+ , mrOutAttrs(rInAttrs)
+ , mpColorList(pColList)
+ , maUIScale(pInView->GetDoc().GetUIScale())
+ , mpView(pInView)
{
- FreeResource();
+ get(m_pNumFldCopies, "copies");
+ get(m_pBtnSetViewData, "viewdata");
+ get(m_pMtrFldMoveX, "x");
+ get(m_pMtrFldMoveY, "y");
+ get(m_pMtrFldAngle, "angle");
+ m_pMtrFldAngle->SetUnit(FUNIT_CUSTOM);
+ m_pMtrFldAngle->SetCustomUnitText(get<FixedText>("degrees")->GetText());
+ get(m_pMtrFldWidth, "width");
+ get(m_pMtrFldHeight, "height");
+ get(m_pLbStartColor, "start");
+ get(m_pFtEndColor, "endlabel");
+ get(m_pLbEndColor, "end");
+ get(m_pBtnSetDefault, "default");
// Set up the view data button (image and accessible name).
- maBtnSetViewData.SetAccessibleName (maBtnSetViewData.GetQuickHelpText());
+ m_pBtnSetViewData->SetAccessibleName (m_pBtnSetViewData->GetQuickHelpText());
// color tables
DBG_ASSERT( mpColorList.is(), "No colortable available !" );
- maLbStartColor.Fill( mpColorList );
- maLbEndColor.CopyEntries( maLbStartColor );
+ m_pLbStartColor->Fill( mpColorList );
+ m_pLbEndColor->CopyEntries( *m_pLbStartColor );
- maLbStartColor.SetSelectHdl( LINK( this, CopyDlg, SelectColorHdl ) );
- maBtnSetViewData.SetClickHdl( LINK( this, CopyDlg, SetViewData ) );
- maBtnSetDefault.SetClickHdl( LINK( this, CopyDlg, SetDefault ) );
+ m_pLbStartColor->SetSelectHdl( LINK( this, CopyDlg, SelectColorHdl ) );
+ m_pBtnSetViewData->SetClickHdl( LINK( this, CopyDlg, SetViewData ) );
+ m_pBtnSetDefault->SetClickHdl( LINK( this, CopyDlg, SetDefault ) );
FieldUnit eFUnit( SfxModule::GetCurrentFieldUnit() );
- SetFieldUnit( maMtrFldMoveX, eFUnit, sal_True );
- SetFieldUnit( maMtrFldMoveY, eFUnit, sal_True );
- SetFieldUnit( maMtrFldWidth, eFUnit, sal_True );
- SetFieldUnit( maMtrFldHeight, eFUnit, sal_True );
+ SetFieldUnit( *m_pMtrFldMoveX, eFUnit, sal_True );
+ SetFieldUnit( *m_pMtrFldMoveY, eFUnit, sal_True );
+ SetFieldUnit( *m_pMtrFldWidth, eFUnit, sal_True );
+ SetFieldUnit( *m_pMtrFldHeight, eFUnit, sal_True );
Reset();
}
@@ -107,28 +91,28 @@ CopyDlg::~CopyDlg()
{
String& rStr = GetExtraData();
- rStr = OUString::number(maNumFldCopies.GetValue());
+ rStr = OUString::number(m_pNumFldCopies->GetValue());
rStr.Append( TOKEN );
- rStr += OUString::number(maMtrFldMoveX.GetValue());
+ rStr += OUString::number(m_pMtrFldMoveX->GetValue());
rStr.Append( TOKEN );
- rStr += OUString::number(maMtrFldMoveY.GetValue());
+ rStr += OUString::number(m_pMtrFldMoveY->GetValue());
rStr.Append( TOKEN );
- rStr += OUString::number(maMtrFldAngle.GetValue());
+ rStr += OUString::number(m_pMtrFldAngle->GetValue());
rStr.Append( TOKEN );
- rStr += OUString::number(maMtrFldWidth.GetValue());
+ rStr += OUString::number(m_pMtrFldWidth->GetValue());
rStr.Append( TOKEN );
- rStr += OUString::number(maMtrFldHeight.GetValue());
+ rStr += OUString::number(m_pMtrFldHeight->GetValue());
rStr.Append( TOKEN );
- rStr += OUString::valueOf( (long)maLbStartColor.GetSelectEntryColor().GetColor() );
+ rStr += OUString::valueOf( (long)m_pLbStartColor->GetSelectEntryColor().GetColor() );
rStr.Append( TOKEN );
- rStr += OUString::valueOf( (long)maLbEndColor.GetSelectEntryColor().GetColor() );
+ rStr += OUString::valueOf( (long)m_pLbEndColor->GetSelectEntryColor().GetColor() );
}
/**
@@ -142,75 +126,75 @@ void CopyDlg::Reset()
if (comphelper::string::getTokenCount(aStr, TOKEN) < 8)
{
if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_NUMBER, sal_True, &pPoolItem ) )
- maNumFldCopies.SetValue( ( ( const SfxUInt16Item* ) pPoolItem )->GetValue() );
+ m_pNumFldCopies->SetValue( ( ( const SfxUInt16Item* ) pPoolItem )->GetValue() );
else
- maNumFldCopies.SetValue( 1L );
+ m_pNumFldCopies->SetValue( 1L );
long nMoveX = 500L;
if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_X, sal_True, &pPoolItem ) )
nMoveX = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() );
- SetMetricValue( maMtrFldMoveX, Fraction(nMoveX) / maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldMoveX, Fraction(nMoveX) / maUIScale, SFX_MAPUNIT_100TH_MM);
long nMoveY = 500L;
if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_Y, sal_True, &pPoolItem ) )
nMoveY = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() );
- SetMetricValue( maMtrFldMoveY, Fraction(nMoveY) / maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldMoveY, Fraction(nMoveY) / maUIScale, SFX_MAPUNIT_100TH_MM);
if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_ANGLE, sal_True, &pPoolItem ) )
- maMtrFldAngle.SetValue( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() );
+ m_pMtrFldAngle->SetValue( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() );
else
- maMtrFldAngle.SetValue( 0L );
+ m_pMtrFldAngle->SetValue( 0L );
long nWidth = 0L;
if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_WIDTH, sal_True, &pPoolItem ) )
nWidth = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() );
- SetMetricValue( maMtrFldWidth, Fraction(nWidth) / maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldWidth, Fraction(nWidth) / maUIScale, SFX_MAPUNIT_100TH_MM);
long nHeight = 0L;
if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_HEIGHT, sal_True, &pPoolItem ) )
nHeight = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() );
- SetMetricValue( maMtrFldHeight, Fraction(nHeight) / maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldHeight, Fraction(nHeight) / maUIScale, SFX_MAPUNIT_100TH_MM);
if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, sal_True, &pPoolItem ) )
{
Color aColor = ( ( const XColorItem* ) pPoolItem )->GetColorValue();
- maLbStartColor.SelectEntry( aColor );
- maLbEndColor.SelectEntry( aColor );
+ m_pLbStartColor->SelectEntry( aColor );
+ m_pLbEndColor->SelectEntry( aColor );
}
else
{
- maLbStartColor.SetNoSelection();
- maLbEndColor.SetNoSelection();
- maLbEndColor.Disable();
- maFtEndColor.Disable();
+ m_pLbStartColor->SetNoSelection();
+ m_pLbEndColor->SetNoSelection();
+ m_pLbEndColor->Disable();
+ m_pFtEndColor->Disable();
}
}
else
{
long nTmp;
nTmp = (long)aStr.GetToken( 0, TOKEN ).ToInt32();
- maNumFldCopies.SetValue( nTmp );
+ m_pNumFldCopies->SetValue( nTmp );
nTmp = (long)aStr.GetToken( 1, TOKEN ).ToInt32();
- maMtrFldMoveX.SetValue( nTmp );
+ m_pMtrFldMoveX->SetValue( nTmp );
nTmp = (long)aStr.GetToken( 2, TOKEN ).ToInt32();
- maMtrFldMoveY.SetValue( nTmp );
+ m_pMtrFldMoveY->SetValue( nTmp );
nTmp = (long)aStr.GetToken( 3, TOKEN ).ToInt32();
- maMtrFldAngle.SetValue( nTmp );
+ m_pMtrFldAngle->SetValue( nTmp );
nTmp = (long)aStr.GetToken( 4, TOKEN ).ToInt32();
- maMtrFldWidth.SetValue( nTmp );
+ m_pMtrFldWidth->SetValue( nTmp );
nTmp = (long)aStr.GetToken( 5, TOKEN ).ToInt32();
- maMtrFldHeight.SetValue( nTmp );
+ m_pMtrFldHeight->SetValue( nTmp );
nTmp = (long)aStr.GetToken( 6, TOKEN ).ToInt32();
- maLbStartColor.SelectEntry( Color( nTmp ) );
+ m_pLbStartColor->SelectEntry( Color( nTmp ) );
nTmp = (long)aStr.GetToken( 7, TOKEN ).ToInt32();
- maLbEndColor.SelectEntry( Color( nTmp ) );
+ m_pLbEndColor->SelectEntry( Color( nTmp ) );
}
}
@@ -220,28 +204,28 @@ void CopyDlg::Reset()
*/
void CopyDlg::GetAttr( SfxItemSet& rOutAttrs )
{
- long nMoveX = Fraction( GetCoreValue( maMtrFldMoveX, SFX_MAPUNIT_100TH_MM) ) * maUIScale;
- long nMoveY = Fraction( GetCoreValue( maMtrFldMoveY, SFX_MAPUNIT_100TH_MM) ) * maUIScale;
- long nHeight = Fraction( GetCoreValue( maMtrFldHeight, SFX_MAPUNIT_100TH_MM) ) * maUIScale;
- long nWidth = Fraction( GetCoreValue( maMtrFldWidth, SFX_MAPUNIT_100TH_MM) ) * maUIScale;
+ long nMoveX = Fraction( GetCoreValue( *m_pMtrFldMoveX, SFX_MAPUNIT_100TH_MM) ) * maUIScale;
+ long nMoveY = Fraction( GetCoreValue( *m_pMtrFldMoveY, SFX_MAPUNIT_100TH_MM) ) * maUIScale;
+ long nHeight = Fraction( GetCoreValue( *m_pMtrFldHeight, SFX_MAPUNIT_100TH_MM) ) * maUIScale;
+ long nWidth = Fraction( GetCoreValue( *m_pMtrFldWidth, SFX_MAPUNIT_100TH_MM) ) * maUIScale;
- rOutAttrs.Put( SfxUInt16Item( ATTR_COPY_NUMBER, (sal_uInt16) maNumFldCopies.GetValue() ) );
+ rOutAttrs.Put( SfxUInt16Item( ATTR_COPY_NUMBER, (sal_uInt16) m_pNumFldCopies->GetValue() ) );
rOutAttrs.Put( SfxInt32Item( ATTR_COPY_MOVE_X, nMoveX ) );
rOutAttrs.Put( SfxInt32Item( ATTR_COPY_MOVE_Y, nMoveY ) );
- rOutAttrs.Put( SfxInt32Item( ATTR_COPY_ANGLE, static_cast<sal_Int32>(maMtrFldAngle.GetValue()) ) );
+ rOutAttrs.Put( SfxInt32Item( ATTR_COPY_ANGLE, static_cast<sal_Int32>(m_pMtrFldAngle->GetValue()) ) );
rOutAttrs.Put( SfxInt32Item( ATTR_COPY_WIDTH, nWidth ) );
rOutAttrs.Put( SfxInt32Item( ATTR_COPY_HEIGHT, nHeight ) );
- if( maLbStartColor.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ if( m_pLbStartColor->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
{
- XColorItem aXColorItem( ATTR_COPY_START_COLOR, maLbStartColor.GetSelectEntry(),
- maLbStartColor.GetSelectEntryColor() );
+ XColorItem aXColorItem( ATTR_COPY_START_COLOR, m_pLbStartColor->GetSelectEntry(),
+ m_pLbStartColor->GetSelectEntryColor() );
rOutAttrs.Put( aXColorItem );
}
- if( maLbEndColor.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ if( m_pLbEndColor->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
{
- XColorItem aXColorItem( ATTR_COPY_END_COLOR, maLbEndColor.GetSelectEntry(),
- maLbEndColor.GetSelectEntryColor() );
+ XColorItem aXColorItem( ATTR_COPY_END_COLOR, m_pLbEndColor->GetSelectEntry(),
+ m_pLbEndColor->GetSelectEntryColor() );
rOutAttrs.Put( aXColorItem );
}
}
@@ -251,14 +235,14 @@ void CopyDlg::GetAttr( SfxItemSet& rOutAttrs )
*/
IMPL_LINK_NOARG(CopyDlg, SelectColorHdl)
{
- sal_uInt16 nPos = maLbStartColor.GetSelectEntryPos();
+ sal_uInt16 nPos = m_pLbStartColor->GetSelectEntryPos();
if( nPos != LISTBOX_ENTRY_NOTFOUND &&
- !maLbEndColor.IsEnabled() )
+ !m_pLbEndColor->IsEnabled() )
{
- maLbEndColor.SelectEntryPos( nPos );
- maLbEndColor.Enable();
- maFtEndColor.Enable();
+ m_pLbEndColor->SelectEntryPos( nPos );
+ m_pLbEndColor->Enable();
+ m_pFtEndColor->Enable();
}
return 0;
}
@@ -270,9 +254,9 @@ IMPL_LINK_NOARG(CopyDlg, SetViewData)
{
Rectangle aRect = mpView->GetAllMarkedRect();
- SetMetricValue( maMtrFldMoveX, Fraction( aRect.GetWidth() ) /
+ SetMetricValue( *m_pMtrFldMoveX, Fraction( aRect.GetWidth() ) /
maUIScale, SFX_MAPUNIT_100TH_MM);
- SetMetricValue( maMtrFldMoveY, Fraction( aRect.GetHeight() ) /
+ SetMetricValue( *m_pMtrFldMoveY, Fraction( aRect.GetHeight() ) /
maUIScale, SFX_MAPUNIT_100TH_MM);
// sets color attribute
@@ -280,7 +264,7 @@ IMPL_LINK_NOARG(CopyDlg, SetViewData)
if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, sal_True, &pPoolItem ) )
{
Color aColor = ( ( const XColorItem* ) pPoolItem )->GetColorValue();
- maLbStartColor.SelectEntry( aColor );
+ m_pLbStartColor->SelectEntry( aColor );
}
return 0;
@@ -291,24 +275,24 @@ IMPL_LINK_NOARG(CopyDlg, SetViewData)
*/
IMPL_LINK_NOARG(CopyDlg, SetDefault)
{
- maNumFldCopies.SetValue( 1L );
+ m_pNumFldCopies->SetValue( 1L );
long nValue = 500L;
- SetMetricValue( maMtrFldMoveX, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM);
- SetMetricValue( maMtrFldMoveY, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldMoveX, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldMoveY, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM);
nValue = 0L;
- maMtrFldAngle.SetValue( nValue );
- SetMetricValue( maMtrFldWidth, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM);
- SetMetricValue( maMtrFldHeight, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM);
+ m_pMtrFldAngle->SetValue( nValue );
+ SetMetricValue( *m_pMtrFldWidth, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldHeight, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM);
// set color attribute
const SfxPoolItem* pPoolItem = NULL;
if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, sal_True, &pPoolItem ) )
{
Color aColor = ( ( const XColorItem* ) pPoolItem )->GetColorValue();
- maLbStartColor.SelectEntry( aColor );
- maLbEndColor.SelectEntry( aColor );
+ m_pLbStartColor->SelectEntry( aColor );
+ m_pLbEndColor->SelectEntry( aColor );
}
return 0;