2010-10-12 15:57:08 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2009-10-31 00:36:06 +01:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2009-10-31 00:36:06 +01: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.
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2009-11-04 10:53:36 +01:00
|
|
|
#include "align.hxx"
|
|
|
|
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/svxenum.hxx>
|
2009-10-31 00:36:06 +01:00
|
|
|
#include <svx/dialogs.hrc>
|
2009-11-02 20:49:14 +01:00
|
|
|
#include <cuires.hrc>
|
2009-10-31 00:36:06 +01:00
|
|
|
#include "align.hrc"
|
|
|
|
#include <svx/rotmodit.hxx>
|
|
|
|
|
|
|
|
#include <svx/algitem.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/frmdiritem.hxx>
|
2010-10-05 11:15:56 -04:00
|
|
|
#include <editeng/justifyitem.hxx>
|
2009-11-02 20:49:14 +01:00
|
|
|
#include <dialmgr.hxx>
|
2009-10-31 00:36:06 +01:00
|
|
|
#include <svx/dlgutil.hxx>
|
|
|
|
#include <tools/shl.hxx>
|
|
|
|
#include <sfx2/app.hxx>
|
|
|
|
#include <sfx2/module.hxx>
|
|
|
|
#include <sfx2/itemconnect.hxx>
|
|
|
|
#include <svl/cjkoptions.hxx>
|
|
|
|
#include <svl/languageoptions.hxx>
|
|
|
|
#include <svtools/localresaccess.hxx>
|
2010-10-11 20:11:42 -04:00
|
|
|
#include <svx/flagsdef.hxx>
|
|
|
|
#include <svl/intitem.hxx>
|
|
|
|
#include <sfx2/request.hxx>
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
namespace svx {
|
|
|
|
|
|
|
|
// item connections ===========================================================
|
|
|
|
|
|
|
|
// horizontal alignment -------------------------------------------------------
|
|
|
|
|
2011-01-14 12:41:27 +01:00
|
|
|
typedef sfx::ValueItemWrapper< SvxHorJustifyItem, SvxCellHorJustify, sal_uInt16 > HorJustItemWrapper;
|
2009-10-31 00:36:06 +01:00
|
|
|
typedef sfx::ListBoxConnection< HorJustItemWrapper > HorJustConnection;
|
|
|
|
|
|
|
|
static const HorJustConnection::MapEntryType s_pHorJustMap[] =
|
|
|
|
{
|
|
|
|
{ ALIGNDLG_HORALIGN_STD, SVX_HOR_JUSTIFY_STANDARD },
|
|
|
|
{ ALIGNDLG_HORALIGN_LEFT, SVX_HOR_JUSTIFY_LEFT },
|
|
|
|
{ ALIGNDLG_HORALIGN_CENTER, SVX_HOR_JUSTIFY_CENTER },
|
|
|
|
{ ALIGNDLG_HORALIGN_RIGHT, SVX_HOR_JUSTIFY_RIGHT },
|
|
|
|
{ ALIGNDLG_HORALIGN_BLOCK, SVX_HOR_JUSTIFY_BLOCK },
|
|
|
|
{ ALIGNDLG_HORALIGN_FILL, SVX_HOR_JUSTIFY_REPEAT },
|
2010-10-05 11:15:56 -04:00
|
|
|
{ ALIGNDLG_HORALIGN_DISTRIBUTED, SVX_HOR_JUSTIFY_BLOCK },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ LISTBOX_ENTRY_NOTFOUND, SVX_HOR_JUSTIFY_STANDARD }
|
|
|
|
};
|
|
|
|
|
|
|
|
// vertical alignment ---------------------------------------------------------
|
|
|
|
|
2011-01-14 12:41:27 +01:00
|
|
|
typedef sfx::ValueItemWrapper< SvxVerJustifyItem, SvxCellVerJustify, sal_uInt16 > VerJustItemWrapper;
|
2009-10-31 00:36:06 +01:00
|
|
|
typedef sfx::ListBoxConnection< VerJustItemWrapper > VerJustConnection;
|
|
|
|
|
|
|
|
static const VerJustConnection::MapEntryType s_pVerJustMap[] =
|
|
|
|
{
|
|
|
|
{ ALIGNDLG_VERALIGN_STD, SVX_VER_JUSTIFY_STANDARD },
|
|
|
|
{ ALIGNDLG_VERALIGN_TOP, SVX_VER_JUSTIFY_TOP },
|
|
|
|
{ ALIGNDLG_VERALIGN_MID, SVX_VER_JUSTIFY_CENTER },
|
|
|
|
{ ALIGNDLG_VERALIGN_BOTTOM, SVX_VER_JUSTIFY_BOTTOM },
|
2010-10-05 11:15:56 -04:00
|
|
|
{ ALIGNDLG_VERALIGN_BLOCK, SVX_VER_JUSTIFY_BLOCK },
|
|
|
|
{ ALIGNDLG_VERALIGN_DISTRIBUTED, SVX_VER_JUSTIFY_BLOCK },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ LISTBOX_ENTRY_NOTFOUND, SVX_VER_JUSTIFY_STANDARD }
|
|
|
|
};
|
|
|
|
|
|
|
|
// cell rotate mode -----------------------------------------------------------
|
|
|
|
|
2011-01-14 12:41:27 +01:00
|
|
|
typedef sfx::ValueItemWrapper< SvxRotateModeItem, SvxRotateMode, sal_uInt16 > RotateModeItemWrapper;
|
2009-10-31 00:36:06 +01:00
|
|
|
typedef sfx::ValueSetConnection< RotateModeItemWrapper > RotateModeConnection;
|
|
|
|
|
|
|
|
static const RotateModeConnection::MapEntryType s_pRotateModeMap[] =
|
|
|
|
{
|
|
|
|
{ IID_BOTTOMLOCK, SVX_ROTATE_MODE_BOTTOM },
|
|
|
|
{ IID_TOPLOCK, SVX_ROTATE_MODE_TOP },
|
|
|
|
{ IID_CELLLOCK, SVX_ROTATE_MODE_STANDARD },
|
|
|
|
{ VALUESET_ITEM_NOTFOUND, SVX_ROTATE_MODE_STANDARD }
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
|
2011-01-14 12:41:27 +01:00
|
|
|
static sal_uInt16 s_pRanges[] =
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
SID_ATTR_ALIGN_HOR_JUSTIFY,SID_ATTR_ALIGN_VER_JUSTIFY,
|
|
|
|
SID_ATTR_ALIGN_STACKED,SID_ATTR_ALIGN_LINEBREAK,
|
|
|
|
SID_ATTR_ALIGN_INDENT,SID_ATTR_ALIGN_INDENT,
|
|
|
|
SID_ATTR_ALIGN_DEGREES,SID_ATTR_ALIGN_DEGREES,
|
|
|
|
SID_ATTR_ALIGN_LOCKPOS,SID_ATTR_ALIGN_LOCKPOS,
|
|
|
|
SID_ATTR_ALIGN_HYPHENATION,SID_ATTR_ALIGN_HYPHENATION,
|
|
|
|
SID_ATTR_ALIGN_ASIANVERTICAL,SID_ATTR_ALIGN_ASIANVERTICAL,
|
|
|
|
SID_ATTR_FRAMEDIRECTION,SID_ATTR_FRAMEDIRECTION,
|
|
|
|
SID_ATTR_ALIGN_SHRINKTOFIT,SID_ATTR_ALIGN_SHRINKTOFIT,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
|
2010-10-05 11:15:56 -04:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
template<typename _JustContainerType, typename _JustEnumType>
|
|
|
|
void lcl_MaybeResetAlignToDistro(
|
2011-03-12 23:58:22 -06:00
|
|
|
ListBox& rLB, sal_uInt16 nListPos, const SfxItemSet& rCoreAttrs, sal_uInt16 nWhichAlign, sal_uInt16 nWhichJM, _JustEnumType eBlock)
|
2010-10-05 11:15:56 -04:00
|
|
|
{
|
|
|
|
const SfxPoolItem* pItem;
|
2011-03-12 23:58:22 -06:00
|
|
|
if (rCoreAttrs.GetItemState(nWhichAlign, sal_True, &pItem) != SFX_ITEM_SET)
|
2010-10-05 11:15:56 -04:00
|
|
|
// alignment not set.
|
|
|
|
return;
|
|
|
|
|
|
|
|
const SfxEnumItem* p = static_cast<const SfxEnumItem*>(pItem);
|
|
|
|
_JustContainerType eVal = static_cast<_JustContainerType>(p->GetEnumValue());
|
|
|
|
if (eVal != eBlock)
|
|
|
|
// alignment is not 'justify'. No need to go further.
|
|
|
|
return;
|
|
|
|
|
2011-03-12 23:58:22 -06:00
|
|
|
if (rCoreAttrs.GetItemState(nWhichJM, sal_True, &pItem) != SFX_ITEM_SET)
|
2010-10-05 11:15:56 -04:00
|
|
|
// justification method is not set.
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = static_cast<const SfxEnumItem*>(pItem);
|
|
|
|
SvxCellJustifyMethod eMethod = static_cast<SvxCellJustifyMethod>(p->GetEnumValue());
|
|
|
|
if (eMethod == SVX_JUSTIFY_METHOD_DISTRIBUTE)
|
|
|
|
// Select the 'distribute' entry in the specified list box.
|
|
|
|
rLB.SelectEntryPos(nListPos);
|
|
|
|
}
|
|
|
|
|
2011-03-12 23:58:22 -06:00
|
|
|
void lcl_SetJustifyMethodToItemSet(SfxItemSet& rSet, sal_uInt16 nWhichJM, const ListBox& rLB, sal_uInt16 nListPos)
|
2010-10-05 11:15:56 -04:00
|
|
|
{
|
|
|
|
SvxCellJustifyMethod eJM = SVX_JUSTIFY_METHOD_AUTO;
|
|
|
|
if (rLB.GetSelectEntryPos() == nListPos)
|
|
|
|
eJM = SVX_JUSTIFY_METHOD_DISTRIBUTE;
|
|
|
|
|
|
|
|
SvxJustifyMethodItem aItem(eJM, nWhichJM);
|
|
|
|
rSet.Put(aItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
AlignmentTabPage::AlignmentTabPage( Window* pParent, const SfxItemSet& rCoreAttrs ) :
|
|
|
|
|
2009-11-02 20:49:14 +01:00
|
|
|
SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_ALIGNMENT ), rCoreAttrs ),
|
|
|
|
|
|
|
|
maFlAlignment ( this, CUI_RES( FL_ALIGNMENT ) ),
|
|
|
|
maFtHorAlign ( this, CUI_RES( FT_HORALIGN ) ),
|
|
|
|
maLbHorAlign ( this, CUI_RES( LB_HORALIGN ) ),
|
|
|
|
maFtIndent ( this, CUI_RES( FT_INDENT ) ),
|
|
|
|
maEdIndent ( this, CUI_RES( ED_INDENT ) ),
|
|
|
|
maFtVerAlign ( this, CUI_RES( FT_VERALIGN ) ),
|
|
|
|
maLbVerAlign ( this, CUI_RES( LB_VERALIGN ) ),
|
|
|
|
|
|
|
|
maFlOrient ( this, CUI_RES( FL_ORIENTATION ) ),
|
|
|
|
maCtrlDial ( this, CUI_RES( CTR_DIAL ) ),
|
|
|
|
maFtRotate ( this, CUI_RES( FT_DEGREES ) ),
|
|
|
|
maNfRotate ( this, CUI_RES( NF_DEGREES ) ),
|
|
|
|
maFtRefEdge ( this, CUI_RES( FT_BORDER_LOCK ) ),
|
|
|
|
maVsRefEdge ( this, CUI_RES( CTR_BORDER_LOCK ) ),
|
|
|
|
maCbStacked ( this, CUI_RES( BTN_TXTSTACKED ) ),
|
|
|
|
maCbAsianMode ( this, CUI_RES( BTN_ASIAN_VERTICAL ) ),
|
2009-10-31 00:36:06 +01:00
|
|
|
maOrientHlp ( maCtrlDial, maNfRotate, maCbStacked ),
|
|
|
|
|
2009-11-02 20:49:14 +01:00
|
|
|
maFlProperties ( this, CUI_RES( FL_WRAP ) ),
|
|
|
|
maBtnWrap ( this, CUI_RES( BTN_WRAP ) ),
|
|
|
|
maBtnHyphen ( this, CUI_RES( BTN_HYPH ) ),
|
|
|
|
maBtnShrink ( this, CUI_RES( BTN_SHRINK ) ),
|
|
|
|
maFtFrameDir ( this, CUI_RES( FT_TEXTFLOW ) ),
|
|
|
|
maLbFrameDir ( this, CUI_RES( LB_FRAMEDIR ) )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
InitVsRefEgde();
|
|
|
|
|
|
|
|
// windows to be disabled, if stacked text is turned ON
|
|
|
|
maOrientHlp.AddDependentWindow( maFtRotate, STATE_CHECK );
|
|
|
|
maOrientHlp.AddDependentWindow( maFtRefEdge, STATE_CHECK );
|
|
|
|
maOrientHlp.AddDependentWindow( maVsRefEdge, STATE_CHECK );
|
|
|
|
// windows to be disabled, if stacked text is turned OFF
|
|
|
|
maOrientHlp.AddDependentWindow( maCbAsianMode, STATE_NOCHECK );
|
|
|
|
|
|
|
|
Link aLink = LINK( this, AlignmentTabPage, UpdateEnableHdl );
|
|
|
|
|
|
|
|
maLbHorAlign.SetSelectHdl( aLink );
|
|
|
|
maBtnWrap.SetClickHdl( aLink );
|
|
|
|
|
|
|
|
// Asian vertical mode
|
|
|
|
maCbAsianMode.Show( SvtCJKOptions().IsVerticalTextEnabled() );
|
|
|
|
|
|
|
|
// CTL frame direction
|
2009-11-02 20:49:14 +01:00
|
|
|
maLbFrameDir.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_LTR ), FRMDIR_HORI_LEFT_TOP );
|
|
|
|
maLbFrameDir.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_RTL ), FRMDIR_HORI_RIGHT_TOP );
|
|
|
|
maLbFrameDir.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER ), FRMDIR_ENVIRONMENT );
|
2009-10-31 00:36:06 +01:00
|
|
|
if( !SvtLanguageOptions().IsCTLFontEnabled() )
|
|
|
|
{
|
|
|
|
maFtFrameDir.Hide();
|
|
|
|
maLbFrameDir.Hide();
|
|
|
|
}
|
|
|
|
|
2010-10-24 13:08:34 +01:00
|
|
|
// This page needs ExchangeSupport.
|
2009-10-31 00:36:06 +01:00
|
|
|
SetExchangeSupport();
|
|
|
|
|
|
|
|
FreeResource();
|
|
|
|
|
|
|
|
AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_HOR_JUSTIFY, maFtHorAlign, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
|
|
|
AddItemConnection( new HorJustConnection( SID_ATTR_ALIGN_HOR_JUSTIFY, maLbHorAlign, s_pHorJustMap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
|
|
|
AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_INDENT, maFtIndent, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
|
|
|
AddItemConnection( new sfx::UInt16MetricConnection( SID_ATTR_ALIGN_INDENT, maEdIndent, FUNIT_TWIP, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
|
|
|
AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_VER_JUSTIFY, maFtVerAlign, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
|
|
|
AddItemConnection( new VerJustConnection( SID_ATTR_ALIGN_VER_JUSTIFY, maLbVerAlign, s_pVerJustMap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
|
|
|
AddItemConnection( new DialControlConnection( SID_ATTR_ALIGN_DEGREES, maCtrlDial, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
|
|
|
AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_DEGREES, maFtRotate, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
|
|
|
AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_LOCKPOS, maFtRefEdge, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
|
|
|
AddItemConnection( new RotateModeConnection( SID_ATTR_ALIGN_LOCKPOS, maVsRefEdge, s_pRotateModeMap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
|
|
|
AddItemConnection( new OrientStackedConnection( SID_ATTR_ALIGN_STACKED, maOrientHlp ) );
|
|
|
|
AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_STACKED, maCbStacked, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
|
|
|
AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_ASIANVERTICAL, maCbAsianMode, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
|
|
|
AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_LINEBREAK, maBtnWrap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
|
|
|
AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_HYPHENATION, maBtnHyphen, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
|
|
|
AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_SHRINKTOFIT, maBtnShrink, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
|
|
|
AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_FRAMEDIRECTION, maFtFrameDir, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
|
|
|
AddItemConnection( new FrameDirListBoxConnection( SID_ATTR_FRAMEDIRECTION, maLbFrameDir, sfx::ITEMCONN_HIDE_UNKNOWN ) );
|
2011-01-20 12:21:31 +01:00
|
|
|
|
|
|
|
maLbHorAlign.SetAccessibleRelationMemberOf( &maFlAlignment );
|
|
|
|
maEdIndent.SetAccessibleRelationMemberOf( &maFlAlignment );
|
|
|
|
maLbVerAlign.SetAccessibleRelationMemberOf( &maFlAlignment );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
AlignmentTabPage::~AlignmentTabPage()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxTabPage* AlignmentTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
|
|
|
|
{
|
|
|
|
return new AlignmentTabPage( pParent, rAttrSet );
|
|
|
|
}
|
|
|
|
|
2011-01-14 12:41:27 +01:00
|
|
|
sal_uInt16* AlignmentTabPage::GetRanges()
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
return s_pRanges;
|
|
|
|
}
|
|
|
|
|
2011-03-12 23:58:22 -06:00
|
|
|
sal_Bool AlignmentTabPage::FillItemSet( SfxItemSet& rSet )
|
2010-10-05 11:15:56 -04:00
|
|
|
{
|
|
|
|
bool bChanged = SfxTabPage::FillItemSet(rSet);
|
|
|
|
|
|
|
|
// Special treatment for distributed alignment; we need to set the justify
|
|
|
|
// method to 'distribute' to distinguish from the normal justification.
|
|
|
|
|
2011-03-12 23:58:22 -06:00
|
|
|
sal_uInt16 nWhichHorJM = GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD);
|
2010-10-05 11:15:56 -04:00
|
|
|
lcl_SetJustifyMethodToItemSet(rSet, nWhichHorJM, maLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED);
|
|
|
|
if (!bChanged)
|
|
|
|
bChanged = HasAlignmentChanged(rSet, nWhichHorJM);
|
|
|
|
|
2011-03-12 23:58:22 -06:00
|
|
|
sal_uInt16 nWhichVerJM = GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD);
|
2010-10-05 11:15:56 -04:00
|
|
|
lcl_SetJustifyMethodToItemSet(rSet, nWhichVerJM, maLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED);
|
|
|
|
if (!bChanged)
|
|
|
|
bChanged = HasAlignmentChanged(rSet, nWhichVerJM);
|
|
|
|
|
|
|
|
return bChanged;
|
|
|
|
}
|
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
void AlignmentTabPage::Reset( const SfxItemSet& rCoreAttrs )
|
|
|
|
{
|
|
|
|
SfxTabPage::Reset( rCoreAttrs );
|
2010-10-05 11:15:56 -04:00
|
|
|
|
|
|
|
// Special treatment for distributed alignment; we need to set the justify
|
|
|
|
// method to 'distribute' to distinguish from the normal justification.
|
|
|
|
|
|
|
|
lcl_MaybeResetAlignToDistro<SvxCellHorJustify, SvxCellHorJustify>(
|
|
|
|
maLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED, rCoreAttrs,
|
|
|
|
GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY), GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD),
|
|
|
|
SVX_HOR_JUSTIFY_BLOCK);
|
|
|
|
|
|
|
|
lcl_MaybeResetAlignToDistro<SvxCellVerJustify, SvxCellVerJustify>(
|
|
|
|
maLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED, rCoreAttrs,
|
|
|
|
GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY), GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD),
|
|
|
|
SVX_VER_JUSTIFY_BLOCK);
|
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
UpdateEnableControls();
|
|
|
|
}
|
|
|
|
|
|
|
|
int AlignmentTabPage::DeactivatePage( SfxItemSet* _pSet )
|
|
|
|
{
|
|
|
|
if( _pSet )
|
|
|
|
FillItemSet( *_pSet );
|
|
|
|
return LEAVE_PAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AlignmentTabPage::DataChanged( const DataChangedEvent& rDCEvt )
|
|
|
|
{
|
|
|
|
SfxTabPage::DataChanged( rDCEvt );
|
|
|
|
if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
|
|
|
|
{
|
2009-11-02 20:49:14 +01:00
|
|
|
svt::OLocalResourceAccess aLocalResAcc( CUI_RES( RID_SVXPAGE_ALIGNMENT ), RSC_TABPAGE );
|
2009-10-31 00:36:06 +01:00
|
|
|
InitVsRefEgde();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AlignmentTabPage::InitVsRefEgde()
|
|
|
|
{
|
|
|
|
// remember selection - is deleted in call to ValueSet::Clear()
|
2011-01-14 12:41:27 +01:00
|
|
|
sal_uInt16 nSel = maVsRefEdge.GetSelectItemId();
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2010-11-16 17:13:06 +01:00
|
|
|
ResId aResId( IL_LOCK_BMPS, CUI_MGR() );
|
2009-10-31 00:36:06 +01:00
|
|
|
ImageList aImageList( aResId );
|
|
|
|
Size aItemSize( aImageList.GetImage( IID_BOTTOMLOCK ).GetSizePixel() );
|
|
|
|
|
|
|
|
maVsRefEdge.Clear();
|
|
|
|
maVsRefEdge.SetStyle( maVsRefEdge.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
|
|
|
|
|
|
|
|
maVsRefEdge.SetColCount( 3 );
|
2009-11-02 20:49:14 +01:00
|
|
|
maVsRefEdge.InsertItem( IID_BOTTOMLOCK, aImageList.GetImage( IID_BOTTOMLOCK ), String( CUI_RES( STR_BOTTOMLOCK ) ) );
|
|
|
|
maVsRefEdge.InsertItem( IID_TOPLOCK, aImageList.GetImage( IID_TOPLOCK ), String( CUI_RES( STR_TOPLOCK ) ) );
|
|
|
|
maVsRefEdge.InsertItem( IID_CELLLOCK, aImageList.GetImage( IID_CELLLOCK ), String( CUI_RES( STR_CELLLOCK ) ) );
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
maVsRefEdge.SetSizePixel( maVsRefEdge.CalcWindowSizePixel( aItemSize ) );
|
|
|
|
|
|
|
|
maVsRefEdge.SelectItem( nSel );
|
|
|
|
}
|
|
|
|
|
|
|
|
void AlignmentTabPage::UpdateEnableControls()
|
|
|
|
{
|
2011-01-14 12:41:27 +01:00
|
|
|
sal_uInt16 nHorAlign = maLbHorAlign.GetSelectEntryPos();
|
2009-10-31 00:36:06 +01:00
|
|
|
bool bHorLeft = (nHorAlign == ALIGNDLG_HORALIGN_LEFT);
|
|
|
|
bool bHorBlock = (nHorAlign == ALIGNDLG_HORALIGN_BLOCK);
|
|
|
|
bool bHorFill = (nHorAlign == ALIGNDLG_HORALIGN_FILL);
|
2010-10-05 11:15:56 -04:00
|
|
|
bool bHorDist = (nHorAlign == ALIGNDLG_HORALIGN_DISTRIBUTED);
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
// indent edit field only for left alignment
|
|
|
|
maFtIndent.Enable( bHorLeft );
|
|
|
|
maEdIndent.Enable( bHorLeft );
|
|
|
|
|
|
|
|
// rotation/stacked disabled for fill alignment
|
|
|
|
maOrientHlp.Enable( !bHorFill );
|
|
|
|
|
|
|
|
// hyphenation only for automatic line breaks or for block alignment
|
|
|
|
maBtnHyphen.Enable( maBtnWrap.IsChecked() || bHorBlock );
|
|
|
|
|
2010-10-05 11:15:56 -04:00
|
|
|
// shrink only without automatic line break, and not for block, fill or distribute.
|
|
|
|
maBtnShrink.Enable( (maBtnWrap.GetState() == STATE_NOCHECK) && !bHorBlock && !bHorFill && !bHorDist );
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
// visibility of fixed lines
|
|
|
|
maFlAlignment.Show( maLbHorAlign.IsVisible() || maEdIndent.IsVisible() || maLbVerAlign.IsVisible() );
|
|
|
|
maFlOrient.Show( maCtrlDial.IsVisible() || maVsRefEdge.IsVisible() || maCbStacked.IsVisible() || maCbAsianMode.IsVisible() );
|
|
|
|
maFlProperties.Show( maBtnWrap.IsVisible() || maBtnHyphen.IsVisible() || maBtnShrink.IsVisible() || maLbFrameDir.IsVisible() );
|
|
|
|
}
|
|
|
|
|
2011-03-12 23:58:22 -06:00
|
|
|
bool AlignmentTabPage::HasAlignmentChanged( const SfxItemSet& rNew, sal_uInt16 nWhich ) const
|
2010-10-05 11:15:56 -04:00
|
|
|
{
|
|
|
|
const SfxItemSet& rOld = GetItemSet();
|
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
SvxCellJustifyMethod eMethodOld = SVX_JUSTIFY_METHOD_AUTO;
|
|
|
|
SvxCellJustifyMethod eMethodNew = SVX_JUSTIFY_METHOD_AUTO;
|
2011-03-12 23:58:22 -06:00
|
|
|
if (rOld.GetItemState(nWhich, sal_True, &pItem) == SFX_ITEM_SET)
|
2010-10-05 11:15:56 -04:00
|
|
|
{
|
|
|
|
const SfxEnumItem* p = static_cast<const SfxEnumItem*>(pItem);
|
|
|
|
eMethodOld = static_cast<SvxCellJustifyMethod>(p->GetEnumValue());
|
|
|
|
}
|
|
|
|
|
2011-03-12 23:58:22 -06:00
|
|
|
if (rNew.GetItemState(nWhich, sal_True, &pItem) == SFX_ITEM_SET)
|
2010-10-05 11:15:56 -04:00
|
|
|
{
|
|
|
|
const SfxEnumItem* p = static_cast<const SfxEnumItem*>(pItem);
|
|
|
|
eMethodNew = static_cast<SvxCellJustifyMethod>(p->GetEnumValue());
|
|
|
|
}
|
|
|
|
|
|
|
|
return eMethodOld != eMethodNew;
|
|
|
|
}
|
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG(AlignmentTabPage, UpdateEnableHdl)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
UpdateEnableControls();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
} // namespace svx
|
|
|
|
|
2010-10-12 15:57:08 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|