2002-02-07 14:17:04 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 20:11:50 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2002-02-07 14:17:04 +00:00
|
|
|
*
|
2008-04-10 20:11:50 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2002-02-07 14:17:04 +00:00
|
|
|
*
|
2008-04-10 20:11:50 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-02-07 14:17:04 +00:00
|
|
|
*
|
2008-04-10 20:11:50 +00:00
|
|
|
* $RCSfile: pggrid.cxx,v $
|
|
|
|
* $Revision: 1.19 $
|
2002-02-07 14:17:04 +00:00
|
|
|
*
|
2008-04-10 20:11:50 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2002-02-07 14:17:04 +00:00
|
|
|
*
|
2008-04-10 20:11:50 +00:00
|
|
|
* 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.
|
2002-02-07 14:17:04 +00:00
|
|
|
*
|
2008-04-10 20:11:50 +00:00
|
|
|
* 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).
|
2002-02-07 14:17:04 +00:00
|
|
|
*
|
2008-04-10 20:11:50 +00:00
|
|
|
* 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.
|
2002-02-07 14:17:04 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 22:09:06 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sw.hxx"
|
|
|
|
|
2004-08-23 08:07:48 +00:00
|
|
|
#ifdef SW_DLLIMPLEMENTATION
|
|
|
|
#undef SW_DLLIMPLEMENTATION
|
|
|
|
#endif
|
|
|
|
|
2002-02-07 14:17:04 +00:00
|
|
|
|
|
|
|
|
2004-02-03 15:46:33 +00:00
|
|
|
#include <sfx2/app.hxx>
|
|
|
|
|
2002-02-07 14:17:04 +00:00
|
|
|
#ifndef _CMDID_H
|
|
|
|
#include <cmdid.h>
|
|
|
|
#endif
|
|
|
|
#include <hintids.hxx>
|
|
|
|
#include <swtypes.hxx>
|
|
|
|
#ifndef _GLOBALS_HRC
|
|
|
|
#include <globals.hrc>
|
|
|
|
#endif
|
|
|
|
#include <svx/xtable.hxx>
|
2002-02-11 11:30:58 +00:00
|
|
|
#include <uitool.hxx>
|
|
|
|
#include <svx/sizeitem.hxx>
|
|
|
|
#include <svx/lrspitem.hxx>
|
2008-03-07 15:34:02 +00:00
|
|
|
#include <svx/ulspitem.hxx>
|
2002-02-11 11:30:58 +00:00
|
|
|
#include <svx/boxitem.hxx>
|
2002-04-10 14:04:37 +00:00
|
|
|
#include <svx/frmdiritem.hxx>
|
2002-02-07 14:17:04 +00:00
|
|
|
#include <pggrid.hxx>
|
|
|
|
#include <tgrditem.hxx>
|
|
|
|
#include <pggrid.hrc>
|
|
|
|
|
2008-03-07 15:34:02 +00:00
|
|
|
#include "wrtsh.hxx"
|
|
|
|
#include "doc.hxx"
|
|
|
|
#include "uiitems.hxx"
|
|
|
|
#include "swmodule.hxx"
|
|
|
|
#include "view.hxx"
|
2002-02-07 14:17:04 +00:00
|
|
|
/*-- 06.02.2002 15:25:39---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
SwTextGridPage::SwTextGridPage(Window *pParent, const SfxItemSet &rSet) :
|
|
|
|
SfxTabPage(pParent, SW_RES(TP_TEXTGRID_PAGE), rSet),
|
2007-04-26 08:14:07 +00:00
|
|
|
aGridTypeFL (this, SW_RES(FL_GRID_TYPE )),
|
|
|
|
aNoGridRB (this, SW_RES(RB_NOGRID )),
|
|
|
|
aLinesGridRB (this, SW_RES(RB_LINESGRID )),
|
|
|
|
aCharsGridRB (this, SW_RES(RB_CHARSGRID )),
|
2008-03-07 15:34:02 +00:00
|
|
|
aSnapToCharsCB (this, SW_RES(CB_SNAPTOCHARS )),
|
2007-04-26 08:14:07 +00:00
|
|
|
aExampleWN (this, SW_RES(WN_EXAMPLE )),
|
|
|
|
aLayoutFL (this, SW_RES(FL_LAYOUT )),
|
|
|
|
aLinesPerPageFT (this, SW_RES(FT_LINESPERPAGE )),
|
|
|
|
aLinesPerPageNF (this, SW_RES(NF_LINESPERPAGE )),
|
|
|
|
aTextSizeFT (this, SW_RES(FT_TEXTSIZE )),
|
|
|
|
aTextSizeMF (this, SW_RES(MF_TEXTSIZE )),
|
|
|
|
aCharsPerLineFT (this, SW_RES(FT_CHARSPERLINE )),
|
|
|
|
aCharsPerLineNF (this, SW_RES(NF_CHARSPERLINE )),
|
2008-03-07 15:34:02 +00:00
|
|
|
aCharWidthFT (this, SW_RES(FT_CHARWIDTH )),
|
|
|
|
aCharWidthMF (this, SW_RES(MF_CHARWIDTH )),
|
2007-04-26 08:14:07 +00:00
|
|
|
aRubySizeFT (this, SW_RES(FT_RUBYSIZE )),
|
|
|
|
aRubySizeMF (this, SW_RES(MF_RUBYSIZE )),
|
|
|
|
aRubyBelowCB (this, SW_RES(CB_RUBYBELOW )),
|
|
|
|
aDisplayFL (this, SW_RES(FL_DISPLAY )),
|
|
|
|
aDisplayCB (this, SW_RES(CB_DISPLAY )),
|
|
|
|
aPrintCB (this, SW_RES(CB_PRINT )),
|
|
|
|
aColorFT (this, SW_RES(FT_COLOR )),
|
|
|
|
aColorLB (this, SW_RES(LB_COLOR )),
|
2002-04-10 14:04:37 +00:00
|
|
|
m_nRubyUserValue(0),
|
|
|
|
m_bRubyUserValue(sal_False),
|
2002-04-22 13:07:02 +00:00
|
|
|
m_aPageSize(MM50, MM50),
|
2008-03-07 15:34:02 +00:00
|
|
|
m_bVertical(sal_False),
|
|
|
|
m_bSquaredMode(sal_False)
|
2002-02-07 14:17:04 +00:00
|
|
|
{
|
|
|
|
FreeResource();
|
2002-02-11 11:30:58 +00:00
|
|
|
|
2002-04-22 13:07:02 +00:00
|
|
|
aControls[0] =&aLayoutFL;
|
|
|
|
aControls[1] =&aLinesPerPageFT;
|
|
|
|
aControls[2] =&aLinesPerPageNF;
|
|
|
|
aControls[3] =&aTextSizeFT;
|
|
|
|
aControls[4] =&aTextSizeMF;
|
|
|
|
aControls[5] =&aCharsPerLineFT;
|
|
|
|
aControls[6] =&aCharsPerLineNF;
|
2008-03-07 15:34:02 +00:00
|
|
|
aControls[7] =&aCharWidthFT;
|
|
|
|
aControls[8] =&aCharWidthMF;
|
|
|
|
aControls[9] =&aRubySizeFT;
|
|
|
|
aControls[10] =&aRubySizeMF;
|
|
|
|
aControls[11] =&aRubyBelowCB;
|
|
|
|
aControls[12] =&aDisplayFL;
|
|
|
|
aControls[13] =&aDisplayCB;
|
|
|
|
aControls[14] =&aPrintCB;
|
|
|
|
aControls[15] =&aColorFT;
|
|
|
|
aControls[16] =&aColorLB;
|
|
|
|
aControls[17] =0;
|
|
|
|
|
|
|
|
Link aLink = LINK(this, SwTextGridPage, CharorLineChangedHdl);
|
2002-08-15 06:04:16 +00:00
|
|
|
aCharsPerLineNF.SetUpHdl(aLink);
|
|
|
|
aCharsPerLineNF.SetDownHdl(aLink);
|
|
|
|
aCharsPerLineNF.SetLoseFocusHdl(aLink);
|
2008-03-07 15:34:02 +00:00
|
|
|
aLinesPerPageNF.SetUpHdl(aLink);
|
|
|
|
aLinesPerPageNF.SetDownHdl(aLink);
|
|
|
|
aLinesPerPageNF.SetLoseFocusHdl(aLink);
|
|
|
|
|
|
|
|
Link aSizeLink = LINK(this, SwTextGridPage, TextSizeChangedHdl);
|
|
|
|
aTextSizeMF.SetUpHdl(aSizeLink);
|
|
|
|
aTextSizeMF.SetDownHdl(aSizeLink);
|
|
|
|
aTextSizeMF.SetLoseFocusHdl(aSizeLink);
|
|
|
|
aRubySizeMF.SetUpHdl(aSizeLink);
|
|
|
|
aRubySizeMF.SetDownHdl(aSizeLink);
|
|
|
|
aRubySizeMF.SetLoseFocusHdl(aSizeLink);
|
|
|
|
aCharWidthMF.SetUpHdl(aSizeLink);
|
|
|
|
aCharWidthMF.SetDownHdl(aSizeLink);
|
|
|
|
aCharWidthMF.SetLoseFocusHdl(aSizeLink);
|
2002-02-11 11:30:58 +00:00
|
|
|
|
2002-04-22 13:07:02 +00:00
|
|
|
Link aGridTypeHdl = LINK(this, SwTextGridPage, GridTypeHdl);
|
|
|
|
aNoGridRB .SetClickHdl(aGridTypeHdl);
|
|
|
|
aLinesGridRB.SetClickHdl(aGridTypeHdl);
|
|
|
|
aCharsGridRB.SetClickHdl(aGridTypeHdl);
|
|
|
|
|
2002-02-11 11:30:58 +00:00
|
|
|
Link aModifyLk = LINK(this, SwTextGridPage, GridModifyHdl);
|
|
|
|
aColorLB.SetSelectHdl(aModifyLk);
|
|
|
|
aPrintCB.SetClickHdl(aModifyLk);
|
|
|
|
aRubyBelowCB.SetClickHdl(aModifyLk);
|
|
|
|
|
2002-08-15 06:04:16 +00:00
|
|
|
|
2002-04-22 13:07:02 +00:00
|
|
|
aDisplayCB.SetClickHdl(LINK(this, SwTextGridPage, DisplayGridHdl));
|
|
|
|
|
2004-02-03 15:46:33 +00:00
|
|
|
XColorTable* pColorTbl = XColorTable::GetStdColorTable();
|
2002-02-07 14:17:04 +00:00
|
|
|
aColorLB.InsertAutomaticEntry();
|
|
|
|
for( USHORT i = 0; i < pColorTbl->Count(); ++i )
|
|
|
|
{
|
2006-06-19 11:43:59 +00:00
|
|
|
XColorEntry* pEntry = pColorTbl->GetColor( i );
|
2002-02-07 14:17:04 +00:00
|
|
|
Color aColor = pEntry->GetColor();
|
|
|
|
String sName = pEntry->GetName();
|
|
|
|
aColorLB.InsertEntry( aColor, sName );
|
|
|
|
}
|
|
|
|
aColorLB.SetUpdateMode( TRUE );
|
2008-03-07 15:34:02 +00:00
|
|
|
//Get the default paper mode
|
|
|
|
SwView *pView = ::GetActiveView();
|
|
|
|
if( pView )
|
|
|
|
{
|
|
|
|
SwWrtShell* pSh = pView->GetWrtShellPtr();
|
|
|
|
if( pSh )
|
|
|
|
{
|
|
|
|
m_bSquaredMode = pSh->GetDoc()->IsSquaredPageMode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( m_bSquaredMode )
|
|
|
|
{
|
|
|
|
aRubySizeFT.Show();
|
|
|
|
aRubySizeMF.Show();
|
|
|
|
aRubyBelowCB.Show();
|
|
|
|
aSnapToCharsCB.Hide();
|
|
|
|
aCharWidthFT.Hide();
|
|
|
|
aCharWidthMF.Hide();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aRubySizeFT.Hide();
|
|
|
|
aRubySizeMF.Hide();
|
|
|
|
aRubyBelowCB.Hide();
|
|
|
|
aSnapToCharsCB.Show();
|
|
|
|
aCharWidthFT.Show();
|
|
|
|
aCharWidthMF.Show();
|
|
|
|
}
|
2002-02-07 14:17:04 +00:00
|
|
|
}
|
|
|
|
/*-- 06.02.2002 15:25:40---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
SwTextGridPage::~SwTextGridPage()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
/*-- 06.02.2002 15:25:40---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
SfxTabPage *SwTextGridPage::Create(Window *pParent, const SfxItemSet &rSet)
|
|
|
|
{
|
|
|
|
return new SwTextGridPage(pParent, rSet);
|
|
|
|
}
|
|
|
|
/*-- 06.02.2002 15:25:40---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
BOOL SwTextGridPage::FillItemSet(SfxItemSet &rSet)
|
|
|
|
{
|
|
|
|
BOOL bRet = FALSE;
|
|
|
|
if(aNoGridRB.GetSavedValue() != aNoGridRB.IsChecked()||
|
|
|
|
aLinesGridRB.GetSavedValue() != aLinesGridRB.IsChecked()||
|
2004-02-26 12:10:28 +00:00
|
|
|
aLinesPerPageNF.GetSavedValue().ToInt32()
|
|
|
|
!= aLinesPerPageNF.GetValue()||
|
|
|
|
aTextSizeMF.GetSavedValue().ToInt32() != aTextSizeMF.GetValue()||
|
|
|
|
aCharsPerLineNF.GetSavedValue().ToInt32()
|
|
|
|
!= aCharsPerLineNF.GetValue()||
|
2008-03-07 15:34:02 +00:00
|
|
|
aSnapToCharsCB.GetSavedValue() != aSnapToCharsCB.IsChecked() ||
|
2004-02-26 12:10:28 +00:00
|
|
|
aRubySizeMF.GetSavedValue().ToInt32() != aRubySizeMF.GetValue()||
|
2008-03-07 15:34:02 +00:00
|
|
|
aCharWidthMF.GetSavedValue().ToInt32() != aCharWidthMF.GetValue()||
|
2002-02-07 14:17:04 +00:00
|
|
|
aRubyBelowCB.GetSavedValue() != aRubyBelowCB.IsChecked()||
|
|
|
|
aDisplayCB.GetSavedValue() != aDisplayCB.IsChecked()||
|
|
|
|
aPrintCB.GetSavedValue() != aPrintCB.IsChecked()||
|
|
|
|
aColorLB.GetSavedValue() != aColorLB.GetSelectEntryPos())
|
|
|
|
{
|
2002-02-11 11:30:58 +00:00
|
|
|
PutGridItem(rSet);
|
2002-02-07 14:17:04 +00:00
|
|
|
bRet = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
/*-- 06.02.2002 15:25:40---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
void SwTextGridPage::Reset(const SfxItemSet &rSet)
|
|
|
|
{
|
|
|
|
if(SFX_ITEM_AVAILABLE <= rSet.GetItemState(RES_TEXTGRID, TRUE))
|
|
|
|
{
|
|
|
|
const SwTextGridItem& rGridItem = (const SwTextGridItem&)rSet.Get(RES_TEXTGRID);
|
2002-04-22 13:07:02 +00:00
|
|
|
RadioButton* pButton = 0;
|
2002-02-07 14:17:04 +00:00
|
|
|
switch(rGridItem.GetGridType())
|
|
|
|
{
|
2002-04-22 13:07:02 +00:00
|
|
|
case GRID_NONE : pButton = &aNoGridRB; break;
|
|
|
|
case GRID_LINES_ONLY : pButton = &aLinesGridRB; break;
|
|
|
|
default: pButton = &aCharsGridRB;
|
2002-02-07 14:17:04 +00:00
|
|
|
}
|
2002-04-22 13:07:02 +00:00
|
|
|
pButton->Check();
|
2009-08-06 12:44:16 +00:00
|
|
|
aDisplayCB.Check(rGridItem.IsDisplayGrid());
|
2002-04-22 13:07:02 +00:00
|
|
|
GridTypeHdl(pButton);
|
2008-03-07 15:34:02 +00:00
|
|
|
aSnapToCharsCB.Check(rGridItem.IsSnapToChars());
|
2002-02-07 14:17:04 +00:00
|
|
|
aLinesPerPageNF.SetValue(rGridItem.GetLines());
|
2002-04-10 14:04:37 +00:00
|
|
|
m_nRubyUserValue = rGridItem.GetBaseHeight();
|
|
|
|
m_bRubyUserValue = sal_True;
|
|
|
|
aTextSizeMF.SetValue(aTextSizeMF.Normalize(m_nRubyUserValue), FUNIT_TWIP);
|
2002-02-07 14:17:04 +00:00
|
|
|
aRubySizeMF.SetValue(aRubySizeMF.Normalize(rGridItem.GetRubyHeight()), FUNIT_TWIP);
|
2008-03-07 15:34:02 +00:00
|
|
|
aCharWidthMF.SetValue(aCharWidthMF.Normalize(rGridItem.GetBaseWidth()), FUNIT_TWIP);
|
2002-02-07 14:17:04 +00:00
|
|
|
aRubyBelowCB.Check(rGridItem.IsRubyTextBelow());
|
|
|
|
aPrintCB.Check(rGridItem.IsPrintGrid());
|
|
|
|
aColorLB.SelectEntry(rGridItem.GetColor());
|
|
|
|
}
|
2002-04-22 13:07:02 +00:00
|
|
|
UpdatePageSize(rSet);
|
2002-02-11 11:30:58 +00:00
|
|
|
|
2002-02-07 14:17:04 +00:00
|
|
|
aNoGridRB.SaveValue();
|
|
|
|
aLinesGridRB.SaveValue();
|
2008-03-07 15:34:02 +00:00
|
|
|
aSnapToCharsCB.SaveValue();
|
2002-02-07 14:17:04 +00:00
|
|
|
aLinesPerPageNF.SaveValue();
|
|
|
|
aTextSizeMF.SaveValue();
|
|
|
|
aCharsPerLineNF.SaveValue();
|
|
|
|
aRubySizeMF.SaveValue();
|
2008-03-07 15:34:02 +00:00
|
|
|
aCharWidthMF.SaveValue();
|
2002-02-07 14:17:04 +00:00
|
|
|
aRubyBelowCB.SaveValue();
|
|
|
|
aDisplayCB.SaveValue();
|
|
|
|
aPrintCB.SaveValue();
|
|
|
|
aColorLB.SaveValue();
|
|
|
|
}
|
|
|
|
/*-- 06.02.2002 15:25:41---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
void SwTextGridPage::ActivatePage( const SfxItemSet& rSet )
|
|
|
|
{
|
|
|
|
aExampleWN.Hide();
|
2002-02-11 11:30:58 +00:00
|
|
|
aExampleWN.UpdateExample( rSet );
|
2002-04-22 13:07:02 +00:00
|
|
|
UpdatePageSize(rSet);
|
2002-02-07 14:17:04 +00:00
|
|
|
aExampleWN.Show();
|
2002-02-11 11:30:58 +00:00
|
|
|
aExampleWN.Invalidate();
|
2002-02-07 14:17:04 +00:00
|
|
|
}
|
|
|
|
/*-- 06.02.2002 15:25:41---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
2007-09-27 11:23:06 +00:00
|
|
|
int SwTextGridPage::DeactivatePage( SfxItemSet* )
|
2002-02-07 14:17:04 +00:00
|
|
|
{
|
2002-07-23 07:25:36 +00:00
|
|
|
return LEAVE_PAGE;
|
2002-02-07 14:17:04 +00:00
|
|
|
}
|
2002-02-11 11:30:58 +00:00
|
|
|
/* -----------------------------08.02.2002 11:57------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
void SwTextGridPage::PutGridItem(SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
SwTextGridItem aGridItem;
|
|
|
|
aGridItem.SetGridType(aNoGridRB.IsChecked() ? GRID_NONE :
|
|
|
|
aLinesGridRB.IsChecked() ? GRID_LINES_ONLY : GRID_LINES_CHARS );
|
2008-03-07 15:34:02 +00:00
|
|
|
aGridItem.SetSnapToChars(aSnapToCharsCB.IsChecked());
|
2007-09-27 11:23:06 +00:00
|
|
|
aGridItem.SetLines( static_cast< sal_uInt16 >(aLinesPerPageNF.GetValue()) );
|
|
|
|
aGridItem.SetBaseHeight( static_cast< sal_uInt16 >(
|
2002-04-10 14:04:37 +00:00
|
|
|
m_bRubyUserValue ? m_nRubyUserValue :
|
2007-09-27 11:23:06 +00:00
|
|
|
aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP))) );
|
|
|
|
aGridItem.SetRubyHeight( static_cast< sal_uInt16 >(aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP))) );
|
2008-03-07 15:34:02 +00:00
|
|
|
aGridItem.SetBaseWidth( static_cast< sal_uInt16 >(aCharWidthMF.Denormalize(aCharWidthMF.GetValue(FUNIT_TWIP))) );
|
2002-02-11 11:30:58 +00:00
|
|
|
aGridItem.SetRubyTextBelow(aRubyBelowCB.IsChecked());
|
2008-03-07 15:34:02 +00:00
|
|
|
aGridItem.SetSquaredMode(m_bSquaredMode);
|
2002-02-11 11:30:58 +00:00
|
|
|
aGridItem.SetDisplayGrid(aDisplayCB.IsChecked());
|
|
|
|
aGridItem.SetPrintGrid(aPrintCB.IsChecked());
|
|
|
|
aGridItem.SetColor(aColorLB.GetSelectEntryColor());
|
|
|
|
rSet.Put(aGridItem);
|
|
|
|
}
|
|
|
|
/* -----------------------------08.02.2002 10:54------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
2002-04-22 13:07:02 +00:00
|
|
|
void SwTextGridPage::UpdatePageSize(const SfxItemSet& rSet)
|
2002-02-11 11:30:58 +00:00
|
|
|
{
|
2002-04-10 14:04:37 +00:00
|
|
|
if( SFX_ITEM_UNKNOWN != rSet.GetItemState( RES_FRAMEDIR, TRUE ))
|
|
|
|
{
|
|
|
|
const SvxFrameDirectionItem& rDirItem =
|
|
|
|
(const SvxFrameDirectionItem&)rSet.Get(RES_FRAMEDIR);
|
|
|
|
m_bVertical = rDirItem.GetValue() == FRMDIR_VERT_TOP_RIGHT||
|
|
|
|
rDirItem.GetValue() == FRMDIR_VERT_TOP_LEFT;
|
|
|
|
}
|
|
|
|
|
2002-02-11 11:30:58 +00:00
|
|
|
if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_PAGE_SIZE ))
|
|
|
|
{
|
|
|
|
const SvxSizeItem& rSize = (const SvxSizeItem&)rSet.Get(
|
|
|
|
SID_ATTR_PAGE_SIZE);
|
|
|
|
const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)rSet.Get(
|
|
|
|
RES_LR_SPACE );
|
2008-03-07 15:34:02 +00:00
|
|
|
const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)rSet.Get(
|
|
|
|
RES_UL_SPACE );
|
2002-02-11 11:30:58 +00:00
|
|
|
const SvxBoxItem& rBox = (const SvxBoxItem&) rSet.Get(RES_BOX);
|
2008-03-07 15:34:02 +00:00
|
|
|
sal_Int32 nDistanceLR = rLRSpace.GetLeft() + rLRSpace.GetRight();
|
|
|
|
sal_Int32 nDistanceUL = rULSpace.GetUpper() + rULSpace.GetLower();
|
2002-04-10 14:04:37 +00:00
|
|
|
|
2008-03-07 15:34:02 +00:00
|
|
|
sal_Int32 nValue1 = rSize.GetSize().Height() - nDistanceUL -
|
2002-04-10 14:04:37 +00:00
|
|
|
rBox.GetDistance(BOX_LINE_TOP) -
|
|
|
|
rBox.GetDistance(BOX_LINE_BOTTOM);
|
2008-03-07 15:34:02 +00:00
|
|
|
sal_Int32 nValue2 = rSize.GetSize().Width() - nDistanceLR -
|
2002-04-10 14:04:37 +00:00
|
|
|
rBox.GetDistance(BOX_LINE_LEFT) -
|
|
|
|
rBox.GetDistance(BOX_LINE_RIGHT);
|
2002-04-22 13:07:02 +00:00
|
|
|
if(m_bVertical)
|
|
|
|
{
|
|
|
|
m_aPageSize.Width() = nValue1;
|
|
|
|
m_aPageSize.Height() = nValue2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_aPageSize.Width() = nValue2;
|
|
|
|
m_aPageSize.Height() = nValue1;
|
|
|
|
}
|
2002-04-10 14:04:37 +00:00
|
|
|
|
2007-09-27 11:23:06 +00:00
|
|
|
sal_Int32 nTextSize = static_cast< sal_Int32 >(m_bRubyUserValue ?
|
2002-04-10 14:04:37 +00:00
|
|
|
m_nRubyUserValue :
|
2008-03-07 15:34:02 +00:00
|
|
|
aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)));
|
|
|
|
|
|
|
|
if ( m_bSquaredMode )
|
|
|
|
{
|
|
|
|
aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextSize);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sal_Int32 nTextWidth = static_cast< sal_Int32 >(aCharWidthMF.Denormalize(aCharWidthMF.GetValue(FUNIT_TWIP)));
|
|
|
|
aLinesPerPageNF.SetValue(m_aPageSize.Height() / nTextSize);
|
|
|
|
if (nTextWidth)
|
|
|
|
aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextWidth);
|
|
|
|
else
|
|
|
|
aCharsPerLineNF.SetValue( 45 );
|
|
|
|
}
|
2002-02-11 11:30:58 +00:00
|
|
|
}
|
|
|
|
}
|
2002-02-07 14:17:04 +00:00
|
|
|
/* -----------------------------06.02.2002 15:24------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
USHORT* SwTextGridPage::GetRanges()
|
|
|
|
{
|
|
|
|
static USHORT __FAR_DATA aPageRg[] = {
|
|
|
|
RES_TEXTGRID, RES_TEXTGRID,
|
|
|
|
0};
|
|
|
|
return aPageRg;
|
|
|
|
}
|
2002-02-11 11:30:58 +00:00
|
|
|
/* -----------------------------08.02.2002 10:56------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
2008-03-07 15:34:02 +00:00
|
|
|
IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField*, pField)
|
2002-02-11 11:30:58 +00:00
|
|
|
{
|
2008-03-07 15:34:02 +00:00
|
|
|
//if in squared mode
|
|
|
|
if ( m_bSquaredMode )
|
2002-02-11 11:30:58 +00:00
|
|
|
{
|
2008-03-07 15:34:02 +00:00
|
|
|
if(&aCharsPerLineNF == pField)
|
|
|
|
{
|
|
|
|
long nWidth = (long)(m_aPageSize.Width() / aCharsPerLineNF.GetValue());
|
|
|
|
aTextSizeMF.SetValue(aTextSizeMF.Normalize(nWidth), FUNIT_TWIP);
|
|
|
|
//prevent rounding errors in the MetricField by saving the used value
|
|
|
|
m_nRubyUserValue = nWidth;
|
|
|
|
m_bRubyUserValue = sal_True;
|
|
|
|
|
|
|
|
}
|
|
|
|
//set maximum line per page
|
|
|
|
{
|
|
|
|
sal_Int32 nMaxLines = static_cast< sal_Int32 >(m_aPageSize.Height() /
|
|
|
|
( aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)) +
|
|
|
|
aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP))));
|
|
|
|
aLinesPerPageNF.SetMax(nMaxLines);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else//in normal mode
|
|
|
|
{
|
|
|
|
if(&aLinesPerPageNF == pField)
|
|
|
|
{
|
|
|
|
long nHeight = static_cast< sal_Int32 >(m_aPageSize.Height() / aLinesPerPageNF.GetValue());
|
|
|
|
aTextSizeMF.SetValue(aTextSizeMF.Normalize(nHeight), FUNIT_TWIP);
|
|
|
|
aRubySizeMF.SetValue(0, FUNIT_TWIP);
|
|
|
|
|
|
|
|
m_nRubyUserValue = nHeight;
|
|
|
|
m_bRubyUserValue = sal_True;
|
|
|
|
}
|
|
|
|
else if (&aCharsPerLineNF == pField)
|
|
|
|
{
|
|
|
|
long nWidth = static_cast< sal_Int32 >(m_aPageSize.Width() / aCharsPerLineNF.GetValue());
|
|
|
|
aCharWidthMF.SetValue(aCharWidthMF.Normalize(nWidth), FUNIT_TWIP);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GridModifyHdl(0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* -----------------------------04.09.2006 15:46------------------------------
|
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField*, pField)
|
|
|
|
{
|
|
|
|
//if in squared mode
|
|
|
|
if( m_bSquaredMode )
|
|
|
|
{
|
|
|
|
if (&aTextSizeMF == pField)
|
|
|
|
{
|
|
|
|
sal_Int32 nTextSize = static_cast< sal_Int32 >(aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)));
|
|
|
|
aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextSize);
|
|
|
|
m_bRubyUserValue = sal_False;
|
|
|
|
}
|
|
|
|
//set maximum line per page
|
|
|
|
{
|
|
|
|
sal_Int32 nMaxLines = static_cast< sal_Int32 >(m_aPageSize.Height() /
|
|
|
|
( aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)) +
|
|
|
|
aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP))));
|
|
|
|
aLinesPerPageNF.SetMax(nMaxLines);
|
|
|
|
}
|
2002-02-11 11:30:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-07 15:34:02 +00:00
|
|
|
if (&aTextSizeMF == pField)
|
|
|
|
{
|
|
|
|
sal_Int32 nTextSize = static_cast< sal_Int32 >(aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)));
|
|
|
|
aLinesPerPageNF.SetValue(m_aPageSize.Height() / nTextSize);
|
|
|
|
m_bRubyUserValue = sal_False;
|
|
|
|
}
|
|
|
|
else if (&aCharWidthMF == pField)
|
|
|
|
{
|
|
|
|
sal_Int32 nTextWidth = static_cast< sal_Int32 >(aCharWidthMF.Denormalize(aCharWidthMF.GetValue(FUNIT_TWIP)));
|
|
|
|
if (nTextWidth)
|
|
|
|
aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextWidth);
|
|
|
|
else
|
|
|
|
aCharsPerLineNF.SetValue( 45 );
|
|
|
|
}
|
|
|
|
//rubySize is disabled
|
2002-02-11 11:30:58 +00:00
|
|
|
}
|
|
|
|
GridModifyHdl(0);
|
|
|
|
return 0;
|
|
|
|
}
|
2002-04-22 13:07:02 +00:00
|
|
|
/* -----------------------------22.04.2002 14:53------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
IMPL_LINK(SwTextGridPage, GridTypeHdl, RadioButton*, pButton)
|
|
|
|
{
|
|
|
|
sal_Bool bEnable = &aNoGridRB != pButton;
|
|
|
|
sal_Int32 nIndex = 0;
|
|
|
|
while(aControls[nIndex])
|
|
|
|
aControls[nIndex++]->Enable(bEnable);
|
|
|
|
//one special case
|
|
|
|
if(bEnable)
|
|
|
|
DisplayGridHdl(&aDisplayCB);
|
|
|
|
|
2008-03-07 15:34:02 +00:00
|
|
|
bEnable = &aCharsGridRB == pButton;
|
|
|
|
aSnapToCharsCB.Enable(bEnable);
|
|
|
|
|
|
|
|
bEnable = &aLinesGridRB == pButton;
|
|
|
|
if(bEnable && !m_bSquaredMode )
|
|
|
|
{
|
|
|
|
aCharsPerLineFT.Enable(sal_False);
|
|
|
|
aCharsPerLineNF.Enable(sal_False);
|
|
|
|
aCharWidthFT.Enable(sal_False);
|
|
|
|
aCharWidthMF.Enable(sal_False);
|
|
|
|
}
|
|
|
|
|
2002-04-22 13:07:02 +00:00
|
|
|
GridModifyHdl(0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* -----------------------------22.04.2002 15:46------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
IMPL_LINK(SwTextGridPage, DisplayGridHdl, CheckBox*, EMPTYARG)
|
|
|
|
{
|
|
|
|
aPrintCB.Enable(aDisplayCB.IsChecked());
|
|
|
|
return 0;
|
|
|
|
}
|
2002-02-11 11:30:58 +00:00
|
|
|
/* -----------------------------08.02.2002 11:54------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
IMPL_LINK(SwTextGridPage, GridModifyHdl, void*, EMPTYARG)
|
|
|
|
{
|
|
|
|
const SfxItemSet& rOldSet = GetItemSet();
|
|
|
|
SfxItemSet aSet(rOldSet);
|
|
|
|
const SfxItemSet* pExSet = GetTabDialog()->GetExampleSet();
|
|
|
|
if(pExSet)
|
|
|
|
aSet.Put(*pExSet);
|
|
|
|
PutGridItem(aSet);
|
|
|
|
aExampleWN.UpdateExample(aSet);
|
|
|
|
return 0;
|
|
|
|
}
|
2002-02-07 14:17:04 +00:00
|
|
|
|