2010-10-12 08:57:08 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2009-10-30 18:36:06 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2009-10-30 18:36:06 -05:00
|
|
|
*
|
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
|
|
|
*
|
|
|
|
* This file is part of OpenOffice.org.
|
|
|
|
*
|
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include <sfx2/basedlgs.hxx>
|
2009-11-02 13:49:14 -06:00
|
|
|
#include <cuires.hrc>
|
2009-10-30 18:36:06 -05:00
|
|
|
#include "dstribut.hxx"
|
|
|
|
#include "dstribut.hrc"
|
2009-11-02 13:49:14 -06:00
|
|
|
#include <svx/dialogs.hrc>
|
2009-10-30 18:36:06 -05:00
|
|
|
#include <svx/svddef.hxx>
|
2009-11-02 13:49:14 -06:00
|
|
|
#include <dialmgr.hxx>
|
2009-10-30 18:36:06 -05:00
|
|
|
#include <tools/shl.hxx>
|
|
|
|
|
2011-01-14 05:41:27 -06:00
|
|
|
static sal_uInt16 pRanges[] =
|
2009-10-30 18:36:06 -05:00
|
|
|
{
|
|
|
|
SDRATTR_MEASURE_FIRST,
|
|
|
|
SDRATTR_MEASURE_LAST,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Dialog
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
SvxDistributeDialog::SvxDistributeDialog(
|
|
|
|
Window* pParent,
|
|
|
|
const SfxItemSet& rInAttrs,
|
|
|
|
SvxDistributeHorizontal eHor,
|
|
|
|
SvxDistributeVertical eVer)
|
|
|
|
: SfxSingleTabDialog(pParent, rInAttrs, RID_SVXPAGE_DISTRIBUTE ),
|
|
|
|
mpPage(0L)
|
|
|
|
{
|
|
|
|
mpPage = new SvxDistributePage(this, rInAttrs, eHor, eVer);
|
|
|
|
SetTabPage(mpPage);
|
|
|
|
SetText(mpPage->GetText());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Dtor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
SvxDistributeDialog::~SvxDistributeDialog()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Tabpage
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
SvxDistributePage::SvxDistributePage(
|
|
|
|
Window* pWindow,
|
|
|
|
const SfxItemSet& rInAttrs,
|
|
|
|
SvxDistributeHorizontal eHor,
|
|
|
|
SvxDistributeVertical eVer)
|
2009-11-02 13:49:14 -06:00
|
|
|
: SvxTabPage(pWindow, CUI_RES(RID_SVXPAGE_DISTRIBUTE), rInAttrs),
|
2009-10-30 18:36:06 -05:00
|
|
|
meDistributeHor(eHor),
|
|
|
|
meDistributeVer(eVer),
|
2010-11-13 02:33:43 -06:00
|
|
|
maFlHorizontal (this, CUI_RES(FL_HORIZONTAL )),
|
2009-11-02 13:49:14 -06:00
|
|
|
maBtnHorNone (this, CUI_RES(BTN_HOR_NONE )),
|
|
|
|
maBtnHorLeft (this, CUI_RES(BTN_HOR_LEFT )),
|
2010-11-13 02:33:43 -06:00
|
|
|
maBtnHorCenter (this, CUI_RES(BTN_HOR_CENTER )),
|
2009-11-02 13:49:14 -06:00
|
|
|
maBtnHorDistance (this, CUI_RES(BTN_HOR_DISTANCE )),
|
2010-11-13 02:33:43 -06:00
|
|
|
maBtnHorRight (this, CUI_RES(BTN_HOR_RIGHT )),
|
2009-11-02 13:49:14 -06:00
|
|
|
maHorLow (this, CUI_RES(IMG_HOR_LOW )),
|
2010-11-13 02:33:43 -06:00
|
|
|
maHorCenter (this, CUI_RES(IMG_HOR_CENTER )),
|
2009-11-02 13:49:14 -06:00
|
|
|
maHorDistance (this, CUI_RES(IMG_HOR_DISTANCE )),
|
|
|
|
maHorHigh (this, CUI_RES(IMG_HOR_HIGH )),
|
|
|
|
maFlVertical (this, CUI_RES(FL_VERTICAL )),
|
|
|
|
maBtnVerNone (this, CUI_RES(BTN_VER_NONE )),
|
|
|
|
maBtnVerTop (this, CUI_RES(BTN_VER_TOP )),
|
2010-11-13 02:33:43 -06:00
|
|
|
maBtnVerCenter (this, CUI_RES(BTN_VER_CENTER )),
|
2009-11-02 13:49:14 -06:00
|
|
|
maBtnVerDistance (this, CUI_RES(BTN_VER_DISTANCE )),
|
2010-11-13 02:33:43 -06:00
|
|
|
maBtnVerBottom (this, CUI_RES(BTN_VER_BOTTOM )),
|
|
|
|
maVerLow (this, CUI_RES(IMG_VER_LOW )),
|
|
|
|
maVerCenter (this, CUI_RES(IMG_VER_CENTER )),
|
|
|
|
maVerDistance (this, CUI_RES(IMG_VER_DISTANCE )),
|
|
|
|
maVerHigh (this, CUI_RES(IMG_VER_HIGH ))
|
2009-10-30 18:36:06 -05:00
|
|
|
{
|
|
|
|
FreeResource();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Dtor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
SvxDistributePage::~SvxDistributePage()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* create the tabpage
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
SfxTabPage* SvxDistributePage::Create(Window* pWindow, const SfxItemSet& rAttrs,
|
|
|
|
SvxDistributeHorizontal eHor, SvxDistributeVertical eVer)
|
|
|
|
{
|
|
|
|
return(new SvxDistributePage(pWindow, rAttrs, eHor, eVer));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|*
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2011-01-14 05:41:27 -06:00
|
|
|
sal_uInt16* SvxDistributePage::GetRanges()
|
2009-10-30 18:36:06 -05:00
|
|
|
{
|
|
|
|
return(pRanges);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|*
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void SvxDistributePage::PointChanged(Window* /*pWindow*/, RECT_POINT /*eRP*/)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* read the delivered Item-Set
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2010-12-11 15:45:31 -06:00
|
|
|
void SvxDistributePage::Reset(const SfxItemSet& )
|
2009-10-30 18:36:06 -05:00
|
|
|
{
|
2011-01-14 05:41:27 -06:00
|
|
|
maBtnHorNone.SetState(sal_False);
|
|
|
|
maBtnHorLeft.SetState(sal_False);
|
|
|
|
maBtnHorCenter.SetState(sal_False);
|
|
|
|
maBtnHorDistance.SetState(sal_False);
|
|
|
|
maBtnHorRight.SetState(sal_False);
|
2009-10-30 18:36:06 -05:00
|
|
|
|
|
|
|
switch(meDistributeHor)
|
|
|
|
{
|
2011-01-14 05:41:27 -06:00
|
|
|
case SvxDistributeHorizontalNone : maBtnHorNone.SetState(sal_True); break;
|
|
|
|
case SvxDistributeHorizontalLeft : maBtnHorLeft.SetState(sal_True); break;
|
|
|
|
case SvxDistributeHorizontalCenter : maBtnHorCenter.SetState(sal_True); break;
|
|
|
|
case SvxDistributeHorizontalDistance : maBtnHorDistance.SetState(sal_True); break;
|
2011-03-12 23:58:22 -06:00
|
|
|
case SvxDistributeHorizontalRight : maBtnHorRight.SetState(sal_True); break;
|
2009-10-30 18:36:06 -05:00
|
|
|
}
|
|
|
|
|
2011-01-14 05:41:27 -06:00
|
|
|
maBtnVerNone.SetState(sal_False);
|
|
|
|
maBtnVerTop.SetState(sal_False);
|
|
|
|
maBtnVerCenter.SetState(sal_False);
|
|
|
|
maBtnVerDistance.SetState(sal_False);
|
|
|
|
maBtnVerBottom.SetState(sal_False);
|
2009-10-30 18:36:06 -05:00
|
|
|
|
|
|
|
switch(meDistributeVer)
|
|
|
|
{
|
2011-01-14 05:41:27 -06:00
|
|
|
case SvxDistributeVerticalNone : maBtnVerNone.SetState(sal_True); break;
|
|
|
|
case SvxDistributeVerticalTop : maBtnVerTop.SetState(sal_True); break;
|
|
|
|
case SvxDistributeVerticalCenter : maBtnVerCenter.SetState(sal_True); break;
|
|
|
|
case SvxDistributeVerticalDistance : maBtnVerDistance.SetState(sal_True); break;
|
|
|
|
case SvxDistributeVerticalBottom : maBtnVerBottom.SetState(sal_True); break;
|
2009-10-30 18:36:06 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Fill the delivered Item-Set with dialogbox-attributes
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2011-01-14 05:41:27 -06:00
|
|
|
sal_Bool SvxDistributePage::FillItemSet( SfxItemSet& )
|
2009-10-30 18:36:06 -05:00
|
|
|
{
|
|
|
|
SvxDistributeHorizontal eDistributeHor(SvxDistributeHorizontalNone);
|
|
|
|
SvxDistributeVertical eDistributeVer(SvxDistributeVerticalNone);
|
|
|
|
|
|
|
|
if(maBtnHorLeft.IsChecked())
|
|
|
|
eDistributeHor = SvxDistributeHorizontalLeft;
|
|
|
|
else if(maBtnHorCenter.IsChecked())
|
|
|
|
eDistributeHor = SvxDistributeHorizontalCenter;
|
|
|
|
else if(maBtnHorDistance.IsChecked())
|
|
|
|
eDistributeHor = SvxDistributeHorizontalDistance;
|
|
|
|
else if(maBtnHorRight.IsChecked())
|
|
|
|
eDistributeHor = SvxDistributeHorizontalRight;
|
|
|
|
|
|
|
|
if(maBtnVerTop.IsChecked())
|
|
|
|
eDistributeVer = SvxDistributeVerticalTop;
|
|
|
|
else if(maBtnVerCenter.IsChecked())
|
|
|
|
eDistributeVer = SvxDistributeVerticalCenter;
|
|
|
|
else if(maBtnVerDistance.IsChecked())
|
|
|
|
eDistributeVer = SvxDistributeVerticalDistance;
|
|
|
|
else if(maBtnVerBottom.IsChecked())
|
|
|
|
eDistributeVer = SvxDistributeVerticalBottom;
|
|
|
|
|
|
|
|
if(eDistributeHor != meDistributeHor || eDistributeVer != meDistributeVer)
|
|
|
|
{
|
|
|
|
meDistributeHor = eDistributeHor;
|
|
|
|
meDistributeVer = eDistributeVer;
|
2011-01-14 05:41:27 -06:00
|
|
|
return sal_True;
|
2009-10-30 18:36:06 -05:00
|
|
|
}
|
|
|
|
|
2011-01-14 05:41:27 -06:00
|
|
|
return sal_False;
|
2009-10-30 18:36:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-12 08:57:08 -05:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|