Files
libreoffice/sw/source/ui/misc/pggrid.cxx

525 lines
19 KiB
C++
Raw Normal View History

2002-02-07 14:17:04 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2002-02-07 14:17:04 +00:00
*
* Copyright 2008 by Sun Microsystems, Inc.
2002-02-07 14:17:04 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2002-02-07 14:17:04 +00:00
*
* $RCSfile: pggrid.cxx,v $
* $Revision: 1.19 $
2002-02-07 14:17:04 +00:00
*
* This file is part of OpenOffice.org.
2002-02-07 14:17:04 +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
*
* 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
*
* 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
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
#ifdef SW_DLLIMPLEMENTATION
#undef SW_DLLIMPLEMENTATION
#endif
2002-02-07 14:17:04 +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>
#include <svx/ulspitem.hxx>
2002-02-11 11:30:58 +00:00
#include <svx/boxitem.hxx>
#include <svx/frmdiritem.hxx>
2002-02-07 14:17:04 +00:00
#include <pggrid.hxx>
#include <tgrditem.hxx>
#include <pggrid.hrc>
#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),
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 )),
aSnapToCharsCB (this, SW_RES(CB_SNAPTOCHARS )),
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 )),
aCharWidthFT (this, SW_RES(FT_CHARWIDTH )),
aCharWidthMF (this, SW_RES(MF_CHARWIDTH )),
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 )),
m_nRubyUserValue(0),
m_bRubyUserValue(sal_False),
m_aPageSize(MM50, MM50),
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
aControls[0] =&aLayoutFL;
aControls[1] =&aLinesPerPageFT;
aControls[2] =&aLinesPerPageNF;
aControls[3] =&aTextSizeFT;
aControls[4] =&aTextSizeMF;
aControls[5] =&aCharsPerLineFT;
aControls[6] =&aCharsPerLineNF;
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);
aCharsPerLineNF.SetUpHdl(aLink);
aCharsPerLineNF.SetDownHdl(aLink);
aCharsPerLineNF.SetLoseFocusHdl(aLink);
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
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);
aDisplayCB.SetClickHdl(LINK(this, SwTextGridPage, DisplayGridHdl));
XColorTable* pColorTbl = XColorTable::GetStdColorTable();
2002-02-07 14:17:04 +00:00
aColorLB.InsertAutomaticEntry();
for( USHORT i = 0; i < pColorTbl->Count(); ++i )
{
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 );
//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()||
aLinesPerPageNF.GetSavedValue().ToInt32()
!= aLinesPerPageNF.GetValue()||
aTextSizeMF.GetSavedValue().ToInt32() != aTextSizeMF.GetValue()||
aCharsPerLineNF.GetSavedValue().ToInt32()
!= aCharsPerLineNF.GetValue()||
aSnapToCharsCB.GetSavedValue() != aSnapToCharsCB.IsChecked() ||
aRubySizeMF.GetSavedValue().ToInt32() != aRubySizeMF.GetValue()||
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);
RadioButton* pButton = 0;
2002-02-07 14:17:04 +00:00
switch(rGridItem.GetGridType())
{
case GRID_NONE : pButton = &aNoGridRB; break;
case GRID_LINES_ONLY : pButton = &aLinesGridRB; break;
default: pButton = &aCharsGridRB;
2002-02-07 14:17:04 +00:00
}
pButton->Check();
CWS-TOOLING: integrate CWS os132 2009-07-21 15:24:18 +0200 os r274201 : #i103696# SwXTextPortion/SwXParagraph excluded 2009-07-15 13:19:17 +0200 os r274007 : #i103564# typo 2009-07-15 13:09:30 +0200 os r274005 : #i103564# SwFrames::hasElements 2009-07-15 13:02:16 +0200 os r274003 : #i103564# SwXBookmark::getPropertySetInfo fixed 2009-06-26 10:11:00 +0200 os r273395 : CWS-TOOLING: rebase CWS os132 to trunk@272827 (milestone: DEV300:m50) 2009-06-23 08:52:24 +0200 os r273256 : #i102764# patch: attribute ListBoxes correctly handled in ::Reset() 2009-06-23 08:51:31 +0200 os r273255 : #i102764# ResetColor() added to remove background color 2009-06-22 14:57:38 +0200 os r273233 : #i102619# prevent access to already destroyed shell 2009-06-18 13:26:51 +0200 os r273112 : #i99508# ::insertTextContent: re-route to ::attach() 2009-06-18 10:59:53 +0200 os r273107 : #i85405# patch to enable 'Print grid' CheckBox correctly 2009-06-18 10:54:02 +0200 os r273106 : #i85133# dispose connection in GetColumnFmt to prevent connection locking 2009-06-18 10:24:31 +0200 os r273104 : #99535# ExportGraphic changed 2009-06-18 10:24:03 +0200 os r273103 : #99535# ExportGraphic changed 2009-06-18 10:23:11 +0200 os r273102 : #i102841# redlining mode switches to insert mode (cmc) 2009-06-17 14:05:42 +0200 os r273070 : #i102111# do not save already saved HTML documents before switching to source veiw 2009-06-17 13:18:20 +0200 os r273063 : #i101825# set rembered start position at the real start not at the initial start 2009-06-17 08:24:10 +0200 os r273048 : #99535# no dierect access to the file picker interface 2009-06-16 15:00:12 +0200 os r273020 : #i99937# notification of user options changes re-introduced 2009-06-15 14:36:03 +0200 os r272987 : #i98032# unreplaced text in protected areas must not be attributed either 2009-06-15 14:20:26 +0200 os r272985 : #i98032# replace list has to be initialised 2009-06-04 13:29:02 +0200 os r272624 : #i97810# set focus into column page 2009-06-04 11:01:14 +0200 os r272617 : #i98164# dialog resize to ease localisation 2009-06-04 10:59:44 +0200 os r272616 : #i98164# dialog resize to ease localisation 2009-05-28 16:05:03 +0200 os r272413 : #i98172# ConvertFieldsToText: take care of tabs with attributes 2009-05-28 11:12:45 +0200 os r272385 : #i59361# dialog controls resized 2009-05-28 11:03:14 +0200 os r272383 : #i59174# dialog controls moved
2009-08-06 12:44:16 +00:00
aDisplayCB.Check(rGridItem.IsDisplayGrid());
GridTypeHdl(pButton);
aSnapToCharsCB.Check(rGridItem.IsSnapToChars());
2002-02-07 14:17:04 +00:00
aLinesPerPageNF.SetValue(rGridItem.GetLines());
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);
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());
}
UpdatePageSize(rSet);
2002-02-11 11:30:58 +00:00
2002-02-07 14:17:04 +00:00
aNoGridRB.SaveValue();
aLinesGridRB.SaveValue();
aSnapToCharsCB.SaveValue();
2002-02-07 14:17:04 +00:00
aLinesPerPageNF.SaveValue();
aTextSizeMF.SaveValue();
aCharsPerLineNF.SaveValue();
aRubySizeMF.SaveValue();
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 );
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---------------------------------------------------
-----------------------------------------------------------------------*/
int SwTextGridPage::DeactivatePage( SfxItemSet* )
2002-02-07 14:17:04 +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 );
aGridItem.SetSnapToChars(aSnapToCharsCB.IsChecked());
aGridItem.SetLines( static_cast< sal_uInt16 >(aLinesPerPageNF.GetValue()) );
aGridItem.SetBaseHeight( static_cast< sal_uInt16 >(
m_bRubyUserValue ? m_nRubyUserValue :
aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP))) );
aGridItem.SetRubyHeight( static_cast< sal_uInt16 >(aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP))) );
aGridItem.SetBaseWidth( static_cast< sal_uInt16 >(aCharWidthMF.Denormalize(aCharWidthMF.GetValue(FUNIT_TWIP))) );
2002-02-11 11:30:58 +00:00
aGridItem.SetRubyTextBelow(aRubyBelowCB.IsChecked());
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------------------------------
---------------------------------------------------------------------------*/
void SwTextGridPage::UpdatePageSize(const SfxItemSet& rSet)
2002-02-11 11:30:58 +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 );
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);
sal_Int32 nDistanceLR = rLRSpace.GetLeft() + rLRSpace.GetRight();
sal_Int32 nDistanceUL = rULSpace.GetUpper() + rULSpace.GetLower();
sal_Int32 nValue1 = rSize.GetSize().Height() - nDistanceUL -
rBox.GetDistance(BOX_LINE_TOP) -
rBox.GetDistance(BOX_LINE_BOTTOM);
sal_Int32 nValue2 = rSize.GetSize().Width() - nDistanceLR -
rBox.GetDistance(BOX_LINE_LEFT) -
rBox.GetDistance(BOX_LINE_RIGHT);
if(m_bVertical)
{
m_aPageSize.Width() = nValue1;
m_aPageSize.Height() = nValue2;
}
else
{
m_aPageSize.Width() = nValue2;
m_aPageSize.Height() = nValue1;
}
sal_Int32 nTextSize = static_cast< sal_Int32 >(m_bRubyUserValue ?
m_nRubyUserValue :
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------------------------------
---------------------------------------------------------------------------*/
IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField*, pField)
2002-02-11 11:30:58 +00:00
{
//if in squared mode
if ( m_bSquaredMode )
2002-02-11 11:30:58 +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
{
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;
}
/* -----------------------------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);
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);
}
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