2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-21 22:06:52 +00:00
|
|
|
/*
|
|
|
|
* 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 .
|
|
|
|
*/
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#include <tools/shl.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/itemiter.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <sfx2/app.hxx>
|
|
|
|
#include <sfx2/objsh.hxx>
|
|
|
|
#include <sfx2/module.hxx>
|
|
|
|
#include <vcl/msgbox.hxx>
|
|
|
|
#include <vcl/graph.hxx>
|
|
|
|
|
2010-06-03 10:47:56 +02:00
|
|
|
#include <sfx2/sfxsids.hrc>
|
|
|
|
#include <svx/svxids.hrc>
|
2007-06-27 16:10:37 +00:00
|
|
|
#include <svx/dialogs.hrc>
|
2013-03-01 00:44:20 -03:00
|
|
|
|
2010-01-07 18:52:36 +01:00
|
|
|
#include <svl/intitem.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2007-06-27 16:10:37 +00:00
|
|
|
#include <svx/hdft.hxx>
|
|
|
|
#include <svx/pageitem.hxx>
|
2010-10-11 20:39:21 -04:00
|
|
|
|
2010-04-20 15:55:51 +02:00
|
|
|
#include "svx/dlgutil.hxx"
|
2007-06-27 16:10:37 +00:00
|
|
|
#include <svx/dialmgr.hxx>
|
2013-04-19 18:21:26 -04:00
|
|
|
#include <sfx2/htmlmode.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-02-12 13:41:53 -05:00
|
|
|
#include <editeng/brushitem.hxx>
|
2010-01-07 18:52:36 +01:00
|
|
|
#include <editeng/lrspitem.hxx>
|
|
|
|
#include <editeng/ulspitem.hxx>
|
|
|
|
#include <editeng/shaditem.hxx>
|
|
|
|
#include <editeng/sizeitem.hxx>
|
|
|
|
#include <editeng/boxitem.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-10-11 20:39:21 -04:00
|
|
|
#include <svx/svxdlg.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
// static ----------------------------------------------------------------
|
|
|
|
|
2010-11-09 01:42:14 +05:00
|
|
|
// Word 97 incompatibility (#i19922#)
|
2004-08-02 13:29:17 +00:00
|
|
|
static const long MINBODY = 56; // 1mm in twips rounded
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// default distance to Header or footer
|
|
|
|
static const long DEF_DIST_WRITER = 500; // 5mm (Writer)
|
2011-02-21 23:29:31 +01:00
|
|
|
static const long DEF_DIST_CALC = 250; // 2.5mm (Calc)
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-01-10 16:11:35 +01:00
|
|
|
static sal_uInt16 pRanges[] =
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
SID_ATTR_BRUSH, SID_ATTR_BRUSH,
|
|
|
|
SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_OUTER,
|
|
|
|
SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
|
|
|
|
SID_ATTR_BORDER_SHADOW, SID_ATTR_BORDER_SHADOW,
|
|
|
|
SID_ATTR_LRSPACE, SID_ATTR_LRSPACE,
|
|
|
|
SID_ATTR_ULSPACE, SID_ATTR_ULSPACE,
|
|
|
|
SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
|
|
|
|
SID_ATTR_PAGE_HEADERSET, SID_ATTR_PAGE_HEADERSET,
|
|
|
|
SID_ATTR_PAGE_FOOTERSET, SID_ATTR_PAGE_FOOTERSET,
|
|
|
|
SID_ATTR_PAGE_ON, SID_ATTR_PAGE_ON,
|
|
|
|
SID_ATTR_PAGE_DYNAMIC, SID_ATTR_PAGE_DYNAMIC,
|
|
|
|
SID_ATTR_PAGE_SHARED, SID_ATTR_PAGE_SHARED,
|
2012-07-02 12:07:57 +02:00
|
|
|
SID_ATTR_PAGE_SHARED_FIRST, SID_ATTR_PAGE_SHARED_FIRST,
|
2002-08-26 10:36:56 +00:00
|
|
|
SID_ATTR_HDFT_DYNAMIC_SPACING, SID_ATTR_HDFT_DYNAMIC_SPACING,
|
2000-09-18 16:07:07 +00:00
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2011-09-15 10:54:46 +02:00
|
|
|
namespace svx {
|
|
|
|
|
|
|
|
bool ShowBorderBackgroundDlg( Window* pParent, SfxItemSet* pBBSet,
|
|
|
|
bool bEnableBackgroundSelector )
|
|
|
|
{
|
|
|
|
bool bRes = false;
|
|
|
|
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
|
|
|
|
if(pFact)
|
|
|
|
{
|
|
|
|
SfxAbstractTabDialog* pDlg = pFact->CreateSvxBorderBackgroundDlg( pParent, *pBBSet, bEnableBackgroundSelector );
|
|
|
|
DBG_ASSERT(pDlg, "Dialogdiet fail!");
|
|
|
|
if ( pDlg->Execute() == RET_OK && pDlg->GetOutputItemSet() )
|
|
|
|
{
|
|
|
|
SfxItemIter aIter( *pDlg->GetOutputItemSet() );
|
|
|
|
const SfxPoolItem* pItem = aIter.FirstItem();
|
|
|
|
|
|
|
|
while ( pItem )
|
|
|
|
{
|
|
|
|
if ( !IsInvalidItem( pItem ) )
|
|
|
|
pBBSet->Put( *pItem );
|
|
|
|
pItem = aIter.NextItem();
|
|
|
|
}
|
|
|
|
bRes = true;
|
|
|
|
}
|
|
|
|
delete pDlg;
|
|
|
|
}
|
|
|
|
return bRes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-21 23:29:31 +01:00
|
|
|
// returns the Which values to the range
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
2011-01-10 16:11:35 +01:00
|
|
|
sal_uInt16* SvxHeaderPage::GetRanges()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return pRanges;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
|
|
|
SfxTabPage* SvxHeaderPage::Create( Window* pParent, const SfxItemSet& rSet )
|
|
|
|
{
|
|
|
|
return new SvxHeaderPage( pParent, rSet );
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
2011-01-10 16:11:35 +01:00
|
|
|
sal_uInt16* SvxFooterPage::GetRanges()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return pRanges;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
SfxTabPage* SvxFooterPage::Create( Window* pParent, const SfxItemSet& rSet )
|
|
|
|
{
|
|
|
|
return new SvxFooterPage( pParent, rSet );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
SvxHeaderPage::SvxHeaderPage( Window* pParent, const SfxItemSet& rAttr ) :
|
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
SvxHFPage( pParent, rAttr, SID_ATTR_PAGE_HEADERSET )
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
SvxFooterPage::SvxFooterPage( Window* pParent, const SfxItemSet& rAttr ) :
|
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
SvxHFPage( pParent, rAttr, SID_ATTR_PAGE_FOOTERSET )
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
SvxHFPage::SvxHFPage( Window* pParent, const SfxItemSet& rSet, sal_uInt16 nSetId ) :
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
SfxTabPage( pParent, "HFFormatPage", "svx/ui/headfootformatpage.ui", rSet ),
|
2000-09-18 16:07:07 +00:00
|
|
|
nId ( nSetId ),
|
2006-06-19 14:12:17 +00:00
|
|
|
pBBSet ( NULL ),
|
2011-01-10 16:11:35 +01:00
|
|
|
bDisableQueryBox ( sal_False ),
|
|
|
|
bEnableBackgroundSelector ( sal_True )
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
get(m_pCntSharedBox,"checkSameLR");
|
|
|
|
get(m_pCntSharedFirstBox,"checkSameFP");
|
|
|
|
get(m_pLMEdit,"spinMargLeft");
|
|
|
|
get(m_pLMLbl,"labelLeftMarg");
|
|
|
|
get(m_pRMEdit,"spinMargRight");
|
|
|
|
get(m_pRMLbl,"labelRightMarg");
|
|
|
|
get(m_pDistEdit,"spinSpacing");
|
|
|
|
get(m_pDistFT,"labelSpacing");
|
|
|
|
get(m_pDynSpacingCB,"checkDynSpacing");
|
|
|
|
get(m_pHeightFT,"labelHeight");
|
|
|
|
get(m_pHeightEdit,"spinHeight");
|
|
|
|
get(m_pHeightDynBtn,"checkAutofit");
|
|
|
|
get(m_pBspWin,"drawingareaPageHF");
|
|
|
|
get(m_pBackgroundBtn,"buttonMore");
|
|
|
|
|
|
|
|
//swap header <-> footer in UI
|
|
|
|
if(nId == SID_ATTR_PAGE_FOOTERSET)
|
|
|
|
{
|
2013-03-04 11:21:29 +00:00
|
|
|
get(m_pPageLbl,"labelFooterFormat");
|
|
|
|
get(m_pTurnOnBox, "checkFooterOn");
|
2013-03-01 00:44:20 -03:00
|
|
|
}
|
|
|
|
else //Header
|
|
|
|
{
|
2013-03-04 11:21:29 +00:00
|
|
|
get(m_pPageLbl,"labelHeaderFormat");
|
|
|
|
get(m_pTurnOnBox, "checkHeaderOn");
|
2013-03-01 00:44:20 -03:00
|
|
|
}
|
2013-03-04 11:21:29 +00:00
|
|
|
m_pTurnOnBox->Show();
|
|
|
|
m_pPageLbl->Show();
|
2013-03-01 00:44:20 -03:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
InitHandler();
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->EnableRTL( sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-21 23:29:31 +01:00
|
|
|
// This Page needs ExchangeSupport
|
2000-09-18 16:07:07 +00:00
|
|
|
SetExchangeSupport();
|
|
|
|
|
|
|
|
|
2011-02-21 23:29:31 +01:00
|
|
|
// Set metrics
|
2013-03-01 00:44:20 -03:00
|
|
|
FieldUnit eFUnit = GetModuleFieldUnit( rSet );
|
|
|
|
SetFieldUnit( *m_pDistEdit, eFUnit );
|
|
|
|
SetFieldUnit( *m_pHeightEdit, eFUnit );
|
|
|
|
SetFieldUnit( *m_pLMEdit, eFUnit );
|
|
|
|
SetFieldUnit( *m_pRMEdit, eFUnit );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
SvxHFPage::~SvxHFPage()
|
|
|
|
{
|
|
|
|
delete pBBSet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2011-01-10 16:11:35 +01:00
|
|
|
sal_Bool SvxHFPage::FillItemSet( SfxItemSet& rSet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-01-10 16:11:35 +01:00
|
|
|
const sal_uInt16 nWSize = GetWhich( SID_ATTR_PAGE_SIZE );
|
|
|
|
const sal_uInt16 nWLRSpace = GetWhich( SID_ATTR_LRSPACE );
|
|
|
|
const sal_uInt16 nWULSpace = GetWhich( SID_ATTR_ULSPACE );
|
|
|
|
const sal_uInt16 nWOn = GetWhich( SID_ATTR_PAGE_ON );
|
|
|
|
const sal_uInt16 nWDynamic = GetWhich( SID_ATTR_PAGE_DYNAMIC );
|
|
|
|
const sal_uInt16 nWDynSpacing = GetWhich( SID_ATTR_HDFT_DYNAMIC_SPACING );
|
|
|
|
const sal_uInt16 nWShared = GetWhich( SID_ATTR_PAGE_SHARED );
|
2012-07-02 12:07:57 +02:00
|
|
|
const sal_uInt16 nWSharedFirst = GetWhich( SID_ATTR_PAGE_SHARED_FIRST );
|
2011-01-10 16:11:35 +01:00
|
|
|
const sal_uInt16 nWBrush = GetWhich( SID_ATTR_BRUSH );
|
|
|
|
const sal_uInt16 nWBox = GetWhich( SID_ATTR_BORDER_OUTER );
|
|
|
|
const sal_uInt16 nWBoxInfo = GetWhich( SID_ATTR_BORDER_INNER );
|
|
|
|
const sal_uInt16 nWShadow = GetWhich( SID_ATTR_BORDER_SHADOW );
|
|
|
|
const sal_uInt16 aWhichTab[] = { nWSize, nWSize,
|
2000-09-18 16:07:07 +00:00
|
|
|
nWLRSpace, nWLRSpace,
|
|
|
|
nWULSpace, nWULSpace,
|
|
|
|
nWOn, nWOn,
|
|
|
|
nWDynamic, nWDynamic,
|
|
|
|
nWShared, nWShared,
|
2012-07-02 12:07:57 +02:00
|
|
|
nWSharedFirst, nWSharedFirst,
|
2000-09-18 16:07:07 +00:00
|
|
|
nWBrush, nWBrush,
|
|
|
|
nWBoxInfo, nWBoxInfo,
|
|
|
|
nWBox, nWBox,
|
|
|
|
nWShadow, nWShadow,
|
2002-08-26 10:36:56 +00:00
|
|
|
nWDynSpacing, nWDynSpacing,
|
2000-09-18 16:07:07 +00:00
|
|
|
0 };
|
|
|
|
const SfxItemSet& rOldSet = GetItemSet();
|
|
|
|
SfxItemPool* pPool = rOldSet.GetPool();
|
|
|
|
DBG_ASSERT( pPool, "no pool :-(" );
|
|
|
|
SfxMapUnit eUnit = pPool->GetMetric( nWSize );
|
|
|
|
SfxItemSet aSet ( *pPool, aWhichTab );
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
aSet.Put( SfxBoolItem( nWOn, m_pTurnOnBox->IsChecked() ) );
|
|
|
|
aSet.Put( SfxBoolItem( nWDynamic, m_pHeightDynBtn->IsChecked() ) );
|
|
|
|
aSet.Put( SfxBoolItem( nWShared, m_pCntSharedBox->IsChecked() ) );
|
2013-05-13 16:49:07 +01:00
|
|
|
if(m_pCntSharedFirstBox->IsVisible())
|
|
|
|
aSet.Put( SfxBoolItem( nWSharedFirst, m_pCntSharedFirstBox->IsChecked() ) );
|
2013-03-01 00:44:20 -03:00
|
|
|
if(m_pDynSpacingCB->IsVisible() && SFX_WHICH_MAX > nWDynSpacing)
|
2002-08-26 10:36:56 +00:00
|
|
|
{
|
|
|
|
SfxBoolItem* pBoolItem = (SfxBoolItem*)pPool->GetDefaultItem(nWDynSpacing).Clone();
|
2013-03-01 00:44:20 -03:00
|
|
|
pBoolItem->SetValue(m_pDynSpacingCB->IsChecked());
|
2002-08-26 10:36:56 +00:00
|
|
|
aSet.Put(*pBoolItem);
|
|
|
|
delete pBoolItem;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-21 23:29:31 +01:00
|
|
|
// Size
|
2000-09-18 16:07:07 +00:00
|
|
|
SvxSizeItem aSizeItem( (const SvxSizeItem&)rOldSet.Get( nWSize ) );
|
|
|
|
Size aSize( aSizeItem.GetSize() );
|
2013-03-01 00:44:20 -03:00
|
|
|
long nDist = GetCoreValue( *m_pDistEdit, eUnit );
|
|
|
|
long nH = GetCoreValue( *m_pHeightEdit, eUnit );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-21 23:29:31 +01:00
|
|
|
nH += nDist; // add distance
|
2000-09-18 16:07:07 +00:00
|
|
|
aSize.Height() = nH;
|
|
|
|
aSizeItem.SetSize( aSize );
|
|
|
|
aSet.Put( aSizeItem );
|
|
|
|
|
2011-02-21 23:29:31 +01:00
|
|
|
// Margins
|
2000-09-18 16:07:07 +00:00
|
|
|
SvxLRSpaceItem aLR( nWLRSpace );
|
2013-03-01 00:44:20 -03:00
|
|
|
aLR.SetLeft( (sal_uInt16)GetCoreValue( *m_pLMEdit, eUnit ) );
|
|
|
|
aLR.SetRight( (sal_uInt16)GetCoreValue( *m_pRMEdit, eUnit ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
aSet.Put( aLR );
|
|
|
|
|
|
|
|
SvxULSpaceItem aUL( nWULSpace );
|
|
|
|
if ( nId == SID_ATTR_PAGE_HEADERSET )
|
2011-01-10 16:11:35 +01:00
|
|
|
aUL.SetLower( (sal_uInt16)nDist );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2011-01-10 16:11:35 +01:00
|
|
|
aUL.SetUpper( (sal_uInt16)nDist );
|
2000-09-18 16:07:07 +00:00
|
|
|
aSet.Put( aUL );
|
|
|
|
|
2011-02-21 23:29:31 +01:00
|
|
|
// Background and border?
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pBBSet )
|
|
|
|
aSet.Put( *pBBSet );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
|
|
|
|
if ( SFX_ITEM_SET ==
|
2011-01-10 16:11:35 +01:00
|
|
|
GetItemSet().GetItemState( GetWhich( nId ), sal_False, &pItem ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-12-19 23:54:10 +01:00
|
|
|
const SfxItemSet* _pSet;
|
2006-06-19 14:12:17 +00:00
|
|
|
_pSet = &( (SvxSetItem*)pItem )->GetItemSet();
|
|
|
|
|
|
|
|
if ( _pSet->GetItemState( nWBrush ) == SFX_ITEM_SET )
|
|
|
|
aSet.Put( (const SvxBrushItem&)_pSet->Get( nWBrush ) );
|
|
|
|
if ( _pSet->GetItemState( nWBoxInfo ) == SFX_ITEM_SET )
|
|
|
|
aSet.Put( (const SvxBoxInfoItem&)_pSet->Get( nWBoxInfo ) );
|
|
|
|
if ( _pSet->GetItemState( nWBox ) == SFX_ITEM_SET )
|
|
|
|
aSet.Put( (const SvxBoxItem&)_pSet->Get( nWBox ) );
|
|
|
|
if ( _pSet->GetItemState( nWShadow ) == SFX_ITEM_SET )
|
|
|
|
aSet.Put( (const SvxShadowItem&)_pSet->Get( nWShadow ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-21 23:29:31 +01:00
|
|
|
// Flush the SetItem
|
2000-09-18 16:07:07 +00:00
|
|
|
SvxSetItem aSetItem( GetWhich( nId ), aSet );
|
|
|
|
rSet.Put( aSetItem );
|
|
|
|
|
2011-01-10 16:11:35 +01:00
|
|
|
return sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
void SvxHFPage::Reset( const SfxItemSet& rSet )
|
|
|
|
{
|
|
|
|
ActivatePage( rSet );
|
|
|
|
ResetBackground_Impl( rSet );
|
|
|
|
|
|
|
|
SfxItemPool* pPool = GetItemSet().GetPool();
|
2011-02-21 23:29:31 +01:00
|
|
|
DBG_ASSERT( pPool, "Where is the pool" );
|
2000-09-18 16:07:07 +00:00
|
|
|
SfxMapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_PAGE_SIZE ) );
|
|
|
|
|
2013-05-14 13:50:28 +01:00
|
|
|
//hide "same content on first page when this is calc
|
|
|
|
bool bIsCalc = false;
|
|
|
|
const SfxPoolItem* pExt1 = GetItem(rSet, SID_ATTR_PAGE_EXT1);
|
|
|
|
const SfxPoolItem* pExt2 = GetItem(rSet, SID_ATTR_PAGE_EXT2);
|
|
|
|
if (pExt1 && pExt1->ISA(SfxBoolItem) && pExt2 && pExt2->ISA(SfxBoolItem))
|
|
|
|
bIsCalc = true;
|
|
|
|
m_pCntSharedFirstBox->Show(!bIsCalc);
|
|
|
|
|
2011-02-21 23:29:31 +01:00
|
|
|
// Evaluate header-/footer- attributes
|
2000-09-18 16:07:07 +00:00
|
|
|
const SvxSetItem* pSetItem = 0;
|
|
|
|
|
2011-01-10 16:11:35 +01:00
|
|
|
if ( SFX_ITEM_SET == rSet.GetItemState( GetWhich(nId), sal_False,
|
2000-09-18 16:07:07 +00:00
|
|
|
(const SfxPoolItem**)&pSetItem ) )
|
|
|
|
{
|
|
|
|
const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
|
|
|
|
const SfxBoolItem& rHeaderOn =
|
|
|
|
(const SfxBoolItem&)rHeaderSet.Get(GetWhich(SID_ATTR_PAGE_ON));
|
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pTurnOnBox->Check(rHeaderOn.GetValue());
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( rHeaderOn.GetValue() )
|
|
|
|
{
|
|
|
|
const SfxBoolItem& rDynamic =
|
|
|
|
(const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_DYNAMIC ) );
|
|
|
|
const SfxBoolItem& rShared =
|
|
|
|
(const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SHARED ) );
|
2012-10-05 16:33:45 +02:00
|
|
|
const SfxBoolItem* pSharedFirst = 0;
|
|
|
|
if (rHeaderSet.HasItem(GetWhich(SID_ATTR_PAGE_SHARED_FIRST)))
|
|
|
|
pSharedFirst = (const SfxBoolItem*)&rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SHARED_FIRST ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
const SvxSizeItem& rSize =
|
|
|
|
(const SvxSizeItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
|
|
|
|
const SvxULSpaceItem& rUL =
|
|
|
|
(const SvxULSpaceItem&)rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
|
|
|
|
const SvxLRSpaceItem& rLR =
|
|
|
|
(const SvxLRSpaceItem&)rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
|
2013-03-01 00:44:20 -03:00
|
|
|
if(m_pDynSpacingCB->IsVisible())
|
2002-08-26 10:36:56 +00:00
|
|
|
{
|
|
|
|
const SfxBoolItem& rDynSpacing =
|
|
|
|
(const SfxBoolItem&)rHeaderSet.Get(GetWhich(SID_ATTR_HDFT_DYNAMIC_SPACING));
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pDynSpacingCB->Check(rDynSpacing.GetValue());
|
2002-08-26 10:36:56 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( nId == SID_ATTR_PAGE_HEADERSET )
|
2011-02-21 23:29:31 +01:00
|
|
|
{ // Header
|
2013-03-01 00:44:20 -03:00
|
|
|
SetMetricValue( *m_pDistEdit, rUL.GetLower(), eUnit );
|
|
|
|
SetMetricValue( *m_pHeightEdit, rSize.GetSize().Height() - rUL.GetLower(), eUnit );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
2011-02-21 23:29:31 +01:00
|
|
|
{ // Footer
|
2013-03-01 00:44:20 -03:00
|
|
|
SetMetricValue( *m_pDistEdit, rUL.GetUpper(), eUnit );
|
|
|
|
SetMetricValue( *m_pHeightEdit, rSize.GetSize().Height() - rUL.GetUpper(), eUnit );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pHeightDynBtn->Check(rDynamic.GetValue());
|
|
|
|
SetMetricValue( *m_pLMEdit, rLR.GetLeft(), eUnit );
|
|
|
|
SetMetricValue( *m_pRMEdit, rLR.GetRight(), eUnit );
|
|
|
|
m_pCntSharedBox->Check(rShared.GetValue());
|
2012-10-05 16:33:45 +02:00
|
|
|
if (pSharedFirst)
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pCntSharedFirstBox->Check(pSharedFirst->GetValue());
|
2012-10-05 16:33:45 +02:00
|
|
|
else
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pCntSharedFirstBox->Hide();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
pSetItem = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// defaults for distance and height
|
2013-05-14 13:50:28 +01:00
|
|
|
long nDefaultDist = bIsCalc ? DEF_DIST_CALC : DEF_DIST_WRITER;
|
2013-03-01 00:44:20 -03:00
|
|
|
SetMetricValue( *m_pDistEdit, nDefaultDist, SFX_MAPUNIT_100TH_MM );
|
|
|
|
SetMetricValue( *m_pHeightEdit, 500, SFX_MAPUNIT_100TH_MM );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( !pSetItem )
|
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pTurnOnBox->Check( sal_False );
|
|
|
|
m_pHeightDynBtn->Check( sal_True );
|
|
|
|
m_pCntSharedBox->Check( sal_True );
|
|
|
|
m_pCntSharedFirstBox->Check( sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TurnOnHdl(0);
|
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pTurnOnBox->SaveValue();
|
|
|
|
m_pDistEdit->SaveValue();
|
|
|
|
m_pHeightEdit->SaveValue();
|
|
|
|
m_pHeightDynBtn->SaveValue();
|
|
|
|
m_pLMEdit->SaveValue();
|
|
|
|
m_pRMEdit->SaveValue();
|
|
|
|
m_pCntSharedBox->SaveValue();
|
2000-09-18 16:07:07 +00:00
|
|
|
RangeHdl( 0 );
|
|
|
|
|
|
|
|
const SfxPoolItem* pItem = 0;
|
|
|
|
SfxObjectShell* pShell;
|
2011-01-10 16:11:35 +01:00
|
|
|
if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem) ||
|
2000-09-18 16:07:07 +00:00
|
|
|
( 0 != (pShell = SfxObjectShell::Current()) &&
|
|
|
|
0 != (pItem = pShell->GetItem(SID_HTML_MODE))))
|
|
|
|
{
|
2011-03-12 02:42:58 +01:00
|
|
|
sal_uInt16 nHtmlMode = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
|
2012-03-02 17:35:01 +02:00
|
|
|
if(nHtmlMode & HTMLMODE_ON)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pCntSharedBox->Hide();
|
|
|
|
m_pBackgroundBtn->Hide();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxHFPage::InitHandler()
|
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pTurnOnBox->SetClickHdl(LINK(this, SvxHFPage, TurnOnHdl));
|
|
|
|
m_pDistEdit->SetModifyHdl(LINK(this, SvxHFPage, DistModify));
|
|
|
|
m_pDistEdit->SetLoseFocusHdl(LINK(this, SvxHFPage, RangeHdl));
|
|
|
|
|
|
|
|
m_pHeightEdit->SetModifyHdl(LINK(this, SvxHFPage, HeightModify));
|
|
|
|
m_pHeightEdit->SetLoseFocusHdl(LINK(this,SvxHFPage,RangeHdl));
|
|
|
|
|
|
|
|
m_pLMEdit->SetModifyHdl(LINK(this, SvxHFPage, BorderModify));
|
|
|
|
m_pLMEdit->SetLoseFocusHdl(LINK(this, SvxHFPage, RangeHdl));
|
|
|
|
m_pRMEdit->SetModifyHdl(LINK(this, SvxHFPage, BorderModify));
|
|
|
|
m_pRMEdit->SetLoseFocusHdl(LINK(this, SvxHFPage, RangeHdl));
|
|
|
|
m_pBackgroundBtn->SetClickHdl(LINK(this,SvxHFPage, BackgroundHdl));
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
IMPL_LINK( SvxHFPage, TurnOnHdl, CheckBox *, pBox )
|
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
if ( m_pTurnOnBox->IsChecked() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pDistFT->Enable();
|
|
|
|
m_pDistEdit->Enable();
|
|
|
|
m_pDynSpacingCB->Enable();
|
|
|
|
m_pHeightFT->Enable();
|
|
|
|
m_pHeightEdit->Enable();
|
|
|
|
m_pHeightDynBtn->Enable();
|
|
|
|
m_pLMLbl->Enable();
|
|
|
|
m_pLMEdit->Enable();
|
|
|
|
m_pRMLbl->Enable();
|
|
|
|
m_pRMEdit->Enable();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
sal_uInt16 nUsage = m_pBspWin->GetUsage();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( nUsage == SVX_PAGE_RIGHT || nUsage == SVX_PAGE_LEFT )
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pCntSharedBox->Disable();
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2012-10-05 16:33:45 +02:00
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pCntSharedBox->Enable();
|
|
|
|
m_pCntSharedFirstBox->Enable();
|
2012-10-05 16:33:45 +02:00
|
|
|
}
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBackgroundBtn->Enable();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-19 14:11:15 +09:00
|
|
|
bool bDelete = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
if ( !bDisableQueryBox && pBox && m_pTurnOnBox->GetSavedValue() == sal_True )
|
2013-05-28 11:47:28 +01:00
|
|
|
{
|
|
|
|
short nResult;
|
|
|
|
if (nId == SID_ATTR_PAGE_HEADERSET)
|
|
|
|
nResult = DeleteHeaderDialog(this).Execute();
|
|
|
|
else
|
|
|
|
nResult = DeleteFooterDialog(this).Execute();
|
|
|
|
bDelete = nResult == RET_YES;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( bDelete )
|
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pDistFT->Disable();
|
|
|
|
m_pDistEdit->Disable();
|
2014-01-28 19:57:37 +01:00
|
|
|
m_pDynSpacingCB->Enable(false);
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pHeightFT->Disable();
|
|
|
|
m_pHeightEdit->Disable();
|
|
|
|
m_pHeightDynBtn->Disable();
|
|
|
|
|
|
|
|
m_pLMLbl->Disable();
|
|
|
|
m_pLMEdit->Disable();
|
|
|
|
m_pRMLbl->Disable();
|
|
|
|
m_pRMEdit->Disable();
|
|
|
|
|
|
|
|
m_pCntSharedBox->Disable();
|
|
|
|
m_pBackgroundBtn->Disable();
|
|
|
|
m_pCntSharedFirstBox->Disable();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pTurnOnBox->Check();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
UpdateExample();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG_INLINE_START(SvxHFPage, DistModify)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
UpdateExample();
|
|
|
|
return 0;
|
|
|
|
}
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG_INLINE_END(SvxHFPage, DistModify)
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG_INLINE_START(SvxHFPage, HeightModify)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
UpdateExample();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG_INLINE_END(SvxHFPage, HeightModify)
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG_INLINE_START(SvxHFPage, BorderModify)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
UpdateExample();
|
|
|
|
return 0;
|
|
|
|
}
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG_INLINE_END(SvxHFPage, BorderModify)
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG(SvxHFPage, BackgroundHdl)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( !pBBSet )
|
|
|
|
{
|
2011-02-21 23:29:31 +01:00
|
|
|
// Use only the necessary items for border and background
|
2011-01-10 16:11:35 +01:00
|
|
|
sal_uInt16 nBrush = GetWhich( SID_ATTR_BRUSH );
|
|
|
|
sal_uInt16 nOuter = GetWhich( SID_ATTR_BORDER_OUTER );
|
|
|
|
sal_uInt16 nInner = GetWhich( SID_ATTR_BORDER_INNER, sal_False );
|
|
|
|
sal_uInt16 nShadow = GetWhich( SID_ATTR_BORDER_SHADOW );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-21 23:29:31 +01:00
|
|
|
// Create an empty set
|
2000-09-18 16:07:07 +00:00
|
|
|
pBBSet = new SfxItemSet( *GetItemSet().GetPool(), nBrush, nBrush,
|
|
|
|
nOuter, nOuter, nInner, nInner,
|
|
|
|
nShadow, nShadow, 0 );
|
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
|
|
|
|
if ( SFX_ITEM_SET ==
|
2011-01-10 16:11:35 +01:00
|
|
|
GetItemSet().GetItemState( GetWhich( nId ), sal_False, &pItem ) )
|
2011-02-21 23:29:31 +01:00
|
|
|
// if there is one that is already set, then use this
|
2000-09-18 16:07:07 +00:00
|
|
|
pBBSet->Put( ( (SvxSetItem*)pItem)->GetItemSet() );
|
|
|
|
|
|
|
|
if ( SFX_ITEM_SET ==
|
2011-01-10 16:11:35 +01:00
|
|
|
GetItemSet().GetItemState( nInner, sal_False, &pItem ) )
|
2011-02-21 23:29:31 +01:00
|
|
|
// The set InfoItem is always required
|
2000-09-18 16:07:07 +00:00
|
|
|
pBBSet->Put( *pItem );
|
|
|
|
}
|
|
|
|
|
2011-09-15 10:54:46 +02:00
|
|
|
if ( svx::ShowBorderBackgroundDlg( this, pBBSet, bEnableBackgroundSelector ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-09-15 10:54:46 +02:00
|
|
|
//----------------------------------------------------------------
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-09-15 10:54:46 +02:00
|
|
|
sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-09-15 10:54:46 +02:00
|
|
|
if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET )
|
|
|
|
{
|
|
|
|
const SvxBrushItem& rItem = (const SvxBrushItem&)pBBSet->Get( nWhich );
|
|
|
|
if ( nId == SID_ATTR_PAGE_HEADERSET )
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetHdColor( rItem.GetColor() );
|
2011-09-15 10:54:46 +02:00
|
|
|
else
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetFtColor( rItem.GetColor() );
|
2011-09-15 10:54:46 +02:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-09-15 10:54:46 +02:00
|
|
|
//----------------------------------------------------------------
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-09-15 10:54:46 +02:00
|
|
|
nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-09-15 10:54:46 +02:00
|
|
|
if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET )
|
|
|
|
{
|
|
|
|
const SvxBoxItem& rItem = (const SvxBoxItem&)pBBSet->Get( nWhich );
|
2004-02-03 17:28:15 +00:00
|
|
|
|
2011-09-15 10:54:46 +02:00
|
|
|
if ( nId == SID_ATTR_PAGE_HEADERSET )
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetHdBorder( rItem );
|
2011-09-15 10:54:46 +02:00
|
|
|
else
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetFtBorder( rItem );
|
2004-02-03 17:28:15 +00:00
|
|
|
}
|
2011-09-15 10:54:46 +02:00
|
|
|
|
|
|
|
UpdateExample();
|
2004-02-03 17:28:15 +00:00
|
|
|
}
|
2011-09-15 10:54:46 +02:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxHFPage::UpdateExample()
|
|
|
|
{
|
|
|
|
if ( nId == SID_ATTR_PAGE_HEADERSET )
|
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetHeader( m_pTurnOnBox->IsChecked() );
|
|
|
|
m_pBspWin->SetHdHeight( GetCoreValue( *m_pHeightEdit, SFX_MAPUNIT_TWIP ) );
|
|
|
|
m_pBspWin->SetHdDist( GetCoreValue( *m_pDistEdit, SFX_MAPUNIT_TWIP ) );
|
|
|
|
m_pBspWin->SetHdLeft( GetCoreValue( *m_pLMEdit, SFX_MAPUNIT_TWIP ) );
|
|
|
|
m_pBspWin->SetHdRight( GetCoreValue( *m_pRMEdit, SFX_MAPUNIT_TWIP ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetFooter( m_pTurnOnBox->IsChecked() );
|
|
|
|
m_pBspWin->SetFtHeight( GetCoreValue( *m_pHeightEdit, SFX_MAPUNIT_TWIP ) );
|
|
|
|
m_pBspWin->SetFtDist( GetCoreValue( *m_pDistEdit, SFX_MAPUNIT_TWIP ) );
|
|
|
|
m_pBspWin->SetFtLeft( GetCoreValue( *m_pLMEdit, SFX_MAPUNIT_TWIP ) );
|
|
|
|
m_pBspWin->SetFtRight( GetCoreValue( *m_pRMEdit, SFX_MAPUNIT_TWIP ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->Invalidate();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet )
|
|
|
|
{
|
2011-01-10 16:11:35 +01:00
|
|
|
sal_uInt16 nWhich = GetWhich( SID_ATTR_PAGE_HEADERSET );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-01-10 16:11:35 +01:00
|
|
|
if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
const SvxSetItem& rSetItem =
|
2011-01-10 16:11:35 +01:00
|
|
|
(const SvxSetItem&)rSet.Get( nWhich, sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
|
|
|
|
const SfxBoolItem& rOn =
|
|
|
|
(const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
|
|
|
|
|
|
|
|
if ( rOn.GetValue() )
|
|
|
|
{
|
|
|
|
nWhich = GetWhich( SID_ATTR_BRUSH );
|
|
|
|
|
|
|
|
if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
|
|
|
|
{
|
|
|
|
const SvxBrushItem& rItem = (const SvxBrushItem&)rTmpSet.Get( nWhich );
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetHdColor( rItem.GetColor() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
|
|
|
|
|
|
|
|
if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
|
|
|
|
{
|
|
|
|
const SvxBoxItem& rItem =
|
|
|
|
(const SvxBoxItem&)rTmpSet.Get( nWhich );
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetHdBorder( rItem );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nWhich = GetWhich( SID_ATTR_PAGE_FOOTERSET );
|
|
|
|
|
2011-01-10 16:11:35 +01:00
|
|
|
if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
const SvxSetItem& rSetItem =
|
2011-01-10 16:11:35 +01:00
|
|
|
(const SvxSetItem&)rSet.Get( nWhich, sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
|
|
|
|
const SfxBoolItem& rOn =
|
|
|
|
(const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
|
|
|
|
|
|
|
|
if ( rOn.GetValue() )
|
|
|
|
{
|
|
|
|
nWhich = GetWhich( SID_ATTR_BRUSH );
|
|
|
|
|
|
|
|
if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
|
|
|
|
{
|
|
|
|
const SvxBrushItem& rItem = (const SvxBrushItem&)rTmpSet.Get( nWhich );
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetFtColor( rItem.GetColor() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
|
|
|
|
|
|
|
|
if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
|
|
|
|
{
|
|
|
|
const SvxBoxItem& rItem =
|
|
|
|
(const SvxBoxItem&)rTmpSet.Get( nWhich );
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetFtBorder( rItem );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nWhich = GetWhich( SID_ATTR_BRUSH );
|
|
|
|
|
|
|
|
if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
|
|
|
|
{
|
|
|
|
const SvxBrushItem& rItem = (const SvxBrushItem&)rSet.Get( nWhich );
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetColor( rItem.GetColor() );
|
2000-09-18 16:07:07 +00:00
|
|
|
const Graphic* pGrf = rItem.GetGraphic();
|
|
|
|
|
|
|
|
if ( pGrf )
|
|
|
|
{
|
|
|
|
Bitmap aBitmap = pGrf->GetBitmap();
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetBitmap( &aBitmap );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetBitmap( NULL );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
|
|
|
|
|
|
|
|
if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
|
|
|
|
{
|
|
|
|
const SvxBoxItem& rItem = (const SvxBoxItem&)rSet.Get( nWhich );
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetBorder( rItem );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
|
|
|
|
{
|
|
|
|
const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_LRSPACE );
|
|
|
|
|
|
|
|
if ( pItem )
|
|
|
|
{
|
2011-02-21 23:29:31 +01:00
|
|
|
// Set left and right margins
|
2000-09-18 16:07:07 +00:00
|
|
|
const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)*pItem;
|
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetLeft( rLRSpace.GetLeft() );
|
|
|
|
m_pBspWin->SetRight( rLRSpace.GetRight() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetLeft( 0 );
|
|
|
|
m_pBspWin->SetRight( 0 );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pItem = GetItem( rSet, SID_ATTR_ULSPACE );
|
|
|
|
|
|
|
|
if ( pItem )
|
|
|
|
{
|
2011-02-21 23:29:31 +01:00
|
|
|
// Set top and bottom margins
|
2000-09-18 16:07:07 +00:00
|
|
|
const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)*pItem;
|
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetTop( rULSpace.GetUpper() );
|
|
|
|
m_pBspWin->SetBottom( rULSpace.GetLower() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetTop( 0 );
|
|
|
|
m_pBspWin->SetBottom( 0 );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-01-10 16:11:35 +01:00
|
|
|
sal_uInt16 nUsage = SVX_PAGE_ALL;
|
2000-09-18 16:07:07 +00:00
|
|
|
pItem = GetItem( rSet, SID_ATTR_PAGE );
|
|
|
|
|
|
|
|
if ( pItem )
|
|
|
|
nUsage = ( (const SvxPageItem*)pItem )->GetPageUsage();
|
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetUsage( nUsage );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( SVX_PAGE_RIGHT == nUsage || SVX_PAGE_LEFT == nUsage )
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pCntSharedBox->Disable();
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2012-10-05 16:33:45 +02:00
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pCntSharedBox->Enable();
|
|
|
|
m_pCntSharedFirstBox->Enable();
|
2012-10-05 16:33:45 +02:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE );
|
|
|
|
|
|
|
|
if ( pItem )
|
|
|
|
{
|
2011-02-21 23:29:31 +01:00
|
|
|
// Orientation and Size from the PageItem
|
2000-09-18 16:07:07 +00:00
|
|
|
const SvxSizeItem& rSize = (const SvxSizeItem&)*pItem;
|
2011-02-21 23:29:31 +01:00
|
|
|
// if the size is already swapped (Landscape)
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetSize( rSize.GetSize() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-02-21 23:29:31 +01:00
|
|
|
// Evaluate Header attribute
|
2000-09-18 16:07:07 +00:00
|
|
|
const SvxSetItem* pSetItem = 0;
|
|
|
|
|
|
|
|
if ( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET ),
|
2011-01-10 16:11:35 +01:00
|
|
|
sal_False,
|
2000-09-18 16:07:07 +00:00
|
|
|
(const SfxPoolItem**)&pSetItem ) )
|
|
|
|
{
|
|
|
|
const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
|
|
|
|
const SfxBoolItem& rHeaderOn =
|
|
|
|
(const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
|
|
|
|
|
|
|
|
if ( rHeaderOn.GetValue() )
|
|
|
|
{
|
|
|
|
const SvxSizeItem& rSize = (const SvxSizeItem&)
|
|
|
|
rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
|
|
|
|
const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)
|
|
|
|
rHeaderSet.Get( GetWhich(SID_ATTR_ULSPACE ) );
|
|
|
|
const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)
|
|
|
|
rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
|
|
|
|
long nDist = rUL.GetLower();
|
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetHdHeight( rSize.GetSize().Height() - nDist );
|
|
|
|
m_pBspWin->SetHdDist( nDist );
|
|
|
|
m_pBspWin->SetHdLeft( rLR.GetLeft() );
|
|
|
|
m_pBspWin->SetHdRight( rLR.GetRight() );
|
|
|
|
m_pBspWin->SetHeader( sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
pSetItem = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !pSetItem )
|
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetHeader( sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( SID_ATTR_PAGE_HEADERSET == nId )
|
2012-10-05 16:33:45 +02:00
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pCntSharedBox->Disable();
|
|
|
|
m_pCntSharedFirstBox->Disable();
|
2012-10-05 16:33:45 +02:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
pSetItem = 0;
|
|
|
|
|
|
|
|
if ( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET ),
|
2011-01-10 16:11:35 +01:00
|
|
|
sal_False,
|
2000-09-18 16:07:07 +00:00
|
|
|
(const SfxPoolItem**)&pSetItem ) )
|
|
|
|
{
|
|
|
|
const SfxItemSet& rFooterSet = pSetItem->GetItemSet();
|
|
|
|
const SfxBoolItem& rFooterOn =
|
|
|
|
(const SfxBoolItem&)rFooterSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
|
|
|
|
|
|
|
|
if ( rFooterOn.GetValue() )
|
|
|
|
{
|
|
|
|
const SvxSizeItem& rSize = (const SvxSizeItem&)
|
|
|
|
rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
|
|
|
|
const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)
|
|
|
|
rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
|
|
|
|
const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)
|
|
|
|
rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
|
|
|
|
long nDist = rUL.GetUpper();
|
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetFtHeight( rSize.GetSize().Height() - nDist );
|
|
|
|
m_pBspWin->SetFtDist( nDist );
|
|
|
|
m_pBspWin->SetFtLeft( rLR.GetLeft() );
|
|
|
|
m_pBspWin->SetFtRight( rLR.GetRight() );
|
|
|
|
m_pBspWin->SetFooter( sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
pSetItem = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !pSetItem )
|
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetFooter( sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( SID_ATTR_PAGE_FOOTERSET == nId )
|
2012-10-05 16:33:45 +02:00
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pCntSharedBox->Disable();
|
|
|
|
m_pCntSharedFirstBox->Disable();
|
2012-10-05 16:33:45 +02:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 );
|
|
|
|
|
|
|
|
if ( pItem && pItem->ISA(SfxBoolItem) )
|
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetTable( sal_True );
|
|
|
|
m_pBspWin->SetHorz( ( (SfxBoolItem*)pItem )->GetValue() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pItem = GetItem( rSet, SID_ATTR_PAGE_EXT2 );
|
|
|
|
|
|
|
|
if ( pItem && pItem->ISA(SfxBoolItem) )
|
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pBspWin->SetTable( sal_True );
|
|
|
|
m_pBspWin->SetVert( ( (SfxBoolItem*)pItem )->GetValue() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
ResetBackground_Impl( rSet );
|
|
|
|
RangeHdl( 0 );
|
|
|
|
}
|
|
|
|
|
2006-06-19 14:12:17 +00:00
|
|
|
int SvxHFPage::DeactivatePage( SfxItemSet* _pSet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-06-19 14:12:17 +00:00
|
|
|
if ( _pSet )
|
|
|
|
FillItemSet( *_pSet );
|
2000-09-18 16:07:07 +00:00
|
|
|
return LEAVE_PAGE;
|
|
|
|
}
|
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG(SvxHFPage, RangeHdl)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
long nHHeight = m_pBspWin->GetHdHeight();
|
|
|
|
long nHDist = m_pBspWin->GetHdDist();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
long nFHeight = m_pBspWin->GetFtHeight();
|
|
|
|
long nFDist = m_pBspWin->GetFtDist();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-04-11 00:21:40 -03:00
|
|
|
long nHeight = std::max( (long)MINBODY,
|
2013-03-01 00:44:20 -03:00
|
|
|
static_cast<long>(m_pHeightEdit->Denormalize( m_pHeightEdit->GetValue( FUNIT_TWIP ) ) ) );
|
|
|
|
long nDist = m_pTurnOnBox->IsChecked() ?
|
|
|
|
static_cast<long>(m_pDistEdit->Denormalize( m_pDistEdit->GetValue( FUNIT_TWIP ) )) : 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
long nMin;
|
|
|
|
long nMax;
|
|
|
|
|
|
|
|
if ( nId == SID_ATTR_PAGE_HEADERSET )
|
|
|
|
{
|
|
|
|
nHHeight = nHeight;
|
|
|
|
nHDist = nDist;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nFHeight = nHeight;
|
|
|
|
nFDist = nDist;
|
|
|
|
}
|
|
|
|
|
2011-02-21 23:29:31 +01:00
|
|
|
// Current values of the side edges
|
2013-03-01 00:44:20 -03:00
|
|
|
long nBT = m_pBspWin->GetTop();
|
|
|
|
long nBB = m_pBspWin->GetBottom();
|
|
|
|
long nBL = m_pBspWin->GetLeft();
|
|
|
|
long nBR = m_pBspWin->GetRight();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-03-01 00:44:20 -03:00
|
|
|
long nH = m_pBspWin->GetSize().Height();
|
|
|
|
long nW = m_pBspWin->GetSize().Width();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-21 23:29:31 +01:00
|
|
|
// Borders
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nId == SID_ATTR_PAGE_HEADERSET )
|
|
|
|
{
|
|
|
|
// Header
|
|
|
|
nMin = ( nH - nBB - nBT ) / 5; // 20%
|
2013-04-11 00:21:40 -03:00
|
|
|
nMax = std::max( nH - nMin - nHDist - nFDist - nFHeight - nBB - nBT,
|
2000-09-18 16:07:07 +00:00
|
|
|
nMin );
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pHeightEdit->SetMax( m_pHeightEdit->Normalize( nMax ), FUNIT_TWIP );
|
2000-09-18 16:07:07 +00:00
|
|
|
nMin = ( nH - nBB - nBT ) / 5; // 20%
|
2013-04-11 00:21:40 -03:00
|
|
|
nDist = std::max( nH - nMin - nHHeight - nFDist - nFHeight - nBB - nBT,
|
2000-09-18 16:07:07 +00:00
|
|
|
long(0) );
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pDistEdit->SetMax( m_pDistEdit->Normalize( nDist ), FUNIT_TWIP );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Footer
|
|
|
|
nMin = ( nH - nBT - nBB ) / 5; // 20%
|
2013-04-11 00:21:40 -03:00
|
|
|
nMax = std::max( nH - nMin - nFDist - nHDist - nHHeight - nBT - nBB,
|
2000-09-18 16:07:07 +00:00
|
|
|
nMin );
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pHeightEdit->SetMax( m_pHeightEdit->Normalize( nMax ), FUNIT_TWIP );
|
2000-09-18 16:07:07 +00:00
|
|
|
nMin = ( nH - nBT - nBB ) / 5; // 20%
|
2013-04-11 00:21:40 -03:00
|
|
|
nDist = std::max( nH - nMin - nFHeight - nHDist - nHHeight - nBT - nBB,
|
2000-09-18 16:07:07 +00:00
|
|
|
long(0) );
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pDistEdit->SetMax( m_pDistEdit->Normalize( nDist ), FUNIT_TWIP );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-02-21 23:29:31 +01:00
|
|
|
// Limit Indentation
|
2000-09-18 16:07:07 +00:00
|
|
|
nMax = nW - nBL - nBR -
|
2013-03-01 00:44:20 -03:00
|
|
|
static_cast<long>(m_pRMEdit->Denormalize( m_pRMEdit->GetValue( FUNIT_TWIP ) )) - MINBODY;
|
|
|
|
m_pLMEdit->SetMax( m_pLMEdit->Normalize( nMax ), FUNIT_TWIP );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
nMax = nW - nBL - nBR -
|
2013-03-01 00:44:20 -03:00
|
|
|
static_cast<long>(m_pLMEdit->Denormalize( m_pLMEdit->GetValue( FUNIT_TWIP ) )) - MINBODY;
|
|
|
|
m_pRMEdit->SetMax( m_pLMEdit->Normalize( nMax ), FUNIT_TWIP );
|
2000-09-18 16:07:07 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-12 13:33:22 +02:00
|
|
|
static void lcl_Move(Window& rWin, sal_Int32 nDiff)
|
2002-08-26 10:36:56 +00:00
|
|
|
{
|
|
|
|
Point aPos(rWin.GetPosPixel());
|
|
|
|
aPos.Y() -= nDiff;
|
|
|
|
rWin.SetPosPixel(aPos);
|
|
|
|
}
|
|
|
|
void SvxHFPage::EnableDynamicSpacing()
|
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pDynSpacingCB->Show();
|
2002-08-26 10:36:56 +00:00
|
|
|
//move all following controls
|
|
|
|
Window* aMoveWindows[] =
|
|
|
|
{
|
2013-03-01 00:44:20 -03:00
|
|
|
m_pHeightFT,
|
|
|
|
m_pHeightEdit,
|
|
|
|
m_pHeightDynBtn,
|
|
|
|
m_pBackgroundBtn,
|
2002-08-26 10:36:56 +00:00
|
|
|
0
|
|
|
|
};
|
2013-03-01 00:44:20 -03:00
|
|
|
sal_Int32 nOffset = m_pTurnOnBox->GetPosPixel().Y() - m_pCntSharedBox->GetPosPixel().Y();
|
2002-08-26 10:36:56 +00:00
|
|
|
sal_Int32 nIdx = 0;
|
|
|
|
while(aMoveWindows[nIdx])
|
|
|
|
lcl_Move(*aMoveWindows[nIdx++], nOffset);
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|