From d32b3a714fe55892bdead03502c5a9b0e77fa61d Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Sat, 31 Oct 2009 00:36:06 +0100 Subject: #i106421#: move svx/source/cui to cui --- cui/source/tabpages/align.cxx | 299 +++ cui/source/tabpages/align.hrc | 87 + cui/source/tabpages/align.src | 251 ++ cui/source/tabpages/autocdlg.cxx | 2775 ++++++++++++++++++++ cui/source/tabpages/autocdlg.hrc | 162 ++ cui/source/tabpages/autocdlg.src | 856 +++++++ cui/source/tabpages/backgrnd.cxx | 1979 +++++++++++++++ cui/source/tabpages/backgrnd.hrc | 73 + cui/source/tabpages/backgrnd.src | 307 +++ cui/source/tabpages/bbdlg.cxx | 75 + cui/source/tabpages/bbdlg.src | 88 + cui/source/tabpages/border.cxx | 1271 ++++++++++ cui/source/tabpages/border.hrc | 109 + cui/source/tabpages/border.src | 431 ++++ cui/source/tabpages/borderconn.cxx | 314 +++ cui/source/tabpages/borderconn.hxx | 79 + cui/source/tabpages/chardlg.cxx | 4066 ++++++++++++++++++++++++++++++ cui/source/tabpages/chardlg.h | 74 + cui/source/tabpages/chardlg.hrc | 184 ++ cui/source/tabpages/chardlg.src | 1133 +++++++++ cui/source/tabpages/connect.cxx | 565 +++++ cui/source/tabpages/connect.hrc | 48 + cui/source/tabpages/connect.src | 268 ++ cui/source/tabpages/dstribut.cxx | 247 ++ cui/source/tabpages/dstribut.hrc | 58 + cui/source/tabpages/dstribut.src | 293 +++ cui/source/tabpages/grfpage.cxx | 838 ++++++ cui/source/tabpages/grfpage.hrc | 56 + cui/source/tabpages/grfpage.src | 334 +++ cui/source/tabpages/labdlg.cxx | 653 +++++ cui/source/tabpages/labdlg.hrc | 80 + cui/source/tabpages/labdlg.src | 301 +++ cui/source/tabpages/macroass.cxx | 719 ++++++ cui/source/tabpages/macroass.hrc | 85 + cui/source/tabpages/macroass.src | 143 ++ cui/source/tabpages/makefile.mk | 112 + cui/source/tabpages/measure.cxx | 876 +++++++ cui/source/tabpages/measure.hrc | 56 + cui/source/tabpages/measure.src | 310 +++ cui/source/tabpages/numfmt.cxx | 1953 ++++++++++++++ cui/source/tabpages/numfmt.hrc | 77 + cui/source/tabpages/numfmt.src | 297 +++ cui/source/tabpages/numpages.cxx | 4038 +++++++++++++++++++++++++++++ cui/source/tabpages/numpages.hrc | 135 + cui/source/tabpages/numpages.src | 910 +++++++ cui/source/tabpages/page.cxx | 1771 +++++++++++++ cui/source/tabpages/page.h | 74 + cui/source/tabpages/page.hrc | 87 + cui/source/tabpages/page.src | 668 +++++ cui/source/tabpages/paragrph.cxx | 2374 +++++++++++++++++ cui/source/tabpages/paragrph.hrc | 124 + cui/source/tabpages/paragrph.src | 734 ++++++ cui/source/tabpages/swpossizetabpage.cxx | 1973 +++++++++++++++ cui/source/tabpages/swpossizetabpage.hrc | 62 + cui/source/tabpages/swpossizetabpage.hxx | 161 ++ cui/source/tabpages/swpossizetabpage.src | 299 +++ cui/source/tabpages/tabarea.cxx | 370 +++ cui/source/tabpages/tabarea.hrc | 190 ++ cui/source/tabpages/tabarea.src | 1541 +++++++++++ cui/source/tabpages/tabline.cxx | 300 +++ cui/source/tabpages/tabline.hrc | 109 + cui/source/tabpages/tabline.src | 803 ++++++ cui/source/tabpages/tabstpge.cxx | 746 ++++++ cui/source/tabpages/tabstpge.hrc | 66 + cui/source/tabpages/tabstpge.src | 234 ++ cui/source/tabpages/textanim.cxx | 759 ++++++ cui/source/tabpages/textanim.hrc | 50 + cui/source/tabpages/textanim.src | 322 +++ cui/source/tabpages/textattr.cxx | 801 ++++++ cui/source/tabpages/textattr.hrc | 49 + cui/source/tabpages/textattr.src | 247 ++ cui/source/tabpages/tparea.cxx | 2582 +++++++++++++++++++ cui/source/tabpages/tpbitmap.cxx | 1170 +++++++++ cui/source/tabpages/tpcolor.cxx | 1280 ++++++++++ cui/source/tabpages/tpgradnt.cxx | 943 +++++++ cui/source/tabpages/tphatch.cxx | 901 +++++++ cui/source/tabpages/tpline.cxx | 1926 ++++++++++++++ cui/source/tabpages/tplnedef.cxx | 1020 ++++++++ cui/source/tabpages/tplneend.cxx | 753 ++++++ cui/source/tabpages/tpshadow.cxx | 612 +++++ cui/source/tabpages/transfrm.cxx | 1701 +++++++++++++ cui/source/tabpages/transfrm.hrc | 79 + cui/source/tabpages/transfrm.src | 612 +++++ 83 files changed, 56558 insertions(+) create mode 100644 cui/source/tabpages/align.cxx create mode 100644 cui/source/tabpages/align.hrc create mode 100644 cui/source/tabpages/align.src create mode 100644 cui/source/tabpages/autocdlg.cxx create mode 100644 cui/source/tabpages/autocdlg.hrc create mode 100644 cui/source/tabpages/autocdlg.src create mode 100644 cui/source/tabpages/backgrnd.cxx create mode 100644 cui/source/tabpages/backgrnd.hrc create mode 100644 cui/source/tabpages/backgrnd.src create mode 100644 cui/source/tabpages/bbdlg.cxx create mode 100644 cui/source/tabpages/bbdlg.src create mode 100644 cui/source/tabpages/border.cxx create mode 100644 cui/source/tabpages/border.hrc create mode 100644 cui/source/tabpages/border.src create mode 100644 cui/source/tabpages/borderconn.cxx create mode 100644 cui/source/tabpages/borderconn.hxx create mode 100644 cui/source/tabpages/chardlg.cxx create mode 100644 cui/source/tabpages/chardlg.h create mode 100644 cui/source/tabpages/chardlg.hrc create mode 100644 cui/source/tabpages/chardlg.src create mode 100644 cui/source/tabpages/connect.cxx create mode 100644 cui/source/tabpages/connect.hrc create mode 100644 cui/source/tabpages/connect.src create mode 100644 cui/source/tabpages/dstribut.cxx create mode 100644 cui/source/tabpages/dstribut.hrc create mode 100644 cui/source/tabpages/dstribut.src create mode 100644 cui/source/tabpages/grfpage.cxx create mode 100644 cui/source/tabpages/grfpage.hrc create mode 100644 cui/source/tabpages/grfpage.src create mode 100644 cui/source/tabpages/labdlg.cxx create mode 100644 cui/source/tabpages/labdlg.hrc create mode 100644 cui/source/tabpages/labdlg.src create mode 100644 cui/source/tabpages/macroass.cxx create mode 100644 cui/source/tabpages/macroass.hrc create mode 100644 cui/source/tabpages/macroass.src create mode 100755 cui/source/tabpages/makefile.mk create mode 100644 cui/source/tabpages/measure.cxx create mode 100644 cui/source/tabpages/measure.hrc create mode 100644 cui/source/tabpages/measure.src create mode 100644 cui/source/tabpages/numfmt.cxx create mode 100644 cui/source/tabpages/numfmt.hrc create mode 100644 cui/source/tabpages/numfmt.src create mode 100644 cui/source/tabpages/numpages.cxx create mode 100644 cui/source/tabpages/numpages.hrc create mode 100644 cui/source/tabpages/numpages.src create mode 100644 cui/source/tabpages/page.cxx create mode 100644 cui/source/tabpages/page.h create mode 100644 cui/source/tabpages/page.hrc create mode 100644 cui/source/tabpages/page.src create mode 100644 cui/source/tabpages/paragrph.cxx create mode 100644 cui/source/tabpages/paragrph.hrc create mode 100644 cui/source/tabpages/paragrph.src create mode 100644 cui/source/tabpages/swpossizetabpage.cxx create mode 100644 cui/source/tabpages/swpossizetabpage.hrc create mode 100644 cui/source/tabpages/swpossizetabpage.hxx create mode 100644 cui/source/tabpages/swpossizetabpage.src create mode 100644 cui/source/tabpages/tabarea.cxx create mode 100644 cui/source/tabpages/tabarea.hrc create mode 100644 cui/source/tabpages/tabarea.src create mode 100644 cui/source/tabpages/tabline.cxx create mode 100644 cui/source/tabpages/tabline.hrc create mode 100644 cui/source/tabpages/tabline.src create mode 100644 cui/source/tabpages/tabstpge.cxx create mode 100644 cui/source/tabpages/tabstpge.hrc create mode 100644 cui/source/tabpages/tabstpge.src create mode 100644 cui/source/tabpages/textanim.cxx create mode 100644 cui/source/tabpages/textanim.hrc create mode 100644 cui/source/tabpages/textanim.src create mode 100644 cui/source/tabpages/textattr.cxx create mode 100644 cui/source/tabpages/textattr.hrc create mode 100644 cui/source/tabpages/textattr.src create mode 100644 cui/source/tabpages/tparea.cxx create mode 100644 cui/source/tabpages/tpbitmap.cxx create mode 100644 cui/source/tabpages/tpcolor.cxx create mode 100644 cui/source/tabpages/tpgradnt.cxx create mode 100644 cui/source/tabpages/tphatch.cxx create mode 100644 cui/source/tabpages/tpline.cxx create mode 100644 cui/source/tabpages/tplnedef.cxx create mode 100644 cui/source/tabpages/tplneend.cxx create mode 100644 cui/source/tabpages/tpshadow.cxx create mode 100644 cui/source/tabpages/transfrm.cxx create mode 100644 cui/source/tabpages/transfrm.hrc create mode 100644 cui/source/tabpages/transfrm.src (limited to 'cui/source/tabpages') diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx new file mode 100644 index 000000000000..9edac23e6669 --- /dev/null +++ b/cui/source/tabpages/align.cxx @@ -0,0 +1,299 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: align.cxx,v $ + * $Revision: 1.26.272.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- + +#include + +#include +#include "align.hrc" +#include + +#include +#include +#include "align.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //CHINA001 +#include //CHINA001 +#include //CHINA001 +#include //CHINA001 + +namespace svx { + +// item connections =========================================================== + +// horizontal alignment ------------------------------------------------------- + +typedef sfx::ValueItemWrapper< SvxHorJustifyItem, SvxCellHorJustify, USHORT > HorJustItemWrapper; +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 }, + { LISTBOX_ENTRY_NOTFOUND, SVX_HOR_JUSTIFY_STANDARD } +}; + +// vertical alignment --------------------------------------------------------- + +typedef sfx::ValueItemWrapper< SvxVerJustifyItem, SvxCellVerJustify, USHORT > VerJustItemWrapper; +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 }, + { LISTBOX_ENTRY_NOTFOUND, SVX_VER_JUSTIFY_STANDARD } +}; + +// cell rotate mode ----------------------------------------------------------- + +typedef sfx::ValueItemWrapper< SvxRotateModeItem, SvxRotateMode, USHORT > RotateModeItemWrapper; +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 } +}; + +// ============================================================================ + +static USHORT s_pRanges[] = +{ + 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 +}; + +// ============================================================================ + +AlignmentTabPage::AlignmentTabPage( Window* pParent, const SfxItemSet& rCoreAttrs ) : + + SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_ALIGNMENT ), rCoreAttrs ), + + maFlAlignment ( this, SVX_RES( FL_ALIGNMENT ) ), + maFtHorAlign ( this, SVX_RES( FT_HORALIGN ) ), + maLbHorAlign ( this, SVX_RES( LB_HORALIGN ) ), + maFtIndent ( this, SVX_RES( FT_INDENT ) ), + maEdIndent ( this, SVX_RES( ED_INDENT ) ), + maFtVerAlign ( this, SVX_RES( FT_VERALIGN ) ), + maLbVerAlign ( this, SVX_RES( LB_VERALIGN ) ), + + maFlOrient ( this, SVX_RES( FL_ORIENTATION ) ), + maCtrlDial ( this, SVX_RES( CTR_DIAL ) ), + maFtRotate ( this, SVX_RES( FT_DEGREES ) ), + maNfRotate ( this, SVX_RES( NF_DEGREES ) ), + maFtRefEdge ( this, SVX_RES( FT_BORDER_LOCK ) ), + maVsRefEdge ( this, SVX_RES( CTR_BORDER_LOCK ) ), + maCbStacked ( this, SVX_RES( BTN_TXTSTACKED ) ), + maCbAsianMode ( this, SVX_RES( BTN_ASIAN_VERTICAL ) ), + maOrientHlp ( maCtrlDial, maNfRotate, maCbStacked ), + + maFlProperties ( this, SVX_RES( FL_WRAP ) ), + maBtnWrap ( this, SVX_RES( BTN_WRAP ) ), + maBtnHyphen ( this, SVX_RES( BTN_HYPH ) ), + maBtnShrink ( this, SVX_RES( BTN_SHRINK ) ), + maFtFrameDir ( this, SVX_RES( FT_TEXTFLOW ) ), + maLbFrameDir ( this, SVX_RES( LB_FRAMEDIR ) ) +{ + 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 + maLbFrameDir.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_LTR ), FRMDIR_HORI_LEFT_TOP ); + maLbFrameDir.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_RTL ), FRMDIR_HORI_RIGHT_TOP ); + maLbFrameDir.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER ), FRMDIR_ENVIRONMENT ); + if( !SvtLanguageOptions().IsCTLFontEnabled() ) + { + maFtFrameDir.Hide(); + maLbFrameDir.Hide(); + } + + // diese Page braucht ExchangeSupport + 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 ) ); +} + +AlignmentTabPage::~AlignmentTabPage() +{ +} + +SfxTabPage* AlignmentTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) +{ + return new AlignmentTabPage( pParent, rAttrSet ); +} + +USHORT* AlignmentTabPage::GetRanges() +{ + return s_pRanges; +} + +void AlignmentTabPage::Reset( const SfxItemSet& rCoreAttrs ) +{ + SfxTabPage::Reset( rCoreAttrs ); + 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) ) + { + svt::OLocalResourceAccess aLocalResAcc( SVX_RES( RID_SVXPAGE_ALIGNMENT ), RSC_TABPAGE ); + InitVsRefEgde(); + } +} + +void AlignmentTabPage::InitVsRefEgde() +{ + // remember selection - is deleted in call to ValueSet::Clear() + USHORT nSel = maVsRefEdge.GetSelectItemId(); + + ResId aResId( GetBackground().GetColor().IsDark() ? IL_LOCK_BMPS_HC : IL_LOCK_BMPS, DIALOG_MGR() ); + ImageList aImageList( aResId ); + Size aItemSize( aImageList.GetImage( IID_BOTTOMLOCK ).GetSizePixel() ); + + maVsRefEdge.Clear(); + maVsRefEdge.SetStyle( maVsRefEdge.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER ); + + maVsRefEdge.SetColCount( 3 ); + maVsRefEdge.InsertItem( IID_BOTTOMLOCK, aImageList.GetImage( IID_BOTTOMLOCK ), String( SVX_RES( STR_BOTTOMLOCK ) ) ); + maVsRefEdge.InsertItem( IID_TOPLOCK, aImageList.GetImage( IID_TOPLOCK ), String( SVX_RES( STR_TOPLOCK ) ) ); + maVsRefEdge.InsertItem( IID_CELLLOCK, aImageList.GetImage( IID_CELLLOCK ), String( SVX_RES( STR_CELLLOCK ) ) ); + + maVsRefEdge.SetSizePixel( maVsRefEdge.CalcWindowSizePixel( aItemSize ) ); + + maVsRefEdge.SelectItem( nSel ); +} + +void AlignmentTabPage::UpdateEnableControls() +{ + USHORT nHorAlign = maLbHorAlign.GetSelectEntryPos(); + bool bHorLeft = (nHorAlign == ALIGNDLG_HORALIGN_LEFT); + bool bHorBlock = (nHorAlign == ALIGNDLG_HORALIGN_BLOCK); + bool bHorFill = (nHorAlign == ALIGNDLG_HORALIGN_FILL); + + // 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 ); + + // shrink only without automatic line break, and not for block and fill + maBtnShrink.Enable( (maBtnWrap.GetState() == STATE_NOCHECK) && !bHorBlock && !bHorFill ); + + // 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() ); +} + +IMPL_LINK( AlignmentTabPage, UpdateEnableHdl, void*, EMPTYARG ) +{ + UpdateEnableControls(); + return 0; +} + +// ============================================================================ + +} // namespace svx + diff --git a/cui/source/tabpages/align.hrc b/cui/source/tabpages/align.hrc new file mode 100644 index 000000000000..d9138200d381 --- /dev/null +++ b/cui/source/tabpages/align.hrc @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: align.hrc,v $ + * $Revision: 1.10 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_ALIGN_HRC +#define _SVX_ALIGN_HRC + +// defines ------------------------------------------------------------------ + +// resource id's +#define FL_ALIGNMENT 10 +#define FT_HORALIGN 11 +#define LB_HORALIGN 12 +#define FT_INDENT 13 +#define ED_INDENT 14 +#define FT_VERALIGN 15 +#define LB_VERALIGN 16 + +#define FL_ORIENTATION 20 +#define BTN_TXTSTACKED 21 +#define CTR_DIAL 22 +#define FT_DEGREES 23 +#define NF_DEGREES 24 +#define FT_BORDER_LOCK 25 +#define CTR_BORDER_LOCK 26 +#define BTN_ASIAN_VERTICAL 27 + +#define FL_WRAP 40 +#define BTN_WRAP 41 +#define BTN_HYPH 42 +#define FT_TEXTFLOW 43 +#define LB_FRAMEDIR 44 +#define BTN_SHRINK 45 + +//#define ED_INDENT1 100 + +// list box indexes +#define ALIGNDLG_HORALIGN_STD 0 +#define ALIGNDLG_HORALIGN_LEFT 1 +#define ALIGNDLG_HORALIGN_CENTER 2 +#define ALIGNDLG_HORALIGN_RIGHT 3 +#define ALIGNDLG_HORALIGN_BLOCK 4 +#define ALIGNDLG_HORALIGN_FILL 5 + +#define ALIGNDLG_VERALIGN_STD 0 +#define ALIGNDLG_VERALIGN_TOP 1 +#define ALIGNDLG_VERALIGN_MID 2 +#define ALIGNDLG_VERALIGN_BOTTOM 3 + +// image list for ValueSets: +#define IL_LOCK_BMPS 1100 +#define IL_LOCK_BMPS_HC 1101 +#define IID_BOTTOMLOCK 1 +#define IID_TOPLOCK 2 +#define IID_CELLLOCK 3 + +#define STR_BOTTOMLOCK 1 +#define STR_TOPLOCK 2 +#define STR_CELLLOCK 3 + +#endif + diff --git a/cui/source/tabpages/align.src b/cui/source/tabpages/align.src new file mode 100644 index 000000000000..24e88b77a8a0 --- /dev/null +++ b/cui/source/tabpages/align.src @@ -0,0 +1,251 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: align.src,v $ + * $Revision: 1.55 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include +#include "helpid.hrc" +#include "align.hrc" + // pragma ---------------------------------------------------------------- + +#define MASKCOLOR \ + MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; } + + // define --------------------------------------------------------------- +#define IL_LOCK_MCOL Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; } + // RID_SVXPAGE_ALIGNMENT ------------------------------------------------- +TabPage RID_SVXPAGE_ALIGNMENT +{ + HelpId = HID_ALIGNMENT ; + Hide = TRUE ; + Text [ en-US ] = "Alignment" ; + Size = MAP_APPFONT ( 260 , 185 ) ; + SVLook = TRUE ; + FixedLine FL_ALIGNMENT + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Text alignment"; + }; + FixedText FT_HORALIGN + { + Pos = MAP_APPFONT ( 12 ,14 ) ; + Size = MAP_APPFONT ( 100 , 8 ) ; + Text [ en-US ] = "Hori~zontal"; + }; + ListBox LB_HORALIGN + { + Border = TRUE; + Pos = MAP_APPFONT ( 12 , 25 ); + Size = MAP_APPFONT ( 100 , 60 ); + TabStop = TRUE; + DropDown = TRUE; + StringList [ en-US ] = + { + < "Default" ; ALIGNDLG_HORALIGN_STD ; > ; + < "Left" ; ALIGNDLG_HORALIGN_LEFT ; > ; + < "Center" ; ALIGNDLG_HORALIGN_CENTER ; > ; + < "Right" ; ALIGNDLG_HORALIGN_RIGHT ; > ; + < "Justified" ; ALIGNDLG_HORALIGN_BLOCK ; > ; + < "Filled" ; ALIGNDLG_HORALIGN_FILL ; > ; + }; + }; + FixedText FT_INDENT + { + Pos = MAP_APPFONT ( 118 , 14 ) ; + Size = MAP_APPFONT ( 40 , 8 ) ; + Text [ en-US ] = "I~ndent" ; + }; + MetricField ED_INDENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 118 , 25 ) ; + Size = MAP_APPFONT ( 36 , 12 ) ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 990 ; + SpinSize = 10 ; + Unit = FUNIT_POINT ; + }; + FixedText FT_VERALIGN + { + Pos = MAP_APPFONT ( 160 , 14 ) ; + Size = MAP_APPFONT ( 88 , 8 ) ; + Text [ en-US ] = "~Vertical"; + }; + ListBox LB_VERALIGN + { + Border = TRUE; + Pos = MAP_APPFONT ( 160 , 25 ); + Size = MAP_APPFONT ( 88 , 60 ); + TabStop = TRUE; + DropDown = TRUE; + StringList [ en-US ] = + { + < "Default" ; ALIGNDLG_VERALIGN_STD ; > ; + < "Top" ; ALIGNDLG_VERALIGN_TOP ; > ; + < "Middle" ; ALIGNDLG_VERALIGN_MID ; > ; + < "Bottom" ; ALIGNDLG_VERALIGN_BOTTOM ; > ; + }; + }; + FixedLine FL_ORIENTATION + { + Pos = MAP_APPFONT ( 6 , 43 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Text orientation" ; + }; + TriStateBox BTN_TXTSTACKED + { + Pos = MAP_APPFONT ( 133 , 54 ) ; + Size = MAP_APPFONT ( 115 , 10 ) ; + TabStop = TRUE ; + Text[ en-US ] = "Ve~rtically stacked"; + }; + Control CTR_DIAL + { + HelpId = HID_ALIGNMENT_CTR_DIAL ; + Pos = MAP_APPFONT ( 12 , 60 ) ; + Size = MAP_APPFONT ( 42 , 43 ) ; + Text = "ABCD" ; + }; + FixedText FT_DEGREES + { + Pos = MAP_APPFONT ( 72 , 54 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "De~grees"; + }; + NumericField NF_DEGREES + { + Border = TRUE ; + Pos = MAP_APPFONT ( 72 , 65 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 359 ; + SpinSize = 5 ; + StrictFormat = TRUE ; + }; + FixedText FT_BORDER_LOCK + { + Pos = MAP_APPFONT ( 72 , 83 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Re~ference edge" ; + }; + Control CTR_BORDER_LOCK + { + HelpId = HID_ALIGNMENT_CTR_BORDER_LOCK ; + Pos = MAP_APPFONT ( 72 , 94 ) ; + Size = MAP_APPFONT ( 50 , 15 ) ; + TabStop = TRUE ; + }; + TriStateBox BTN_ASIAN_VERTICAL + { + Pos = MAP_APPFONT ( 143 , 68 ) ; + Size = MAP_APPFONT ( 105 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Asian layout ~mode" ; + }; + FixedLine FL_WRAP + { + Pos = MAP_APPFONT ( 6 , 115 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Properties" ; + }; + TriStateBox BTN_WRAP + { + Pos = MAP_APPFONT ( 12 , 126 ) ; + Size = MAP_APPFONT ( 236 , 10 ) ; + Text [ en-US ] = "~Wrap text automatically" ; + }; + TriStateBox BTN_HYPH + { + Pos = MAP_APPFONT ( 22 , 139 ) ; + Size = MAP_APPFONT ( 226 , 10 ) ; + Text [ en-US ] = "Hyphenation ~active"; + }; + TriStateBox BTN_SHRINK + { + Pos = MAP_APPFONT( 12, 152 ); + Size = MAP_APPFONT( 236, 10 ); + Text [ en-US ] = "~Shrink to fit cell size"; + }; + FixedText FT_TEXTFLOW + { + Pos = MAP_APPFONT( 12 , 170 ); + Size = MAP_APPFONT( 64 , 8 ); + Text [ en-US ] = "Te~xt direction"; + }; + ListBox LB_FRAMEDIR + { + Pos = MAP_APPFONT( 78 , 168 ); + Size = MAP_APPFONT( 170 , 50 ); + Border = TRUE; + DropDown = TRUE; + }; + ImageList IL_LOCK_BMPS + { + Prefix = "lo"; + MaskColor = IL_LOCK_MCOL ; + IdList = + { + IID_BOTTOMLOCK ; + IID_TOPLOCK ; + IID_CELLLOCK ; + }; + IdCount = { 3 ; }; + }; + ImageList IL_LOCK_BMPS_HC + { + Prefix = "loh"; + MaskColor = IL_LOCK_MCOL ; + IdList = + { + IID_BOTTOMLOCK ; + IID_TOPLOCK ; + IID_CELLLOCK ; + }; + IdCount = { 3 ; }; + }; + String STR_BOTTOMLOCK + { + Text [ en-US ] = "Text Extension From Lower Cell Border" ; + }; + String STR_TOPLOCK + { + Text [ en-US ] = "Text Extension From Upper Cell Border" ; + }; + String STR_CELLLOCK + { + Text [ en-US ] = "Text Extension Inside Cell" ; + }; +}; + // ********************************************************************** EOF + diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx new file mode 100644 index 000000000000..3e6908293871 --- /dev/null +++ b/cui/source/tabpages/autocdlg.cxx @@ -0,0 +1,2775 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: autocdlg.cxx,v $ + * $Revision: 1.25 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +#define _SVSTDARR_STRINGSISORTDTOR +#define _SVSTDARR_STRINGSDTOR +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define _OFA_AUTOCDLG_CXX +#include "autocdlg.hxx" +#include "autocdlg.hrc" +#include "helpid.hrc" +#include +#include +#include "cuicharmap.hxx" +#include +#include + +static LanguageType eLastDialogLanguage = LANGUAGE_SYSTEM; + +using namespace ::com::sun::star::util; +using namespace ::com::sun::star; +using namespace ::rtl; + +static ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory >& GetProcessFact() +{ + static ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory > xMSF = + ::comphelper::getProcessServiceFactory(); + return xMSF; +} + +/*-----------------14.10.96 15.47------------------- + +--------------------------------------------------*/ + +OfaAutoCorrDlg::OfaAutoCorrDlg(Window* pParent, const SfxItemSet* _pSet ) : + SfxTabDialog(pParent, SVX_RES( RID_OFA_AUTOCORR_DLG ), _pSet), + aLanguageFT( this, SVX_RES(FT_LANG )), + aLanguageLB( this, SVX_RES(LB_LANG )) +{ + BOOL bShowSWOptions = FALSE; + BOOL bOpenSmartTagOptions = FALSE; + + if ( _pSet ) + { + SFX_ITEMSET_ARG( _pSet, pItem, SfxBoolItem, SID_AUTO_CORRECT_DLG, FALSE ); + if ( pItem && pItem->GetValue() ) + bShowSWOptions = TRUE; + + SFX_ITEMSET_ARG( _pSet, pItem2, SfxBoolItem, SID_OPEN_SMARTTAGOPTIONS, FALSE ); + if ( pItem2 && pItem2->GetValue() ) + bOpenSmartTagOptions = TRUE; + } + + aLanguageFT.SetZOrder(0, WINDOW_ZORDER_FIRST); + aLanguageLB.SetZOrder(&aLanguageFT, WINDOW_ZORDER_BEHIND); + aLanguageLB.SetHelpId(HID_AUTOCORR_LANGUAGE); + FreeResource(); + + AddTabPage(RID_OFAPAGE_AUTOCORR_OPTIONS, OfaAutocorrOptionsPage::Create, 0); + AddTabPage(RID_OFAPAGE_AUTOFMT_APPLY, OfaSwAutoFmtOptionsPage::Create, 0); + AddTabPage(RID_OFAPAGE_AUTOCOMPLETE_OPTIONS, OfaAutoCompleteTabPage::Create, 0); + AddTabPage(RID_OFAPAGE_SMARTTAG_OPTIONS, OfaSmartTagOptionsTabPage::Create, 0); + + if (!bShowSWOptions) + { + RemoveTabPage(RID_OFAPAGE_AUTOFMT_APPLY); + RemoveTabPage(RID_OFAPAGE_AUTOCOMPLETE_OPTIONS); + RemoveTabPage(RID_OFAPAGE_SMARTTAG_OPTIONS); + } + else + { + // remove smart tag tab page if no extensions are installed + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); + if ( !pOpt || !pOpt->pSmartTagMgr || 0 == pOpt->pSmartTagMgr->NumberOfRecognizers() ) + RemoveTabPage(RID_OFAPAGE_SMARTTAG_OPTIONS); + + RemoveTabPage(RID_OFAPAGE_AUTOCORR_OPTIONS); + } + + AddTabPage(RID_OFAPAGE_AUTOCORR_REPLACE, OfaAutocorrReplacePage::Create, 0); + AddTabPage(RID_OFAPAGE_AUTOCORR_EXCEPT, OfaAutocorrExceptPage::Create, 0); + AddTabPage(RID_OFAPAGE_AUTOCORR_QUOTE, OfaQuoteTabPage::Create, 0); + + // initialize languages + //! LANGUAGE_NONE is displayed as '[All]' and the LanguageType + //! will be set to LANGUAGE_DONTKNOW + sal_Int16 nLangList = LANG_LIST_WESTERN; + + if( SvtLanguageOptions().IsCTLFontEnabled() ) + nLangList |= LANG_LIST_CTL; + aLanguageLB.SetLanguageList( nLangList, TRUE, TRUE ); + aLanguageLB.SelectLanguage( LANGUAGE_NONE ); + USHORT nPos = aLanguageLB.GetSelectEntryPos(); + DBG_ASSERT( LISTBOX_ENTRY_NOTFOUND != nPos, "listbox entry missing" ); + aLanguageLB.SetEntryData( nPos, (void*)(long) LANGUAGE_DONTKNOW ); + + // Initialisierung funktionier fuer static nicht unter Linux - deswegen hier + if( LANGUAGE_SYSTEM == eLastDialogLanguage ) + eLastDialogLanguage = Application::GetSettings().GetLanguage(); + + LanguageType nSelectLang = LANGUAGE_DONTKNOW; + nPos = aLanguageLB.GetEntryPos( (void*)(long) eLastDialogLanguage ); + if (LISTBOX_ENTRY_NOTFOUND != nPos) + nSelectLang = eLastDialogLanguage; + aLanguageLB.SelectLanguage( nSelectLang ); + + aLanguageLB.SetSelectHdl(LINK(this, OfaAutoCorrDlg, SelectLanguageHdl)); + + Size aMinSize(aLanguageFT.CalcMinimumSize()); + //reserve some extra space for CJK accelerators that are possible inserted + //later (like '(A)') + aLanguageFT.SetPosSizePixel( 0, 0, aMinSize.Width() + 20, 0, WINDOW_POSSIZE_WIDTH ); + + if ( bOpenSmartTagOptions ) + SetCurPageId( RID_OFAPAGE_SMARTTAG_OPTIONS ); +} +/*-----------------16.10.96 14.06------------------- + +--------------------------------------------------*/ + +BOOL lcl_FindEntry( ListBox& rLB, const String& rEntry, + CollatorWrapper& rCmpClass ) +{ + USHORT nCount = rLB.GetEntryCount(); + USHORT nSelPos = rLB.GetSelectEntryPos(); + USHORT i; + for(i = 0; i < nCount; i++) + { + if( 0 == rCmpClass.compareString(rEntry, rLB.GetEntry(i) )) + { + rLB.SelectEntryPos(i, TRUE); + return TRUE; + } + } + if(LISTBOX_ENTRY_NOTFOUND != nSelPos) + rLB.SelectEntryPos(nSelPos, FALSE); + return FALSE; +} + +/* -----------------23.11.98 10:46------------------- + * + * --------------------------------------------------*/ +IMPL_LINK(OfaAutoCorrDlg, SelectLanguageHdl, ListBox*, pBox) +{ + USHORT nPos = pBox->GetSelectEntryPos(); + void* pVoid = pBox->GetEntryData(nPos); + LanguageType eNewLang = (LanguageType)(long)pVoid; + //alte Einstellungen speichern und neu fuellen + if(eNewLang != eLastDialogLanguage) + { + USHORT nPageId = GetCurPageId(); + if(RID_OFAPAGE_AUTOCORR_REPLACE == nPageId) + ((OfaAutocorrReplacePage*)GetTabPage( nPageId ))->SetLanguage(eNewLang); + else if(RID_OFAPAGE_AUTOCORR_EXCEPT == nPageId) + ((OfaAutocorrExceptPage*)GetTabPage( nPageId ))->SetLanguage(eNewLang); + } + return 0; +} +/*-----------------14.10.96 15.57------------------- + +--------------------------------------------------*/ + +OfaAutocorrOptionsPage::OfaAutocorrOptionsPage( Window* pParent, + const SfxItemSet& rSet ) : + SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_AUTOCORR_OPTIONS ), rSet), + aCheckLB (this, SVX_RES(CLB_SETTINGS )), + + sInput (SVX_RES(ST_USE_REPLACE )), + sDoubleCaps (SVX_RES(ST_CPTL_STT_WORD )), + sStartCap (SVX_RES(ST_CPTL_STT_SENT )), + sBoldUnderline (SVX_RES(ST_BOLD_UNDER )), + sURL (SVX_RES(ST_DETECT_URL )), + sNoDblSpaces (SVX_RES(STR_NO_DBL_SPACES )), + sHalf (SVX_RES(ST_FRACTION )), + sDash (SVX_RES(ST_DASH )), + sFirst (SVX_RES(ST_ORDINAL )) +{ + FreeResource(); + + aCheckLB.SetHelpId(HID_OFAPAGE_AUTOCORR_CLB); +} + +/*-----------------14.10.96 15.58------------------- + +--------------------------------------------------*/ + + +OfaAutocorrOptionsPage::~OfaAutocorrOptionsPage() +{ +} + +/*-----------------14.10.96 15.58------------------- + +--------------------------------------------------*/ + + +SfxTabPage* OfaAutocorrOptionsPage::Create( Window* pParent, + const SfxItemSet& rSet) +{ + return new OfaAutocorrOptionsPage(pParent, rSet); +} +/*-----------------14.10.96 15.58------------------- + +--------------------------------------------------*/ + + +BOOL OfaAutocorrOptionsPage::FillItemSet( SfxItemSet& ) +{ + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + long nFlags = pAutoCorrect->GetFlags(); + + USHORT nPos = 0; + pAutoCorrect->SetAutoCorrFlag(Autocorrect, aCheckLB.IsChecked(nPos++)); + pAutoCorrect->SetAutoCorrFlag(CptlSttWrd, aCheckLB.IsChecked(nPos++)); + pAutoCorrect->SetAutoCorrFlag(CptlSttSntnc, aCheckLB.IsChecked(nPos++)); + pAutoCorrect->SetAutoCorrFlag(ChgWeightUnderl, aCheckLB.IsChecked(nPos++)); + pAutoCorrect->SetAutoCorrFlag(SetINetAttr, aCheckLB.IsChecked(nPos++)); + pAutoCorrect->SetAutoCorrFlag(ChgOrdinalNumber, aCheckLB.IsChecked(nPos++)); + pAutoCorrect->SetAutoCorrFlag(ChgFractionSymbol, aCheckLB.IsChecked(nPos++)); + pAutoCorrect->SetAutoCorrFlag(ChgToEnEmDash, aCheckLB.IsChecked(nPos++)); + pAutoCorrect->SetAutoCorrFlag(IngnoreDoubleSpace, aCheckLB.IsChecked(nPos++)); + + BOOL bReturn = nFlags != pAutoCorrect->GetFlags(); + if(bReturn ) + { + SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get(); + pCfg->SetModified(); + pCfg->Commit(); + } + return bReturn; +} + +/* -----------------23.11.98 16:15------------------- + * + * --------------------------------------------------*/ +void OfaAutocorrOptionsPage::ActivatePage( const SfxItemSet& ) +{ + ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(FALSE); +} + +/*-----------------14.10.96 15.58------------------- + +--------------------------------------------------*/ + + +void OfaAutocorrOptionsPage::Reset( const SfxItemSet& ) +{ + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + const long nFlags = pAutoCorrect->GetFlags(); + + aCheckLB.SetUpdateMode(FALSE); + aCheckLB.Clear(); + + aCheckLB.InsertEntry(sInput); + aCheckLB.InsertEntry(sDoubleCaps); + aCheckLB.InsertEntry(sStartCap); + aCheckLB.InsertEntry(sBoldUnderline); + aCheckLB.InsertEntry(sURL); + aCheckLB.InsertEntry(sFirst); + aCheckLB.InsertEntry(sHalf); + aCheckLB.InsertEntry(sDash); + aCheckLB.InsertEntry(sNoDblSpaces); + + USHORT nPos = 0; + aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & Autocorrect) ); + aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & CptlSttWrd) ); + aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & CptlSttSntnc) ); + aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgWeightUnderl) ); + aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & SetINetAttr) ); + aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgOrdinalNumber) ); + aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgFractionSymbol) ); + aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgToEnEmDash) ); + aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & IngnoreDoubleSpace) ); + + aCheckLB.SetUpdateMode(TRUE); +} + +/*********************************************************************/ +/* */ +/* Hilfs-struct fuer dUserDaten der Checklistbox */ +/* */ +/*********************************************************************/ + +struct ImpUserData +{ + String *pString; + Font* pFont; + + ImpUserData(String* pText, Font* pFnt) + { pString = pText; pFont = pFnt;} +}; + + +/*********************************************************************/ +/* */ +/* Dialog fuer Prozenteinstellung */ +/* */ +/*********************************************************************/ + +class OfaAutoFmtPrcntSet : public ModalDialog +{ + OKButton aOKPB; + CancelButton aCancelPB; + FixedLine aPrcntFL; + MetricField aPrcntMF; + + public: + OfaAutoFmtPrcntSet(Window* pParent) : + ModalDialog(pParent, SVX_RES(RID_OFADLG_PRCNT_SET)), + aOKPB(this, SVX_RES(BT_OK)), + aCancelPB(this, SVX_RES(BT_CANCEL)), + aPrcntFL(this, SVX_RES(FL_PRCNT)), + aPrcntMF(this, SVX_RES(ED_RIGHT_MARGIN)) + { + FreeResource(); + } + MetricField& GetPrcntFld(){return aPrcntMF;} +}; + + +/*********************************************************************/ +/* */ +/* veraenderter LBoxString */ +/* */ +/*********************************************************************/ + +class OfaImpBrwString : public SvLBoxString +{ +public: + + OfaImpBrwString( SvLBoxEntry* pEntry, USHORT nFlags, + const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr){} + + virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, + SvLBoxEntry* pEntry); +}; + +/*********************************************************************/ +/* */ +/*********************************************************************/ + + +void __EXPORT OfaImpBrwString::Paint( const Point& rPos, SvLBox& rDev, USHORT /*nFlags*/, + SvLBoxEntry* pEntry ) +{ + rDev.DrawText( rPos, GetText() ); + if(pEntry->GetUserData()) + { + ImpUserData* pUserData = (ImpUserData* )pEntry->GetUserData(); + Point aNewPos(rPos); + aNewPos.X() += rDev.GetTextWidth(GetText()); + Font aOldFont( rDev.GetFont()); + Font aFont( aOldFont ); + if(pUserData->pFont) + { + aFont = *pUserData->pFont; + aFont.SetColor(aOldFont.GetColor()); + aFont.SetSize(aOldFont.GetSize()); + } + aFont.SetWeight( WEIGHT_BOLD ); + + BOOL bFett = TRUE; + USHORT nPos = 0; + do { + String sTxt( pUserData->pString->GetToken( 0, 1, nPos )); + + if( bFett ) + rDev.SetFont( aFont ); + + rDev.DrawText( aNewPos, sTxt ); + + if( STRING_NOTFOUND != nPos ) + aNewPos.X() += rDev.GetTextWidth( sTxt ); + + if( bFett ) + rDev.SetFont( aOldFont ); + + bFett = !bFett; + } while( STRING_NOTFOUND != nPos ); + } +} + +/*********************************************************************/ +/* */ +/* TabPage Autoformat anwenden */ +/* */ +/*********************************************************************/ + +#define CBCOL_FIRST 0 +#define CBCOL_SECOND 1 +#define CBCOL_BOTH 2 + +enum OfaAutoFmtOptions +{ + USE_REPLACE_TABLE, + CORR_UPPER, + BEGIN_UPPER, + BOLD_UNDERLINE, + DETECT_URL, + REPLACE_1ST, + REPLACE_HALF, + REPLACE_DASHES, + DEL_SPACES_AT_STT_END, + DEL_SPACES_BETWEEN_LINES, + IGNORE_DBLSPACE, + APPLY_NUMBERING, + INSERT_BORDER, + CREATE_TABLE, + REPLACE_STYLES, + DEL_EMPTY_NODE, + REPLACE_USER_COLL, + REPLACE_BULLETS, + REPLACE_QUOTATION, + MERGE_SINGLE_LINE_PARA +}; + +OfaSwAutoFmtOptionsPage::OfaSwAutoFmtOptionsPage( Window* pParent, + const SfxItemSet& rSet ) : + SfxTabPage(pParent, SVX_RES(RID_OFAPAGE_AUTOFMT_APPLY), rSet), + aCheckLB (this, SVX_RES(CLB_SETTINGS)), + aEditPB (this, SVX_RES(PB_EDIT)), + aHeader1Expl (this, SVX_RES(FT_HEADER1_EXPLANATION)), + aHeader2Expl (this, SVX_RES(FT_HEADER2_EXPLANATION)), + sHeader1 (SVX_RES( STR_HEADER1 )), + sHeader2 (SVX_RES( STR_HEADER2 )), + sDeleteEmptyPara (SVX_RES( ST_DEL_EMPTY_PARA)), + sUseReplaceTbl (SVX_RES( ST_USE_REPLACE )), + sCptlSttWord (SVX_RES( ST_CPTL_STT_WORD)), + sCptlSttSent (SVX_RES( ST_CPTL_STT_SENT)), + sTypo (SVX_RES( ST_TYPO )), + sUserStyle (SVX_RES( ST_USER_STYLE )), + sBullet (SVX_RES( ST_BULLET )), + sBoldUnder (SVX_RES( ST_BOLD_UNDER )), + sNoDblSpaces (SVX_RES( STR_NO_DBL_SPACES)), + sFraction (SVX_RES( ST_FRACTION )), + sDetectURL (SVX_RES( ST_DETECT_URL )), + sDash (SVX_RES( ST_DASH )), + sOrdinal (SVX_RES( ST_ORDINAL )), + sRightMargin (SVX_RES( ST_RIGHT_MARGIN )), + sNum (SVX_RES( STR_NUM )), + sBorder (SVX_RES( STR_BORDER )), + sTable (SVX_RES( STR_TABLE )), + sReplaceTemplates (SVX_RES( STR_REPLACE_TEMPLATES)), + sDelSpaceAtSttEnd (SVX_RES( STR_DEL_SPACES_AT_STT_END)), + sDelSpaceBetweenLines(SVX_RES(STR_DEL_SPACES_BETWEEN_LINES)), + + nPercent ( 50 ), + pCheckButtonData( NULL ) + +{ + FreeResource(); + + //typ. Anfuehrungszeichen einsetzen + SvtSysLocale aSysLcl; + const LocaleDataWrapper& rLcl = aSysLcl.GetLocaleData(); + sTypo.SearchAndReplace( String::CreateFromAscii("%1"), + rLcl.getDoubleQuotationMarkStart()); + sTypo.SearchAndReplace( String::CreateFromAscii("%2"), + rLcl.getDoubleQuotationMarkEnd()); + + aCheckLB.SetHelpId(HID_OFAPAGE_AUTOFORMAT_CLB); + aCheckLB.SetWindowBits(WB_HSCROLL| WB_VSCROLL); + + aCheckLB.SetSelectHdl(LINK(this, OfaSwAutoFmtOptionsPage, SelectHdl)); + aCheckLB.SetDoubleClickHdl(LINK(this, OfaSwAutoFmtOptionsPage, EditHdl)); + + static long aStaticTabs[]= + { + 3, 0, 20, 40 + }; + + aCheckLB.SvxSimpleTable::SetTabs(aStaticTabs); + String sHeader( sHeader1 ); + sHeader += '\t'; + sHeader += sHeader2; + sHeader += '\t'; + aCheckLB.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, + HIB_CENTER | HIB_VCENTER | HIB_FIXEDPOS | HIB_FIXED); + + aEditPB.SetClickHdl(LINK(this, OfaSwAutoFmtOptionsPage, EditHdl)); +} + +/*********************************************************************/ +/* */ +/*********************************************************************/ + +SvLBoxEntry* OfaSwAutoFmtOptionsPage::CreateEntry(String& rTxt, USHORT nCol) +{ + SvLBoxEntry* pEntry = new SvLBoxEntry; + + if ( !pCheckButtonData ) + { + pCheckButtonData = new SvLBoxButtonData( &aCheckLB ); + aCheckLB.SetCheckButtonData( pCheckButtonData ); + } + + pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff! + + String sEmpty; + if (nCol == CBCOL_SECOND) + pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte + else + pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) ); + + if (nCol == CBCOL_FIRST) + pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte + else + pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) ); + pEntry->AddItem( new OfaImpBrwString( pEntry, 0, rTxt ) ); + + return pEntry; +} + +/*********************************************************************/ +/* */ +/*********************************************************************/ + + +__EXPORT OfaSwAutoFmtOptionsPage::~OfaSwAutoFmtOptionsPage() +{ + delete (ImpUserData*) aCheckLB.GetUserData( REPLACE_BULLETS ); + delete (ImpUserData*) aCheckLB.GetUserData( APPLY_NUMBERING ); + delete (ImpUserData*) aCheckLB.GetUserData( MERGE_SINGLE_LINE_PARA ); + delete pCheckButtonData; +} + +/*********************************************************************/ +/* */ +/*********************************************************************/ + +SfxTabPage* __EXPORT OfaSwAutoFmtOptionsPage::Create( Window* pParent, + const SfxItemSet& rAttrSet) +{ + return new OfaSwAutoFmtOptionsPage(pParent, rAttrSet); +} + +/*********************************************************************/ +/* */ +/*********************************************************************/ + +BOOL OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet& ) +{ + BOOL bModified = FALSE; + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); + long nFlags = pAutoCorrect->GetFlags(); + + BOOL bCheck = aCheckLB.IsChecked(USE_REPLACE_TABLE, CBCOL_FIRST); + bModified |= pOpt->bAutoCorrect != bCheck; + pOpt->bAutoCorrect = bCheck; + pAutoCorrect->SetAutoCorrFlag(Autocorrect, + aCheckLB.IsChecked(USE_REPLACE_TABLE, CBCOL_SECOND)); + + bCheck = aCheckLB.IsChecked(CORR_UPPER, CBCOL_FIRST); + bModified |= pOpt->bCptlSttWrd != bCheck; + pOpt->bCptlSttWrd = bCheck; + pAutoCorrect->SetAutoCorrFlag(CptlSttWrd, + aCheckLB.IsChecked(CORR_UPPER, CBCOL_SECOND)); + + bCheck = aCheckLB.IsChecked(BEGIN_UPPER, CBCOL_FIRST); + bModified |= pOpt->bCptlSttSntnc != bCheck; + pOpt->bCptlSttSntnc = bCheck; + pAutoCorrect->SetAutoCorrFlag(CptlSttSntnc, + aCheckLB.IsChecked(BEGIN_UPPER, CBCOL_SECOND)); + + bCheck = aCheckLB.IsChecked(BOLD_UNDERLINE, CBCOL_FIRST); + bModified |= pOpt->bChgWeightUnderl != bCheck; + pOpt->bChgWeightUnderl = bCheck; + pAutoCorrect->SetAutoCorrFlag(ChgWeightUnderl, + aCheckLB.IsChecked(BOLD_UNDERLINE, CBCOL_SECOND)); + + pAutoCorrect->SetAutoCorrFlag(IngnoreDoubleSpace, + aCheckLB.IsChecked(IGNORE_DBLSPACE, CBCOL_SECOND)); + + bCheck = aCheckLB.IsChecked(DETECT_URL, CBCOL_FIRST); + bModified |= pOpt->bSetINetAttr != bCheck; + pOpt->bSetINetAttr = bCheck; + pAutoCorrect->SetAutoCorrFlag(SetINetAttr, + aCheckLB.IsChecked(DETECT_URL, CBCOL_SECOND)); + + bCheck = aCheckLB.IsChecked(REPLACE_1ST, CBCOL_FIRST); + bModified |= pOpt->bChgOrdinalNumber != bCheck; + pOpt->bChgOrdinalNumber = bCheck; + pAutoCorrect->SetAutoCorrFlag(ChgOrdinalNumber, + aCheckLB.IsChecked(REPLACE_1ST, CBCOL_SECOND)); + + bCheck = aCheckLB.IsChecked(DEL_EMPTY_NODE, CBCOL_FIRST); + bModified |= pOpt->bDelEmptyNode != bCheck; + pOpt->bDelEmptyNode = bCheck; + + bCheck = aCheckLB.IsChecked(REPLACE_QUOTATION, CBCOL_FIRST); + bModified |= pOpt->bReplaceQuote != bCheck; + pOpt->bReplaceQuote = bCheck; + + bCheck = aCheckLB.IsChecked(REPLACE_USER_COLL, CBCOL_FIRST); + bModified |= pOpt->bChgUserColl != bCheck; + pOpt->bChgUserColl = bCheck; + + bCheck = aCheckLB.IsChecked(REPLACE_BULLETS, CBCOL_FIRST); + bModified |= pOpt->bChgEnumNum != bCheck; + pOpt->bChgEnumNum = bCheck; + bModified |= aBulletFont != pOpt->aBulletFont; + pOpt->aBulletFont = aBulletFont; + bModified |= String(pOpt->cBullet) != sBulletChar; + pOpt->cBullet = sBulletChar.GetChar(0); + + bModified |= aByInputBulletFont != pOpt->aByInputBulletFont; + bModified |= String(pOpt->cByInputBullet) != sByInputBulletChar; + pOpt->aByInputBulletFont = aByInputBulletFont; + pOpt->cByInputBullet = sByInputBulletChar.GetChar(0); + + bCheck = aCheckLB.IsChecked(MERGE_SINGLE_LINE_PARA, CBCOL_FIRST); + bModified |= pOpt->bRightMargin != bCheck; + pOpt->bRightMargin = bCheck; + bModified |= nPercent != pOpt->nRightMargin; + pOpt->nRightMargin = (BYTE)nPercent; + + bCheck = aCheckLB.IsChecked(APPLY_NUMBERING, CBCOL_SECOND); + bModified |= pOpt->bSetNumRule != bCheck; + pOpt->bSetNumRule = bCheck; + + bCheck = aCheckLB.IsChecked(INSERT_BORDER, CBCOL_SECOND); + bModified |= pOpt->bSetBorder != bCheck; + pOpt->bSetBorder = bCheck; + + bCheck = aCheckLB.IsChecked(CREATE_TABLE, CBCOL_SECOND); + bModified |= pOpt->bCreateTable != bCheck; + pOpt->bCreateTable = bCheck; + + bCheck = aCheckLB.IsChecked(REPLACE_STYLES, CBCOL_SECOND); + bModified |= pOpt->bReplaceStyles != bCheck; + pOpt->bReplaceStyles = bCheck; + + bCheck = aCheckLB.IsChecked(REPLACE_HALF, CBCOL_FIRST); + bModified |= pOpt->bChgFracionSymbol != bCheck; + pOpt->bChgFracionSymbol = bCheck; + pAutoCorrect->SetAutoCorrFlag(ChgFractionSymbol, + aCheckLB.IsChecked(REPLACE_HALF, CBCOL_SECOND)); + + bCheck = aCheckLB.IsChecked(REPLACE_DASHES, CBCOL_FIRST); + bModified |= pOpt->bChgToEnEmDash != bCheck; + pOpt->bChgToEnEmDash = bCheck; + pAutoCorrect->SetAutoCorrFlag(ChgToEnEmDash, + aCheckLB.IsChecked(REPLACE_DASHES, CBCOL_SECOND)); + + bCheck = aCheckLB.IsChecked(DEL_SPACES_AT_STT_END, CBCOL_FIRST); + bModified |= pOpt->bAFmtDelSpacesAtSttEnd != bCheck; + pOpt->bAFmtDelSpacesAtSttEnd = bCheck; + bCheck = aCheckLB.IsChecked(DEL_SPACES_AT_STT_END, CBCOL_SECOND); + bModified |= pOpt->bAFmtByInpDelSpacesAtSttEnd != bCheck; + pOpt->bAFmtByInpDelSpacesAtSttEnd = bCheck; + + bCheck = aCheckLB.IsChecked(DEL_SPACES_BETWEEN_LINES, CBCOL_FIRST); + bModified |= pOpt->bAFmtDelSpacesBetweenLines != bCheck; + pOpt->bAFmtDelSpacesBetweenLines = bCheck; + bCheck = aCheckLB.IsChecked(DEL_SPACES_BETWEEN_LINES, CBCOL_SECOND); + bModified |= pOpt->bAFmtByInpDelSpacesBetweenLines != bCheck; + pOpt->bAFmtByInpDelSpacesBetweenLines = bCheck; + + if(bModified || nFlags != pAutoCorrect->GetFlags()) + { + SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get(); + pCfg->SetModified(); + pCfg->Commit(); + } + + return TRUE; +} + +/* -----------------23.11.98 16:15------------------- + * + * --------------------------------------------------*/ +void OfaSwAutoFmtOptionsPage::ActivatePage( const SfxItemSet& ) +{ + ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(FALSE); +} + +/*********************************************************************/ +/* */ +/*********************************************************************/ + + +void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet& ) +{ + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); + const long nFlags = pAutoCorrect->GetFlags(); + + aCheckLB.SetUpdateMode(FALSE); + aCheckLB.Clear(); + + // Die folgenden Eintraege muessen in der selben Reihenfolge, wie im + // OfaAutoFmtOptions-enum eingefuegt werden! + aCheckLB.GetModel()->Insert(CreateEntry(sUseReplaceTbl, CBCOL_BOTH )); + aCheckLB.GetModel()->Insert(CreateEntry(sCptlSttWord, CBCOL_BOTH )); + aCheckLB.GetModel()->Insert(CreateEntry(sCptlSttSent, CBCOL_BOTH )); + aCheckLB.GetModel()->Insert(CreateEntry(sBoldUnder, CBCOL_BOTH )); + aCheckLB.GetModel()->Insert(CreateEntry(sDetectURL, CBCOL_BOTH )); + aCheckLB.GetModel()->Insert(CreateEntry(sOrdinal, CBCOL_BOTH )); + aCheckLB.GetModel()->Insert(CreateEntry(sFraction, CBCOL_BOTH )); + aCheckLB.GetModel()->Insert(CreateEntry(sDash, CBCOL_BOTH )); + aCheckLB.GetModel()->Insert(CreateEntry(sDelSpaceAtSttEnd, CBCOL_BOTH )); + aCheckLB.GetModel()->Insert(CreateEntry(sDelSpaceBetweenLines, CBCOL_BOTH )); + + aCheckLB.GetModel()->Insert(CreateEntry(sNoDblSpaces, CBCOL_SECOND)); + aCheckLB.GetModel()->Insert(CreateEntry(sNum, CBCOL_SECOND)); + aCheckLB.GetModel()->Insert(CreateEntry(sBorder, CBCOL_SECOND)); + aCheckLB.GetModel()->Insert(CreateEntry(sTable, CBCOL_SECOND)); + aCheckLB.GetModel()->Insert(CreateEntry(sReplaceTemplates, CBCOL_SECOND)); + aCheckLB.GetModel()->Insert(CreateEntry(sDeleteEmptyPara, CBCOL_FIRST )); + aCheckLB.GetModel()->Insert(CreateEntry(sUserStyle, CBCOL_FIRST )); + aCheckLB.GetModel()->Insert(CreateEntry(sBullet, CBCOL_FIRST )); + aCheckLB.GetModel()->Insert(CreateEntry(sTypo, CBCOL_FIRST )); + aCheckLB.GetModel()->Insert(CreateEntry(sRightMargin, CBCOL_FIRST )); + + aCheckLB.CheckEntryPos( USE_REPLACE_TABLE, CBCOL_FIRST, pOpt->bAutoCorrect ); + aCheckLB.CheckEntryPos( USE_REPLACE_TABLE, CBCOL_SECOND, 0 != (nFlags & Autocorrect)); + aCheckLB.CheckEntryPos( CORR_UPPER, CBCOL_FIRST, pOpt->bCptlSttWrd ); + aCheckLB.CheckEntryPos( CORR_UPPER, CBCOL_SECOND, 0 != (nFlags & CptlSttWrd) ); + aCheckLB.CheckEntryPos( BEGIN_UPPER, CBCOL_FIRST, pOpt->bCptlSttSntnc ); + aCheckLB.CheckEntryPos( BEGIN_UPPER, CBCOL_SECOND, 0 != (nFlags & CptlSttSntnc) ); + aCheckLB.CheckEntryPos( BOLD_UNDERLINE, CBCOL_FIRST, pOpt->bChgWeightUnderl ); + aCheckLB.CheckEntryPos( BOLD_UNDERLINE, CBCOL_SECOND, 0 != (nFlags & ChgWeightUnderl) ); + aCheckLB.CheckEntryPos( IGNORE_DBLSPACE, CBCOL_SECOND, 0 != (nFlags & IngnoreDoubleSpace) ); + aCheckLB.CheckEntryPos( DETECT_URL, CBCOL_FIRST, pOpt->bSetINetAttr ); + aCheckLB.CheckEntryPos( DETECT_URL, CBCOL_SECOND, 0 != (nFlags & SetINetAttr) ); + aCheckLB.CheckEntryPos( REPLACE_1ST, CBCOL_FIRST, pOpt->bChgOrdinalNumber ); + aCheckLB.CheckEntryPos( REPLACE_1ST, CBCOL_SECOND, 0 != (nFlags & ChgOrdinalNumber) ); + aCheckLB.CheckEntryPos( REPLACE_HALF, CBCOL_FIRST, pOpt->bChgFracionSymbol ); + aCheckLB.CheckEntryPos( REPLACE_HALF, CBCOL_SECOND, 0 != (nFlags & ChgFractionSymbol) ); + aCheckLB.CheckEntryPos( REPLACE_DASHES, CBCOL_FIRST, pOpt->bChgToEnEmDash ); + aCheckLB.CheckEntryPos( REPLACE_DASHES, CBCOL_SECOND, 0 != (nFlags & ChgToEnEmDash) ); + aCheckLB.CheckEntryPos( DEL_SPACES_AT_STT_END, CBCOL_FIRST, pOpt->bAFmtDelSpacesAtSttEnd ); + aCheckLB.CheckEntryPos( DEL_SPACES_AT_STT_END, CBCOL_SECOND, pOpt->bAFmtByInpDelSpacesAtSttEnd ); + aCheckLB.CheckEntryPos( DEL_SPACES_BETWEEN_LINES, CBCOL_FIRST, pOpt->bAFmtDelSpacesBetweenLines ); + aCheckLB.CheckEntryPos( DEL_SPACES_BETWEEN_LINES, CBCOL_SECOND, pOpt->bAFmtByInpDelSpacesBetweenLines ); + aCheckLB.CheckEntryPos( DEL_EMPTY_NODE, CBCOL_FIRST, pOpt->bDelEmptyNode ); + aCheckLB.CheckEntryPos( REPLACE_QUOTATION, CBCOL_FIRST, pOpt->bReplaceQuote ); + aCheckLB.CheckEntryPos( REPLACE_USER_COLL, CBCOL_FIRST, pOpt->bChgUserColl ); + aCheckLB.CheckEntryPos( REPLACE_BULLETS, CBCOL_FIRST, pOpt->bChgEnumNum ); + + aBulletFont = pOpt->aBulletFont; + sBulletChar = pOpt->cBullet; + ImpUserData* pUserData = new ImpUserData(&sBulletChar, &aBulletFont); + aCheckLB.SetUserData( REPLACE_BULLETS, pUserData ); + + nPercent = pOpt->nRightMargin; + sMargin = ' '; + sMargin += String::CreateFromInt32( nPercent ); + sMargin += '%'; + pUserData = new ImpUserData(&sMargin, 0); + aCheckLB.SetUserData( MERGE_SINGLE_LINE_PARA, pUserData ); + + aCheckLB.CheckEntryPos( APPLY_NUMBERING, CBCOL_SECOND, pOpt->bSetNumRule ); + + aByInputBulletFont = pOpt->aByInputBulletFont; + sByInputBulletChar = pOpt->cByInputBullet; + ImpUserData* pUserData2 = new ImpUserData(&sByInputBulletChar, &aByInputBulletFont); + aCheckLB.SetUserData( APPLY_NUMBERING , pUserData2 ); + + aCheckLB.CheckEntryPos( MERGE_SINGLE_LINE_PARA, CBCOL_FIRST, pOpt->bRightMargin ); + aCheckLB.CheckEntryPos( INSERT_BORDER, CBCOL_SECOND, pOpt->bSetBorder ); + aCheckLB.CheckEntryPos( CREATE_TABLE, CBCOL_SECOND, pOpt->bCreateTable ); + aCheckLB.CheckEntryPos( REPLACE_STYLES, CBCOL_SECOND, pOpt->bReplaceStyles ); + + aCheckLB.SetUpdateMode(TRUE); +} + +/*********************************************************************/ +/* */ +/*********************************************************************/ + +IMPL_LINK(OfaSwAutoFmtOptionsPage, SelectHdl, OfaACorrCheckListBox*, pBox) +{ + aEditPB.Enable(0 != pBox->FirstSelected()->GetUserData()); + return 0; +} + +/*********************************************************************/ +/* */ +/*********************************************************************/ + +IMPL_LINK(OfaSwAutoFmtOptionsPage, EditHdl, PushButton*, EMPTYARG) +{ + ULONG nSelEntryPos = aCheckLB.GetSelectEntryPos(); + if( nSelEntryPos == REPLACE_BULLETS || + nSelEntryPos == APPLY_NUMBERING) + { + SvxCharacterMap *pMapDlg = new SvxCharacterMap(this); + ImpUserData* pUserData = (ImpUserData*)aCheckLB.FirstSelected()->GetUserData(); + pMapDlg->SetCharFont(*pUserData->pFont); + pMapDlg->SetChar( pUserData->pString->GetChar(0) ); + if(RET_OK == pMapDlg->Execute()) + { + Font aFont(pMapDlg->GetCharFont()); + *pUserData->pFont = aFont; + sal_UCS4 aChar = pMapDlg->GetChar(); + // using the UCS4 constructor + rtl::OUString aOUStr( &aChar, 1 ); + *pUserData->pString = aOUStr; + } + delete pMapDlg; + } + else if( MERGE_SINGLE_LINE_PARA == nSelEntryPos ) + { + // Dialog fuer Prozenteinstellung + OfaAutoFmtPrcntSet aDlg(this); + aDlg.GetPrcntFld().SetValue(nPercent); + if(RET_OK == aDlg.Execute()) + { + nPercent = (USHORT)aDlg.GetPrcntFld().GetValue(); + sMargin = ' '; + sMargin += String::CreateFromInt32( nPercent ); + sMargin += '%'; + } + } + aCheckLB.Invalidate(); + return 0; +} + +/*********************************************************************/ +/* */ +/*********************************************************************/ + +void OfaACorrCheckListBox::SetTabs() +{ + SvxSimpleTable::SetTabs(); + USHORT nAdjust = SV_LBOXTAB_ADJUST_RIGHT|SV_LBOXTAB_ADJUST_LEFT|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_ADJUST_NUMERIC|SV_LBOXTAB_FORCE; + + if( aTabs.Count() > 1 ) + { + SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(1); + pTab->nFlags &= ~nAdjust; + pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE; + } + if( aTabs.Count() > 2 ) + { + SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(2); + pTab->nFlags &= ~nAdjust; + pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE; + } +} + +/*********************************************************************/ +/* */ +/*********************************************************************/ + +void OfaACorrCheckListBox::CheckEntryPos(ULONG nPos, USHORT nCol, BOOL bChecked) +{ + if ( nPos < GetEntryCount() ) + SetCheckButtonState( + GetEntry(nPos), + nCol, + bChecked ? SvButtonState( SV_BUTTON_CHECKED ) : + SvButtonState( SV_BUTTON_UNCHECKED ) ); +} + +/*********************************************************************/ +/* */ +/*********************************************************************/ + +BOOL OfaACorrCheckListBox::IsChecked(ULONG nPos, USHORT nCol) +{ + return GetCheckButtonState( GetEntry(nPos), nCol ) == SV_BUTTON_CHECKED; +} + +/*********************************************************************/ +/* */ +/*********************************************************************/ + +void OfaACorrCheckListBox::SetCheckButtonState( SvLBoxEntry* pEntry, USHORT nCol, SvButtonState eState) +{ + SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1)); + + DBG_ASSERT(pItem,"SetCheckButton:Item not found"); + if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON) + { + switch( eState ) + { + case SV_BUTTON_CHECKED: + pItem->SetStateChecked(); + break; + + case SV_BUTTON_UNCHECKED: + pItem->SetStateUnchecked(); + break; + + case SV_BUTTON_TRISTATE: + pItem->SetStateTristate(); + break; + } + InvalidateEntry( pEntry ); + } +} + +/*********************************************************************/ +/* */ +/*********************************************************************/ + +SvButtonState OfaACorrCheckListBox::GetCheckButtonState( SvLBoxEntry* pEntry, USHORT nCol ) const +{ + SvButtonState eState = SV_BUTTON_UNCHECKED; + SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1)); + DBG_ASSERT(pItem,"GetChButnState:Item not found"); + + if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON) + { + USHORT nButtonFlags = pItem->GetButtonFlags(); + eState = pCheckButtonData->ConvertToButtonState( nButtonFlags ); + } + + return eState; +} + +void OfaACorrCheckListBox::HBarClick() +{ + // Sortierung durch diese Ueberladung abgeklemmt +} +/* -----------------------------22.05.2002 11:06------------------------------ + + ---------------------------------------------------------------------------*/ +void OfaACorrCheckListBox::KeyInput( const KeyEvent& rKEvt ) +{ + if(!rKEvt.GetKeyCode().GetModifier() && + KEY_SPACE == rKEvt.GetKeyCode().GetCode()) + { + ULONG nSelPos = GetSelectEntryPos(); + USHORT nCol = GetCurrentTabPos() - 1; + if ( nCol < 2 ) + { + CheckEntryPos( nSelPos, nCol, !IsChecked( nSelPos, nCol ) ); + CallImplEventListeners( VCLEVENT_CHECKBOX_TOGGLE, (void*)GetEntry( nSelPos ) ); + } + else + { + USHORT nCheck = IsChecked(nSelPos, 1) ? 1 : 0; + if(IsChecked(nSelPos, 0)) + nCheck += 2; + nCheck--; + nCheck &= 3; + CheckEntryPos(nSelPos, 1, 0 != (nCheck & 1)); + CheckEntryPos(nSelPos, 0, 0 != (nCheck & 2)); + } + } + else + SvxSimpleTable::KeyInput(rKEvt); +} +/* -----------------19.11.98 15:57------------------- + * + * --------------------------------------------------*/ +struct DoubleString +{ + String sShort; + String sLong; + void* pUserData; // CheckBox -> form. Text Bool -> Selektionstext +}; +typedef DoubleString* DoubleStringPtr; +SV_DECL_PTRARR_DEL(DoubleStringArray, DoubleStringPtr, 4, 4) +SV_IMPL_PTRARR(DoubleStringArray, DoubleStringPtr); + +/* -----------------19.11.98 16:07------------------- + * + * --------------------------------------------------*/ +void lcl_ClearTable(DoubleStringTable& rTable) +{ + DoubleStringArrayPtr pArray = rTable.Last(); + while(pArray) + { + pArray->DeleteAndDestroy(0, pArray->Count()); + delete pArray; + pArray = rTable.Prev(); + } + rTable.Clear(); +} + +/*-----------------14.10.96 15.57------------------- + +--------------------------------------------------*/ + +OfaAutocorrReplacePage::OfaAutocorrReplacePage( Window* pParent, + const SfxItemSet& rSet ) : + SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_AUTOCORR_REPLACE ), rSet), + aTextOnlyCB( this, SVX_RES(CB_TEXT_ONLY )), + aShortFT ( this, SVX_RES(FT_SHORT )), + aShortED ( this, SVX_RES(ED_SHORT )), + aReplaceFT( this, SVX_RES(FT_REPLACE )), + aReplaceED( this, SVX_RES(ED_REPLACE )), + aReplaceTLB( this, SVX_RES(TLB_REPLACE )), + aNewReplacePB( this, SVX_RES(PB_NEW_REPLACE )), + aDeleteReplacePB(this,SVX_RES(PB_DELETE_REPLACE )), + sModify(SVX_RES(STR_MODIFY)), + sNew(aNewReplacePB.GetText()), + pFormatText(0), + eLang(eLastDialogLanguage), + bHasSelectionText(FALSE), + bFirstSelect(TRUE), + bReplaceEditChanged(FALSE), + bSWriter(TRUE) +{ + FreeResource(); + SfxModule *pMod = *(SfxModule**)GetAppData(SHL_WRITER); + bSWriter = pMod == SfxModule::GetActiveModule(); + + ::com::sun::star::lang::Locale aLcl( SvxCreateLocale(eLastDialogLanguage )); + pCompareClass = new CollatorWrapper( GetProcessFact() ); + pCompareCaseClass = new CollatorWrapper( GetProcessFact() ); + pCompareClass->loadDefaultCollator( aLcl, ::com::sun::star::i18n:: + CollatorOptions::CollatorOptions_IGNORE_CASE ); + pCompareCaseClass->loadDefaultCollator( aLcl, 0 ); + pCharClass = new CharClass( aLcl ); + + static long nTabs[] = { 2 /* Tab-Count */, 1, 61 }; + aReplaceTLB.SetTabs( &nTabs[0], MAP_APPFONT ); + + aReplaceTLB.SetWindowBits(WB_HSCROLL|WB_CLIPCHILDREN); + aReplaceTLB.SetSelectHdl(LINK(this, OfaAutocorrReplacePage, SelectHdl)); + aNewReplacePB.SetClickHdl( LINK(this, OfaAutocorrReplacePage, NewDelHdl)); + aDeleteReplacePB.SetClickHdl(LINK(this, OfaAutocorrReplacePage, NewDelHdl)); + aShortED.SetModifyHdl(LINK(this, OfaAutocorrReplacePage, ModifyHdl)); + aReplaceED.SetModifyHdl(LINK(this, OfaAutocorrReplacePage, ModifyHdl)); + aShortED.SetActionHdl(LINK(this, OfaAutocorrReplacePage, NewDelHdl)); + aReplaceED.SetActionHdl(LINK(this, OfaAutocorrReplacePage, NewDelHdl)); + + aReplaceED.SetSpaces(TRUE); + aShortED.SetSpaces(TRUE); + aShortED.SetMaxTextLen(30); +} + +/*-----------------14.10.96 15.58------------------- + +--------------------------------------------------*/ + + +OfaAutocorrReplacePage::~OfaAutocorrReplacePage() +{ + delete pFormatText; + lcl_ClearTable(aDoubleStringTable); + delete pCompareClass; + delete pCompareCaseClass; + delete pCharClass; +} +/*-----------------14.10.96 15.58------------------- + +--------------------------------------------------*/ + +SfxTabPage* OfaAutocorrReplacePage::Create( Window* pParent, + const SfxItemSet& rSet) +{ + return new OfaAutocorrReplacePage(pParent, rSet); +} +/* -----------------20.11.98 13:26------------------- + * + * --------------------------------------------------*/ +void OfaAutocorrReplacePage::ActivatePage( const SfxItemSet& ) +{ + if(eLang != eLastDialogLanguage) + SetLanguage(eLastDialogLanguage); + ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(TRUE); +} +/* -----------------20.11.98 13:26------------------- + * + * --------------------------------------------------*/ +int OfaAutocorrReplacePage::DeactivatePage( SfxItemSet* ) +{ + return LEAVE_PAGE; +} +/*-----------------14.10.96 15.58------------------- + +--------------------------------------------------*/ + +BOOL OfaAutocorrReplacePage::FillItemSet( SfxItemSet& ) +{ + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + DoubleStringArrayPtr pDoubleStringArray = aDoubleStringTable.Last(); + while(pDoubleStringArray) + { + LanguageType eCurLang = (LanguageType)aDoubleStringTable.GetCurKey(); + if(eCurLang != eLang) // die aktuelle Sprache wird weiter hinten behandelt + { + SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eCurLang); + USHORT nWordListCount = pWordList->Count(); + USHORT nDoubleStringArrayCount = pDoubleStringArray->Count(); + USHORT nPos = nDoubleStringArrayCount; + USHORT nLastPos = nPos; + // 1. Durchlauf: Eintraege loeschen oder veraendern: + + + for( USHORT nWordListPos = nWordListCount; nWordListPos; nWordListPos-- ) + { + SvxAutocorrWordPtr pWordPtr = pWordList->GetObject(nWordListPos - 1); + String sEntry(pWordPtr->GetShort()); + // formatierter Text steht nur im Writer + BOOL bFound = !bSWriter && !pWordPtr->IsTextOnly(); + while(!bFound && nPos) + { + DoubleString* pDouble = pDoubleStringArray->GetObject( nPos - 1); + + if( 0 == pCompareClass->compareString( + sEntry, pDouble->sShort )) + { + nLastPos = nPos - 1; + bFound = TRUE; + if( !(pWordPtr->IsTextOnly() == (0 == pDouble->pUserData) + && 0 == pCompareCaseClass->compareString( + pWordPtr->GetLong(), pDouble->sLong ) ) ) + { + pAutoCorrect->PutText(sEntry, pDouble->sLong, eCurLang); + } + pDoubleStringArray->DeleteAndDestroy(nPos - 1, 1); + break; + } + nPos--; + } + nPos = nLastPos; + if(!bFound) + { + pAutoCorrect->DeleteText(sEntry, eCurLang); + } + } + nDoubleStringArrayCount = pDoubleStringArray->Count(); + for(USHORT nDoubleStringArrayPos = 0; nDoubleStringArrayPos < nDoubleStringArrayCount; nDoubleStringArrayPos++ ) + { + //jetzt sollte es nur noch neue Eintraege geben + DoubleString* pDouble = pDoubleStringArray->GetObject( nDoubleStringArrayPos ); + if(pDouble->pUserData == &bHasSelectionText) + pAutoCorrect->PutText( pDouble->sShort, + *SfxObjectShell::Current(), eCurLang ); + else + { + pAutoCorrect->PutText( pDouble->sShort, pDouble->sLong, + eCurLang); + } + } + } + pDoubleStringArray->DeleteAndDestroy(0, pDoubleStringArray->Count()); + delete pDoubleStringArray; + pDoubleStringArray = aDoubleStringTable.Prev(); + } + aDoubleStringTable.Clear(); + // jetzt noch die aktuelle Selektion + SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eLang); + USHORT nWordListCount = pWordList->Count(); + USHORT nListBoxCount = (USHORT)aReplaceTLB.GetEntryCount(); + + aReplaceTLB.SetUpdateMode(FALSE); + USHORT nListBoxPos = nListBoxCount; + USHORT nLastListBoxPos = nListBoxPos; + // 1. Durchlauf: Eintraege loeschen oder veraendern: + + USHORT i; + for( i = nWordListCount; i; i-- ) + { + SvxAutocorrWordPtr pWordPtr = pWordList->GetObject(i- 1); + String sEntry(pWordPtr->GetShort()); + // formatierter Text steht nur im Writer + BOOL bFound = !bSWriter && !pWordPtr->IsTextOnly(); + while(!bFound && nListBoxPos) + { + SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( nListBoxPos - 1); + if( 0 == pCompareClass->compareString( sEntry, + aReplaceTLB.GetEntryText(pEntry, 0))) + { + nLastListBoxPos = nListBoxPos - 1; + bFound = TRUE; + String sLong = aReplaceTLB.GetEntryText(pEntry, 1); + if( !(pWordPtr->IsTextOnly() == (0 == pEntry->GetUserData()) + && 0 == pCompareCaseClass->compareString( + pWordPtr->GetLong(), sLong ))) + { + pAutoCorrect->PutText(sEntry, sLong, eLang); + } + aReplaceTLB.GetModel()->Remove(pEntry); + break; + + } + nListBoxPos --; + } + nListBoxPos = nLastListBoxPos; + if(!bFound) + { + pAutoCorrect->DeleteText(sEntry, eLang); + } + + } + nListBoxCount = (USHORT)aReplaceTLB.GetEntryCount(); + for(i = 0; i < nListBoxCount; i++ ) + { + //jetzt sollte es nur noch neue Eintraege geben + SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( i ); + String sShort = aReplaceTLB.GetEntryText(pEntry, 0); + if(pEntry->GetUserData() == &bHasSelectionText) + pAutoCorrect->PutText(sShort, *SfxObjectShell::Current(), eLang); + else + { + String sLong = aReplaceTLB.GetEntryText(pEntry, 1); + pAutoCorrect->PutText(sShort, sLong, eLang); + } + } + + return FALSE; +} + +/* -----------------19.11.98 13:16------------------- + * + * --------------------------------------------------*/ +void OfaAutocorrReplacePage::RefillReplaceBox(BOOL bFromReset, + LanguageType eOldLanguage, + LanguageType eNewLanguage) +{ + eLang = eNewLanguage; + if(bFromReset) + lcl_ClearTable(aDoubleStringTable); + else + { + DoubleStringArray* pArray = 0; + if(aDoubleStringTable.IsKeyValid(eOldLanguage)) + { + pArray = aDoubleStringTable.Seek(ULONG(eOldLanguage)); + pArray->DeleteAndDestroy(0, pArray->Count()); + } + else + { + pArray = new DoubleStringArray; + aDoubleStringTable.Insert(ULONG(eOldLanguage), pArray); + } + + USHORT nListBoxCount = (USHORT)aReplaceTLB.GetEntryCount(); + USHORT i; + for(i = 0; i < nListBoxCount; i++) + { + DoubleString* pDouble = new DoubleString(); + SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( i ); + pDouble->sShort = aReplaceTLB.GetEntryText(pEntry, 0); + pDouble->sLong = aReplaceTLB.GetEntryText(pEntry, 1); + pDouble->pUserData = pEntry->GetUserData(); + pArray->Insert(pDouble, i); + } + } + + aReplaceTLB.Clear(); + if(!bSWriter) + { + if(pFormatText) + pFormatText->DeleteAndDestroy(0, pFormatText->Count()); + else + pFormatText = new SvStringsISortDtor(); + } + + if(aDoubleStringTable.IsKeyValid(eLang)) + { + DoubleStringArray* pArray = aDoubleStringTable.Seek(ULONG(eNewLanguage)); + for(USHORT i = 0; i < pArray->Count(); i++) + { + DoubleString* pDouble = pArray->GetObject(i); + BOOL bTextOnly = 0 == pDouble->pUserData; + // formatierter Text wird nur im Writer angeboten + if(bSWriter || bTextOnly) + { + String sEntry(pDouble->sShort); + sEntry += '\t'; + sEntry += pDouble->sLong; + SvLBoxEntry* pEntry = aReplaceTLB.InsertEntry(sEntry); + aTextOnlyCB.Check(bTextOnly); + if(!bTextOnly) + pEntry->SetUserData(pDouble->pUserData); // Das heisst: mit Formatinfo oder sogar mit Selektionstext + } + else + { + pFormatText->Insert(new String(pDouble->sShort)); + } + } + } + else + { + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eLang); + + for(USHORT i = 0; i < pWordList->Count(); i++) + { + SvxAutocorrWordPtr pWordPtr = pWordList->GetObject(i); + BOOL bTextOnly = pWordPtr->IsTextOnly(); + // formatierter Text wird nur im Writer angeboten + if(bSWriter || bTextOnly) + { + String sEntry(pWordPtr->GetShort()); + sEntry += '\t'; + sEntry += pWordPtr->GetLong(); + SvLBoxEntry* pEntry = aReplaceTLB.InsertEntry(sEntry); + aTextOnlyCB.Check(pWordPtr->IsTextOnly()); + if(!bTextOnly) + pEntry->SetUserData(&aTextOnlyCB); // Das heisst: mit Formatinfo + } + else + { + pFormatText->Insert(new String(pWordPtr->GetShort())); + } + } + aNewReplacePB.Enable(FALSE); + aDeleteReplacePB.Enable(FALSE); + + } + + SfxViewShell* pViewShell = SfxViewShell::Current(); + if( pViewShell && pViewShell->HasSelection( TRUE ) ) + { + bHasSelectionText = TRUE; + const String sSelection( pViewShell->GetSelectionText() ); + aReplaceED.SetText( sSelection ); + aTextOnlyCB.Check( !bSWriter ); + aTextOnlyCB.Enable( bSWriter && sSelection.Len() ); + } + else + aTextOnlyCB.Enable( FALSE ); +} +/*-----------------14.10.96 15.58------------------- + +--------------------------------------------------*/ + +void OfaAutocorrReplacePage::Reset( const SfxItemSet& ) +{ + RefillReplaceBox(TRUE, eLang, eLang); + aShortED.GrabFocus(); +} + +/* -----------------23.11.98 10:33------------------- + * + * --------------------------------------------------*/ +void OfaAutocorrReplacePage::SetLanguage(LanguageType eSet) +{ + //save old settings an refill + if(eSet != eLang) + { + RefillReplaceBox(FALSE, eLang, eSet); + eLastDialogLanguage = eSet; + delete pCompareClass; + delete pCompareCaseClass; + delete pCharClass; + + ::com::sun::star::lang::Locale aLcl( SvxCreateLocale(eLastDialogLanguage )); + pCompareClass = new CollatorWrapper( GetProcessFact() ); + pCompareCaseClass = new CollatorWrapper( GetProcessFact() ); + pCompareClass->loadDefaultCollator( aLcl, ::com::sun::star::i18n:: + CollatorOptions::CollatorOptions_IGNORE_CASE ); + pCompareCaseClass->loadDefaultCollator( aLcl, 0 ); + pCharClass = new CharClass( aLcl ); + ModifyHdl(&aShortED); + } +} +/*-----------------14.10.96 15.58------------------- + +--------------------------------------------------*/ + + +IMPL_LINK(OfaAutocorrReplacePage, SelectHdl, SvTabListBox*, pBox) +{ + if(!bFirstSelect || !bHasSelectionText) + { + SvLBoxEntry* pEntry = pBox->FirstSelected(); + String sTmpShort(pBox->GetEntryText(pEntry, 0)); + // wird der Text ueber den ModifyHdl gesetzt, dann steht der Cursor sonst immer am Wortanfang, + // obwohl man gerade hier editiert + BOOL bSameContent = 0 == pCompareClass->compareString( + sTmpShort, aShortED.GetText() ); + Selection aSel = aShortED.GetSelection(); + if(aShortED.GetText() != sTmpShort) + { + aShortED.SetText(sTmpShort); + //war es nur eine andere Schreibweise, dann muss die Selektion auch wieder gesetzt werden + if(bSameContent) + aShortED.SetSelection(aSel); + } + aReplaceED.SetText(pBox->GetEntryText(pEntry, 1)); + // mit UserData gibt es eine Formatinfo + aTextOnlyCB.Check(0 == pEntry->GetUserData()); + } + else + bFirstSelect = FALSE; + + aNewReplacePB.Enable(FALSE); + aDeleteReplacePB.Enable(); + return 0; +}; + +/*-----------------14.10.96 15.58------------------- + +--------------------------------------------------*/ + + +IMPL_LINK(OfaAutocorrReplacePage, NewDelHdl, PushButton*, pBtn) +{ + SvLBoxEntry* _pEntry = aReplaceTLB.FirstSelected(); + if(pBtn == &aDeleteReplacePB) + { + DBG_ASSERT(_pEntry, "keine Eintrag selektiert"); + if(_pEntry) + { + aReplaceTLB.GetModel()->Remove(_pEntry); + ModifyHdl(&aShortED); + return 0; + } + } + if(pBtn == &aNewReplacePB || aNewReplacePB.IsEnabled()) + { + SvLBoxEntry* _pNewEntry = aReplaceTLB.FirstSelected(); + String sEntry(aShortED.GetText()); + if(sEntry.Len() && ( aReplaceED.GetText().Len() || + ( bHasSelectionText && bSWriter ) )) + { + aReplaceTLB.SetUpdateMode(FALSE); + USHORT nPos = USHRT_MAX; + sEntry += '\t'; + sEntry += aReplaceED.GetText(); + if(_pNewEntry) + { + nPos = (USHORT)aReplaceTLB.GetModel()->GetAbsPos(_pNewEntry); + aReplaceTLB.GetModel()->Remove(_pNewEntry); + } + else + { + USHORT j; + for( j = 0; j < aReplaceTLB.GetEntryCount(); j++ ) + { + SvLBoxEntry* pReplaceEntry = aReplaceTLB.GetEntry(j); + if( 0 >= pCompareClass->compareString(sEntry, + aReplaceTLB.GetEntryText(pReplaceEntry, 0) ) ) + break; + } + nPos = j; + } + SvLBoxEntry* pInsEntry = + aReplaceTLB.InsertEntry( + sEntry, static_cast< SvLBoxEntry * >(NULL), false, + nPos == USHRT_MAX ? LIST_APPEND : nPos); + if( !bReplaceEditChanged && !aTextOnlyCB.IsChecked()) + pInsEntry->SetUserData(&bHasSelectionText); // neuer formatierter Text + + aReplaceTLB.MakeVisible( pInsEntry ); + aReplaceTLB.SetUpdateMode(TRUE); + // falls der Request aus dem ReplaceEdit kam, dann Focus in das ShortEdit setzen + if(aReplaceED.HasFocus()) + aShortED.GrabFocus(); + + } + } + else + { + // das kann nur ein Enter in einem der beiden Edit-Felder sein und das + // bedeutet EndDialog() - muss im KeyInput ausgewertet werden + return 0; + } + ModifyHdl(&aShortED); + return 1; +} + +/*-----------------17.10.96 07.49------------------- + +--------------------------------------------------*/ +IMPL_LINK(OfaAutocorrReplacePage, ModifyHdl, Edit*, pEdt) +{ + SvLBoxEntry* pFirstSel = aReplaceTLB.FirstSelected(); + BOOL bShort = pEdt == &aShortED; + const String rEntry = pEdt->GetText(); + const String rRepString = aReplaceED.GetText(); + String aWordStr( pCharClass->lower( rEntry )); + + if(bShort) + { + if(rEntry.Len()) + { + BOOL bFound = FALSE; + BOOL bTmpSelEntry=FALSE; + + for(USHORT i = 0; i < aReplaceTLB.GetEntryCount(); i++) + { + SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( i ); + String aTestStr=aReplaceTLB.GetEntryText(pEntry, 0); + if( 0 == pCompareClass->compareString(rEntry, aTestStr )) + { + if(rRepString.Len()) + bFirstSelect = TRUE; + aReplaceTLB.SetCurEntry(pEntry); + pFirstSel = pEntry; + aNewReplacePB.SetText(sModify); + bFound= TRUE; + break; + } + else + { + pCharClass->toLower( aTestStr ); + if(aTestStr.Search(aWordStr)==0 && !bTmpSelEntry) + { + aReplaceTLB.MakeVisible(pEntry); + bTmpSelEntry=TRUE; + } + } + } + if(!bFound) + { + aReplaceTLB.SelectAll(FALSE); + pFirstSel = 0; + aNewReplacePB.SetText(sNew); + if(bReplaceEditChanged) + aTextOnlyCB.Enable(FALSE); + } + aDeleteReplacePB.Enable(bFound); + } + else if(aReplaceTLB.GetEntryCount()>0) + { + SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( 0 ); + aReplaceTLB.MakeVisible(pEntry); + } + + } + else if(!bShort) + { + bReplaceEditChanged = TRUE; + if(pFirstSel) + { + aNewReplacePB.SetText(sModify); + } + } + + const String& rShortTxt = aShortED.GetText(); + BOOL bEnableNew = rShortTxt.Len() && + ( rRepString.Len() || + ( bHasSelectionText && bSWriter )) && + ( !pFirstSel || rRepString != + aReplaceTLB.GetEntryText( pFirstSel, 1 ) ); + if(bEnableNew && pFormatText) + { + for(USHORT i = 0; i < pFormatText->Count(); i++) + if(*pFormatText->GetObject(i) == rShortTxt) + { + bEnableNew = FALSE; + break; + } + } + aNewReplacePB.Enable(bEnableNew); + + return 0; +} + +/* -----------------20.11.98 13:48------------------- + * + * --------------------------------------------------*/ + +struct StringsArrays +{ + + SvStringsDtor aAbbrevStrings; + SvStringsDtor aDoubleCapsStrings; + + StringsArrays() : + aAbbrevStrings(5,5), aDoubleCapsStrings(5,5) {} +}; +typedef StringsArrays* StringsArraysPtr; +/* -----------------19.11.98 16:07------------------- + * + * --------------------------------------------------*/ +BOOL lcl_FindInArray(SvStringsDtor& rStrings, const String& rString) +{ + for(USHORT i = 0; i < rStrings.Count(); i++) + if(rString == *rStrings.GetObject(i)) + return TRUE; + return FALSE; +} + +void lcl_ClearTable(StringsTable& rTable) +{ + StringsArraysPtr pArrays = rTable.Last(); + while(pArrays) + { + delete pArrays; + pArrays = rTable.Prev(); + } + rTable.Clear(); +} + +/*-----------------14.10.96 15.57------------------- + +--------------------------------------------------*/ + +OfaAutocorrExceptPage::OfaAutocorrExceptPage( Window* pParent, + const SfxItemSet& rSet ) : + SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_AUTOCORR_EXCEPT ), rSet), + aAbbrevFL (this, SVX_RES(FL_ABBREV )), + aAbbrevED (this, SVX_RES(ED_ABBREV )), + aAbbrevLB (this, SVX_RES(LB_ABBREV )), + aNewAbbrevPB (this, SVX_RES(PB_NEWABBREV )), + aDelAbbrevPB (this, SVX_RES(PB_DELABBREV )), + aAutoAbbrevCB (this, SVX_RES(CB_AUTOABBREV )), + aDoubleCapsFL (this, SVX_RES(FL_DOUBLECAPS )), + aDoubleCapsED (this, SVX_RES(ED_DOUBLE_CAPS )), + aDoubleCapsLB (this, SVX_RES(LB_DOUBLE_CAPS )), + aNewDoublePB (this, SVX_RES(PB_NEWDOUBLECAPS)), + aDelDoublePB (this, SVX_RES(PB_DELDOUBLECAPS)), + aAutoCapsCB (this, SVX_RES(CB_AUTOCAPS )), + eLang(eLastDialogLanguage) +{ + FreeResource(); + + ::com::sun::star::lang::Locale aLcl( SvxCreateLocale(eLastDialogLanguage )); + pCompareClass = new CollatorWrapper( GetProcessFact() ); + pCompareClass->loadDefaultCollator( aLcl, ::com::sun::star::i18n:: + CollatorOptions::CollatorOptions_IGNORE_CASE ); + + aNewAbbrevPB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); + aDelAbbrevPB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); + aNewDoublePB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); + aDelDoublePB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); + + aAbbrevLB.SetSelectHdl(LINK(this, OfaAutocorrExceptPage, SelectHdl)); + aDoubleCapsLB.SetSelectHdl(LINK(this, OfaAutocorrExceptPage, SelectHdl)); + aAbbrevED.SetModifyHdl(LINK(this, OfaAutocorrExceptPage, ModifyHdl)); + aDoubleCapsED.SetModifyHdl(LINK(this, OfaAutocorrExceptPage, ModifyHdl)); + + aAbbrevED.SetActionHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); + aDoubleCapsED.SetActionHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); + +} + +/*-----------------14.10.96 15.58------------------- + +--------------------------------------------------*/ + +OfaAutocorrExceptPage::~OfaAutocorrExceptPage() +{ + lcl_ClearTable(aStringsTable); + delete pCompareClass; +} + +/*-----------------14.10.96 15.58------------------- + +--------------------------------------------------*/ + +SfxTabPage* OfaAutocorrExceptPage::Create( Window* pParent, + const SfxItemSet& rSet) +{ + return new OfaAutocorrExceptPage(pParent, rSet); +} +/* -----------------20.11.98 13:26------------------- + * + * --------------------------------------------------*/ +void OfaAutocorrExceptPage::ActivatePage( const SfxItemSet& ) +{ + if(eLang != eLastDialogLanguage) + SetLanguage(eLastDialogLanguage); + ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(TRUE); +} +/* -----------------20.11.98 13:26------------------- + * + * --------------------------------------------------*/ +int OfaAutocorrExceptPage::DeactivatePage( SfxItemSet* ) +{ + return LEAVE_PAGE; +} +/*-----------------14.10.96 15.58------------------- + +--------------------------------------------------*/ + +BOOL OfaAutocorrExceptPage::FillItemSet( SfxItemSet& ) +{ + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + StringsArraysPtr pArrays = aStringsTable.Last(); + while(pArrays) + { + LanguageType eCurLang = (LanguageType)aStringsTable.GetCurKey(); + if(eCurLang != eLang) // die aktuelle Sprache wird weiter hinten behandelt + { + SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWrdSttExceptList(eCurLang); + + if(pWrdList) + { + USHORT nCount = pWrdList->Count(); + USHORT i; + for( i = nCount; i; ) + { + String* pString = pWrdList->GetObject( --i ); + //Eintrag finden u. gfs entfernen + if( !lcl_FindInArray(pArrays->aDoubleCapsStrings, *pString)) + pWrdList->DeleteAndDestroy( i ); + } + nCount = pArrays->aDoubleCapsStrings.Count(); + for( i = 0; i < nCount; ++i ) + { + String* pEntry = new String( *pArrays->aDoubleCapsStrings.GetObject( i ) ); + if( !pWrdList->Insert( pEntry )) + delete pEntry; + } + pAutoCorrect->SaveWrdSttExceptList(eCurLang); + } + + SvStringsISortDtor* pCplList = pAutoCorrect->LoadCplSttExceptList(eCurLang); + + if(pCplList) + { + USHORT nCount = pCplList->Count(); + USHORT i; + for( i = nCount; i; ) + { + String* pString = pCplList->GetObject( --i ); + if( !lcl_FindInArray(pArrays->aAbbrevStrings, *pString)) + pCplList->DeleteAndDestroy( i ); + } + nCount = pArrays->aAbbrevStrings.Count(); + for( i = 0; i < nCount; ++i ) + { + String* pEntry = new String( *pArrays->aAbbrevStrings.GetObject(i) ); + if( !pCplList->Insert( pEntry )) + delete pEntry; + } + pAutoCorrect->SaveCplSttExceptList(eCurLang); + } + } + pArrays = aStringsTable.Prev(); + } + aStringsTable.Clear(); + + SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWrdSttExceptList(eLang); + + if(pWrdList) + { + USHORT nCount = pWrdList->Count(); + USHORT i; + for( i = nCount; i; ) + { + String* pString = pWrdList->GetObject( --i ); + if( USHRT_MAX == aDoubleCapsLB.GetEntryPos(*pString) ) + pWrdList->DeleteAndDestroy( i ); + } + nCount = aDoubleCapsLB.GetEntryCount(); + for( i = 0; i < nCount; ++i ) + { + String* pEntry = new String( aDoubleCapsLB.GetEntry( i ) ); + if( !pWrdList->Insert( pEntry )) + delete pEntry; + } + pAutoCorrect->SaveWrdSttExceptList(eLang); + } + + SvStringsISortDtor* pCplList = pAutoCorrect->LoadCplSttExceptList(eLang); + + if(pCplList) + { + USHORT nCount = pCplList->Count(); + USHORT i; + for( i = nCount; i; ) + { + String* pString = pCplList->GetObject( --i ); + if( USHRT_MAX == aAbbrevLB.GetEntryPos(*pString) ) + pCplList->DeleteAndDestroy( i ); + } + nCount = aAbbrevLB.GetEntryCount(); + for( i = 0; i < nCount; ++i ) + { + String* pEntry = new String( aAbbrevLB.GetEntry( i ) ); + if( !pCplList->Insert( pEntry )) + delete pEntry; + } + pAutoCorrect->SaveCplSttExceptList(eLang); + } + if(aAutoAbbrevCB.IsChecked() != aAutoAbbrevCB.GetSavedValue()) + pAutoCorrect->SetAutoCorrFlag( SaveWordCplSttLst, aAutoAbbrevCB.IsChecked()); + if(aAutoCapsCB.IsChecked() != aAutoCapsCB.GetSavedValue()) + pAutoCorrect->SetAutoCorrFlag( SaveWordWrdSttLst, aAutoCapsCB.IsChecked()); + return FALSE; +} + +/* -----------------23.11.98 10:33------------------- + * + * --------------------------------------------------*/ +void OfaAutocorrExceptPage::SetLanguage(LanguageType eSet) +{ + if(eLang != eSet) + { + //alte Einstellungen speichern und neu fuellen + RefillReplaceBoxes(FALSE, eLang, eSet); + eLastDialogLanguage = eSet; + delete pCompareClass; + pCompareClass = new CollatorWrapper( GetProcessFact() ); + pCompareClass->loadDefaultCollator( SvxCreateLocale( eLastDialogLanguage ), + ::com::sun::star::i18n:: + CollatorOptions::CollatorOptions_IGNORE_CASE ); + ModifyHdl(&aAbbrevED); + ModifyHdl(&aDoubleCapsED); + } +} +/* -----------------20.11.98 14:06------------------- + * + * --------------------------------------------------*/ +void OfaAutocorrExceptPage::RefillReplaceBoxes(BOOL bFromReset, + LanguageType eOldLanguage, + LanguageType eNewLanguage) +{ + eLang = eNewLanguage; + if(bFromReset) + lcl_ClearTable(aStringsTable); + else + { + StringsArraysPtr pArrays = 0; + if(aStringsTable.IsKeyValid(eOldLanguage)) + { + pArrays = aStringsTable.Seek(ULONG(eOldLanguage)); + pArrays->aAbbrevStrings.DeleteAndDestroy( + 0, pArrays->aAbbrevStrings.Count()); + pArrays->aDoubleCapsStrings.DeleteAndDestroy( + 0, pArrays->aDoubleCapsStrings.Count()); + } + else + { + pArrays = new StringsArrays; + aStringsTable.Insert(ULONG(eOldLanguage), pArrays); + } + + USHORT i; + for(i = 0; i < aAbbrevLB.GetEntryCount(); i++) + { + pArrays->aAbbrevStrings.Insert( + new String(aAbbrevLB.GetEntry(i)), i); + + } + for(i = 0; i < aDoubleCapsLB.GetEntryCount(); i++) + { + pArrays->aDoubleCapsStrings.Insert( + new String(aDoubleCapsLB.GetEntry(i)), i); + } + } + aDoubleCapsLB.Clear(); + aAbbrevLB.Clear(); + String sTemp; + aAbbrevED.SetText(sTemp); + aDoubleCapsED.SetText(sTemp); + + if(aStringsTable.IsKeyValid(eLang)) + { + StringsArraysPtr pArrays = aStringsTable.Seek(ULONG(eLang)); + USHORT i; + for(i = 0; i < pArrays->aAbbrevStrings.Count(); i++ ) + { + aAbbrevLB.InsertEntry(*pArrays->aAbbrevStrings.GetObject(i)); + } + for( i = 0; i < pArrays->aDoubleCapsStrings.Count(); i++ ) + { + aDoubleCapsLB.InsertEntry(*pArrays->aDoubleCapsStrings.GetObject(i)); + } + } + else + { + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + const SvStringsISortDtor* pCplList = pAutoCorrect->GetCplSttExceptList(eLang); + const SvStringsISortDtor* pWrdList = pAutoCorrect->GetWrdSttExceptList(eLang); + USHORT i; + for( i = 0; i < pCplList->Count(); i++ ) + { + aAbbrevLB.InsertEntry(*pCplList->GetObject(i)); + } + for( i = 0; i < pWrdList->Count(); i++ ) + { + aDoubleCapsLB.InsertEntry(*pWrdList->GetObject(i)); + } + } +} + +/*-----------------14.10.96 15.58------------------- + +--------------------------------------------------*/ + +void OfaAutocorrExceptPage::Reset( const SfxItemSet& ) +{ + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + RefillReplaceBoxes(TRUE, eLang, eLang); + aAutoAbbrevCB. Check( pAutoCorrect->IsAutoCorrFlag( SaveWordCplSttLst )); + aAutoCapsCB. Check( pAutoCorrect->IsAutoCorrFlag( SaveWordWrdSttLst )); + aAutoAbbrevCB.SaveValue(); + aAutoCapsCB.SaveValue(); +} + +/*-----------------16.10.96 12.27------------------- + +--------------------------------------------------*/ + + +IMPL_LINK(OfaAutocorrExceptPage, NewDelHdl, PushButton*, pBtn) +{ + if((pBtn == &aNewAbbrevPB || pBtn == (PushButton*)&aAbbrevED ) + && aAbbrevED.GetText().Len()) + { + aAbbrevLB.InsertEntry(aAbbrevED.GetText()); + ModifyHdl(&aAbbrevED); + } + else if(pBtn == &aDelAbbrevPB) + { + aAbbrevLB.RemoveEntry(aAbbrevED.GetText()); + ModifyHdl(&aAbbrevED); + } + else if((pBtn == &aNewDoublePB || pBtn == (PushButton*)&aDoubleCapsED ) + && aDoubleCapsED.GetText().Len()) + { + aDoubleCapsLB.InsertEntry(aDoubleCapsED.GetText()); + ModifyHdl(&aDoubleCapsED); + } + else if(pBtn == &aDelDoublePB) + { + aDoubleCapsLB.RemoveEntry(aDoubleCapsED.GetText()); + ModifyHdl(&aDoubleCapsED); + } + return 0; +} + +/*-----------------16.10.96 12.57------------------- + +--------------------------------------------------*/ + +IMPL_LINK(OfaAutocorrExceptPage, SelectHdl, ListBox*, pBox) +{ + if(pBox == &aAbbrevLB) + { + aAbbrevED.SetText(pBox->GetSelectEntry()); + aNewAbbrevPB.Enable(FALSE); + aDelAbbrevPB.Enable(); + } + else + { + aDoubleCapsED.SetText(pBox->GetSelectEntry()); + aNewDoublePB.Enable(FALSE); + aDelDoublePB.Enable(); + } + return 0; +} + +/*-----------------16.10.96 13.02------------------- + +--------------------------------------------------*/ + +IMPL_LINK(OfaAutocorrExceptPage, ModifyHdl, Edit*, pEdt) +{ +// BOOL bSame = pEdt->GetText() == ->GetSelectEntry(); + const String& sEntry = pEdt->GetText(); + BOOL bEntryLen = 0!= sEntry.Len(); + if(pEdt == &aAbbrevED) + { + BOOL bSame = lcl_FindEntry(aAbbrevLB, sEntry, *pCompareClass); + if(bSame && sEntry != aAbbrevLB.GetSelectEntry()) + pEdt->SetText(aAbbrevLB.GetSelectEntry()); + aNewAbbrevPB.Enable(!bSame && bEntryLen); + aDelAbbrevPB.Enable(bSame && bEntryLen); + } + else + { + BOOL bSame = lcl_FindEntry(aDoubleCapsLB, sEntry, *pCompareClass); + if(bSame && sEntry != aDoubleCapsLB.GetSelectEntry()) + pEdt->SetText(aDoubleCapsLB.GetSelectEntry()); + aNewDoublePB.Enable(!bSame && bEntryLen); + aDelDoublePB.Enable(bSame && bEntryLen); + } + return 0; +} + +/*-----------------16.10.96 15.03------------------- + +--------------------------------------------------*/ + +void AutoCorrEdit::KeyInput( const KeyEvent& rKEvt ) +{ + const KeyCode aKeyCode = rKEvt.GetKeyCode(); + const USHORT nModifier = aKeyCode.GetModifier(); + if( aKeyCode.GetCode() == KEY_RETURN ) + { + //wird bei Enter nichts getan, dann doch die Basisklasse rufen + // um den Dialog zu schliessen + if(!nModifier && !aActionLink.Call(this)) + Edit::KeyInput(rKEvt); + } + else if(bSpaces || aKeyCode.GetCode() != KEY_SPACE) + Edit::KeyInput(rKEvt); +} + +/*-----------------03.07.97 13:17------------------- + +--------------------------------------------------*/ + +OfaQuoteTabPage::OfaQuoteTabPage( Window* pParent, const SfxItemSet& rSet ) : + SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_AUTOCORR_QUOTE ), rSet), + aSingleFL (this, SVX_RES(FL_SINGLE )), + aSingleTypoCB (this, SVX_RES(CB_SGL_TYPO )), + aSglStartQuoteFT (this, SVX_RES(FT_SGL_STARTQUOTE )), + aSglStartQuotePB (this, SVX_RES(PB_SGL_STARTQUOTE )), + aSglStartExFT (this, SVX_RES(FT_SGSTEX )), + aSglEndQuoteFT (this, SVX_RES(FT_SGL_ENDQUOTE )), + aSglEndQuotePB (this, SVX_RES(PB_SGL_ENDQUOTE )), + aSglEndExFT (this, SVX_RES(FT_SGENEX )), + aSglStandardPB (this, SVX_RES(PB_SGL_STD )), + + aDoubleFL (this, SVX_RES(FL_DOUBLE )), + aTypoCB (this, SVX_RES(CB_TYPO )), + aStartQuoteFT (this, SVX_RES(FT_STARTQUOTE )), + aStartQuotePB (this, SVX_RES(PB_STARTQUOTE )), + aDblStartExFT (this, SVX_RES(FT_DBSTEX )), + aEndQuoteFT (this, SVX_RES(FT_ENDQUOTE )), + aEndQuotePB (this, SVX_RES(PB_ENDQUOTE )), + aDblEndExFT (this, SVX_RES(FT_DBECEX )), + aDblStandardPB (this, SVX_RES(PB_DBL_STD )), + + sStartQuoteDlg (SVX_RES(STR_CHANGE_START)), + sEndQuoteDlg (SVX_RES(STR_CHANGE_END)), + + sStandard(SVX_RES(ST_STANDARD)) +{ + FreeResource(); + + aStartQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl)); + aEndQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl)); + aSglStartQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl)); + aSglEndQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl)); + aDblStandardPB.SetClickHdl(LINK(this, OfaQuoteTabPage, StdQuoteHdl)); + aSglStandardPB.SetClickHdl(LINK(this, OfaQuoteTabPage, StdQuoteHdl)); + +} +/*-----------------03.07.97 13:17------------------- + +--------------------------------------------------*/ +OfaQuoteTabPage::~OfaQuoteTabPage() +{ +} +/*-----------------03.07.97 13:17------------------- + +--------------------------------------------------*/ +SfxTabPage* OfaQuoteTabPage::Create( Window* pParent, + const SfxItemSet& rAttrSet) +{ + return new OfaQuoteTabPage(pParent, rAttrSet); +} +/*-----------------03.07.97 13:18------------------- + +--------------------------------------------------*/ +BOOL OfaQuoteTabPage::FillItemSet( SfxItemSet& ) +{ + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + + long nFlags = pAutoCorrect->GetFlags(); + pAutoCorrect->SetAutoCorrFlag(ChgQuotes, aTypoCB.IsChecked()); + pAutoCorrect->SetAutoCorrFlag(ChgSglQuotes, aSingleTypoCB.IsChecked()); + BOOL bReturn = nFlags != pAutoCorrect->GetFlags(); + if(cStartQuote != pAutoCorrect->GetStartDoubleQuote()) + { + bReturn = TRUE; + sal_Unicode cUCS2 = static_cast(cStartQuote); //TODO + pAutoCorrect->SetStartDoubleQuote(cUCS2); + } + if(cEndQuote != pAutoCorrect->GetEndDoubleQuote()) + { + bReturn = TRUE; + sal_Unicode cUCS2 = static_cast(cEndQuote); //TODO + pAutoCorrect->SetEndDoubleQuote(cUCS2); + } + if(cSglStartQuote != pAutoCorrect->GetStartSingleQuote()) + { + bReturn = TRUE; + sal_Unicode cUCS2 = static_cast(cSglStartQuote); //TODO + pAutoCorrect->SetStartSingleQuote(cUCS2); + } + if(cSglEndQuote != pAutoCorrect->GetEndSingleQuote()) + { + bReturn = TRUE; + sal_Unicode cUCS2 = static_cast(cSglEndQuote); //TODO + pAutoCorrect->SetEndSingleQuote(cUCS2); + } + + if(bReturn ) + { + SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get(); + pCfg->SetModified(); + pCfg->Commit(); + } + return bReturn; +} +/* -----------------23.11.98 16:15------------------- + * + * --------------------------------------------------*/ +void OfaQuoteTabPage::ActivatePage( const SfxItemSet& ) +{ + ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(FALSE); +} +/*-----------------03.07.97 13:18------------------- + +--------------------------------------------------*/ +void OfaQuoteTabPage::Reset( const SfxItemSet& ) +{ + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + const long nFlags = pAutoCorrect->GetFlags(); + + aTypoCB .Check(0 != (nFlags & ChgQuotes)); + aSingleTypoCB .Check(0 != (nFlags & ChgSglQuotes)); + aTypoCB .SaveValue(); + aSingleTypoCB .SaveValue(); + + cStartQuote = pAutoCorrect->GetStartDoubleQuote(); + cEndQuote = pAutoCorrect->GetEndDoubleQuote(); + cSglStartQuote = pAutoCorrect->GetStartSingleQuote(); + cSglEndQuote = pAutoCorrect->GetEndSingleQuote(); + + aSglStartExFT .SetText(ChangeStringExt_Impl(cSglStartQuote)); + aSglEndExFT .SetText(ChangeStringExt_Impl(cSglEndQuote)); + aDblStartExFT .SetText(ChangeStringExt_Impl(cStartQuote)); + aDblEndExFT .SetText(ChangeStringExt_Impl(cEndQuote)); +} + + +/*-----------------15.10.96 16.42------------------- + +--------------------------------------------------*/ +#define SGL_START 0 +#define DBL_START 1 +#define SGL_END 2 +#define DBL_END 3 + + +IMPL_LINK( OfaQuoteTabPage, QuoteHdl, PushButton*, pBtn ) +{ + USHORT nMode = SGL_START; + if(pBtn == &aSglEndQuotePB) + nMode = SGL_END; + else if(pBtn == &aStartQuotePB) + nMode = DBL_START; + else if(pBtn == &aEndQuotePB) + nMode = DBL_END; + // Zeichenauswahl-Dialog starten + SvxCharacterMap* pMap = new SvxCharacterMap( this, TRUE ); + pMap->SetCharFont( OutputDevice::GetDefaultFont(DEFAULTFONT_LATIN_TEXT, + LANGUAGE_ENGLISH_US, DEFAULTFONT_FLAGS_ONLYONE, 0 )); + pMap->SetText(nMode < SGL_END ? sStartQuoteDlg : sEndQuoteDlg ); + sal_UCS4 cDlg; + //The two lines below are added by BerryJia for Bug95846 Time:2002-8-13 15:50 + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + LanguageType eLang = Application::GetSettings().GetLanguage(); + switch( nMode ) + { + case SGL_START: + cDlg = cSglStartQuote; + if(cDlg == 0) + cDlg = pAutoCorrect->GetQuote('\'',TRUE,eLang); //add by BerryJia for Bug95846 Time:2002-8-13 15:50 + break; + case SGL_END: + cDlg = cSglEndQuote; + if(cDlg == 0) + cDlg = pAutoCorrect->GetQuote('\'',FALSE,eLang); //add by BerryJia for Bug95846 Time:2002-8-13 15:50 + break; + case DBL_START: + cDlg = cStartQuote; + if(cDlg == 0) + cDlg = pAutoCorrect->GetQuote('\"',TRUE,eLang); //add by BerryJia for Bug95846 Time:2002-8-13 15:50 + break; + case DBL_END: + cDlg = cEndQuote; + if(cDlg == 0) + cDlg = pAutoCorrect->GetQuote('\"',FALSE,eLang); //add by BerryJia for Bug95846 Time:2002-8-13 15:50 + break; + default: + DBG_ERROR("svx::OfaQuoteTabPage::QuoteHdl(), how to initialize cDlg?" ); + cDlg = 0; + break; + + } + pMap->SetChar( cDlg ); + pMap->DisableFontSelection(); + if(pMap->Execute() == RET_OK) + { + sal_UCS4 cNewChar = pMap->GetChar(); + switch( nMode ) + { + case SGL_START: + cSglStartQuote = cNewChar; + aSglStartExFT.SetText(ChangeStringExt_Impl(cNewChar)); + break; + case SGL_END: + cSglEndQuote = cNewChar; + aSglEndExFT.SetText(ChangeStringExt_Impl(cNewChar)); + break; + case DBL_START: + cStartQuote = cNewChar; + aDblStartExFT.SetText(ChangeStringExt_Impl(cNewChar)); + break; + case DBL_END: + cEndQuote = cNewChar; + aDblEndExFT.SetText(ChangeStringExt_Impl(cNewChar)); + break; + } + } + delete pMap; + + return 0; +} + +/*-----------------27.06.97 09.55------------------- + +--------------------------------------------------*/ +IMPL_LINK( OfaQuoteTabPage, StdQuoteHdl, PushButton*, pBtn ) +{ + if(pBtn == &aDblStandardPB) + { + cStartQuote = 0; + aDblStartExFT.SetText(ChangeStringExt_Impl(0)); + cEndQuote = 0; + aDblEndExFT.SetText(ChangeStringExt_Impl(0)); + + } + else + { + cSglStartQuote = 0; + aSglStartExFT.SetText(ChangeStringExt_Impl(0)); + cSglEndQuote = 0; + aSglEndExFT.SetText(ChangeStringExt_Impl(0)); + } + return 0; +} + +// -------------------------------------------------- + +String OfaQuoteTabPage::ChangeStringExt_Impl( sal_UCS4 cChar ) +{ + if( !cChar ) + return sStandard; + + // convert codepoint value to unicode-hex string + sal_UCS4 aStrCodes[32] = { 0, ' ', '(', 'U', '+', '0' }; + aStrCodes[0] = cChar; + int nFullLen = 5; + int nHexLen = 4; + while( (cChar >> (4*nHexLen)) != 0 ) + ++nHexLen; + for( int i = nHexLen; --i >= 0;) + { + sal_UCS4 cHexDigit = ((cChar >> (4*i)) & 0x0f) + '0'; + if( cHexDigit > '9' ) + cHexDigit += 'A' - ('9' + 1); + aStrCodes[ nFullLen++ ] = cHexDigit; + } + aStrCodes[ nFullLen++ ] = ')'; + // using the new UCS4 constructor + rtl::OUString aOUStr( aStrCodes, nFullLen ); + return aOUStr; +} + +OfaAutoCompleteTabPage::OfaAutoCompleteTabPage( Window* pParent, + const SfxItemSet& rSet ) + : SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_AUTOCOMPLETE_OPTIONS ), rSet), + aCBActiv (this, SVX_RES(CB_ACTIV)), + aCBAppendSpace (this, SVX_RES(CB_APPEND_SPACE)), + aCBAsTip (this, SVX_RES(CB_AS_TIP)), + aCBCollect (this, SVX_RES(CB_COLLECT)), + aCBRemoveList (this, SVX_RES(CB_REMOVE_LIST)), + aFTExpandKey (this, SVX_RES(FT_EXPAND_KEY)), + aDCBExpandKey (this, SVX_RES(DCB_EXPAND_KEY)), + aFTMinWordlen (this, SVX_RES(FT_MIN_WORDLEN)), + aNFMinWordlen (this, SVX_RES(NF_MIN_WORDLEN)), + aFTMaxEntries (this, SVX_RES(FT_MAX_ENTRIES)), + aNFMaxEntries (this, SVX_RES(NF_MAX_ENTRIES)), + aLBEntries (*this, SVX_RES(LB_ENTRIES)), + aPBEntries (this, SVX_RES(PB_ENTRIES)), + pAutoCmpltList( 0 ), + nAutoCmpltListCnt( 0 ) +{ + FreeResource(); + + // the defined KEYs + static const USHORT aKeyCodes[] = { + KEY_END, + KEY_RETURN, + KEY_SPACE, + KEY_RIGHT, + KEY_TAB, + 0 + }; + + for( const USHORT* pKeys = aKeyCodes; *pKeys; ++pKeys ) + { + KeyCode aKCode( *pKeys ); + USHORT nPos = aDCBExpandKey.InsertEntry( aKCode.GetName() ); + aDCBExpandKey.SetEntryData( nPos, (void*)(ULONG)*pKeys ); + if( KEY_RETURN == *pKeys ) // default to RETURN + aDCBExpandKey.SelectEntryPos( nPos ); + } + + aPBEntries.SetClickHdl(LINK(this, OfaAutoCompleteTabPage, DeleteHdl)); + aCBActiv.SetToggleHdl(LINK(this, OfaAutoCompleteTabPage, CheckHdl)); + aCBCollect.SetToggleHdl(LINK(this, OfaAutoCompleteTabPage, CheckHdl)); +} + +OfaAutoCompleteTabPage::~OfaAutoCompleteTabPage() +{ +} + +SfxTabPage* OfaAutoCompleteTabPage::Create( Window* pParent, + const SfxItemSet& rSet) +{ + return new OfaAutoCompleteTabPage( pParent, rSet ); +} + +BOOL OfaAutoCompleteTabPage::FillItemSet( SfxItemSet& ) +{ + BOOL bModified = FALSE, bCheck; + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); + USHORT nVal; + + bCheck = aCBActiv.IsChecked(); + bModified |= pOpt->bAutoCompleteWords != bCheck; + pOpt->bAutoCompleteWords = bCheck; + bCheck = aCBCollect.IsChecked(); + bModified |= pOpt->bAutoCmpltCollectWords != bCheck; + pOpt->bAutoCmpltCollectWords = bCheck; + bCheck = !aCBRemoveList.IsChecked(); // inverted value! + bModified |= pOpt->bAutoCmpltKeepList != bCheck; + pOpt->bAutoCmpltKeepList = bCheck; + bCheck = aCBAppendSpace.IsChecked(); + bModified |= pOpt->bAutoCmpltAppendBlanc != bCheck; + pOpt->bAutoCmpltAppendBlanc = bCheck; + bCheck = aCBAsTip.IsChecked(); + bModified |= pOpt->bAutoCmpltShowAsTip != bCheck; + pOpt->bAutoCmpltShowAsTip = bCheck; + + nVal = (USHORT)aNFMinWordlen.GetValue(); + bModified |= nVal != pOpt->nAutoCmpltWordLen; + pOpt->nAutoCmpltWordLen = nVal; + + nVal = (USHORT)aNFMaxEntries.GetValue(); + bModified |= nVal != pOpt->nAutoCmpltListLen; + pOpt->nAutoCmpltListLen = nVal; + + nVal = aDCBExpandKey.GetSelectEntryPos(); + if( nVal < aDCBExpandKey.GetEntryCount() ) + { + ULONG nKey = (ULONG)aDCBExpandKey.GetEntryData( nVal ); + bModified |= nKey != pOpt->nAutoCmpltExpandKey; + pOpt->nAutoCmpltExpandKey = (USHORT)nKey; + } + + if( pAutoCmpltList && nAutoCmpltListCnt != aLBEntries.GetEntryCount() ) + { + bModified = TRUE; + pOpt->pAutoCmpltList = pAutoCmpltList; + } + if( bModified ) + { + SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get(); + pCfg->SetModified(); + pCfg->Commit(); + } + return TRUE; +} + +void OfaAutoCompleteTabPage::Reset( const SfxItemSet& ) +{ + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); + + aCBActiv.Check( 0 != pOpt->bAutoCompleteWords ); + aCBCollect.Check( 0 != pOpt->bAutoCmpltCollectWords ); + aCBRemoveList.Check( !pOpt->bAutoCmpltKeepList ); //inverted value! + aCBAppendSpace.Check( 0 != pOpt->bAutoCmpltAppendBlanc ); + aCBAsTip.Check( 0 != pOpt->bAutoCmpltShowAsTip ); + + aNFMinWordlen.SetValue( pOpt->nAutoCmpltWordLen ); + aNFMaxEntries.SetValue( pOpt->nAutoCmpltListLen ); + + // select the specific KeyCode: + { + ULONG nKey = pOpt->nAutoCmpltExpandKey; + for( USHORT n = 0, nCnt = aDCBExpandKey.GetEntryCount(); n < nCnt; ++n ) + if( nKey == (ULONG)aDCBExpandKey.GetEntryData( n )) + { + aDCBExpandKey.SelectEntryPos( n ); + break; + } + } + + if( pOpt->pAutoCmpltList && pOpt->pAutoCmpltList->Count() ) + { + pAutoCmpltList = (SvStringsISortDtor*)pOpt->pAutoCmpltList; + pOpt->pAutoCmpltList = 0; + nAutoCmpltListCnt = pAutoCmpltList->Count(); + for( USHORT n = 0; n < nAutoCmpltListCnt; ++n ) + { + const StringPtr pStr = pAutoCmpltList->GetObject( n ); + USHORT nPos = aLBEntries.InsertEntry( *pStr ); + aLBEntries.SetEntryData( nPos, (void*)pStr ); + } + } + else + { + aLBEntries.Disable(); + aPBEntries.Disable(); + } + + CheckHdl( &aCBActiv ); + CheckHdl( &aCBCollect ); +} + +void OfaAutoCompleteTabPage::ActivatePage( const SfxItemSet& ) +{ + ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage( FALSE ); +} + +IMPL_LINK( OfaAutoCompleteTabPage, DeleteHdl, PushButton*, EMPTYARG ) +{ + USHORT nSelCnt = pAutoCmpltList ? aLBEntries.GetSelectEntryCount() : 0; + while( nSelCnt ) + { + USHORT nPos = aLBEntries.GetSelectEntryPos( --nSelCnt ); + const StringPtr pStr = (StringPtr)aLBEntries.GetEntryData( nPos ); + aLBEntries.RemoveEntry( nPos ); + nPos = pAutoCmpltList->GetPos( pStr ); + if( USHRT_MAX != nPos ) + pAutoCmpltList->Remove( nPos ); + } + return 0; +} + +IMPL_LINK( OfaAutoCompleteTabPage, CheckHdl, CheckBox*, pBox ) +{ + BOOL bEnable = pBox->IsChecked(); + if( pBox == &aCBActiv ) + { + aCBAppendSpace.Enable( bEnable ); + aCBAppendSpace.Enable( bEnable ); + aCBAsTip.Enable( bEnable ); + aDCBExpandKey.Enable( bEnable ); + } + else if(&aCBCollect == pBox) + aCBRemoveList.Enable( bEnable ); + return 0; +} + +void OfaAutoCompleteTabPage::CopyToClipboard() const +{ + USHORT nSelCnt = aLBEntries.GetSelectEntryCount(); + if( pAutoCmpltList && nSelCnt ) + { + TransferDataContainer* pCntnr = new TransferDataContainer; + ::com::sun::star::uno::Reference< + ::com::sun::star::datatransfer::XTransferable > xRef( pCntnr ); + + ByteString sData; + const sal_Char* pLineEnd = +#if defined(UNX) + "\012"; +#else + "\015\012"; +#endif + + rtl_TextEncoding nEncode = gsl_getSystemTextEncoding(); + + for( USHORT n = 0; n < nSelCnt; ++n ) + { + sData += ByteString( aLBEntries.GetSelectEntry( n ), nEncode ); + sData += pLineEnd; + } + pCntnr->CopyByteString( SOT_FORMAT_STRING, sData ); + pCntnr->CopyToClipboard( (Window*)this ); + } +} + +long OfaAutoCompleteTabPage::AutoCompleteMultiListBox::PreNotify( + NotifyEvent& rNEvt ) +{ + long nHandled = MultiListBox::PreNotify( rNEvt ); + + if( !nHandled && EVENT_KEYUP == rNEvt.GetType() ) + { + const KeyCode& rKeyCode = rNEvt.GetKeyEvent()->GetKeyCode(); + switch( rKeyCode.GetModifier() | rKeyCode.GetCode() ) + { + case KEY_DELETE: + rPage.DeleteHdl( 0 ); + nHandled = 1; + break; + + default: + if( KEYFUNC_COPY == rKeyCode.GetFunction() ) + { + rPage.CopyToClipboard(); + nHandled = 1; + } + break; + } + } + return nHandled; +} + +// class OfaSmartTagOptionsTabPage --------------------------------------------- + +OfaSmartTagOptionsTabPage::OfaSmartTagOptionsTabPage( Window* pParent, + const SfxItemSet& rSet ) + : SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_SMARTTAG_OPTIONS ), rSet), + m_aMainCB( this, SVX_RES(CB_SMARTTAGS) ), + m_aSmartTagTypesLB( this, SVX_RES(LB_SMARTTAGS) ), + m_aPropertiesPB( this, SVX_RES(PB_SMARTTAGS) ), + m_aTitleFT( this, SVX_RES(FT_SMARTTAGS) ) +{ + FreeResource(); + + // some options for the list box: + m_aSmartTagTypesLB.SetWindowBits( m_aSmartTagTypesLB.GetStyle() | WB_HSCROLL | WB_HIDESELECTION ); + m_aSmartTagTypesLB.SetHighlightRange(); + + // set the handlers: + m_aMainCB.SetToggleHdl(LINK(this, OfaSmartTagOptionsTabPage, CheckHdl)); + m_aPropertiesPB.SetClickHdl(LINK(this, OfaSmartTagOptionsTabPage, ClickHdl)); + m_aSmartTagTypesLB.SetSelectHdl(LINK(this, OfaSmartTagOptionsTabPage, SelectHdl)); +} + +OfaSmartTagOptionsTabPage::~OfaSmartTagOptionsTabPage() +{ + +} + +SfxTabPage* OfaSmartTagOptionsTabPage::Create( Window* pParent, const SfxItemSet& rSet) +{ + return new OfaSmartTagOptionsTabPage( pParent, rSet ); +} + +/** This struct is used to associate list box entries with smart tag data +*/ +struct ImplSmartTagLBUserData +{ + rtl::OUString maSmartTagType; + uno::Reference< smarttags::XSmartTagRecognizer > mxRec; + sal_Int32 mnSmartTagIdx; + + ImplSmartTagLBUserData( const rtl::OUString& rSmartTagType, + uno::Reference< smarttags::XSmartTagRecognizer > xRec, + sal_Int32 nSmartTagIdx ) : + maSmartTagType( rSmartTagType ), + mxRec( xRec ), + mnSmartTagIdx( nSmartTagIdx ) {} +}; + +/** Clears m_aSmartTagTypesLB +*/ +void OfaSmartTagOptionsTabPage::ClearListBox() +{ + const ULONG nCount = m_aSmartTagTypesLB.GetEntryCount(); + for ( USHORT i = 0; i < nCount; ++i ) + { + const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(i); + const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData()); + delete pUserData; + } + + m_aSmartTagTypesLB.Clear(); +} + +/** Inserts items into m_aSmartTagTypesLB +*/ +void OfaSmartTagOptionsTabPage::FillListBox( const SmartTagMgr& rSmartTagMgr ) +{ + // first we have to clear the list box: + ClearListBox(); + + // fill list box: + const sal_uInt32 nNumberOfRecognizers = rSmartTagMgr.NumberOfRecognizers(); + const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) ); + std::vector< ActionReference > aActionReferences; + + for ( sal_uInt32 i = 0; i < nNumberOfRecognizers; ++i ) + { + uno::Reference< smarttags::XSmartTagRecognizer > xRec = rSmartTagMgr.GetRecognizer(i); + + const rtl::OUString aName = xRec->getName( aLocale ); + const rtl::OUString aDesc = xRec->getDescription( aLocale ); + const sal_Int32 nNumberOfSupportedSmartTags = xRec->getSmartTagCount(); + + for ( sal_Int32 j = 0; j < nNumberOfSupportedSmartTags; ++j ) + { + const rtl::OUString aSmartTagType = xRec->getSmartTagName(j); + rtl::OUString aSmartTagCaption = rSmartTagMgr.GetSmartTagCaption( aSmartTagType, aLocale ); + + if ( !aSmartTagCaption.getLength() ) + aSmartTagCaption = aSmartTagType; + + const rtl::OUString aLBEntry = aSmartTagCaption + + OUString::createFromAscii(" (") + + aName + + OUString::createFromAscii(")"); + + SvLBoxEntry* pEntry = m_aSmartTagTypesLB.SvTreeListBox::InsertEntry( aLBEntry ); + if ( pEntry ) + { + const bool bCheck = rSmartTagMgr.IsSmartTagTypeEnabled( aSmartTagType ); + m_aSmartTagTypesLB.SetCheckButtonState( pEntry, bCheck ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED ); + pEntry->SetUserData(static_cast(new ImplSmartTagLBUserData( aSmartTagType, xRec, j ) ) ); + } + } + } +} + +/** Handler for the push button +*/ +IMPL_LINK( OfaSmartTagOptionsTabPage, ClickHdl, PushButton*, EMPTYARG ) +{ + const USHORT nPos = m_aSmartTagTypesLB.GetSelectEntryPos(); + const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(nPos); + const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData()); + uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec; + const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx; + + const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) ); + if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) ) + xRec->displayPropertyPage( nSmartTagIdx, aLocale ); + + return 0; +} + +/** Handler for the check box +*/ +IMPL_LINK( OfaSmartTagOptionsTabPage, CheckHdl, CheckBox*, EMPTYARG ) +{ + const BOOL bEnable = m_aMainCB.IsChecked(); + m_aSmartTagTypesLB.Enable( bEnable ); + m_aSmartTagTypesLB.Invalidate(); + m_aPropertiesPB.Enable( false ); + + // if the controls are currently enabled, we still have to check + // if the properties button should be disabled because the currently + // seleted smart tag type does not have a properties dialog. + // We do this by calling SelectHdl: + if ( bEnable ) + SelectHdl( &m_aSmartTagTypesLB ); + + return 0; +} + +/** Handler for the list box +*/ +IMPL_LINK(OfaSmartTagOptionsTabPage, SelectHdl, SvxCheckListBox*, EMPTYARG) +{ + if ( m_aSmartTagTypesLB.GetEntryCount() < 1 ) + return 0; + + const USHORT nPos = m_aSmartTagTypesLB.GetSelectEntryPos(); + const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(nPos); + const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData()); + uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec; + const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx; + + const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) ); + if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) ) + m_aPropertiesPB.Enable( sal_True ); + else + m_aPropertiesPB.Enable( sal_False ); + + return 0; +} + +/** Propagates the current settings to the smart tag manager. +*/ +BOOL OfaSmartTagOptionsTabPage::FillItemSet( SfxItemSet& ) +{ + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); + SmartTagMgr* pSmartTagMgr = pOpt->pSmartTagMgr; + + // robust! + if ( !pSmartTagMgr ) + return FALSE; + + BOOL bModifiedSmartTagTypes = FALSE; + std::vector< rtl::OUString > aDisabledSmartTagTypes; + + const ULONG nCount = m_aSmartTagTypesLB.GetEntryCount(); + + for ( USHORT i = 0; i < nCount; ++i ) + { + const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(i); + const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData()); + const BOOL bChecked = m_aSmartTagTypesLB.IsChecked(i); + const BOOL bIsCurrentlyEnabled = pSmartTagMgr->IsSmartTagTypeEnabled( pUserData->maSmartTagType ); + + bModifiedSmartTagTypes = bModifiedSmartTagTypes || ( !bChecked != !bIsCurrentlyEnabled ); + + if ( !bChecked ) + aDisabledSmartTagTypes.push_back( pUserData->maSmartTagType ); + + delete pUserData; + } + + const BOOL bModifiedRecognize = ( !m_aMainCB.IsChecked() != !pSmartTagMgr->IsLabelTextWithSmartTags() ); + if ( bModifiedSmartTagTypes || bModifiedRecognize ) + { + bool bLabelTextWithSmartTags = m_aMainCB.IsChecked() ? true : false; + pSmartTagMgr->WriteConfiguration( bModifiedRecognize ? &bLabelTextWithSmartTags : 0, + bModifiedSmartTagTypes ? &aDisabledSmartTagTypes : 0 ); + } + + return TRUE; +} + +/** Sets the controls based on the current settings at SmartTagMgr. +*/ +void OfaSmartTagOptionsTabPage::Reset( const SfxItemSet& ) +{ + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); + const SmartTagMgr* pSmartTagMgr = pOpt->pSmartTagMgr; + + // robust, should not happen! + if ( !pSmartTagMgr ) + return; + + FillListBox( *pSmartTagMgr ); + m_aSmartTagTypesLB.SelectEntryPos( 0 ); + m_aMainCB.Check( pSmartTagMgr->IsLabelTextWithSmartTags() ); + CheckHdl( &m_aMainCB ); +} + +void OfaSmartTagOptionsTabPage::ActivatePage( const SfxItemSet& ) +{ + ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage( FALSE ); +} + diff --git a/cui/source/tabpages/autocdlg.hrc b/cui/source/tabpages/autocdlg.hrc new file mode 100644 index 000000000000..6a698b4397d7 --- /dev/null +++ b/cui/source/tabpages/autocdlg.hrc @@ -0,0 +1,162 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: autocdlg.hrc,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_AUTOCDLG_HRC +#define _SVX_AUTOCDLG_HRC + +#include + +// defines ------------------------------------------------------------------ + +#define CLB_SETTINGS 1 +/* +#define STR_DOUBLECAPS 3 +#define STR_STARTCAPS 4 +#define STR_FIRST 5 +#define STR_HALF 6 +#define STR_DASH 7 +#define STR_BOLDUNDERLINE 8 +#define STR_URL 9 +*/ + +#define CB_TYPO 11 +#define FT_STARTQUOTE 12 +#define PB_STARTQUOTE 13 +#define FT_ENDQUOTE 14 +#define PB_ENDQUOTE 15 + +#define FL_ABBREV 16 +#define ED_ABBREV 17 +#define LB_ABBREV 18 +#define PB_NEWABBREV 19 +#define PB_DELABBREV 20 +#define FL_DOUBLECAPS 21 +#define ED_DOUBLE_CAPS 22 +#define LB_DOUBLE_CAPS 23 +#define PB_NEWDOUBLECAPS 24 +#define PB_DELDOUBLECAPS 25 + +#define ED_SHORT 31 +#define ED_REPLACE 32 +#define TLB_REPLACE 33 +#define CB_TEXT_ONLY 34 +#define PB_NEW_REPLACE 35 +#define PB_DELETE_REPLACE 36 +#define STR_MODIFY 37 +#define STR_CLOSE_AUTOCORR 38 +#define FT_SHORT 39 +#define FT_REPLACE 40 +#define STR_CHANGE_START 41 +#define STR_CHANGE_END 42 +#define CB_AUTOABBREV 43 +#define CB_AUTOCAPS 44 + +#define FT_SGL_STARTQUOTE 45 +#define PB_SGL_STARTQUOTE 46 +#define FT_SGL_ENDQUOTE 47 +#define PB_SGL_ENDQUOTE 48 +#define PB_SGL_STD 49 +#define PB_DBL_STD 50 +#define FL_SINGLE 51 +#define FL_DOUBLE 52 +#define FT_SGSTEX 53 +#define FT_SGENEX 54 +#define FT_DBSTEX 55 +#define FT_DBECEX 56 +#define CB_SGL_TYPO 57 +#define ST_STANDARD 58 + +#define PB_EDIT 61 +#define ST_DEL_EMPTY_PARA 62 +#define ST_TYPO 66 +#define ST_USER_STYLE 67 +#define ST_BULLET 68 +#define STR_DEL_SPACES_AT_STT_END 69 +#define STR_DEL_SPACES_BETWEEN_LINES 70 + +#define ST_RIGHT_MARGIN 74 +#define STR_NUM 75 +#define STR_BORDER 76 +#define STR_TABLE 77 +#define STR_REPLACE_TEMPLATES 78 +#define FL_PRCNT 79 + +#define STR_HEADER 90 +#define FT_HEADER_EXPLANATION 91 +#define STR_HEADER1 92 +#define STR_HEADER2 93 +#define FT_HEADER1_EXPLANATION 94 +#define FT_HEADER2_EXPLANATION 95 + +#define ED_RIGHT_MARGIN 100 +#define BT_OK 101 +#define BT_CANCEL 102 + +#define BT_AWCP_OK 110 +#define BT_AWCP_CANCEL 111 +#define GB_AWCP_VALUE 112 +#define ED_AWCP_WORD_LEN 113 +#define ED_AWCP_LIST_LEN 114 +#define FT_AWCP_WORD_LEN 115 +#define FT_AWCP_LIST_LEN 116 + +#define CB_ACTIV 121 +#define CB_COLLECT 122 +#define CB_APPEND_SPACE 123 +#define CB_REMOVE_LIST 124 +#define CB_AS_TIP 125 +#define FT_MIN_WORDLEN 126 +#define FT_MAX_ENTRIES 127 +#define NF_MIN_WORDLEN 128 +#define NF_MAX_ENTRIES 129 +#define FT_EXPAND_KEY 130 +#define DCB_EXPAND_KEY 131 +#define LB_ENTRIES 132 +#define PB_ENTRIES 133 + + +#define ST_USE_REPLACE 200 +#define ST_CPTL_STT_WORD 201 +#define ST_CPTL_STT_SENT 202 +#define ST_BOLD_UNDER 203 +#define STR_NO_DBL_SPACES 204 +#define ST_DETECT_URL 205 +#define ST_ORDINAL 206 +#define ST_FRACTION 207 +#define ST_DASH 208 +#define FT_LANG 209 +#define LB_LANG 210 + +#define CB_SMARTTAGS 220 +#define FT_SMARTTAGS 221 +#define LB_SMARTTAGS 222 +#define PB_SMARTTAGS 223 + +#endif + diff --git a/cui/source/tabpages/autocdlg.src b/cui/source/tabpages/autocdlg.src new file mode 100644 index 000000000000..a087bd7d59dc --- /dev/null +++ b/cui/source/tabpages/autocdlg.src @@ -0,0 +1,856 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: autocdlg.src,v $ + * $Revision: 1.14 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include ------------------------------------------------------------------ +#include +#include "autocdlg.hrc" +#include +#include "helpid.hrc" + + // pragma ------------------------------------------------------------------- +/**************************************************************************/ +/* */ +/* TabDialog RID_OFA_AUTOCORR_DLG */ +/* */ +/**************************************************************************/ +TabDialog RID_OFA_AUTOCORR_DLG +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Text [ en-US ] = "AutoCorrect" ; + Moveable = TRUE ; + TabControl 1 + { + SVLook = TRUE ; + PageList = + { + PageItem + { + Identifier = RID_OFAPAGE_AUTOCORR_REPLACE ; + Text [ en-US ] = "Replace" ; + }; + PageItem + { + Identifier = RID_OFAPAGE_AUTOCORR_EXCEPT ; + Text [ en-US ] = "Exceptions" ; + }; + PageItem + { + Identifier = RID_OFAPAGE_AUTOCORR_OPTIONS ; + Text [ en-US ] = "Options" ; + }; + PageItem + { + Identifier = RID_OFAPAGE_AUTOFMT_APPLY ; + Text [ en-US ] = "Options" ; + }; + PageItem + { + Identifier = RID_OFAPAGE_AUTOCORR_QUOTE ; + Text [ en-US ] = "Custom Quotes" ; + }; + PageItem + { + Identifier = RID_OFAPAGE_AUTOCOMPLETE_OPTIONS ; + Text [ en-US ] = "Word Completion"; + }; + PageItem + { + Identifier = RID_OFAPAGE_SMARTTAG_OPTIONS ; + Text [ en-US ] = "Smart Tags"; + }; + }; + }; + FixedText FT_LANG + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 140 , 8 ) ; + + Left = TRUE ; + Text [ en-US ] = "Replacements and exceptions for language:"; + }; + ListBox LB_LANG + { + Pos = MAP_APPFONT ( 150 , 3 ) ; + Size = MAP_APPFONT ( 60 , 100 ) ; + DropDown = TRUE; + TabStop = TRUE ; + Border = TRUE ; + }; +}; +#define COMMON_CLB_ENTRIES \ + String ST_USE_REPLACE \ + { \ + Text [ en-US ] = "Use replacement table" ; \ + }; \ + String ST_CPTL_STT_WORD \ + { \ + Text [ en-US ] = "Correct TWo INitial CApitals" ; \ + }; \ + String ST_CPTL_STT_SENT \ + { \ + Text [ en-US ] = "Capitalize first letter of every sentence" ; \ + }; \ + String ST_BOLD_UNDER \ + { \ + Text [ en-US ] = "Automatic *bold* and _underline_" ; \ + }; \ + String STR_NO_DBL_SPACES \ + { \ + Text [ en-US ] = "Ignore double spaces" ; \ + }; \ + String ST_DETECT_URL \ + { \ + Text [ en-US ] = "URL Recognition" ; \ + }; \ + String ST_ORDINAL \ + { \ + Text [ en-US ] = "Replace 1st... with 1^st..." ; \ + }; \ + String ST_FRACTION \ + { \ + Text [ en-US ] = "Replace 1/2 ... with ½ ..." ; \ + }; \ + String ST_DASH \ + { \ + Text [ en-US ] = "Replace dashes" ; \ + }; + +/**************************************************************************/ +/* */ +/* Beschreibung: Autokorrektur-Optionen */ +/* */ +/**************************************************************************/ +TabPage RID_OFAPAGE_AUTOCORR_OPTIONS +{ + HelpId = HID_OFAPAGE_AUTOCORR_OPTIONS ; + OutputSize = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + SVLook = TRUE ; + Text [ en-US ] = "Settings" ; + Control CLB_SETTINGS + { + Pos = MAP_APPFONT ( 6 , 6 ) ; + Size = MAP_APPFONT ( 248 , 173 ) ; + Border = TRUE ; + TabStop = TRUE ; + }; + COMMON_CLB_ENTRIES +}; +/**************************************************************************/ +/* */ +/* */ +/* */ +/**************************************************************************/ +TabPage RID_OFAPAGE_AUTOFMT_APPLY +{ + HelpID = HID_OFAPAGE_AUTOFMT_OPTIONS ; + SVLook = TRUE ; + Hide = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Control CLB_SETTINGS + { + Pos = MAP_APPFONT ( 6 , 6 ) ; + Size = MAP_APPFONT ( 248 , 149 ) ; + Border = TRUE ; + TabStop = TRUE ; + }; + PushButton PB_EDIT + { + Pos = MAP_APPFONT ( 6 , 162 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Edit..." ; + TabStop = TRUE ; + }; + String STR_HEADER1 + { + Text [ en-US ] = "[M]" ; + }; + String STR_HEADER2 + { + Text [ en-US ] = "[T]" ; + }; + FixedText FT_HEADER1_EXPLANATION + { + Pos = MAP_APPFONT ( 80 , 159 ) ; + Size = MAP_APPFONT ( 174 , 8 ) ; + Text [ en-US ] = "[M]: Replace while modifying existing text" ; + }; + FixedText FT_HEADER2_EXPLANATION + { + Pos = MAP_APPFONT ( 80 , 171 ) ; + Size = MAP_APPFONT ( 174 , 8 ) ; + Text [ en-US ] = "[T]: AutoFormat/AutoCorrect while typing" ; + }; + COMMON_CLB_ENTRIES + String ST_DEL_EMPTY_PARA + { + /* ### ACHTUNG: Neuer Text in Resource? Leere Absätze entfernen : Leere Absõtze entfernen */ + Text [ en-US ] = "Remove blank paragraphs" ; + }; + String ST_TYPO + { + Text [ en-US ] = "Replace \"standard\" quotes with %1custom%2 quotes" ; + }; + String ST_USER_STYLE + { + Text [ en-US ] = "Replace Custom Styles" ; + }; + String ST_BULLET + { + Text [ en-US ] = "Replace bullets with: " ; + }; + String ST_RIGHT_MARGIN + { + /* ### ACHTUNG: Neuer Text in Resource? Zusammenfassen von einzeiligen Absätzen ab : Zusammenfassen von einzeiligen Absõtzen ab */ + // Text [ norwegian_wrong ] = "+++Combine single line paragraphs at" ; + // Text [ swedish_wrong ] = ~Kombinera enradiga stycken B738vid " ; + Text [ en-US ] = "Combine single line paragraphs if length greater than" ; + }; + String STR_NUM + { + Text [ en-US ] = "Apply numbering - symbol: " ; + }; + String STR_BORDER + { + Text [ en-US ] = "Apply border" ; + }; + String STR_TABLE + { + Text [ en-US ] = "Create table" ; + }; + String STR_REPLACE_TEMPLATES + { + Text [ en-US ] = "Apply Styles" ; + }; + String STR_DEL_SPACES_AT_STT_END + { + Text [ en-US ] = "Delete spaces and tabs at beginning and end of paragraph"; + }; + String STR_DEL_SPACES_BETWEEN_LINES + { + Text [ en-US ] = "Delete spaces and tabs at end and start of line"; + }; +}; + +ModalDialog RID_OFADLG_PRCNT_SET +{ + HelpID = SID_AUTOFORMAT ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 155 , 43 ) ; + Moveable = TRUE ; + FixedLine FL_PRCNT + { + Pos = MAP_APPFONT ( 4 , 3 ) ; + Size = MAP_APPFONT ( 87 , 8 ) ; + Text [ en-US ] = "Minimum size" ; + }; + OKButton BT_OK + { + Pos = MAP_APPFONT ( 99 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BT_CANCEL + { + Pos = MAP_APPFONT ( 99 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + MetricField ED_RIGHT_MARGIN + { + Border = TRUE ; + Pos = MAP_APPFONT ( 7 , 14 ) ; + Size = MAP_APPFONT ( 31 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + Value = 77 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + First = 10 ; + Last = 100 ; + SpinSize = 5 ; + }; + Text [ en-US ] = "Combine" ; +}; + +/**************************************************************************/ +/* */ +/* Beschreibung: Ersetzungstabelle */ +/* */ +/**************************************************************************/ +TabPage RID_OFAPAGE_AUTOCORR_REPLACE +{ + HelpId = HID_OFAPAGE_AUTOCORR_REPLACE ; + OutputSize = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + SVLook = TRUE ; + Hide = TRUE ; + FixedText FT_SHORT + { + Pos = MAP_APPFONT ( 7 , 3 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "Repla~ce" ; + Left = TRUE ; + }; + Edit ED_SHORT + { + Pos = MAP_APPFONT ( 7 , 13 ) ; + Size = MAP_APPFONT ( 60 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + }; + FixedText FT_REPLACE + { + Pos = MAP_APPFONT ( 71 , 3 ) ; + Size = MAP_APPFONT ( 64 , 8 ) ; + Text [ en-US ] = "~With:" ; + Left = TRUE ; + }; + Edit ED_REPLACE + { + Pos = MAP_APPFONT ( 71 , 13 ) ; + Size = MAP_APPFONT ( 123 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + }; + CheckBox CB_TEXT_ONLY + { + Pos = MAP_APPFONT ( 140 , 3 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Text only" ; + }; + PushButton PB_NEW_REPLACE + { + Pos = MAP_APPFONT ( 198 , 14 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~New" ; + }; + PushButton PB_DELETE_REPLACE + { + Pos = MAP_APPFONT ( 198 , 32 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Delete" ; + }; + Control TLB_REPLACE + { + HelpId = HID_OFACTL_AUTOCORR_REPLACE ; + Pos = MAP_APPFONT ( 7 , 29 ) ; + Size = MAP_APPFONT ( 187 , 150 ) ; + Border = TRUE ; + TabStop = TRUE ; + }; + String STR_MODIFY + { + Text [ en-US ] = "~Replace" ; + }; +}; +/**************************************************************************/ +/* */ +/* Beschreibung: Ausnahmelisten */ +/* */ +/**************************************************************************/ +TabPage RID_OFAPAGE_AUTOCORR_EXCEPT +{ + HelpId = HID_OFAPAGE_AUTOCORR_EXCEPT ; + OutputSize = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + SVLook = TRUE ; + Hide = TRUE ; + FixedLine FL_ABBREV + { + Pos = MAP_APPFONT ( 4 , 3 ) ; + Size = MAP_APPFONT ( 252 , 8 ) ; + Text [ en-US ] = "Abbreviations (no subsequent capital)" ; + }; + Edit ED_ABBREV + { + Pos = MAP_APPFONT ( 7 , 14 ) ; + Size = MAP_APPFONT ( 123 , 12 ) ; + TabStop = TRUE ; + Border = TRUE ; + }; + ListBox LB_ABBREV + { + Pos = MAP_APPFONT ( 7 , 30 ) ; + Size = MAP_APPFONT ( 123 , 58 ) ; + TabStop = TRUE ; + AutoHScroll = TRUE ; + SORT = TRUE ; + Border = TRUE ; + }; + PushButton PB_NEWABBREV + { + Pos = MAP_APPFONT ( 198 , 14 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Disable = TRUE ; + Text [ en-US ] = "~New" ; + }; + PushButton PB_DELABBREV + { + Pos = MAP_APPFONT ( 198 , 31 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Disable = TRUE ; + Text [ en-US ] = "~Delete" ; + }; + CheckBox CB_AUTOABBREV + { + Pos = MAP_APPFONT ( 137 , 78 ) ; + Size = MAP_APPFONT ( 111 , 10 ) ; + Text [ en-US ] = "~AutoInclude"; + Text [ en-US ] = "~AutoInclude" ; + TabStop = TRUE ; + }; + FixedLine FL_DOUBLECAPS + { + Pos = MAP_APPFONT ( 4 , 94 ) ; + Size = MAP_APPFONT ( 252 , 8 ) ; + Text [ en-US ] = "Words with TWo INitial CApitals" ; + }; + Edit ED_DOUBLE_CAPS + { + Pos = MAP_APPFONT ( 7 , 105 ) ; + Size = MAP_APPFONT ( 123 , 12 ) ; + TabStop = TRUE ; + Border = TRUE ; + }; + ListBox LB_DOUBLE_CAPS + { + Pos = MAP_APPFONT ( 7 , 120 ) ; + Size = MAP_APPFONT ( 123 , 59 ) ; + TabStop = TRUE ; + AutoHScroll = TRUE ; + SORT = TRUE ; + Border = TRUE ; + }; + PushButton PB_NEWDOUBLECAPS + { + Pos = MAP_APPFONT ( 198 , 105 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Disable = TRUE ; + Text [ en-US ] = "Ne~w" ; + }; + PushButton PB_DELDOUBLECAPS + { + Pos = MAP_APPFONT ( 198 , 122 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Disable = TRUE ; + Text [ en-US ] = "Dele~te" ; + }; + CheckBox CB_AUTOCAPS + { + Pos = MAP_APPFONT ( 137 , 169 ) ; + Size = MAP_APPFONT ( 111 , 10 ) ; + Text [ en-US ] = "A~utoInclude"; + Text [ en-US ] = "A~utoInclude" ; + }; +}; +/**************************************************************************/ +/* */ +/* Beschreibung: Typografische Anfuehrungszeichen */ +/* */ +/**************************************************************************/ +TabPage RID_OFAPAGE_AUTOCORR_QUOTE +{ + HelpId = HID_OFAPAGE_AUTOCORR_QUOTE ; + OutputSize = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + SVLook = TRUE ; + Hide = TRUE ; + Text [ en-US ] = "Custom Quotes" ; + FixedLine FL_SINGLE + { + Pos = MAP_APPFONT ( 4 , 3 ) ; + Size = MAP_APPFONT ( 252 , 8 ) ; + Text [ en-US ] = "Single quotes" ; + }; + Checkbox CB_SGL_TYPO + { + Pos = MAP_APPFONT ( 7 , 14 ) ; + Size = MAP_APPFONT ( 86 , 10 ) ; + Text [ en-US ] = "Repla~ce" ; + }; + FixedText FT_SGL_STARTQUOTE + { + Pos = MAP_APPFONT ( 7 , 30 ) ; + Size = MAP_APPFONT ( 86 , 8 ) ; + Text [ en-US ] = "~Start quote:" ; + }; + PushButton PB_SGL_STARTQUOTE + { + Pos = MAP_APPFONT ( 105 , 28 ) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + Text = "\'" ; + TabStop = TRUE ; + }; + FixedText FT_SGSTEX + { + Pos = MAP_APPFONT ( 124 , 30 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + }; + FixedText FT_SGL_ENDQUOTE + { + Pos = MAP_APPFONT ( 7 , 46 ) ; + Size = MAP_APPFONT ( 86 , 8 ) ; + Text [ en-US ] = "~End quote:" ; + }; + PushButton PB_SGL_ENDQUOTE + { + Pos = MAP_APPFONT ( 105 , 44 ) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + Text = "\'" ; + TabStop = TRUE ; + }; + FixedText FT_SGENEX + { + Pos = MAP_APPFONT ( 124 , 46 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + }; + PushButton PB_SGL_STD + { + Pos = MAP_APPFONT ( 198 , 63 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Default" ; + }; + FixedLine FL_DOUBLE + { + Pos = MAP_APPFONT ( 4 , 83 ) ; + Size = MAP_APPFONT ( 252 , 8 ) ; + Text [ en-US ] = "Double quotes" ; + }; + CheckBox CB_TYPO + { + Pos = MAP_APPFONT ( 7 , 94 ) ; + Size = MAP_APPFONT ( 86 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Repl~ace" ; + }; + FixedText FT_STARTQUOTE + { + Pos = MAP_APPFONT ( 7 , 110 ) ; + Size = MAP_APPFONT ( 86 , 8 ) ; + Text [ en-US ] = "Start q~uote:" ; + }; + PushButton PB_STARTQUOTE + { + Pos = MAP_APPFONT ( 105 , 108 ) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + Text = "\"" ; + TabStop = TRUE ; + }; + FixedText FT_DBSTEX + { + Pos = MAP_APPFONT ( 124 , 110 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + }; + FixedText FT_ENDQUOTE + { + Pos = MAP_APPFONT ( 7 , 126 ) ; + Size = MAP_APPFONT ( 86 , 10 ) ; + Text [ en-US ] = "E~nd quote:" ; + }; + PushButton PB_ENDQUOTE + { + Pos = MAP_APPFONT ( 105 , 124 ) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + Text = "\"" ; + TabStop = TRUE ; + }; + FixedText FT_DBECEX + { + Pos = MAP_APPFONT ( 124 , 126 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + }; + PushButton PB_DBL_STD + { + Pos = MAP_APPFONT ( 195 , 143 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "De~fault" ; + }; + String STR_CHANGE_START + { + Text [ en-US ] = "Start quote" ; + }; + String STR_CHANGE_END + { + Text [ en-US ] = "End quote" ; + }; + String ST_STANDARD + { + Text [ en-US ] = "Default" ; + }; +}; + +/**************************************************************************/ +/* */ +/* Beschreibung: automatische Wortergänzung */ +/* */ +/**************************************************************************/ +TabPage RID_OFAPAGE_AUTOCOMPLETE_OPTIONS +{ + HelpId = HID_OFAPAGE_AUTOCOMPLETE_OPTIONS ; + OutputSize = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + SVLook = TRUE ; + Hide = TRUE ; + CheckBox CB_ACTIV + { + Pos = MAP_APPFONT( 4, 3 ); + Size = MAP_APPFONT( 116, 10 ); + Text [ en-US ] = "Enable word ~completion"; + }; + CheckBox CB_APPEND_SPACE + { + Pos = MAP_APPFONT( 10, 17 ); + Size = MAP_APPFONT( 110, 10 ); + Text [ en-US ] = "~Append space"; + }; + CheckBox CB_AS_TIP + { + Pos = MAP_APPFONT( 10, 31 ); + Size = MAP_APPFONT( 110, 10 ); + Text [ en-US ] = "~Show as tip"; + }; + CheckBox CB_COLLECT + { + Pos = MAP_APPFONT( 4, 45 ); + Size = MAP_APPFONT( 116, 10 ); + Text [ en-US ] = "C~ollect words"; + }; + CheckBox CB_REMOVE_LIST + { + Pos = MAP_APPFONT( 10, 59 ); + Size = MAP_APPFONT( 110, 40 ); + WordBreak = TRUE; + Text [ en-US ] = "~When closing a document, remove the words collected from it from the list"; + }; + FixedText FT_EXPAND_KEY + { + Pos = MAP_APPFONT( 4, 102 ); + Size = MAP_APPFONT( 116, 8 ); + Text [ en-US ] = "Acc~ept with"; + }; + ListBox DCB_EXPAND_KEY + { + Pos = MAP_APPFONT( 4, 113 ); + Size = MAP_APPFONT( 116, 60 ); + TabStop = TRUE; + DropDown = TRUE; + Group = TRUE; + Sort = FALSE; + }; + FixedText FT_MIN_WORDLEN + { + Pos = MAP_APPFONT( 4, 129 ); + Size = MAP_APPFONT( 116, 8 ); + Text [ en-US ] = "Mi~n. word length"; + }; + NumericField NF_MIN_WORDLEN + { + Border = TRUE; + Pos = MAP_APPFONT( 4, 140 ); + Size = MAP_APPFONT( 30, 12 ); + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Value = 10 ; + Minimum = 5 ; + First = 5 ; + Last = 100 ; + Maximum = 100 ; + SpinSize = 1 ; + }; + FixedText FT_MAX_ENTRIES + { + Pos = MAP_APPFONT( 4, 156 ); + Size = MAP_APPFONT( 116, 8 ); + Text [ en-US ] = "~Max. entries"; + }; + NumericField NF_MAX_ENTRIES + { + Border = TRUE; + Pos = MAP_APPFONT( 4, 167 ); + Size = MAP_APPFONT( 30, 12 ); + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Value = 500 ; + Maximum = 10000; + Last = 10000 ; + First = 50 ; + Minimum = 50; + SpinSize = 25 ; + }; + MultiListBox LB_ENTRIES + { + Pos = MAP_APPFONT( 127, 3 ); + Size = MAP_APPFONT( 121, 158 ); + TabStop = TRUE; + DropDown = FALSE; + Group = TRUE; + Border = TRUE; + Sort = TRUE; + }; + PushButton PB_ENTRIES + { + Pos = MAP_APPFONT( 127, 165 ); + Size = MAP_APPFONT( 121, 14 ); + TabStop = TRUE ; + Text [ en-US ] = "~Delete Entry"; + }; + Text [ en-US ] = "Word Completion"; +}; + + +/**************************************************************************/ +/* */ +/* Beschreibung: Smart Tag Options */ +/* */ +/**************************************************************************/ +TabPage RID_OFAPAGE_SMARTTAG_OPTIONS +{ + HelpId = HID_OFAPAGE_SMARTTAG_OPTIONS ; + OutputSize = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + SVLook = TRUE ; + Hide = TRUE ; + Text [ en-US ] = "Smart Tags"; + + CheckBox CB_SMARTTAGS + { + Pos = MAP_APPFONT( 4, 3 ); + Size = MAP_APPFONT( 116, 10 ); + Text [ en-US ] = "Label text with smart tags"; + }; + + FixedText FT_SMARTTAGS + { + Pos = MAP_APPFONT( 12, 15 ); + Size = MAP_APPFONT( 116, 8 ); + Text [ en-US ] = "Currently installed smart tags"; + }; + + Control LB_SMARTTAGS + { + Pos = MAP_APPFONT ( 12 , 25 ) ; + Size = MAP_APPFONT ( 172 , 154 ) ; + Border = TRUE ; + TabStop = TRUE ; + }; + + PushButton PB_SMARTTAGS + { + Pos = MAP_APPFONT ( 188 , 25 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; + Text [ en-US ] = "Properties..."; + }; + +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx new file mode 100644 index 000000000000..fb3820dd2774 --- /dev/null +++ b/cui/source/tabpages/backgrnd.cxx @@ -0,0 +1,1979 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: backgrnd.cxx,v $ + * $Revision: 1.39 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define _SVX_BACKGRND_CXX + +#include +#include "backgrnd.hrc" +#include + +// Tabellenhintergrund +#define TBL_DEST_CELL 0 +#define TBL_DEST_ROW 1 +#define TBL_DEST_TBL 2 + +#include +#include "backgrnd.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include //CHINA001 +#include //CHINA001 +#include //CHINA001 +#include //CHINA001 +using namespace ::com::sun::star; +// static ---------------------------------------------------------------- + +static USHORT pRanges[] = +{ + SID_VIEW_FLD_PIC, SID_VIEW_FLD_PIC, + SID_ATTR_BRUSH, SID_ATTR_BRUSH, + SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR, + 0 +}; + +struct SvxBackgroundTable_Impl +{ + SvxBrushItem* pCellBrush; + SvxBrushItem* pRowBrush; + SvxBrushItem* pTableBrush; + USHORT nCellWhich; + USHORT nRowWhich; + USHORT nTableWhich; + USHORT nActPos; + + SvxBackgroundTable_Impl() : + pCellBrush(NULL), pRowBrush(NULL), pTableBrush(NULL), + nCellWhich(0), nRowWhich(0), nTableWhich(0) {} +}; + +struct SvxBackgroundPara_Impl +{ + SvxBrushItem* pParaBrush; + SvxBrushItem* pCharBrush; + + USHORT nActPos; + + SvxBackgroundPara_Impl() : + pParaBrush(NULL), pCharBrush(NULL) {} +}; + +struct SvxBackgroundPage_Impl +{ + Timer* pLoadTimer; + BOOL bIsImportDlgInExecute; + + SvxBackgroundPage_Impl() : + pLoadTimer(NULL), bIsImportDlgInExecute(FALSE) {} +}; +/* -----------------------------15.08.2002 12:21------------------------------ + + ---------------------------------------------------------------------------*/ +inline BYTE lcl_PercentToTransparency(long nPercent) +{ + //0xff must not be returned! + return BYTE(nPercent ? (50 + 0xfe * nPercent) / 100 : 0); +} +inline BYTE lcl_TransparencyToPercent(BYTE nTrans) +{ + return (nTrans * 100 + 127) / 254; +} +void lcl_SetTransparency(SvxBrushItem& rBrush, long nTransparency) +{ + uno::Any aTransparency; + aTransparency <<= (sal_Int8)nTransparency; + rBrush.PutValue(aTransparency, MID_GRAPHIC_TRANSPARENCY); +} +//------------------------------------------------------------------------- + +/* [Beschreibung] + +*/ + +USHORT GetItemId_Impl( ValueSet& rValueSet, const Color& rCol ) +{ + BOOL bFound = FALSE; + USHORT nCount = rValueSet.GetItemCount(); + USHORT n = 1; + + while ( !bFound && n <= nCount ) + { + Color aValCol = rValueSet.GetItemColor(n); + + bFound = ( aValCol.GetRed() == rCol.GetRed() + && aValCol.GetGreen() == rCol.GetGreen() + && aValCol.GetBlue() == rCol.GetBlue() ); + + if ( !bFound ) + n++; + } + return bFound ? n : 0; +} + +// class BackgroundPreview ----------------------------------------------- + +/* [Beschreibung] + + Vorschaufenster f"ur Brush oder Bitmap +*/ + +class BackgroundPreviewImpl : public Window +{ +public: + BackgroundPreviewImpl( Window* pParent, + const ResId& rResId, BOOL bIsBmpPreview ); + ~BackgroundPreviewImpl(); + + void NotifyChange( const Color& rColor ); + void NotifyChange( const Bitmap* pBitmap ); + +protected: + virtual void Paint( const Rectangle& rRect ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + +private: + const BOOL bIsBmp; + Bitmap* pBitmap; + Point aDrawPos; + Size aDrawSize; + Rectangle aDrawRect; + BYTE nTransparency; +}; + +//----------------------------------------------------------------------- + +BackgroundPreviewImpl::BackgroundPreviewImpl +( + Window* pParent, + const ResId& rResId, + BOOL bIsBmpPreview +) : + +/* [Beschreibung] + +*/ + + Window( pParent, rResId ), + + bIsBmp ( bIsBmpPreview ), + pBitmap ( NULL ), + aDrawRect( Point(0,0), GetOutputSizePixel() ), + nTransparency(0) + +{ + SetBorderStyle(WINDOW_BORDER_MONO); + Paint( aDrawRect ); +} + +//----------------------------------------------------------------------- + +BackgroundPreviewImpl::~BackgroundPreviewImpl() + +/* [Beschreibung] + +*/ + +{ + delete pBitmap; +} + +//----------------------------------------------------------------------- +void BackgroundPreviewImpl::NotifyChange( const Color& rColor ) +{ + if ( !bIsBmp ) + { + const static Color aTranspCol( COL_TRANSPARENT ); + + nTransparency = lcl_TransparencyToPercent( rColor.GetTransparency() ); + + SetFillColor( rColor == aTranspCol ? GetSettings().GetStyleSettings().GetFieldColor() : (Color) rColor.GetRGBColor() ); + Paint( aDrawRect ); + } +} + +//----------------------------------------------------------------------- + +void BackgroundPreviewImpl::NotifyChange( const Bitmap* pNewBitmap ) +/* [Beschreibung] + +*/ + +{ + if ( bIsBmp && (pNewBitmap || pBitmap) ) + { + if ( pNewBitmap && pBitmap ) + *pBitmap = *pNewBitmap; + else if ( pNewBitmap && !pBitmap ) + pBitmap = new Bitmap( *pNewBitmap ); + else if ( !pNewBitmap ) + DELETEZ( pBitmap ); + + if ( pBitmap ) + { + Size aSize = GetOutputSizePixel(); + // InnerSize == Size without one pixel border + Size aInnerSize = aSize; + aInnerSize.Width() -= 2; + aInnerSize.Height() -= 2; + aDrawSize = pBitmap->GetSizePixel(); + + // bitmap bigger than preview window? + if ( aDrawSize.Width() > aInnerSize.Width() ) + { + aDrawSize.Height() = aDrawSize.Height() * aInnerSize.Width() / aDrawSize.Width(); + if ( aDrawSize.Height() > aInnerSize.Height() ) + { + aDrawSize.Width() = aDrawSize.Height(); + aDrawSize.Height() = aInnerSize.Height(); + } + else + aDrawSize.Width() = aInnerSize.Width(); + } + else if ( aDrawSize.Height() > aInnerSize.Height() ) + { + aDrawSize.Width() = aDrawSize.Width() * aInnerSize.Height() / aDrawSize.Height(); + if ( aDrawSize.Width() > aInnerSize.Width() ) + { + aDrawSize.Height() = aDrawSize.Width(); + aDrawSize.Width() = aInnerSize.Width(); + } + else + aDrawSize.Height() = aInnerSize.Height(); + } + + aDrawPos.X() = (aSize.Width() - aDrawSize.Width()) / 2; + aDrawPos.Y() = (aSize.Height() - aDrawSize.Height()) / 2; + } + Invalidate( aDrawRect ); + Update(); + } +} + +//----------------------------------------------------------------------- + +void BackgroundPreviewImpl::Paint( const Rectangle& ) +{ + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + SetBackground(Wallpaper(rStyleSettings.GetWindowColor())); + SetLineColor(); + if(bIsBmp) + SetFillColor( Color(COL_TRANSPARENT) ); + DrawRect( aDrawRect ); + if ( bIsBmp ) + { + if ( pBitmap ) + DrawBitmap( aDrawPos, aDrawSize, *pBitmap ); + else + { + Size aSize = GetOutputSizePixel(); + DrawLine( Point(0,0), Point(aSize.Width(),aSize.Height()) ); + DrawLine( Point(0,aSize.Height()), Point(aSize.Width(),0) ); + } + } +} +/* -----------------------------27.02.2002 11:07------------------------------ + + ---------------------------------------------------------------------------*/ +void BackgroundPreviewImpl::DataChanged( const DataChangedEvent& rDCEvt ) +{ + if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && + (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + { + Invalidate(); + } + Window::DataChanged( rDCEvt ); +} + +// class SvxBackgroundTabPage -------------------------------------------- + +#define HDL(hdl) LINK(this,SvxBackgroundTabPage,hdl) + +SvxBackgroundTabPage::SvxBackgroundTabPage( Window* pParent, + const SfxItemSet& rCoreSet ) : + +/* [Beschreibung] + +*/ + + SvxTabPage( pParent, SVX_RES( RID_SVXPAGE_BACKGROUND ), rCoreSet ), + + aBorderWin ( this, SVX_RES(CT_BORDER) ), + aBackgroundColorSet ( &aBorderWin, SVX_RES( SET_BGDCOLOR ) ), + aBackgroundColorBox ( this, SVX_RES( GB_BGDCOLOR ) ), + pPreviewWin1 ( new BackgroundPreviewImpl( + this, SVX_RES( WIN_PREVIEW1 ), FALSE ) ), + aColTransFT ( this, SVX_RES( FT_COL_TRANS ) ), + aColTransMF ( this, SVX_RES( MF_COL_TRANS ) ), + aBtnBrowse ( this, SVX_RES( BTN_BROWSE ) ), + aBtnLink ( this, SVX_RES( BTN_LINK ) ), + aBtnPreview ( this, SVX_RES( BTN_PREVIEW ) ), + aFtFile ( this, SVX_RES( FT_FILE ) ), + aGbFile ( this, SVX_RES( GB_FILE ) ), + aBtnPosition ( this, SVX_RES( BTN_POSITION ) ), + aBtnArea ( this, SVX_RES( BTN_AREA ) ), + aBtnTile ( this, SVX_RES( BTN_TILE ) ), + aWndPosition ( this, SVX_RES( WND_POSITION ), RP_MM ), + aGbPosition ( this, SVX_RES( GB_POSITION ) ), + aGraphTransFL ( this, SVX_RES( FL_GRAPH_TRANS ) ), + aGraphTransMF ( this, SVX_RES( MF_GRAPH_TRANS ) ), + pPreviewWin2 ( new BackgroundPreviewImpl( + this, SVX_RES( WIN_PREVIEW2 ), TRUE ) ), + aSelectTxt ( this, SVX_RES( FT_SELECTOR ) ), + aLbSelect ( this, SVX_RES( LB_SELECTOR ) ), + aStrBrowse ( SVX_RES( STR_BROWSE ) ), + aStrUnlinked ( SVX_RES( STR_UNLINKED ) ), + aTblDesc ( this, SVX_RES( FT_TBL_DESC ) ), + aTblLBox ( this, SVX_RES( LB_TBL_BOX ) ), + aParaLBox ( this, SVX_RES( LB_PARA_BOX ) ), + nHtmlMode ( 0 ), + bAllowShowSelector ( TRUE ), + bIsGraphicValid ( FALSE ), + bLinkOnly ( FALSE ), + bResized ( FALSE ), + bColTransparency ( FALSE ), + bGraphTransparency ( FALSE ), + + pPageImpl ( new SvxBackgroundPage_Impl ), + pImportDlg ( NULL ), + pTableBck_Impl ( NULL ), + pParaBck_Impl ( NULL ) + +{ + // diese Page braucht ExchangeSupport + SetExchangeSupport(); + + const SfxPoolItem* pItem; + SfxObjectShell* pShell; + + if ( SFX_ITEM_SET == rCoreSet.GetItemState( SID_HTML_MODE, FALSE, &pItem ) + || ( 0 != ( pShell = SfxObjectShell::Current()) && + 0 != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) ) + { + nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue(); + } + + FillColorValueSets_Impl(); + + aBackgroundColorSet.SetSelectHdl( HDL(BackgroundColorHdl_Impl) ); + FreeResource(); +} + +//------------------------------------------------------------------------ + +SvxBackgroundTabPage::~SvxBackgroundTabPage() + +/* [Beschreibung] + +*/ + +{ + delete pPreviewWin1; + delete pPreviewWin2; + delete pPageImpl->pLoadTimer; + delete pPageImpl; + delete pImportDlg; + + if( pTableBck_Impl) + { + delete pTableBck_Impl->pCellBrush; + delete pTableBck_Impl->pRowBrush; + delete pTableBck_Impl->pTableBrush; + delete pTableBck_Impl; + } + + if(pParaBck_Impl) + { + delete pParaBck_Impl->pParaBrush; + delete pParaBck_Impl->pCharBrush; + delete pParaBck_Impl; + } +} + +//------------------------------------------------------------------------ + +USHORT* SvxBackgroundTabPage::GetRanges() + +/* [Beschreibung] + + gibt den Bereich der Which-Werte zur"uck +*/ + +{ + return pRanges; +} + +//------------------------------------------------------------------------ + +SfxTabPage* SvxBackgroundTabPage::Create( Window* pParent, + const SfxItemSet& rAttrSet ) + +/* [Beschreibung] + + Create-Methode f"ur den TabDialog +*/ + +{ + return ( new SvxBackgroundTabPage( pParent, rAttrSet ) ); +} + +//------------------------------------------------------------------------ + +void SvxBackgroundTabPage::Reset( const SfxItemSet& rSet ) + +/* [Beschreibung] + +*/ + +{ +// os: So ein Unsinn! Irgendwo laesst sich so ein Item immer finden, +// es muss aber im rSet vorhanden sein! +// const SfxPoolItem* pX = GetOldItem( rSet, SID_VIEW_FLD_PIC ); +// if( pX && pX->ISA(SfxWallpaperItem)) + if(SFX_ITEM_AVAILABLE <= rSet.GetItemState(GetWhich(SID_VIEW_FLD_PIC), FALSE)) + { + ResetFromWallpaperItem( rSet ); + return; + } + + // Zustand des Vorschau-Buttons durch UserData persistent + String aUserData = GetUserData(); + aBtnPreview.Check( aUserData.Len() && sal_Unicode('1') == aUserData.GetChar( 0 ) ); + + // nach Reset kein ShowSelector() mehr aufrufen d"urfen + bAllowShowSelector = FALSE; + + + // Input-BrushItem besorgen und auswerten + const SvxBrushItem* pBgdAttr = NULL; + USHORT nSlot = SID_ATTR_BRUSH; + const SfxPoolItem* pItem; + USHORT nDestValue = USHRT_MAX; + + if ( SFX_ITEM_SET == rSet.GetItemState( SID_BACKGRND_DESTINATION, + FALSE, &pItem ) ) + { + nDestValue = ((const SfxUInt16Item*)pItem)->GetValue(); + aTblLBox.SelectEntryPos(nDestValue); + + switch ( nDestValue ) + { + case TBL_DEST_CELL: + nSlot = SID_ATTR_BRUSH; + break; + case TBL_DEST_ROW: + nSlot = SID_ATTR_BRUSH_ROW; + break; + case TBL_DEST_TBL: + nSlot = SID_ATTR_BRUSH_TABLE; + break; + } + } + else if( SFX_ITEM_SET == rSet.GetItemState( + SID_PARA_BACKGRND_DESTINATION, FALSE, &pItem ) ) + { + nDestValue = ((const SfxUInt16Item*)pItem)->GetValue(); + // ist gerade Zeichen aktiviert? + USHORT nParaSel = aParaLBox.GetSelectEntryPos(); + if(1 == nParaSel) + { + // dann war das ein "Standard" - Aufruf + nDestValue = nParaSel; + } + aParaLBox.SelectEntryPos(nDestValue); + + switch ( nDestValue ) + { + case PARA_DEST_PARA: + nSlot = SID_ATTR_BRUSH; + break; + case PARA_DEST_CHAR: + nSlot = SID_ATTR_BRUSH_CHAR; + break; + } + } + //#111173# the destination item is missing when the parent style has been changed + if(USHRT_MAX == nDestValue && (aParaLBox.IsVisible()||aTblLBox.IsVisible())) + nDestValue = 0; + USHORT nWhich = GetWhich( nSlot ); + + if ( rSet.GetItemState( nWhich, FALSE ) >= SFX_ITEM_AVAILABLE ) + pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); + + aBtnTile.Check(); + + if ( pBgdAttr ) + { + FillControls_Impl(*pBgdAttr, aUserData); + aBgdColor = ( (SvxBrushItem*)pBgdAttr )->GetColor(); + } + else + { + aSelectTxt.Hide(); + aLbSelect.Hide(); + aLbSelect.SelectEntryPos( 0 ); + ShowColorUI_Impl(); + + const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_BRUSH ); + + if ( pOld ) + aBgdColor = ( (SvxBrushItem*)pOld )->GetColor(); + } + + if ( nDestValue != USHRT_MAX ) + { + if(aTblLBox.IsVisible()) + { + USHORT nValue = aTblLBox.GetSelectEntryPos(); + + if ( pTableBck_Impl ) + { + DELETEZ( pTableBck_Impl->pCellBrush); + DELETEZ( pTableBck_Impl->pRowBrush); + DELETEZ( pTableBck_Impl->pTableBrush); + } + else + pTableBck_Impl = new SvxBackgroundTable_Impl(); + + pTableBck_Impl->nActPos = nValue; + + nWhich = GetWhich( SID_ATTR_BRUSH ); + if ( rSet.GetItemState( nWhich, FALSE ) >= SFX_ITEM_AVAILABLE ) + { + pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); + pTableBck_Impl->pCellBrush = new SvxBrushItem(*pBgdAttr); + } + pTableBck_Impl->nCellWhich = nWhich; + + if ( rSet.GetItemState( SID_ATTR_BRUSH_ROW, FALSE ) >= SFX_ITEM_AVAILABLE ) + { + pBgdAttr = (const SvxBrushItem*)&( rSet.Get( SID_ATTR_BRUSH_ROW ) ); + pTableBck_Impl->pRowBrush = new SvxBrushItem(*pBgdAttr); + } + pTableBck_Impl->nRowWhich = SID_ATTR_BRUSH_ROW; + + if ( rSet.GetItemState( SID_ATTR_BRUSH_TABLE, FALSE ) >= SFX_ITEM_AVAILABLE ) + { + pBgdAttr = (const SvxBrushItem*)&( rSet.Get( SID_ATTR_BRUSH_TABLE ) ); + pTableBck_Impl->pTableBrush = new SvxBrushItem(*pBgdAttr); + } + pTableBck_Impl->nTableWhich = SID_ATTR_BRUSH_TABLE; + + TblDestinationHdl_Impl(&aTblLBox); + aTblLBox.SaveValue(); + } + else + { + USHORT nValue = aParaLBox.GetSelectEntryPos(); + + if ( pParaBck_Impl ) + { + delete pParaBck_Impl->pParaBrush; + delete pParaBck_Impl->pCharBrush; + } + else + pParaBck_Impl = new SvxBackgroundPara_Impl(); + + pParaBck_Impl->nActPos = nValue; + + nWhich = GetWhich( SID_ATTR_BRUSH ); + if ( rSet.GetItemState( nWhich, FALSE ) >= SFX_ITEM_AVAILABLE ) + { + pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); + pParaBck_Impl->pParaBrush = new SvxBrushItem(*pBgdAttr); + } + + nWhich = GetWhich( SID_ATTR_BRUSH_CHAR ); + SfxItemState eState = rSet.GetItemState( nWhich, TRUE ); + eState = rSet.GetItemState( nWhich, FALSE ); + if ( rSet.GetItemState( nWhich, TRUE ) > SFX_ITEM_AVAILABLE ) + { + pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); + pParaBck_Impl->pCharBrush = new SvxBrushItem(*pBgdAttr); + } + else + pParaBck_Impl->pCharBrush = new SvxBrushItem(SID_ATTR_BRUSH_CHAR); + + ParaDestinationHdl_Impl(&aParaLBox); + aParaLBox.SaveValue(); + } + } + if(!bResized) + { + if(!aLbSelect.IsVisible() && !aTblLBox.IsVisible() && !aParaLBox.IsVisible()) + { + long nY(LogicToPixel(Point(11,14), MAP_APPFONT).X()); + long nX(LogicToPixel(Point(11,14), MAP_APPFONT).Y()); + Point aPos(aBorderWin.GetPosPixel()); + aPos.X() = nX; + aPos.Y() = nY; + aBorderWin.SetPosPixel(aPos); + aPos = pPreviewWin1->GetPosPixel(); + aPos.Y() = nY; + pPreviewWin1->SetPosPixel(aPos); + aBackgroundColorBox.Hide(); + } + } +} + +void SvxBackgroundTabPage::ResetFromWallpaperItem( const SfxItemSet& rSet ) +{ + ShowSelector(); + + // Zustand des Vorschau-Buttons durch UserData persistent + String aUserData = GetUserData(); + aBtnPreview.Check( aUserData.Len() && sal_Unicode('1') == aUserData.GetChar( 0 ) ); + + // Input-BrushItem besorgen und auswerten + const SvxBrushItem* pBgdAttr = NULL; + USHORT nSlot = SID_VIEW_FLD_PIC; + USHORT nWhich = GetWhich( nSlot ); + SvxBrushItem* pTemp = 0; + const CntWallpaperItem* pItem = 0; + + if ( rSet.GetItemState( nWhich, FALSE ) >= SFX_ITEM_AVAILABLE ) + { + pItem = (const CntWallpaperItem*)&rSet.Get( nWhich ); + pTemp = new SvxBrushItem( *pItem, nWhich ); + pBgdAttr = pTemp; + } + + aBtnTile.Check(); + + if ( pBgdAttr ) + { + FillControls_Impl(*pBgdAttr, aUserData); + // Auch bei Anzeige der Grafik, soll die Brush erhalten bleiben + if( aBgdColor != pBgdAttr->GetColor() ) + { + aBgdColor = pBgdAttr->GetColor(); + USHORT nCol = GetItemId_Impl( aBackgroundColorSet, aBgdColor ); + aBackgroundColorSet.SelectItem( nCol ); + pPreviewWin1->NotifyChange( aBgdColor ); + } + } + else + { + aLbSelect.SelectEntryPos( 0 ); + ShowColorUI_Impl(); + + const SfxPoolItem* pOld = GetOldItem( rSet, SID_VIEW_FLD_PIC ); + if ( pOld ) + aBgdColor = Color( ((CntWallpaperItem*)pOld)->GetColor() ); + } + + // We now have always a link to the background + bLinkOnly = TRUE; + aBtnLink.Check( TRUE ); + aBtnLink.Show( FALSE ); +// if( !pItem || !pItem->GetWallpaper(FALSE).IsBitmap() ) +// aBtnLink.Check(); + + delete pTemp; +} + + + +//------------------------------------------------------------------------ + +void SvxBackgroundTabPage::FillUserData() + +/* [Beschreibung] + + Beim Destruieren einer SfxTabPage wird diese virtuelle Methode gerufen, + damit die TabPage interne Informationen sichern kann. + + In diesem Fall wird der Zustand des Vorschau-Buttons gesichert. +*/ + +{ + SetUserData( String( aBtnPreview.IsChecked() ? sal_Unicode('1') : sal_Unicode('0') ) ); +} + +//------------------------------------------------------------------------ + +BOOL SvxBackgroundTabPage::FillItemSet( SfxItemSet& rCoreSet ) + +/* [Beschreibung] + +*/ + +{ + if ( pPageImpl->pLoadTimer && pPageImpl->pLoadTimer->IsActive() ) + { + pPageImpl->pLoadTimer->Stop(); + LoadTimerHdl_Impl( pPageImpl->pLoadTimer ); + } +// os: So ein Unsinn! Irgendwo laesst sich so ein Item immer finden, +// es muss aber im rSet vorhanden sein! + +// const SfxPoolItem* pX = GetOldItem( rCoreSet, SID_VIEW_FLD_PIC ); +// if( pX && pX->ISA(SfxWallpaperItem)) + if(SFX_ITEM_AVAILABLE <= rCoreSet.GetItemState(GetWhich(SID_VIEW_FLD_PIC), FALSE)) + return FillItemSetWithWallpaperItem( rCoreSet, SID_VIEW_FLD_PIC ); + + BOOL bModified = FALSE; + USHORT nSlot = SID_ATTR_BRUSH; + + if ( aTblLBox.IsVisible() ) + { + switch( aTblLBox.GetSelectEntryPos() ) + { + case TBL_DEST_CELL: + nSlot = SID_ATTR_BRUSH; + break; + case TBL_DEST_ROW: + nSlot = SID_ATTR_BRUSH_ROW; + break; + case TBL_DEST_TBL: + nSlot = SID_ATTR_BRUSH_TABLE; + break; + } + } + else if(aParaLBox.GetData() == &aParaLBox) + { + switch(aParaLBox.GetSelectEntryPos()) + { + case PARA_DEST_PARA: + nSlot = SID_ATTR_BRUSH; + break; + case PARA_DEST_CHAR: + nSlot = SID_ATTR_BRUSH_CHAR; + break; + } + } + USHORT nWhich = GetWhich( nSlot ); + + const SfxPoolItem* pOld = GetOldItem( rCoreSet, nSlot ); + SfxItemState eOldItemState = rCoreSet.GetItemState(nSlot, FALSE); + const SfxItemSet& rOldSet = GetItemSet(); + + BOOL bGraphTransparencyChanged = bGraphTransparency && (aGraphTransMF.GetText() != aGraphTransMF.GetSavedValue()); + if ( pOld ) + { + const SvxBrushItem& rOldItem = (const SvxBrushItem&)*pOld; + SvxGraphicPosition eOldPos = rOldItem.GetGraphicPos(); + const BOOL bIsBrush = ( 0 == aLbSelect.GetSelectEntryPos() ); + + // transparency has to be set if enabled, the color not already set to "No fill" and + if( bColTransparency && + aBgdColor.GetTransparency() < 0xff) + { + aBgdColor.SetTransparency(lcl_PercentToTransparency(static_cast(aColTransMF.GetValue()))); + } + if ( ( (GPOS_NONE == eOldPos) && bIsBrush ) + || ( (GPOS_NONE != eOldPos) && !bIsBrush ) ) // Brush <-> Bitmap gewechselt? + { + // Hintergrund-Art wurde nicht gewechselt: + + if ( (GPOS_NONE == eOldPos) || !aLbSelect.IsVisible() ) + { + // Brush-Behandlung: + if ( rOldItem.GetColor() != aBgdColor || + (SFX_ITEM_AVAILABLE >= eOldItemState && !aBackgroundColorSet.IsNoSelection())) + { + bModified = TRUE; + rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) ); + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + rCoreSet.ClearItem( nWhich ); + } + else + { + // Bitmap-Behandlung: + + SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); + const BOOL bIsLink = aBtnLink.IsChecked(); + const BOOL bWasLink = (NULL != rOldItem.GetGraphicLink() ); + + + if ( !bIsLink && !bIsGraphicValid ) + bIsGraphicValid = LoadLinkedGraphic_Impl(); + + if ( bGraphTransparencyChanged || + eNewPos != eOldPos + || bIsLink != bWasLink + || ( bWasLink && *rOldItem.GetGraphicLink() + != aBgdGraphicPath ) + || ( !bWasLink && rOldItem.GetGraphic()->GetBitmap() + != aBgdGraphic.GetBitmap() ) + ) + { + bModified = TRUE; + + SvxBrushItem aTmpBrush(nWhich); + if ( bIsLink ) + { + aTmpBrush = SvxBrushItem( aBgdGraphicPath, + aBgdGraphicFilter, + eNewPos, + nWhich ); + } + else + aTmpBrush = SvxBrushItem( aBgdGraphic, + eNewPos, + nWhich ); + lcl_SetTransparency(aTmpBrush, static_cast(aGraphTransMF.GetValue())); + + rCoreSet.Put(aTmpBrush); + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + rCoreSet.ClearItem( nWhich ); + } + } + else // Brush <-> Bitmap gewechselt! + { + if ( bIsBrush ) + rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) ); + else + { + SvxBrushItem* pTmpBrush = 0; + if ( aBtnLink.IsChecked() ) + { + pTmpBrush = new SvxBrushItem( aBgdGraphicPath, + aBgdGraphicFilter, + GetGraphicPosition_Impl(), + nWhich ); + } + else + { + if ( !bIsGraphicValid ) + bIsGraphicValid = LoadLinkedGraphic_Impl(); + + if ( bIsGraphicValid ) + pTmpBrush = new SvxBrushItem( aBgdGraphic, + GetGraphicPosition_Impl(), + nWhich ); + } + if(pTmpBrush) + { + lcl_SetTransparency(*pTmpBrush, static_cast(aGraphTransMF.GetValue())); + rCoreSet.Put(*pTmpBrush); + delete pTmpBrush; + } + } + bModified = ( bIsBrush || aBtnLink.IsChecked() || bIsGraphicValid ); + } + } + else if ( SID_ATTR_BRUSH_CHAR == nSlot && aBgdColor != Color( COL_WHITE ) ) + { + rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) ); + bModified = TRUE; + } + + if( aTblLBox.IsVisible() ) + { + // Der aktuelle Zustand wurde bereits geputtet + if( nSlot != SID_ATTR_BRUSH && pTableBck_Impl->pCellBrush) + { + const SfxPoolItem* pOldCell = + GetOldItem( rCoreSet, SID_ATTR_BRUSH ); + + if ( *pTableBck_Impl->pCellBrush != *pOldCell ) + { + rCoreSet.Put( *pTableBck_Impl->pCellBrush ); + bModified |= TRUE; + } + } + + if( nSlot != SID_ATTR_BRUSH_ROW && pTableBck_Impl->pRowBrush) + { + const SfxPoolItem* pOldRow = + GetOldItem( rCoreSet, SID_ATTR_BRUSH_ROW ); + + if ( *pTableBck_Impl->pRowBrush != *pOldRow ) + { + rCoreSet.Put( *pTableBck_Impl->pRowBrush ); + bModified |= TRUE; + } + } + + if( nSlot != SID_ATTR_BRUSH_TABLE && pTableBck_Impl->pTableBrush) + { + const SfxPoolItem* pOldTable = + GetOldItem( rCoreSet, SID_ATTR_BRUSH_TABLE ); + + if ( *pTableBck_Impl->pTableBrush != *pOldTable ) + { + rCoreSet.Put( *pTableBck_Impl->pTableBrush ); + bModified |= TRUE; + } + } + + if( aTblLBox.GetSavedValue() != aTblLBox.GetSelectEntryPos() ) + { + rCoreSet.Put( SfxUInt16Item( SID_BACKGRND_DESTINATION, + aTblLBox.GetSelectEntryPos() ) ); + bModified |= TRUE; + } + } + else if(aParaLBox.GetData() == &aParaLBox) + { + // Der aktuelle Zustand wurde bereits geputtet + if( nSlot != SID_ATTR_BRUSH && aParaLBox.IsVisible()) // nicht im Suchen-Format-Dialog + { + const SfxPoolItem* pOldPara = + GetOldItem( rCoreSet, SID_ATTR_BRUSH ); + + if ( *pParaBck_Impl->pParaBrush != *pOldPara ) + { + rCoreSet.Put( *pParaBck_Impl->pParaBrush ); + bModified |= TRUE; + } + } + + if( nSlot != SID_ATTR_BRUSH_CHAR ) + { + const SfxPoolItem* pOldChar = + GetOldItem( rCoreSet, SID_ATTR_BRUSH_CHAR ); + DBG_ASSERT(pParaBck_Impl, "pParaBck_Impl == NULL ?"); + if ( pOldChar && + //#111173# crash report shows that pParaBck_Impl can be NULL, the cause is unknown + pParaBck_Impl && + (*pParaBck_Impl->pCharBrush != *pOldChar || + *pParaBck_Impl->pCharBrush != SvxBrushItem(SID_ATTR_BRUSH_CHAR))) + { + rCoreSet.Put( *pParaBck_Impl->pCharBrush ); + bModified |= TRUE; + } + } + + if( aParaLBox.GetSavedValue() != aParaLBox.GetSelectEntryPos() ) + { + rCoreSet.Put( SfxUInt16Item( SID_BACKGRND_DESTINATION, + aParaLBox.GetSelectEntryPos() ) ); + bModified |= TRUE; + } + } + return bModified; +} + +BOOL SvxBackgroundTabPage::FillItemSetWithWallpaperItem( SfxItemSet& rCoreSet, USHORT nSlot) +{ + USHORT nWhich = GetWhich( nSlot ); + const SfxPoolItem* pOld = GetOldItem( rCoreSet, nSlot ); + const SfxItemSet& rOldSet = GetItemSet(); + DBG_ASSERT(pOld,"FillItemSetWithWallpaperItem: Item not found"); + + SvxBrushItem rOldItem( (const CntWallpaperItem&)*pOld, nWhich ); + SvxGraphicPosition eOldPos = rOldItem.GetGraphicPos(); + const BOOL bIsBrush = ( 0 == aLbSelect.GetSelectEntryPos() ); + BOOL bModified = FALSE; + + if ( ( (GPOS_NONE == eOldPos) && bIsBrush ) + || ( (GPOS_NONE != eOldPos) && !bIsBrush ) ) // Brush <-> Bitmap gewechselt? + { + // Hintergrund-Art wurde nicht gewechselt: + + if ( (GPOS_NONE == eOldPos) || !aLbSelect.IsVisible() ) + { + // Brush-Behandlung: + if ( rOldItem.GetColor() != aBgdColor ) + { + bModified = TRUE; + CntWallpaperItem aItem( nWhich ); + aItem.SetColor( aBgdColor ); + rCoreSet.Put( aItem ); + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + rCoreSet.ClearItem( nWhich ); + } + else + { + // Bitmap-Behandlung: + SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); + + int bBitmapChanged = ( ( eNewPos != eOldPos ) || + ( *rOldItem.GetGraphicLink() != aBgdGraphicPath ) ); + int bBrushChanged = ( rOldItem.GetColor() != aBgdColor ); + if( bBitmapChanged || bBrushChanged ) + { + bModified = TRUE; + + CntWallpaperItem aItem( nWhich ); + WallpaperStyle eWallStyle = SvxBrushItem::GraphicPos2WallpaperStyle(eNewPos); + aItem.SetStyle( sal::static_int_cast< USHORT >( eWallStyle ) ); + aItem.SetColor( aBgdColor ); + aItem.SetBitmapURL( aBgdGraphicPath ); + rCoreSet.Put( aItem ); + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + rCoreSet.ClearItem( nWhich ); + } + } + else // Brush <-> Bitmap gewechselt! + { + CntWallpaperItem aItem( nWhich ); + if ( bIsBrush ) + { + aItem.SetColor( aBgdColor ); + rCoreSet.Put( aItem ); + } + else + { + WallpaperStyle eWallStyle = + SvxBrushItem::GraphicPos2WallpaperStyle( GetGraphicPosition_Impl() ); + aItem.SetStyle( sal::static_int_cast< USHORT >( eWallStyle ) ); + aItem.SetColor( aBgdColor ); + aItem.SetBitmapURL( aBgdGraphicPath ); + rCoreSet.Put( aItem ); + } + + bModified = TRUE; + } + return bModified; +} + +//----------------------------------------------------------------------- + +int SvxBackgroundTabPage::DeactivatePage( SfxItemSet* _pSet ) + +/* [Beschreibung] + + virtuelle Methode, wird beim Deaktivieren gerufen +*/ + +{ + if ( pPageImpl->bIsImportDlgInExecute ) + return KEEP_PAGE; + + if ( _pSet ) + FillItemSet( *_pSet ); + + return LEAVE_PAGE; +} + +//----------------------------------------------------------------------- + +void SvxBackgroundTabPage::PointChanged( Window* , RECT_POINT ) + +/* [Beschreibung] + +*/ + +{ + // muss implementiert werden, damit Position-Control funktioniert +} + +//----------------------------------------------------------------------- + +void SvxBackgroundTabPage::ShowSelector() + +/* [Beschreibung] + +*/ + +{ + if( bAllowShowSelector) + { + aSelectTxt.Show(); + aLbSelect.Show(); + aLbSelect.SetSelectHdl( HDL(SelectHdl_Impl) ); + aBtnLink.SetClickHdl( HDL(FileClickHdl_Impl) ); + aBtnPreview.SetClickHdl( HDL(FileClickHdl_Impl) ); + aBtnBrowse.SetClickHdl( HDL(BrowseHdl_Impl) ); + aBtnArea.SetClickHdl( HDL(RadioClickHdl_Impl) ); + aBtnTile.SetClickHdl( HDL(RadioClickHdl_Impl) ); + aBtnPosition.SetClickHdl( HDL(RadioClickHdl_Impl) ); + + // Verz"ogertes Laden "uber Timer (wg. UI-Update) + pPageImpl->pLoadTimer = new Timer; + pPageImpl->pLoadTimer->SetTimeout( 500 ); // 500ms verz"ogern + pPageImpl->pLoadTimer->SetTimeoutHdl( + LINK( this, SvxBackgroundTabPage, LoadTimerHdl_Impl ) ); + + bAllowShowSelector = FALSE; + + if(nHtmlMode & HTMLMODE_ON) + { + if(!(nHtmlMode & HTMLMODE_GRAPH_POS)) + aBtnPosition.Enable(FALSE); + aBtnArea.Enable(FALSE); + } + } +} + +//------------------------------------------------------------------------ + + +void SvxBackgroundTabPage::RaiseLoadError_Impl() + +/* [Beschreibung] + +*/ + +{ + SfxErrorContext aContext( ERRCTX_SVX_BACKGROUND, + String(), + this, + RID_SVXERRCTX, + &DIALOG_MGR() ); + + ErrorHandler::HandleError( + *new StringErrorInfo( ERRCODE_SVX_GRAPHIC_NOTREADABLE, + aBgdGraphicPath ) ); +} + +//------------------------------------------------------------------------ + +BOOL SvxBackgroundTabPage::LoadLinkedGraphic_Impl() + +/* [Beschreibung] + +*/ + +{ + BOOL bResult = ( aBgdGraphicPath.Len() > 0 ) && + ( GRFILTER_OK == LoadGraphic( aBgdGraphicPath, + aBgdGraphicFilter, + aBgdGraphic ) ); + return bResult; +} + +//------------------------------------------------------------------------ + + +void SvxBackgroundTabPage::FillColorValueSets_Impl() + +/* [Beschreibung] + + F"ullen des Farb-Sets +*/ + +{ + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + const SfxPoolItem* pItem = NULL; + XColorTable* pColorTable = NULL; + const Size aSize15x15 = Size( 15, 15 ); + FASTBOOL bOwn = FALSE; + + if ( pDocSh && ( 0 != ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) ) ) + pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); + + if ( !pColorTable ) + { + bOwn = TRUE; + pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); + } + + if ( pColorTable ) + { + short i = 0; + long nCount = pColorTable->Count(); + XColorEntry* pEntry = NULL; + Color aColWhite( COL_WHITE ); + String aStrWhite( SVX_RES( RID_SVXITEMS_COLOR_WHITE ) ); + WinBits nBits = ( aBackgroundColorSet.GetStyle() | WB_ITEMBORDER | WB_NAMEFIELD | WB_NONEFIELD ); + aBackgroundColorSet.SetText( String( SVX_RES( RID_SVXSTR_TRANSPARENT ) ) ); + aBackgroundColorSet.SetStyle( nBits ); + for ( i = 0; i < nCount; i++ ) + { + pEntry = pColorTable->GetColor(i); + aBackgroundColorSet.InsertItem( i + 1, pEntry->GetColor(), pEntry->GetName() ); + } + + while ( i < 80 ) + { + aBackgroundColorSet.InsertItem( i + 1, aColWhite, aStrWhite ); + i++; + } + + if ( nCount > 80 ) + { + aBackgroundColorSet.SetStyle( nBits | WB_VSCROLL ); + } + } + + if ( bOwn ) + delete pColorTable; + + aBackgroundColorSet.SetColCount( 10 ); + aBackgroundColorSet.SetLineCount( 10 ); + aBackgroundColorSet.CalcWindowSizePixel( aSize15x15 ); + +} + +//------------------------------------------------------------------------ + + + +//------------------------------------------------------------------------ + +void SvxBackgroundTabPage::ShowColorUI_Impl() + +/* [Beschreibung] + + Die Controls f"ur das Einstellen der Grafik ausblenden und die + Controls f"ur die Farbeinstellung einblenden. +*/ + +{ + if( !aBackgroundColorSet.IsVisible() ) + { + aBackgroundColorSet.Show(); + aBackgroundColorBox.Show(); + aBorderWin.Show(); + pPreviewWin1->Show(); + aBtnBrowse.Hide(); + aFtFile.Hide(); + aBtnLink.Hide(); + aBtnPreview.Hide(); + aGbFile.Hide(); + aBtnPosition.Hide(); + aBtnArea.Hide(); + aBtnTile.Hide(); + aWndPosition.Hide(); + aGbPosition.Hide(); + pPreviewWin2->Hide(); + aGraphTransFL.Show(FALSE); + aGraphTransMF.Show(FALSE); + if(bColTransparency) + { + aColTransFT.Show(); + aColTransMF.Show(); + } + } +} + +//------------------------------------------------------------------------ + +void SvxBackgroundTabPage::ShowBitmapUI_Impl() + +/* [Beschreibung] + + Die Controls f"ur die Farbeinstellung ausblenden und die + Controls f"ur das Einstellen der Grafik einblenden. +*/ + +{ + if ( aLbSelect.IsVisible() && + ( + aBackgroundColorSet.IsVisible() + || !aBtnBrowse.IsVisible() ) ) + { + aBackgroundColorSet.Hide(); + aBackgroundColorBox.Hide(); + aBorderWin.Hide(); + pPreviewWin1->Hide(); + aBtnBrowse.Show(); + aFtFile.Show(); + + if ( !bLinkOnly && ! nHtmlMode & HTMLMODE_ON ) + aBtnLink.Show(); + aBtnPreview.Show(); + aGbFile.Show(); + aBtnPosition.Show(); + aBtnArea.Show(); + aBtnTile.Show(); + aWndPosition.Show(); + aGbPosition.Show(); + pPreviewWin2->Show(); + if(bGraphTransparency) + { + aGraphTransFL.Show(); + aGraphTransMF.Show(); + } + aColTransFT.Show(FALSE); + aColTransMF.Show(FALSE); + } +} + +//------------------------------------------------------------------------ + +void SvxBackgroundTabPage::SetGraphicPosition_Impl( SvxGraphicPosition ePos ) + +/* [Beschreibung] + + Die Controls f"ur die Grafikposition einstellen. +*/ + +{ + switch ( ePos ) + { + case GPOS_AREA: + { + aBtnArea.Check(); + aWndPosition.Disable(); + } + break; + + case GPOS_TILED: + { + aBtnTile.Check(); + aWndPosition.Disable(); + } + break; + + default: + { + aBtnPosition.Check(); + aWndPosition.Enable(); + RECT_POINT eNewPos = RP_MM; + + switch ( ePos ) + { + case GPOS_MM: break; + case GPOS_LT: eNewPos = RP_LT; break; + case GPOS_MT: eNewPos = RP_MT; break; + case GPOS_RT: eNewPos = RP_RT; break; + case GPOS_LM: eNewPos = RP_LM; break; + case GPOS_RM: eNewPos = RP_RM; break; + case GPOS_LB: eNewPos = RP_LB; break; + case GPOS_MB: eNewPos = RP_MB; break; + case GPOS_RB: eNewPos = RP_RB; break; + default: ;//prevent warning + } + aWndPosition.SetActualRP( eNewPos ); + } + break; + } + aWndPosition.Invalidate(); +} + +//------------------------------------------------------------------------ + +SvxGraphicPosition SvxBackgroundTabPage::GetGraphicPosition_Impl() + +/* [Beschreibung] + + Die Position der Grafik zur"uckgeben. +*/ + +{ + if ( aBtnTile.IsChecked() ) + return GPOS_TILED; + else if ( aBtnArea.IsChecked() ) + return GPOS_AREA; + else + { + switch ( aWndPosition.GetActualRP() ) + { + case RP_LT: return GPOS_LT; + case RP_MT: return GPOS_MT; + case RP_RT: return GPOS_RT; + case RP_LM: return GPOS_LM; + case RP_MM: return GPOS_MM; + case RP_RM: return GPOS_RM; + case RP_LB: return GPOS_LB; + case RP_MB: return GPOS_MB; + case RP_RB: return GPOS_RB; + } + } + return GPOS_MM; +} + +//----------------------------------------------------------------------- +// Handler +//----------------------------------------------------------------------- + +IMPL_LINK( SvxBackgroundTabPage, BackgroundColorHdl_Impl, ValueSet*, EMPTYARG ) +/* + Handler, called when color selection is changed +*/ +{ + USHORT nItemId = aBackgroundColorSet.GetSelectItemId(); + Color aColor = nItemId ? ( aBackgroundColorSet.GetItemColor( nItemId ) ) : Color( COL_TRANSPARENT ); + aBgdColor = aColor; + pPreviewWin1->NotifyChange( aBgdColor ); + BOOL bEnableTransp = aBgdColor.GetTransparency() < 0xff; + aColTransFT.Enable(bEnableTransp); + aColTransMF.Enable(bEnableTransp); + return 0; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxBackgroundTabPage, SelectHdl_Impl, ListBox*, EMPTYARG ) + +/* [Beschreibung] + +*/ + +{ + if ( 0 == aLbSelect.GetSelectEntryPos() ) + { + ShowColorUI_Impl(); + aParaLBox.Enable(); // Zeichenhintergrund kann keine Bitmap sein + } + else + { + ShowBitmapUI_Impl(); + aParaLBox.Enable(FALSE);// Zeichenhintergrund kann keine Bitmap sein + } + return 0; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxBackgroundTabPage, FileClickHdl_Impl, CheckBox*, pBox ) + +/* [Beschreibung] + +*/ + +{ + if ( &aBtnLink == pBox ) + { + if ( aBtnLink.IsChecked() ) + { + INetURLObject aObj( aBgdGraphicPath ); + String aFilePath; + if ( aObj.GetProtocol() == INET_PROT_FILE ) + aFilePath = aObj.getFSysPath( INetURLObject::FSYS_DETECT ); + else + aFilePath = aBgdGraphicPath; + aFtFile.SetText( aFilePath ); + } + else + aFtFile.SetText( aStrUnlinked ); + } + else if ( &aBtnPreview == pBox ) + { + if ( aBtnPreview.IsChecked() ) + { + if ( !bIsGraphicValid ) + bIsGraphicValid = LoadLinkedGraphic_Impl(); + + if ( bIsGraphicValid ) + { + Bitmap aBmp = aBgdGraphic.GetBitmap(); + pPreviewWin2->NotifyChange( &aBmp ); + } + else + { + if ( aBgdGraphicPath.Len() > 0 ) // nur bei gelinkter Grafik + RaiseLoadError_Impl(); // ein Fehler + pPreviewWin2->NotifyChange( NULL ); + } + } + else + pPreviewWin2->NotifyChange( NULL ); + } + return 0; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxBackgroundTabPage, RadioClickHdl_Impl, RadioButton*, pBtn ) + +/* [Beschreibung] + +*/ + +{ + if ( pBtn == &aBtnPosition ) + { + if ( !aWndPosition.IsEnabled() ) + { + aWndPosition.Enable(); + aWndPosition.Invalidate(); + } + } + else if ( aWndPosition.IsEnabled() ) + { + aWndPosition.Disable(); + aWndPosition.Invalidate(); + } + return 0; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxBackgroundTabPage, BrowseHdl_Impl, PushButton* , EMPTYARG ) + +/* [Beschreibung] + + Handler, gerufen durch das Dr"ucken des Durchsuchen-Buttons. + Grafik/Einf"ugen-Dialog erzeugen, Pfad setzen und starten. +*/ + +{ + if ( pPageImpl->pLoadTimer->IsActive() ) + return 0; + BOOL bHtml = 0 != ( nHtmlMode & HTMLMODE_ON ); + + pImportDlg = new SvxOpenGraphicDialog( aStrBrowse ); + if ( bHtml || bLinkOnly ) + pImportDlg->EnableLink(sal_False); + pImportDlg->SetPath( aBgdGraphicPath, aBtnLink.IsChecked() ); + + pPageImpl->bIsImportDlgInExecute = TRUE; + short nErr = pImportDlg->Execute(); + pPageImpl->bIsImportDlgInExecute = FALSE; + + if( !nErr ) + { + if ( bHtml ) + aBtnLink.Check(); + // wenn Verkn"upfen nicht gecheckt ist und die Vorschau auch nicht, + // dann die Vorschau aktivieren, damit der Anwender sieht, + // welche Grafik er ausgew"ahlt hat + if ( !aBtnLink.IsChecked() && !aBtnPreview.IsChecked() ) + aBtnPreview.Check( TRUE ); + // timer-verz"ogertes Laden der Grafik + pPageImpl->pLoadTimer->Start(); + } + else + DELETEZ( pImportDlg ); + return 0; +} + +//----------------------------------------------------------------------- + +IMPL_LINK( SvxBackgroundTabPage, LoadTimerHdl_Impl, Timer* , pTimer ) + +/* [Beschreibung] + + Verz"ogertes Laden der Grafik. + Grafik wird nur dann geladen, wenn sie unterschiedlich zur + aktuellen Grafik ist. +*/ + +{ + if ( pTimer == pPageImpl->pLoadTimer ) + { + pPageImpl->pLoadTimer->Stop(); + + if ( pImportDlg ) + { + INetURLObject aOld( aBgdGraphicPath ); + INetURLObject aNew( pImportDlg->GetPath() ); + if ( !aBgdGraphicPath.Len() || aNew != aOld ) + { + // neue Datei gew"ahlt + aBgdGraphicPath = pImportDlg->GetPath(); + aBgdGraphicFilter = pImportDlg->GetCurrentFilter(); + BOOL bLink = ( nHtmlMode & HTMLMODE_ON ) || bLinkOnly ? TRUE : pImportDlg->IsAsLink(); + aBtnLink.Check( bLink ); + aBtnLink.Enable(); + + if ( aBtnPreview.IsChecked() ) + { + if( !pImportDlg->GetGraphic(aBgdGraphic) ) + { + bIsGraphicValid = TRUE; + } + else + { + aBgdGraphicFilter.Erase(); + aBgdGraphicPath.Erase(); + bIsGraphicValid = FALSE; + } + } + else + bIsGraphicValid = FALSE; // Grafik erst beim Preview-Click laden + + if ( aBtnPreview.IsChecked() && bIsGraphicValid ) + { + Bitmap aBmp = aBgdGraphic.GetBitmap(); + pPreviewWin2->NotifyChange( &aBmp ); + } + else + pPreviewWin2->NotifyChange( NULL ); + } + + FileClickHdl_Impl( &aBtnLink ); + DELETEZ( pImportDlg ); + } + } + return 0; +} + +//----------------------------------------------------------------------- + +void SvxBackgroundTabPage::ShowTblControl() + +/* [Beschreibung] + +*/ + +{ + aTblLBox .SetSelectHdl( HDL(TblDestinationHdl_Impl) ); + aTblLBox .SelectEntryPos(0); + aTblDesc.Show(); + aTblLBox.Show(); +} + +//----------------------------------------------------------------------- + +void SvxBackgroundTabPage::ShowParaControl(BOOL bCharOnly) +{ + aParaLBox.SetSelectHdl(HDL(ParaDestinationHdl_Impl)); + aParaLBox.SelectEntryPos(0); + if(!bCharOnly) + { + aTblDesc.Show(); + aParaLBox.Show(); + } + aParaLBox.SetData(&aParaLBox); // hier erkennt man, dass dieser Mode eingeschaltet ist +} +//----------------------------------------------------------------------- + +IMPL_LINK( SvxBackgroundTabPage, TblDestinationHdl_Impl, ListBox*, pBox ) + +/* [Beschreibung] + +*/ + +{ + USHORT nSelPos = pBox->GetSelectEntryPos(); + if( pTableBck_Impl && pTableBck_Impl->nActPos != nSelPos) + { + SvxBrushItem** pActItem = new (SvxBrushItem*); + USHORT nWhich = 0; + switch(pTableBck_Impl->nActPos) + { + case TBL_DEST_CELL: + *pActItem = pTableBck_Impl->pCellBrush; + nWhich = pTableBck_Impl->nCellWhich; + break; + case TBL_DEST_ROW: + *pActItem = pTableBck_Impl->pRowBrush; + nWhich = pTableBck_Impl->nRowWhich; + break; + case TBL_DEST_TBL: + *pActItem = pTableBck_Impl->pTableBrush; + nWhich = pTableBck_Impl->nTableWhich; + break; + } + pTableBck_Impl->nActPos = nSelPos; + if(!*pActItem) + *pActItem = new SvxBrushItem(nWhich); + if(0 == aLbSelect.GetSelectEntryPos()) // Brush ausgewaehlt + { + **pActItem = SvxBrushItem( aBgdColor, nWhich ); + } + else + { + SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); + const BOOL bIsLink = aBtnLink.IsChecked(); + + if ( !bIsLink && !bIsGraphicValid ) + bIsGraphicValid = LoadLinkedGraphic_Impl(); + + if ( bIsLink ) + **pActItem = SvxBrushItem( aBgdGraphicPath, + aBgdGraphicFilter, + eNewPos, + (*pActItem)->Which() ); + else + **pActItem = SvxBrushItem( aBgdGraphic, + eNewPos, + (*pActItem)->Which() ); + } + switch(nSelPos) + { + case TBL_DEST_CELL: + *pActItem = pTableBck_Impl->pCellBrush; + aLbSelect.Enable(); + nWhich = pTableBck_Impl->nCellWhich; + break; + case TBL_DEST_ROW: + { + if((nHtmlMode & HTMLMODE_ON) && !(nHtmlMode & HTMLMODE_SOME_STYLES)) + aLbSelect.Disable(); + *pActItem = pTableBck_Impl->pRowBrush; + nWhich = pTableBck_Impl->nRowWhich; + } + break; + case TBL_DEST_TBL: + *pActItem = pTableBck_Impl->pTableBrush; + aLbSelect.Enable(); + nWhich = pTableBck_Impl->nTableWhich; + break; + } + String aUserData = GetUserData(); + if(!*pActItem) + *pActItem = new SvxBrushItem(nWhich); + FillControls_Impl(**pActItem, aUserData); + delete pActItem; + } + return 0; +} + +//----------------------------------------------------------------------- + +IMPL_LINK( SvxBackgroundTabPage, ParaDestinationHdl_Impl, ListBox*, pBox ) +{ + USHORT nSelPos = pBox->GetSelectEntryPos(); + if( pParaBck_Impl && pParaBck_Impl->nActPos != nSelPos) + { + SvxBrushItem** pActItem = new (SvxBrushItem*); + switch(pParaBck_Impl->nActPos) + { + case PARA_DEST_PARA: + *pActItem = pParaBck_Impl->pParaBrush; + break; + case PARA_DEST_CHAR: + *pActItem = pParaBck_Impl->pCharBrush; + break; + } + pParaBck_Impl->nActPos = nSelPos; + if(0 == aLbSelect.GetSelectEntryPos()) // Brush ausgewaehlt + { + USHORT nWhich = (*pActItem)->Which(); + **pActItem = SvxBrushItem( aBgdColor, nWhich ); + } + else + { + SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); + const BOOL bIsLink = aBtnLink.IsChecked(); + + if ( !bIsLink && !bIsGraphicValid ) + bIsGraphicValid = LoadLinkedGraphic_Impl(); + + if ( bIsLink ) + **pActItem = SvxBrushItem( aBgdGraphicPath, + aBgdGraphicFilter, + eNewPos, + (*pActItem)->Which() ); + else + **pActItem = SvxBrushItem( aBgdGraphic, + eNewPos, + (*pActItem)->Which() ); + } + switch(nSelPos) + { + case PARA_DEST_PARA: + *pActItem = pParaBck_Impl->pParaBrush; + aLbSelect.Enable(); + break; + case PARA_DEST_CHAR: + { + *pActItem = pParaBck_Impl->pCharBrush; + aLbSelect.Enable(FALSE); + } + break; + } + String aUserData = GetUserData(); + FillControls_Impl(**pActItem, aUserData); + delete pActItem; + } + return 0; +} + +//----------------------------------------------------------------------- + +void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr, + const String& rUserData ) + +/* [Beschreibung] + +*/ + +{ + SvxGraphicPosition ePos = rBgdAttr.GetGraphicPos(); + const Color& rColor = rBgdAttr.GetColor(); + if(bColTransparency) + { + aColTransMF.SetValue(lcl_TransparencyToPercent(rColor.GetTransparency())); + aColTransMF.SaveValue(); + BOOL bEnableTransp = rColor.GetTransparency() < 0xff; + aColTransFT.Enable(bEnableTransp); + aColTransMF.Enable(bEnableTransp); + //the default setting should be "no transparency" + if(!bEnableTransp) + aColTransMF.SetValue(0); + } + + if ( GPOS_NONE == ePos || !aLbSelect.IsVisible() ) + { + aLbSelect.SelectEntryPos( 0 ); + ShowColorUI_Impl(); + Color aTrColor( COL_TRANSPARENT ); + aBgdColor = rColor; + + USHORT nCol = ( aTrColor != aBgdColor ) ? + GetItemId_Impl( aBackgroundColorSet, aBgdColor ) : 0; + + if( aTrColor != aBgdColor && nCol == 0) + { + aBackgroundColorSet.SetNoSelection(); + } + else + { + aBackgroundColorSet.SelectItem( nCol ); + } + + pPreviewWin1->NotifyChange( aBgdColor ); + if ( aLbSelect.IsVisible() ) // Grafikteil initialisieren + { + aBgdGraphicFilter.Erase(); + aBgdGraphicPath.Erase(); + + if ( !rUserData.Len() ) + aBtnPreview.Check( FALSE ); + aBtnLink.Check( FALSE ); + aBtnLink.Disable(); + pPreviewWin2->NotifyChange( NULL ); + SetGraphicPosition_Impl( GPOS_TILED ); // Kacheln als Default + } + } + else + { + const String* pStrLink = rBgdAttr.GetGraphicLink(); + const String* pStrFilter = rBgdAttr.GetGraphicFilter(); + + aLbSelect.SelectEntryPos( 1 ); + ShowBitmapUI_Impl(); + + if ( pStrLink ) + { +#ifdef DBG_UTIL + INetURLObject aObj( *pStrLink ); + DBG_ASSERT( aObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" ); +#endif + aBgdGraphicPath = *pStrLink; + aBtnLink.Check( TRUE ); + aBtnLink.Enable(); + } + else + { + aBgdGraphicPath.Erase(); + aBtnLink.Check( FALSE ); + aBtnLink.Disable(); + } + + if(bGraphTransparency) + { + const GraphicObject* pObject = rBgdAttr.GetGraphicObject(SfxObjectShell::Current()); + if(pObject) + aGraphTransMF.SetValue(lcl_TransparencyToPercent(pObject->GetAttr().GetTransparency())); + else + aGraphTransMF.SetValue(0); + aGraphTransMF.SaveValue(); + } + + FileClickHdl_Impl( &aBtnLink ); + + if ( pStrFilter ) + aBgdGraphicFilter = *pStrFilter; + else + aBgdGraphicFilter.Erase(); + + if ( !pStrLink || aBtnPreview.IsChecked() ) + { + // Grafik ist im Item vorhanden und muss nicht + // geladen werden: + + const Graphic* pGraphic = + rBgdAttr.GetGraphic( SfxObjectShell::Current() ); + + if ( !pGraphic && aBtnPreview.IsChecked() ) + bIsGraphicValid = LoadLinkedGraphic_Impl(); + else if ( pGraphic ) + { + aBgdGraphic = *pGraphic; + bIsGraphicValid = TRUE; + + if ( !rUserData.Len() ) + aBtnPreview.Check(); + } + else + { + RaiseLoadError_Impl(); + bIsGraphicValid = FALSE; + + if ( !rUserData.Len() ) + aBtnPreview.Check( FALSE ); + } + } + + if ( aBtnPreview.IsChecked() && bIsGraphicValid ) + { + Bitmap aBmp = aBgdGraphic.GetBitmap(); + pPreviewWin2->NotifyChange( &aBmp ); + } + else + pPreviewWin2->NotifyChange( NULL ); + + SetGraphicPosition_Impl( ePos ); + } +} +/* -----------------------------09.08.2002 14:04------------------------------ + + ---------------------------------------------------------------------------*/ +void SvxBackgroundTabPage::EnableTransparency(BOOL bColor, BOOL bGraphic) +{ + bColTransparency = bColor; + bGraphTransparency = bGraphic; + if(bColor) + { + aColTransFT.Show(); + aColTransMF.Show(); + } + if(bGraphic) + { + Size aRectSize(aWndPosition.GetSizePixel()); + Point aRectPos(aWndPosition.GetPosPixel()); + Point aFLPos(aGraphTransFL.GetPosPixel()); + Size aTmp(LogicToPixel(Size(RSC_SP_FLGR_SPACE_Y, RSC_SP_FLGR_SPACE_Y), MAP_APPFONT)); + long nRectHeight = aFLPos.Y() - aRectPos.Y() - aTmp.Height(); + aRectSize.Height() = nRectHeight; + aWndPosition.SetSizePixel(aRectSize); + aWndPosition.Invalidate(); + } +} + +void SvxBackgroundTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 +{ + SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); + if (pFlagItem) + { + UINT32 nFlags=pFlagItem->GetValue(); + if ( ( nFlags & SVX_SHOW_TBLCTL ) == SVX_SHOW_TBLCTL ) + ShowTblControl(); + if ( ( nFlags & SVX_SHOW_PARACTL ) == SVX_SHOW_PARACTL ) + ShowParaControl(); + if ( ( nFlags & SVX_SHOW_SELECTOR ) == SVX_SHOW_SELECTOR ) + ShowSelector(); + if ( ( nFlags & SVX_ENABLE_TRANSPARENCY ) == SVX_ENABLE_TRANSPARENCY ) + EnableTransparency(TRUE, TRUE); + } +} diff --git a/cui/source/tabpages/backgrnd.hrc b/cui/source/tabpages/backgrnd.hrc new file mode 100644 index 000000000000..ce154afa54b6 --- /dev/null +++ b/cui/source/tabpages/backgrnd.hrc @@ -0,0 +1,73 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: backgrnd.hrc,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_BACKGRND_HRC +#define _SVX_BACKGRND_HRC + +// defines ------------------------------------------------------------------ + +#define FT_SELECTOR 1 +#define LB_SELECTOR 1 + +#define SET_BGDCOLOR 10 +#define GB_BGDCOLOR 11 +#define SET_PATTERN 12 +#define GB_COL_PREVIEW 13 +#define SET_PATCOLOR 14 +#define GB_PATCOLOR 15 +#define CT_BORDER 16 +#define FT_PREVIEW 20 +#define WIN_PREVIEW1 21 + +#define BTN_BROWSE 20 +#define FT_FILE 21 +#define BTN_LINK 22 +#define BTN_PREVIEW 23 +#define GB_FILE 24 +#define BTN_AREA 25 +#define BTN_TILE 26 +#define BTN_POSITION 27 +#define WND_POSITION 28 +#define GB_POSITION 29 +#define WIN_PREVIEW2 30 +#define GB_PREVIEW 31 +#define LB_TBL_BOX 32 +#define FT_TBL_DESC 33 +#define LB_PARA_BOX 34 +#define FT_COL_TRANS 35 +#define MF_COL_TRANS 36 +#define FL_GRAPH_TRANS 37 +#define MF_GRAPH_TRANS 38 + +#define STR_BROWSE 1 +#define STR_UNLINKED 2 + + +#endif + diff --git a/cui/source/tabpages/backgrnd.src b/cui/source/tabpages/backgrnd.src new file mode 100644 index 000000000000..c89361a18ae3 --- /dev/null +++ b/cui/source/tabpages/backgrnd.src @@ -0,0 +1,307 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: backgrnd.src,v $ + * $Revision: 1.40 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include +#include "helpid.hrc" +#include +#include "backgrnd.hrc" + // define ---------------------------------------------------------------- +#define UNLINKED_IMAGE \ + Text [ en-US ] = "Unlinked graphic" ; \ + + // pragma ---------------------------------------------------------------- + + // RID_SVXPAGE_BACKGROUND ------------------------------------------------ +TabPage RID_SVXPAGE_BACKGROUND +{ + HelpId = HID_BACKGROUND ; + Hide = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Text [ en-US ] = "Background" ; + FixedText FT_SELECTOR + { + Pos = MAP_APPFONT ( 6 , 4 ) ; + Size = MAP_APPFONT ( 24 , 10 ) ; + Hide = TRUE ; + LeftLabel = TRUE ; + Text [ en-US ] = "A~s" ; + }; + ListBox LB_SELECTOR + { + Hide = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 33 , 3 ) ; + Size = MAP_APPFONT ( 82 , 48 ) ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Color" ; Default ; > ; + < "Graphic" ; Default ; > ; + }; + }; + FixedText FT_TBL_DESC + { + Pos = MAP_APPFONT ( 145 , 5 ) ; + Size = MAP_APPFONT ( 24 , 10 ) ; + Hide = TRUE ; + LeftLabel = TRUE ; + /* ### ACHTUNG: Neuer Text in Resource? Fü~r : F³~r */ + Text [ en-US ] = "F~or" ; + }; + ListBox LB_TBL_BOX + { + Hide = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 172 , 3 ) ; + Size = MAP_APPFONT ( 82 , 48 ) ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Cell" ; > ; + < "Row" ; > ; + < "Table" ; > ; + }; + }; + ListBox LB_PARA_BOX + { + Hide = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 172 , 3 ) ; + Size = MAP_APPFONT ( 82 , 48 ) ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Paragraph" ; > ; + < "Character" ; > ; + }; + }; + // Hintergrund-Brush ---------------------------------------------------- + Control CT_BORDER + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 32 ) ; + Size = MAP_APPFONT ( 116+2 , 145+2 ) ; + DialogControl = TRUE; + }; + Control SET_BGDCOLOR + { + HelpId = HID_BACKGROUND_CTL_BGDCOLORSET ; + Hide = TRUE ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 116 , 145 ) ; + TabStop = TRUE ; + }; + FixedLine GB_BGDCOLOR + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 6 , 21 ) ; + Size = MAP_APPFONT ( 248 , 8) ; + Text [ en-US ] = "Background color" ; + }; + Window WIN_PREVIEW1 + { + Hide = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 166 , 34 ) ; + Size = MAP_APPFONT ( 82 , 40 ) ; + }; + FixedText FT_COL_TRANS + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 166, 74 + RSC_SP_CTRL_Y + 2 ) ; + Size = MAP_APPFONT ( 50 , 8) ; + Text [ en-US ] = "~Transparency" ; + }; + MetricField MF_COL_TRANS + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 218 , 74 + RSC_SP_CTRL_Y ) ; + Size = MAP_APPFONT ( 30 , 12) ; + Border = TRUE ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 5 ; + Minimum = 0; + Maximum = 100; + }; + + // Hintergrund-Bitmap ---------------------------------------------------- + FixedLine GB_FILE + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 6 , 23 ) ; + Size = MAP_APPFONT ( 153 , 8 ) ; + Text [ en-US ] = "File" ; + }; + PushButton BTN_BROWSE + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 6 + RSC_SP_FLGR_INNERBORDER_LEFT , 23 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; + Text [ en-US ] = "~Browse..." ; + }; + CheckBox BTN_LINK + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 6 + RSC_SP_FLGR_INNERBORDER_LEFT + 60 + 2*RSC_SP_CTRL_X, 23 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + 3 ) ; + Size = MAP_APPFONT ( 78 , 10 ) ; + Text [ en-US ] = "~Link" ; + }; + FixedText FT_FILE + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 6 + RSC_SP_FLGR_INNERBORDER_LEFT , 23 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + RSC_CD_PUSHBUTTON_HEIGHT + RSC_SP_CTRL_Y ) ; + Size = MAP_APPFONT ( 141 , 8 ) ; + UNLINKED_IMAGE + }; + FixedLine GB_POSITION + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 6 , 78 ) ; + Size = MAP_APPFONT ( 153 , 8 ) ; + Text [ en-US ] = "Type" ; + }; + RadioButton BTN_POSITION + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 12 , 89 ) ; + Size = MAP_APPFONT ( 49 , 10 ) ; + Text [ en-US ] = "~Position" ; + }; + RadioButton BTN_AREA + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 12 , 103 ) ; + Size = MAP_APPFONT ( 49 , 10 ) ; + /* ### ACHTUNG: Neuer Text in Resource? ~Fläche : ~Flõche */ + Text [ en-US ] = "Ar~ea" ; + }; + RadioButton BTN_TILE + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 12 , 117 ) ; + Size = MAP_APPFONT ( 49 , 10 ) ; + Text [ en-US ] = "~Tile" ; + }; + Control WND_POSITION + { + HelpId = HID_BACKGROUND_CTL_POSITION ; + Hide = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 64 , 89 ) ; + Size = MAP_APPFONT ( 90 , 87 ) ; + TabStop = TRUE ; + }; + FixedLine FL_GRAPH_TRANS + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 6 , 157 ) ; + Size = MAP_APPFONT ( 153 , 8) ; + Text [ en-US ] = "Transparency" ; + }; + MetricField MF_GRAPH_TRANS + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 12 , 168 ) ; + Size = MAP_APPFONT ( 30 , 12) ; + Border = TRUE ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 5 ; + Minimum = 0; + Maximum = 100; + }; + Window WIN_PREVIEW2 + { + Hide = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 170 , 23 + 4 ) ; + Size = MAP_APPFONT ( 81 , 139 ) ; + }; + CheckBox BTN_PREVIEW + { + Pos = MAP_APPFONT ( 170 , 23 + 4 + 139 + RSC_SP_CTRL_GROUP_Y ) ; + Size = MAP_APPFONT ( 141 , 10 ) ; + Text [ en-US ] = "Pre~view" ; + }; + String STR_BROWSE + { + Text [ en-US ] = "Find graphics" ; + }; + String STR_UNLINKED + { + UNLINKED_IMAGE + }; +}; + // ********************************************************************** EOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/bbdlg.cxx b/cui/source/tabpages/bbdlg.cxx new file mode 100644 index 000000000000..d243160facf5 --- /dev/null +++ b/cui/source/tabpages/bbdlg.cxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: bbdlg.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include + +#include +#include "page.hrc" + +#include "bbdlg.hxx" +#include "border.hxx" +#include "backgrnd.hxx" +#include + +// class SvxBorderBackgroundDlg ------------------------------------------ + +SvxBorderBackgroundDlg::SvxBorderBackgroundDlg( Window *pParent, + const SfxItemSet& rCoreSet, + BOOL bEnableSelector ) : + + SfxTabDialog( pParent, SVX_RES( RID_SVXDLG_BBDLG ), &rCoreSet ), + bEnableBackgroundSelector( bEnableSelector ) +{ + FreeResource(); + AddTabPage( RID_SVXPAGE_BORDER, SvxBorderTabPage::Create, 0 ); + AddTabPage( RID_SVXPAGE_BACKGROUND, SvxBackgroundTabPage::Create, 0 ); +} + +// ----------------------------------------------------------------------- + +SvxBorderBackgroundDlg::~SvxBorderBackgroundDlg() +{ +} + +// ----------------------------------------------------------------------- + +void SvxBorderBackgroundDlg::PageCreated( USHORT nPageId, SfxTabPage& rTabPage ) +{ + // Umschalten zwischen Farbe/Grafik ermoeglichen: + + if ( bEnableBackgroundSelector && (RID_SVXPAGE_BACKGROUND == nPageId) ) + ((SvxBackgroundTabPage&)rTabPage).ShowSelector( ); +} + + diff --git a/cui/source/tabpages/bbdlg.src b/cui/source/tabpages/bbdlg.src new file mode 100644 index 000000000000..98b4bf01767e --- /dev/null +++ b/cui/source/tabpages/bbdlg.src @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: bbdlg.src,v $ + * $Revision: 1.22 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include + // pragma ---------------------------------------------------------------- + + // RID_SVXDLG_BBDLG ------------------------------------------------------ +TabDialog RID_SVXDLG_BBDLG +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 328 , 155 ) ; + Text [ en-US ] = "Border / Background" ; + Moveable = TRUE ; + // Closeable = TRUE; hat ja einen OKButton + TabControl 1 + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 2 , 10 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = RID_SVXPAGE_BORDER ; + Text [ en-US ] = "Borders" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_BACKGROUND ; + Text [ en-US ] = "Background" ; + }; + }; + }; +}; + // ********************************************************************** EOF + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx new file mode 100644 index 000000000000..39efc210b6d1 --- /dev/null +++ b/cui/source/tabpages/border.cxx @@ -0,0 +1,1271 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: border.cxx,v $ + * $Revision: 1.39 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include + +#define _SVX_BORDER_CXX + +#include +#include +#include "border.hrc" +#include "helpid.hrc" + +#define LINESTYLE_HTML_MAX 5 + +#include // XColorTable +#include +#include +#include +#include "border.hxx" +#include +#include +#include "svx/htmlmode.hxx" +#include +#include //CHINA001 +#include "svx/flagsdef.hxx" //CHINA001 +#include +#include //CHINA001 +#include +#include "borderconn.hxx" + +// ----------------------------------------------------------------------- + +/* + * [Beschreibung:] + * TabPage zum Einstellen der Rahmen-Attribute. + * Benoetigt + * ein SvxShadowItem: Schatten + * ein SvxBoxItem: Linien links,rechts,oben,unten ), + * ein SvxBoxInfo: Linien vertikal,horizontal, Abstaende, Flags ) + * + * Linien koennen drei Zustaende haben. + * 1. Show ( -> gueltige Werte ) + * 2. Hide ( -> NULL-Pointer ) + * 3. DontCare ( -> gesonderte Valid-Flags im InfoItem ) + */ + +// static ---------------------------------------------------------------- + +static USHORT pRanges[] = +{ + SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_SHADOW, + SID_ATTR_ALIGN_MARGIN, SID_ATTR_ALIGN_MARGIN, + SID_ATTR_BORDER_CONNECT, SID_ATTR_BORDER_CONNECT, + SID_SW_COLLAPSING_BORDERS, SID_SW_COLLAPSING_BORDERS, + SID_ATTR_BORDER_DIAG_TLBR, SID_ATTR_BORDER_DIAG_BLTR, + 0 +}; + +BOOL SvxBorderTabPage::bSync = TRUE; + + +//------------------------------------------------------------------------ + +#define LINE_WIDTH0 (DEF_LINE_WIDTH_0 *100) +#define LINE_WIDTH1 (DEF_LINE_WIDTH_1 *100) +#define LINE_WIDTH2 (DEF_LINE_WIDTH_2 *100) +#define LINE_WIDTH3 (DEF_LINE_WIDTH_3 *100) +#define LINE_WIDTH4 (DEF_LINE_WIDTH_4 *100) +#define LINE_WIDTH5 (DEF_LINE_WIDTH_5 *100) + +#define DLINE0_OUT (DEF_DOUBLE_LINE0_OUT *100) +#define DLINE0_IN (DEF_DOUBLE_LINE0_IN *100) +#define DLINE0_DIST (DEF_DOUBLE_LINE0_DIST *100) + +#define DLINE1_OUT (DEF_DOUBLE_LINE1_OUT *100) +#define DLINE1_IN (DEF_DOUBLE_LINE1_IN *100) +#define DLINE1_DIST (DEF_DOUBLE_LINE1_DIST *100) + +#define DLINE2_OUT (DEF_DOUBLE_LINE2_OUT *100) +#define DLINE2_IN (DEF_DOUBLE_LINE2_IN *100) +#define DLINE2_DIST (DEF_DOUBLE_LINE2_DIST *100) + +#define DLINE3_OUT (DEF_DOUBLE_LINE3_OUT *100) +#define DLINE3_IN (DEF_DOUBLE_LINE3_IN *100) +#define DLINE3_DIST (DEF_DOUBLE_LINE3_DIST *100) + +#define DLINE4_OUT (DEF_DOUBLE_LINE4_OUT *100) +#define DLINE4_IN (DEF_DOUBLE_LINE4_IN *100) +#define DLINE4_DIST (DEF_DOUBLE_LINE4_DIST *100) + +#define DLINE5_OUT (DEF_DOUBLE_LINE5_OUT *100) +#define DLINE5_IN (DEF_DOUBLE_LINE5_IN *100) +#define DLINE5_DIST (DEF_DOUBLE_LINE5_DIST *100) + +#define DLINE6_OUT (DEF_DOUBLE_LINE6_OUT *100) +#define DLINE6_IN (DEF_DOUBLE_LINE6_IN *100) +#define DLINE6_DIST (DEF_DOUBLE_LINE6_DIST *100) + +#define DLINE7_OUT (DEF_DOUBLE_LINE7_OUT *100) +#define DLINE7_IN (DEF_DOUBLE_LINE7_IN *100) +#define DLINE7_DIST (DEF_DOUBLE_LINE7_DIST *100) + +#define DLINE8_OUT (DEF_DOUBLE_LINE8_OUT *100) +#define DLINE8_IN (DEF_DOUBLE_LINE8_IN *100) +#define DLINE8_DIST (DEF_DOUBLE_LINE8_DIST *100) + +#define DLINE9_OUT (DEF_DOUBLE_LINE9_OUT *100) +#define DLINE9_IN (DEF_DOUBLE_LINE9_IN *100) +#define DLINE9_DIST (DEF_DOUBLE_LINE9_DIST *100) + +#define DLINE10_OUT (DEF_DOUBLE_LINE10_OUT *100) +#define DLINE10_IN (DEF_DOUBLE_LINE10_IN *100) +#define DLINE10_DIST (DEF_DOUBLE_LINE10_DIST*100) + +#define RGBCOL(eColorName) (TpBorderRGBColor(eColorName)) + +// LOKALE FUNKTION +// Konvertiert in echte RGB-Farben, damit in den Listboxen +// endlich mal richtig selektiert werden kann. + +Color TpBorderRGBColor( ColorData aColorData ) +{ + Color aRGBColor( aColorData ); + + return( aRGBColor ); +} + +// ----------------------------------------------------------------------- + +Color TpBorderRGBColor( const Color& rColor ) +{ + Color aRGBColor( rColor.GetRed(), + rColor.GetGreen(), + rColor.GetBlue() ); + + return( aRGBColor ); +} + +// ----------------------------------------------------------------------- +void lcl_SetDecimalDigitsTo1(MetricField& rField) +{ + sal_Int64 nMin = rField.Denormalize( rField.GetMin( FUNIT_TWIP ) ); + rField.SetDecimalDigits(1); + rField.SetMin( rField.Normalize( nMin ), FUNIT_TWIP ); +} +// ----------------------------------------------------------------------- + +SvxBorderTabPage::SvxBorderTabPage( Window* pParent, + const SfxItemSet& rCoreAttrs ) + + : SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_BORDER ), rCoreAttrs ), + + aFlBorder ( this, SVX_RES( FL_BORDER ) ), + aDefaultFT ( this, SVX_RES( FT_DEFAULT ) ), + aWndPresets ( this, SVX_RES( WIN_PRESETS ) ), + aUserDefFT ( this, SVX_RES( FT_USERDEF ) ), + aFrameSel ( this, SVX_RES( WIN_FRAMESEL ) ), + + aFlSep1 ( this, SVX_RES( FL_SEPARATOR1 ) ), + aFlLine ( this, SVX_RES( FL_LINE ) ), + aStyleFT ( this, SVX_RES( FT_STYLE ) ), + aLbLineStyle ( this, SVX_RES( LB_LINESTYLE ) ), + aColorFT ( this, SVX_RES( FT_COLOR ) ), + aLbLineColor ( this, SVX_RES( LB_LINECOLOR ) ), + + aFlSep2 ( this, SVX_RES( FL_SEPARATOR2 ) ), + aDistanceFL ( this, SVX_RES( FL_DISTANCE ) ), + aLeftFT ( this, SVX_RES( FT_LEFT ) ), + aLeftMF ( this, SVX_RES( MF_LEFT ) ), + aRightFT ( this, SVX_RES( FT_RIGHT ) ), + aRightMF ( this, SVX_RES( MF_RIGHT ) ), + aTopFT ( this, SVX_RES( FT_TOP ) ), + aTopMF ( this, SVX_RES( MF_TOP ) ), + aBottomFT ( this, SVX_RES( FT_BOTTOM ) ), + aBottomMF ( this, SVX_RES( MF_BOTTOM ) ), + aSynchronizeCB ( this, SVX_RES( CB_SYNC ) ), + + aFlShadow ( this, SVX_RES( FL_SHADOW ) ), + aFtShadowPos ( this, SVX_RES( FT_SHADOWPOS ) ), + aWndShadows ( this, SVX_RES( WIN_SHADOWS ) ), + aFtShadowSize ( this, SVX_RES( FT_SHADOWSIZE ) ), + aEdShadowSize ( this, SVX_RES( ED_SHADOWSIZE ) ), + aFtShadowColor ( this, SVX_RES( FT_SHADOWCOLOR ) ), + aLbShadowColor ( this, SVX_RES( LB_SHADOWCOLOR ) ), + aPropertiesFL ( this, SVX_RES( FL_PROPERTIES ) ), + aMergeWithNextCB( this, SVX_RES( CB_MERGEWITHNEXT ) ), + aMergeAdjacentBordersCB( this, SVX_RES( CB_MERGEADJACENTBORDERS ) ), + aShadowImgLstH( SVX_RES(ILH_SDW_BITMAPS)), + aShadowImgLst( SVX_RES(IL_SDW_BITMAPS)), + aBorderImgLstH( SVX_RES(ILH_PRE_BITMAPS)), + aBorderImgLst( SVX_RES(IL_PRE_BITMAPS)), + nMinValue(0), + nSWMode(0), + mbHorEnabled( false ), + mbVerEnabled( false ), + mbTLBREnabled( false ), + mbBLTREnabled( false ), + mbUseMarginItem( false ) + +{ + // diese Page braucht ExchangeSupport + SetExchangeSupport(); + + /* Use SvxMarginItem instead of margins from SvxBoxItem, if present. + -> Remember this state in mbUseMarginItem, because other special handling + is needed across various functions... */ + mbUseMarginItem = rCoreAttrs.GetItemState(GetWhich(SID_ATTR_ALIGN_MARGIN),TRUE) != SFX_ITEM_UNKNOWN; + + // Metrik einstellen + FieldUnit eFUnit = GetModuleFieldUnit( &rCoreAttrs ); + + if( mbUseMarginItem ) + { + // copied from SvxAlignmentTabPage + switch ( eFUnit ) + { + // #103396# the default value (1pt) can't be accurately represented in + // inches or pica with two decimals, so point is used instead. + case FUNIT_PICA: + case FUNIT_INCH: + case FUNIT_FOOT: + case FUNIT_MILE: + eFUnit = FUNIT_POINT; + break; + + case FUNIT_CM: + case FUNIT_M: + case FUNIT_KM: + eFUnit = FUNIT_MM; + break; + default: ;//prevent warning + } + } + else + { + switch ( eFUnit ) + { + case FUNIT_M: + case FUNIT_KM: + eFUnit = FUNIT_MM; + break; + default: ; //prevent warning + } + } + + SetFieldUnit( aEdShadowSize, eFUnit ); + + USHORT nWhich = GetWhich( SID_ATTR_BORDER_INNER, sal_False ); + BOOL bIsDontCare = TRUE; + + if ( rCoreAttrs.GetItemState( nWhich, TRUE ) >= SFX_ITEM_AVAILABLE ) + { + // Absatz oder Tabelle + const SvxBoxInfoItem* pBoxInfo = + (const SvxBoxInfoItem*)&( rCoreAttrs.Get( nWhich ) ); + + mbHorEnabled = pBoxInfo->IsHorEnabled(); + mbVerEnabled = pBoxInfo->IsVerEnabled(); + mbTLBREnabled = sfx::ItemWrapperHelper::IsKnownItem( rCoreAttrs, SID_ATTR_BORDER_DIAG_TLBR ); + mbBLTREnabled = sfx::ItemWrapperHelper::IsKnownItem( rCoreAttrs, SID_ATTR_BORDER_DIAG_BLTR ); + + if(pBoxInfo->IsDist()) + { + SetFieldUnit(aLeftMF, eFUnit); + SetFieldUnit(aRightMF, eFUnit); + SetFieldUnit(aTopMF, eFUnit); + SetFieldUnit(aBottomMF, eFUnit); + aSynchronizeCB.Check(bSync); + aSynchronizeCB.SetClickHdl(LINK(this, SvxBorderTabPage, SyncHdl_Impl)); + aLeftMF.SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl)); + aRightMF.SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl)); + aTopMF.SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl)); + aBottomMF.SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl)); + } + else + { + aFlSep2.Hide(); + aDistanceFL.Hide(); + aLeftFT.Hide(); + aLeftMF.Hide(); + aRightFT.Hide(); + aRightMF.Hide(); + aTopFT.Hide(); + aTopMF.Hide(); + aBottomFT.Hide(); + aBottomMF.Hide(); + aSynchronizeCB.Hide(); + } + bIsDontCare = !pBoxInfo->IsValid( VALID_DISABLE ); + } + if(!mbUseMarginItem && eFUnit == FUNIT_MM && SFX_MAPUNIT_TWIP == rCoreAttrs.GetPool()->GetMetric( GetWhich( SID_ATTR_BORDER_INNER ) )) + { + //#i91548# changing the number of decimal digits changes the minimum values, too + lcl_SetDecimalDigitsTo1(aLeftMF); + lcl_SetDecimalDigitsTo1(aRightMF); + lcl_SetDecimalDigitsTo1(aTopMF); + lcl_SetDecimalDigitsTo1(aBottomMF); + lcl_SetDecimalDigitsTo1(aEdShadowSize); + } + + svx::FrameSelFlags nFlags = svx::FRAMESEL_OUTER; + if( mbHorEnabled ) + nFlags |= svx::FRAMESEL_INNER_HOR; + if( mbVerEnabled ) + nFlags |= svx::FRAMESEL_INNER_VER; + if( mbTLBREnabled ) + nFlags |= svx::FRAMESEL_DIAG_TLBR; + if( mbBLTREnabled ) + nFlags |= svx::FRAMESEL_DIAG_BLTR; + if( bIsDontCare ) + nFlags |= svx::FRAMESEL_DONTCARE; + aFrameSel.Initialize( nFlags ); + + aFrameSel.SetSelectHdl(LINK(this, SvxBorderTabPage, LinesChanged_Impl)); + aLbLineStyle.SetSelectHdl( LINK( this, SvxBorderTabPage, SelStyleHdl_Impl ) ); + aLbLineColor.SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) ); + aLbShadowColor.SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) ); + aWndPresets.SetSelectHdl( LINK( this, SvxBorderTabPage, SelPreHdl_Impl ) ); + aWndShadows.SetSelectHdl( LINK( this, SvxBorderTabPage, SelSdwHdl_Impl ) ); + + FillValueSets(); + FillLineListBox_Impl(); + + // ColorBox aus der XColorTable fuellen. + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + const SfxPoolItem* pItem = NULL; + XColorTable* pColorTable = NULL; + + DBG_ASSERT( pDocSh, "DocShell not found!" ); + + if ( pDocSh ) + { + pItem = pDocSh->GetItem( SID_COLOR_TABLE ); + if ( pItem != NULL ) + pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); + } + + DBG_ASSERT( pColorTable, "ColorTable not found!" ); + + if ( pColorTable ) + { + // fuellen der Linienfarben-Box + aLbLineColor.SetUpdateMode( FALSE ); + + for ( long i = 0; i < pColorTable->Count(); ++i ) + { + XColorEntry* pEntry = pColorTable->GetColor(i); + aLbLineColor.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + } + aLbLineColor.SetUpdateMode( TRUE ); + // dann nur noch in die Schattenfarben-Box kopieren + aLbShadowColor.CopyEntries( aLbLineColor ); + } + FreeResource(); + + // connections + + bool bSupportsShadow = !SfxItemPool::IsSlot( GetWhich( SID_ATTR_BORDER_SHADOW ) ); + if( bSupportsShadow ) + AddItemConnection( svx::CreateShadowConnection( rCoreAttrs, aWndShadows, aEdShadowSize, aLbShadowColor ) ); + else + HideShadowControls(); + + if( mbUseMarginItem ) + AddItemConnection( svx::CreateMarginConnection( rCoreAttrs, aLeftMF, aRightMF, aTopMF, aBottomMF ) ); + if( aFrameSel.IsBorderEnabled( svx::FRAMEBORDER_TLBR ) ) + AddItemConnection( svx::CreateFrameLineConnection( SID_ATTR_BORDER_DIAG_TLBR, aFrameSel, svx::FRAMEBORDER_TLBR ) ); + if( aFrameSel.IsBorderEnabled( svx::FRAMEBORDER_BLTR ) ) + AddItemConnection( svx::CreateFrameLineConnection( SID_ATTR_BORDER_DIAG_BLTR, aFrameSel, svx::FRAMEBORDER_BLTR ) ); + // --> OD 2005-03-01 #i43593# - item connection doesn't work for Writer, + // because the Writer item sets contain these items + // checkbox "Merge with next paragraph" only visible for Writer dialog format.paragraph + AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_BORDER_CONNECT, aMergeWithNextCB, sfx::ITEMCONN_DEFAULT ) ); + aMergeWithNextCB.Hide(); + // checkbox "Merge adjacent line styles" only visible for Writer dialog format.table + AddItemConnection( new sfx::CheckBoxConnection( SID_SW_COLLAPSING_BORDERS, aMergeAdjacentBordersCB, sfx::ITEMCONN_DEFAULT ) ); + aMergeAdjacentBordersCB.Hide(); + // <-- +} + +// ----------------------------------------------------------------------- + +SvxBorderTabPage::~SvxBorderTabPage() +{ +} + +// ----------------------------------------------------------------------- + +USHORT* SvxBorderTabPage::GetRanges() +{ + return pRanges; +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxBorderTabPage::Create( Window* pParent, + const SfxItemSet& rAttrSet ) +{ + return ( new SvxBorderTabPage( pParent, rAttrSet ) ); +} + +// ----------------------------------------------------------------------- + +void SvxBorderTabPage::ResetFrameLine_Impl( svx::FrameBorderType eBorder, const SvxBorderLine* pCoreLine, bool bValid ) +{ + if( aFrameSel.IsBorderEnabled( eBorder ) ) + { + if( bValid ) + aFrameSel.ShowBorder( eBorder, pCoreLine ); + else + aFrameSel.SetBorderDontCare( eBorder ); + } +} + +// ----------------------------------------------------------------------- + +void SvxBorderTabPage::Reset( const SfxItemSet& rSet ) +{ + SfxTabPage::Reset( rSet ); + + const SvxBoxItem* pBoxItem; + const SvxBoxInfoItem* pBoxInfoItem; + USHORT nWhichBox = GetWhich(SID_ATTR_BORDER_OUTER); + SfxMapUnit eCoreUnit; + const Color aColBlack = RGBCOL(COL_BLACK); + + pBoxItem = (const SvxBoxItem*)GetItem( rSet, SID_ATTR_BORDER_OUTER ); + + + pBoxInfoItem = (const SvxBoxInfoItem*)GetItem( rSet, SID_ATTR_BORDER_INNER, sal_False ); + + eCoreUnit = rSet.GetPool()->GetMetric( nWhichBox ); + + if ( pBoxItem && pBoxInfoItem ) // -> Don't Care + { + ResetFrameLine_Impl( svx::FRAMEBORDER_LEFT, pBoxItem->GetLeft(), pBoxInfoItem->IsValid( VALID_LEFT ) ); + ResetFrameLine_Impl( svx::FRAMEBORDER_RIGHT, pBoxItem->GetRight(), pBoxInfoItem->IsValid( VALID_RIGHT ) ); + ResetFrameLine_Impl( svx::FRAMEBORDER_TOP, pBoxItem->GetTop(), pBoxInfoItem->IsValid( VALID_TOP ) ); + ResetFrameLine_Impl( svx::FRAMEBORDER_BOTTOM, pBoxItem->GetBottom(), pBoxInfoItem->IsValid( VALID_BOTTOM ) ); + ResetFrameLine_Impl( svx::FRAMEBORDER_VER, pBoxInfoItem->GetVert(), pBoxInfoItem->IsValid( VALID_VERT ) ); + ResetFrameLine_Impl( svx::FRAMEBORDER_HOR, pBoxInfoItem->GetHori(), pBoxInfoItem->IsValid( VALID_HORI ) ); + + //------------------- + // Abstand nach innen + //------------------- + if( !mbUseMarginItem ) + { + if ( aLeftMF.IsVisible() ) + { + SetMetricValue( aLeftMF, pBoxInfoItem->GetDefDist(), eCoreUnit ); + SetMetricValue( aRightMF, pBoxInfoItem->GetDefDist(), eCoreUnit ); + SetMetricValue( aTopMF, pBoxInfoItem->GetDefDist(), eCoreUnit ); + SetMetricValue( aBottomMF, pBoxInfoItem->GetDefDist(), eCoreUnit ); + + nMinValue = static_cast(aLeftMF.GetValue()); + + if ( pBoxInfoItem->IsMinDist() ) + { + aLeftMF.SetFirst( nMinValue ); + aRightMF.SetFirst( nMinValue ); + aTopMF.SetFirst( nMinValue ); + aBottomMF.SetFirst( nMinValue ); + } + + if ( pBoxInfoItem->IsDist() ) + { + if( rSet.GetItemState( nWhichBox, TRUE ) >= SFX_ITEM_DEFAULT ) + { + BOOL bIsAnyBorderVisible = aFrameSel.IsAnyBorderVisible(); + if( !bIsAnyBorderVisible || !pBoxInfoItem->IsMinDist() ) + { + aLeftMF.SetMin( 0 ); + aLeftMF.SetFirst( 0 ); + aRightMF.SetMin( 0 ); + aRightMF.SetFirst( 0 ); + aTopMF.SetMin( 0 ); + aTopMF.SetFirst( 0 ); + aBottomMF.SetMin( 0 ); + aBottomMF.SetFirst( 0 ); + } + long nLeftDist = pBoxItem->GetDistance( BOX_LINE_LEFT); + SetMetricValue( aLeftMF, nLeftDist, eCoreUnit ); + long nRightDist = pBoxItem->GetDistance( BOX_LINE_RIGHT); + SetMetricValue( aRightMF, nRightDist, eCoreUnit ); + long nTopDist = pBoxItem->GetDistance( BOX_LINE_TOP); + SetMetricValue( aTopMF, nTopDist, eCoreUnit ); + long nBottomDist = pBoxItem->GetDistance( BOX_LINE_BOTTOM); + SetMetricValue( aBottomMF, nBottomDist, eCoreUnit ); + + // ist der Abstand auf nicht-default gesetzt, + // dann soll der Wert auch nicht + // mehr autom. veraendert werden + + // if the distance is set with no active border line + // or it is null with an active border line + // no automatic changes should be made + const long nDefDist = bIsAnyBorderVisible ? pBoxInfoItem->GetDefDist() : 0; + BOOL bDiffDist = (nDefDist != nLeftDist || + nDefDist != nRightDist || + nDefDist != nTopDist || + nDefDist != nBottomDist); + if((pBoxItem->GetDistance() || + bIsAnyBorderVisible) && bDiffDist ) + { + aLeftMF.SetModifyFlag(); + aRightMF.SetModifyFlag(); + aTopMF.SetModifyFlag(); + aBottomMF.SetModifyFlag(); + } + } + else + { + // #106224# different margins -> do not fill the edits + aLeftMF.SetText( String() ); + aRightMF.SetText( String() ); + aTopMF.SetText( String() ); + aBottomMF.SetText( String() ); + } + } + aLeftMF.SaveValue(); + aRightMF.SaveValue(); + aTopMF.SaveValue(); + aBottomMF.SaveValue(); + } + } + } + else + { + // ResetFrameLine-Aufrufe einsparen: + aFrameSel.HideAllBorders(); + } + + //------------------------------------------------------------- + // Linie/Linienfarbe in Controllern darstellen, wenn eindeutig: + //------------------------------------------------------------- + { + // Do all visible lines show the same line widths? + USHORT nPrim, nDist, nSecn; + bool bWidthEq = aFrameSel.GetVisibleWidth( nPrim, nDist, nSecn ); + if( bWidthEq ) + aLbLineStyle.SelectEntry( nPrim * 100, nSecn * 100, nDist * 100 ); + else + aLbLineStyle.SelectEntryPos( 1 ); + + // Do all visible lines show the same line color? + Color aColor; + bool bColorEq = aFrameSel.GetVisibleColor( aColor ); + if( !bColorEq ) + aColor.SetColor( COL_BLACK ); + + USHORT nSelPos = aLbLineColor.GetEntryPos( aColor ); + if( nSelPos == LISTBOX_ENTRY_NOTFOUND ) + nSelPos = aLbLineColor.InsertEntry( aColor, SVX_RESSTR( RID_SVXSTR_COLOR_USER ) ); + + aLbLineColor.SelectEntryPos( nSelPos ); + aLbLineStyle.SetColor( aColor ); + + // Select all visible lines, if they are all equal. + if( bWidthEq && bColorEq ) + aFrameSel.SelectAllVisibleBorders(); + + // set the current style and color (caches style in control even if nothing is selected) + SelStyleHdl_Impl( &aLbLineStyle ); + SelColHdl_Impl( &aLbLineColor ); + } + + BOOL bEnable = aWndShadows.GetSelectItemId() > 1 ; + aFtShadowSize.Enable(bEnable); + aEdShadowSize.Enable(bEnable); + aFtShadowColor.Enable(bEnable); + aLbShadowColor.Enable(bEnable); + + aWndPresets.SetNoSelection(); + + // - keine Line - sollte nicht selektiert sein + + if ( aLbLineStyle.GetSelectEntryPos() == 0 ) + { + aLbLineStyle.SelectEntryPos( 1 ); + SelStyleHdl_Impl( &aLbLineStyle ); + } + + const SfxPoolItem* pItem; + SfxObjectShell* pShell; + if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem) || + ( 0 != (pShell = SfxObjectShell::Current()) && + 0 != (pItem = pShell->GetItem(SID_HTML_MODE)))) + { + USHORT nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue(); + if(nHtmlMode & HTMLMODE_ON) + { + //Im Html-Mode gibt es keinen Schatten und nur komplette Umrandungen + aFtShadowPos .Disable(); + aWndShadows .Disable(); + aFtShadowSize .Disable(); + aEdShadowSize .Disable(); + aFtShadowColor.Disable(); + aLbShadowColor.Disable(); + aFlShadow .Disable(); + + USHORT nLBCount = aLbLineStyle.GetEntryCount(); + // ist es ein Absatzdialog, dann alle Linien fuer + // Sw-Export, sonst ist die Page nicht da + if(!(mbHorEnabled || mbVerEnabled) + && 0 == (nHtmlMode & HTMLMODE_FULL_ABS_POS) && + SFX_ITEM_AVAILABLE > rSet.GetItemState(GetWhich( SID_ATTR_PARA_LINESPACE ))) + { + for( USHORT i = nLBCount - 1; i > LINESTYLE_HTML_MAX; --i) + aLbLineStyle.RemoveEntry(i); + } + + if( !(nSWMode & SW_BORDER_MODE_TABLE) ) + { + aUserDefFT.Disable(); + aFrameSel.Disable(); + aWndPresets.RemoveItem(3); + aWndPresets.RemoveItem(4); + aWndPresets.RemoveItem(5); + } + } + } + + LinesChanged_Impl( 0 ); +} + +// ----------------------------------------------------------------------- + +int SvxBorderTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if ( _pSet ) + FillItemSet( *_pSet ); + + return LEAVE_PAGE; +} + +// ----------------------------------------------------------------------- + +#define IS_DONT_CARE(a) ((a).GetState() == svx::FRAMESTATE_DONTCARE ) + +BOOL SvxBorderTabPage::FillItemSet( SfxItemSet& rCoreAttrs ) +{ + bool bAttrsChanged = SfxTabPage::FillItemSet( rCoreAttrs ); + + BOOL bPut = TRUE; + USHORT nBoxWhich = GetWhich( SID_ATTR_BORDER_OUTER ); + USHORT nBoxInfoWhich = rCoreAttrs.GetPool()->GetWhich( SID_ATTR_BORDER_INNER, sal_False ); + const SfxItemSet& rOldSet = GetItemSet(); + SvxBoxItem aBoxItem ( nBoxWhich ); + SvxBoxInfoItem aBoxInfoItem ( nBoxInfoWhich ); + SvxBoxItem* pOldBoxItem = (SvxBoxItem*)GetOldItem( rCoreAttrs, SID_ATTR_BORDER_OUTER ); + + SfxMapUnit eCoreUnit = rOldSet.GetPool()->GetMetric( nBoxWhich ); + const SfxPoolItem* pOld = 0; + + //------------------ + // Umrandung aussen: + //------------------ + typedef ::std::pair TBorderPair; + TBorderPair eTypes1[] = { + TBorderPair(svx::FRAMEBORDER_TOP,BOX_LINE_TOP), + TBorderPair(svx::FRAMEBORDER_BOTTOM,BOX_LINE_BOTTOM), + TBorderPair(svx::FRAMEBORDER_LEFT,BOX_LINE_LEFT), + TBorderPair(svx::FRAMEBORDER_RIGHT,BOX_LINE_RIGHT), + }; + + for (sal_uInt32 i=0; i < sizeof(eTypes1)/sizeof(TBorderPair); ++i) + aBoxItem.SetLine( aFrameSel.GetFrameBorderStyle( eTypes1[i].first ), eTypes1[i].second ); + + //-------------------------------- + // Umrandung hor/ver und TableFlag + //-------------------------------- + TBorderPair eTypes2[] = { + TBorderPair(svx::FRAMEBORDER_HOR,BOXINFO_LINE_HORI), + TBorderPair(svx::FRAMEBORDER_VER,BOXINFO_LINE_VERT) + }; + for (sal_uInt32 j=0; j < sizeof(eTypes2)/sizeof(TBorderPair); ++j) + aBoxInfoItem.SetLine( aFrameSel.GetFrameBorderStyle( eTypes2[j].first ), eTypes2[j].second ); + + aBoxInfoItem.EnableHor( mbHorEnabled ); + aBoxInfoItem.EnableVer( mbVerEnabled ); + + //------------------- + // Abstand nach Innen + //------------------- + if( aLeftMF.IsVisible() ) + { + // #i40405# enable distance controls for next dialog call + aBoxInfoItem.SetDist( TRUE ); + + if( !mbUseMarginItem ) + { + // #106224# all edits empty: do nothing + if( aLeftMF.GetText().Len() || aRightMF.GetText().Len() || + aTopMF.GetText().Len() || aBottomMF.GetText().Len() ) + { + if ( ((mbHorEnabled || mbVerEnabled || (nSWMode & SW_BORDER_MODE_TABLE)) && + (aLeftMF.IsModified()||aRightMF.IsModified()|| + aTopMF.IsModified()||aBottomMF.IsModified()) )|| + aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_TOP ) != svx::FRAMESTATE_HIDE + || aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_BOTTOM ) != svx::FRAMESTATE_HIDE + || aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_LEFT ) != svx::FRAMESTATE_HIDE + || aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_RIGHT ) != svx::FRAMESTATE_HIDE ) + { + SvxBoxInfoItem* pOldBoxInfoItem = (SvxBoxInfoItem*)GetOldItem( + rCoreAttrs, SID_ATTR_BORDER_INNER ); + if ( + !pOldBoxItem || + aLeftMF .GetText() != aLeftMF .GetSavedValue() || + aRightMF .GetText() != aRightMF .GetSavedValue() || + aTopMF .GetText() != aTopMF .GetSavedValue() || + aBottomMF.GetText() != aBottomMF.GetSavedValue() || + nMinValue == aLeftMF .GetValue() || + nMinValue == aRightMF .GetValue() || + nMinValue == aTopMF .GetValue() || + nMinValue == aBottomMF.GetValue() || + (pOldBoxInfoItem && !pOldBoxInfoItem->IsValid(VALID_DISTANCE)) + ) + { + aBoxItem.SetDistance( (USHORT)GetCoreValue( aLeftMF, eCoreUnit ), BOX_LINE_LEFT ); + aBoxItem.SetDistance( (USHORT)GetCoreValue( aRightMF, eCoreUnit ), BOX_LINE_RIGHT ); + aBoxItem.SetDistance( (USHORT)GetCoreValue( aTopMF, eCoreUnit ), BOX_LINE_TOP ); + aBoxItem.SetDistance( (USHORT)GetCoreValue( aBottomMF, eCoreUnit ), BOX_LINE_BOTTOM); + } + else + { + aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_LEFT ), BOX_LINE_LEFT); + aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_RIGHT), BOX_LINE_RIGHT); + aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_TOP ), BOX_LINE_TOP); + aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_BOTTOM), BOX_LINE_BOTTOM); + } + aBoxInfoItem.SetValid( VALID_DISTANCE, TRUE ); + } + else + aBoxInfoItem.SetValid( VALID_DISTANCE, FALSE ); + } + } + } + + //------------------------------------------ + // Don't Care Status im Info-Item vermerken: + //------------------------------------------ + aBoxInfoItem.SetValid( VALID_TOP, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_TOP ) != svx::FRAMESTATE_DONTCARE ); + aBoxInfoItem.SetValid( VALID_BOTTOM, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_BOTTOM ) != svx::FRAMESTATE_DONTCARE ); + aBoxInfoItem.SetValid( VALID_LEFT, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_LEFT ) != svx::FRAMESTATE_DONTCARE ); + aBoxInfoItem.SetValid( VALID_RIGHT, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_RIGHT ) != svx::FRAMESTATE_DONTCARE ); + aBoxInfoItem.SetValid( VALID_HORI, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_HOR ) != svx::FRAMESTATE_DONTCARE ); + aBoxInfoItem.SetValid( VALID_VERT, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_VER ) != svx::FRAMESTATE_DONTCARE ); + + // + // Put oder Clear der Umrandung? + // + bPut = TRUE; + + if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nBoxWhich, FALSE )) + { + bPut = aBoxItem != (const SvxBoxItem&)(rOldSet.Get(nBoxWhich)) ? sal_True : sal_False; + } + if( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nBoxInfoWhich, FALSE ) ) + { + const SvxBoxInfoItem& rOldBoxInfo = (const SvxBoxInfoItem&) + rOldSet.Get(nBoxInfoWhich); + + aBoxInfoItem.SetMinDist( rOldBoxInfo.IsMinDist() ); + aBoxInfoItem.SetDefDist( rOldBoxInfo.GetDefDist() ); + bPut |= (aBoxInfoItem != rOldBoxInfo ); + } + + if ( bPut ) + { + if ( !pOldBoxItem || !( *pOldBoxItem == aBoxItem ) ) + { + rCoreAttrs.Put( aBoxItem ); + bAttrsChanged |= TRUE; + } + pOld = GetOldItem( rCoreAttrs, SID_ATTR_BORDER_INNER, sal_False ); + + if ( !pOld || !( *(const SvxBoxInfoItem*)pOld == aBoxInfoItem ) ) + { + rCoreAttrs.Put( aBoxInfoItem ); + bAttrsChanged |= TRUE; + } + } + else + { + rCoreAttrs.ClearItem( nBoxWhich ); + rCoreAttrs.ClearItem( nBoxInfoWhich ); + } + + return bAttrsChanged; +} + +// ----------------------------------------------------------------------- + +void SvxBorderTabPage::HideShadowControls() +{ + aFtShadowPos.Hide(); + aWndShadows.Hide(); + aFtShadowSize.Hide(); + aEdShadowSize.Hide(); + aFtShadowColor.Hide(); + aLbShadowColor.Hide(); + aFlShadow.Hide(); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxBorderTabPage, SelPreHdl_Impl, void *, EMPTYARG ) +{ + const svx::FrameBorderState SHOW = svx::FRAMESTATE_SHOW; + const svx::FrameBorderState HIDE = svx::FRAMESTATE_HIDE; + const svx::FrameBorderState DONT = svx::FRAMESTATE_DONTCARE; + + static const svx::FrameBorderState ppeStates[][ svx::FRAMEBORDERTYPE_COUNT ] = + { /* Left Right Top Bot Hor Ver TLBR BLTR */ +/* ---------------------+--------------------------------------------------- */ +/* IID_PRE_CELL_NONE */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE }, +/* IID_PRE_CELL_ALL */ { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE }, +/* IID_PRE_CELL_LR */ { SHOW, SHOW, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE }, +/* IID_PRE_CELL_TB */ { HIDE, HIDE, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE }, +/* IID_PRE_CELL_L */ { SHOW, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE }, +/* IID_PRE_CELL_DIAG */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, SHOW, SHOW }, +/* IID_PRE_HOR_NONE */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE }, +/* IID_PRE_HOR_OUTER */ { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE }, +/* IID_PRE_HOR_HOR */ { HIDE, HIDE, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE }, +/* IID_PRE_HOR_ALL */ { SHOW, SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE }, +/* IID_PRE_HOR_OUTER2 */ { SHOW, SHOW, SHOW, SHOW, DONT, HIDE, HIDE, HIDE }, +/* IID_PRE_VER_NONE */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE }, +/* IID_PRE_VER_OUTER */ { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE }, +/* IID_PRE_VER_VER */ { SHOW, SHOW, HIDE, HIDE, HIDE, SHOW, HIDE, HIDE }, +/* IID_PRE_VER_ALL */ { SHOW, SHOW, SHOW, SHOW, HIDE, SHOW, HIDE, HIDE }, +/* IID_PRE_VER_OUTER2 */ { SHOW, SHOW, SHOW, SHOW, HIDE, DONT, HIDE, HIDE }, +/* IID_PRE_TABLE_NONE */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE }, +/* IID_PRE_TABLE_OUTER */ { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE }, +/* IID_PRE_TABLE_OUTERH */ { SHOW, SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE }, +/* IID_PRE_TABLE_ALL */ { SHOW, SHOW, SHOW, SHOW, SHOW, SHOW, HIDE, HIDE }, +/* IID_PRE_TABLE_OUTER2 */ { SHOW, SHOW, SHOW, SHOW, DONT, DONT, HIDE, HIDE } + }; + + // first hide and deselect all frame borders + aFrameSel.HideAllBorders(); + aFrameSel.DeselectAllBorders(); + + // Using image ID to find correct line in table above. + USHORT nLine = GetPresetImageId( aWndPresets.GetSelectItemId() ) - 1; + + // Apply all styles from the table + for( int nBorder = 0; nBorder < svx::FRAMEBORDERTYPE_COUNT; ++nBorder ) + { + svx::FrameBorderType eBorder = svx::GetFrameBorderTypeFromIndex( nBorder ); + switch( ppeStates[ nLine ][ nBorder ] ) + { + case SHOW: aFrameSel.SelectBorder( eBorder ); break; + case HIDE: /* nothing to do */ break; + case DONT: aFrameSel.SetBorderDontCare( eBorder ); break; + } + } + + // Show all lines that have been selected above + if( aFrameSel.IsAnyBorderSelected() ) + { + // any visible style, but "no-line" in line list box? -> use hair-line + if( (aLbLineStyle.GetSelectEntryPos() == 0) || (aLbLineStyle.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND) ) + aLbLineStyle.SelectEntryPos( 1 ); + + // set current style to all previously selected lines + SelStyleHdl_Impl( &aLbLineStyle ); + SelColHdl_Impl( &aLbLineColor ); + } + + // Presets ValueSet does not show a selection (used as push buttons). + aWndPresets.SetNoSelection(); + + LinesChanged_Impl( 0 ); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxBorderTabPage, SelSdwHdl_Impl, void *, EMPTYARG ) +{ + BOOL bEnable = aWndShadows.GetSelectItemId() > 1; + aFtShadowSize.Enable(bEnable); + aEdShadowSize.Enable(bEnable); + aFtShadowColor.Enable(bEnable); + aLbShadowColor.Enable(bEnable); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxBorderTabPage, SelColHdl_Impl, ListBox *, pLb ) +{ + ColorListBox* pColLb = (ColorListBox*)pLb; + + if ( pLb == &aLbLineColor ) + { + aFrameSel.SetColorToSelection( pColLb->GetSelectEntryColor() ); + aLbLineStyle.SetColor( pColLb->GetSelectEntryColor() ); + } + + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxBorderTabPage, SelStyleHdl_Impl, ListBox *, pLb ) +{ + if ( pLb == &aLbLineStyle ) + aFrameSel.SetStyleToSelection( + static_cast< USHORT >( aLbLineStyle.GetSelectEntryLine1() / 100 ), + static_cast< USHORT >( aLbLineStyle.GetSelectEntryDistance() / 100 ), + static_cast< USHORT >( aLbLineStyle.GetSelectEntryLine2() / 100 ) ); + + return 0; +} + +// ============================================================================ +// ValueSet handling +// ============================================================================ + +// number of preset images to show +const USHORT SVX_BORDER_PRESET_COUNT = 5; + +// number of shadow images to show +const USHORT SVX_BORDER_SHADOW_COUNT = 5; + +// ---------------------------------------------------------------------------- + +USHORT SvxBorderTabPage::GetPresetImageId( USHORT nValueSetIdx ) const +{ + // table with all sets of predefined border styles + static const USHORT ppnImgIds[][ SVX_BORDER_PRESET_COUNT ] = + { + // simple cell without diagonal frame borders + { IID_PRE_CELL_NONE, IID_PRE_CELL_ALL, IID_PRE_CELL_LR, IID_PRE_CELL_TB, IID_PRE_CELL_L }, + // simple cell with diagonal frame borders + { IID_PRE_CELL_NONE, IID_PRE_CELL_ALL, IID_PRE_CELL_LR, IID_PRE_CELL_TB, IID_PRE_CELL_DIAG }, + // with horizontal inner frame border + { IID_PRE_HOR_NONE, IID_PRE_HOR_OUTER, IID_PRE_HOR_HOR, IID_PRE_HOR_ALL, IID_PRE_HOR_OUTER2 }, + // with vertical inner frame border + { IID_PRE_VER_NONE, IID_PRE_VER_OUTER, IID_PRE_VER_VER, IID_PRE_VER_ALL, IID_PRE_VER_OUTER2 }, + // with horizontal and vertical inner frame borders + { IID_PRE_TABLE_NONE, IID_PRE_TABLE_OUTER, IID_PRE_TABLE_OUTERH, IID_PRE_TABLE_ALL, IID_PRE_TABLE_OUTER2 } + }; + + // find correct set of presets + int nLine = 0; + if( !mbHorEnabled && !mbVerEnabled ) + nLine = (mbTLBREnabled || mbBLTREnabled) ? 1 : 0; + else if( mbHorEnabled && !mbVerEnabled ) + nLine = 2; + else if( !mbHorEnabled && mbVerEnabled ) + nLine = 3; + else + nLine = 4; + + DBG_ASSERT( (1 <= nValueSetIdx) && (nValueSetIdx <= SVX_BORDER_PRESET_COUNT), + "SvxBorderTabPage::GetPresetImageId - wrong index" ); + return ppnImgIds[ nLine ][ nValueSetIdx - 1 ]; +} + +USHORT SvxBorderTabPage::GetPresetStringId( USHORT nValueSetIdx ) const +{ + // string resource IDs for each image (in order of the IID_PRE_* image IDs) + static const USHORT pnStrIds[] = + { + RID_SVXSTR_TABLE_PRESET_NONE, + RID_SVXSTR_PARA_PRESET_ALL, + RID_SVXSTR_PARA_PRESET_LEFTRIGHT, + RID_SVXSTR_PARA_PRESET_TOPBOTTOM, + RID_SVXSTR_PARA_PRESET_ONLYLEFT, + RID_SVXSTR_PARA_PRESET_DIAGONAL, + + RID_SVXSTR_TABLE_PRESET_NONE, + RID_SVXSTR_TABLE_PRESET_ONLYOUTER, + RID_SVXSTR_HOR_PRESET_ONLYHOR, + RID_SVXSTR_TABLE_PRESET_OUTERALL, + RID_SVXSTR_TABLE_PRESET_OUTERINNER, + + RID_SVXSTR_TABLE_PRESET_NONE, + RID_SVXSTR_TABLE_PRESET_ONLYOUTER, + RID_SVXSTR_VER_PRESET_ONLYVER, + RID_SVXSTR_TABLE_PRESET_OUTERALL, + RID_SVXSTR_TABLE_PRESET_OUTERINNER, + + RID_SVXSTR_TABLE_PRESET_NONE, + RID_SVXSTR_TABLE_PRESET_ONLYOUTER, + RID_SVXSTR_TABLE_PRESET_OUTERHORI, + RID_SVXSTR_TABLE_PRESET_OUTERALL, + RID_SVXSTR_TABLE_PRESET_OUTERINNER + }; + return pnStrIds[ GetPresetImageId( nValueSetIdx ) - 1 ]; +} + +// ---------------------------------------------------------------------------- + +void SvxBorderTabPage::FillPresetVS() +{ + // find correct image list + bool bDark = aWndPresets.GetDisplayBackground().GetColor().IsDark(); + ImageList& rImgList = bDark ? aBorderImgLstH : aBorderImgLst; + Size aImgSize( rImgList.GetImage( IID_PRE_CELL_NONE ).GetSizePixel() ); + + // basic initialization of the ValueSet + aWndPresets.SetColCount( SVX_BORDER_PRESET_COUNT ); + aWndPresets.SetStyle( aWndPresets.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER ); + aWndPresets.SetSizePixel( aWndPresets.CalcWindowSizePixel( aImgSize ) ); + + // insert images and help texts + for( USHORT nVSIdx = 1; nVSIdx <= SVX_BORDER_PRESET_COUNT; ++nVSIdx ) + { + aWndPresets.InsertItem( nVSIdx ); + aWndPresets.SetItemImage( nVSIdx, rImgList.GetImage( GetPresetImageId( nVSIdx ) ) ); + aWndPresets.SetItemText( nVSIdx, SVX_RESSTR( GetPresetStringId( nVSIdx ) ) ); + } + + // show the control + aWndPresets.SetNoSelection(); + aWndPresets.Show(); +} + +// ---------------------------------------------------------------------------- + +void SvxBorderTabPage::FillShadowVS() +{ + // find correct image list + bool bDark = aWndShadows.GetDisplayBackground().GetColor().IsDark(); + ImageList& rImgList = bDark ? aShadowImgLstH : aShadowImgLst; + Size aImgSize( rImgList.GetImage( IID_SHADOWNONE ).GetSizePixel() ); + + // basic initialization of the ValueSet + aWndShadows.SetColCount( SVX_BORDER_SHADOW_COUNT ); + aWndShadows.SetStyle( aWndShadows.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER ); + aWndShadows.SetSizePixel( aWndShadows.CalcWindowSizePixel( aImgSize ) ); + + // image resource IDs + static const USHORT pnImgIds[ SVX_BORDER_SHADOW_COUNT ] = + { IID_SHADOWNONE, IID_SHADOW_BOT_RIGHT, IID_SHADOW_TOP_RIGHT, IID_SHADOW_BOT_LEFT, IID_SHADOW_TOP_LEFT }; + // string resource IDs for each image + static const USHORT pnStrIds[ SVX_BORDER_SHADOW_COUNT ] = + { RID_SVXSTR_SHADOW_STYLE_NONE, RID_SVXSTR_SHADOW_STYLE_BOTTOMRIGHT, RID_SVXSTR_SHADOW_STYLE_TOPRIGHT, RID_SVXSTR_SHADOW_STYLE_BOTTOMLEFT, RID_SVXSTR_SHADOW_STYLE_TOPLEFT }; + + // insert images and help texts + for( USHORT nVSIdx = 1; nVSIdx <= SVX_BORDER_SHADOW_COUNT; ++nVSIdx ) + { + aWndShadows.InsertItem( nVSIdx ); + aWndShadows.SetItemImage( nVSIdx, rImgList.GetImage( pnImgIds[ nVSIdx - 1 ] ) ); + aWndShadows.SetItemText( nVSIdx, SVX_RESSTR( pnStrIds[ nVSIdx - 1 ] ) ); + } + + // show the control + aWndShadows.SelectItem( 1 ); + aWndShadows.Show(); +} + +// ---------------------------------------------------------------------------- + +void SvxBorderTabPage::FillValueSets() +{ + FillPresetVS(); + FillShadowVS(); +} + +// ============================================================================ + +void SvxBorderTabPage::FillLineListBox_Impl() +{ + aLbLineStyle.SetUnit( FUNIT_POINT ); + aLbLineStyle.SetSourceUnit( FUNIT_TWIP ); + + // Writer 2.0 Defaults: + aLbLineStyle.InsertEntry( SVX_RESSTR( STR_NONE ) ); + + aLbLineStyle.InsertEntry( LINE_WIDTH0 ); + aLbLineStyle.InsertEntry( LINE_WIDTH5 ); + aLbLineStyle.InsertEntry( LINE_WIDTH1 ); + aLbLineStyle.InsertEntry( LINE_WIDTH2 ); + aLbLineStyle.InsertEntry( LINE_WIDTH3 ); + aLbLineStyle.InsertEntry( LINE_WIDTH4 ); + + // OS: wenn hier neue Linienstaerken zugfuegt werden, dann + // LINESTYLE_HTML_MAX anpassen + + aLbLineStyle.InsertEntry( DLINE0_OUT, DLINE0_IN, DLINE0_DIST ); + aLbLineStyle.InsertEntry( DLINE7_OUT, DLINE7_IN, DLINE7_DIST ); + aLbLineStyle.InsertEntry( DLINE1_OUT, DLINE1_IN, DLINE1_DIST ); + aLbLineStyle.InsertEntry( DLINE2_OUT, DLINE2_IN, DLINE2_DIST ); + aLbLineStyle.InsertEntry( DLINE8_OUT, DLINE8_IN, DLINE8_DIST ); + aLbLineStyle.InsertEntry( DLINE9_OUT, DLINE9_IN, DLINE9_DIST ); + aLbLineStyle.InsertEntry( DLINE10_OUT,DLINE10_IN,DLINE10_DIST); + aLbLineStyle.InsertEntry( DLINE3_OUT, DLINE3_IN, DLINE3_DIST ); + aLbLineStyle.InsertEntry( DLINE4_OUT, DLINE4_IN, DLINE4_DIST ); + aLbLineStyle.InsertEntry( DLINE5_OUT, DLINE5_IN, DLINE5_DIST ); + aLbLineStyle.InsertEntry( DLINE6_OUT, DLINE6_IN, DLINE6_DIST ); +} + +// ----------------------------------------------------------------------- +IMPL_LINK( SvxBorderTabPage, LinesChanged_Impl, void*, EMPTYARG ) +{ + if(!mbUseMarginItem && aLeftMF.IsVisible()) + { + BOOL bLineSet = aFrameSel.IsAnyBorderVisible(); + BOOL bMinAllowed = 0 != (nSWMode & (SW_BORDER_MODE_FRAME|SW_BORDER_MODE_TABLE)); + BOOL bSpaceModified = aLeftMF .IsModified()|| + aRightMF .IsModified()|| + aTopMF .IsModified()|| + aBottomMF.IsModified(); + + if(bLineSet) + { + if(!bMinAllowed) + { + aLeftMF .SetFirst(nMinValue); + aRightMF .SetFirst(nMinValue); + aTopMF .SetFirst(nMinValue); + aBottomMF.SetFirst(nMinValue); + } + if(!bSpaceModified) + { + aLeftMF .SetValue(nMinValue); + aRightMF .SetValue(nMinValue); + aTopMF .SetValue(nMinValue); + aBottomMF.SetValue(nMinValue); + } + } + else + { + aLeftMF .SetMin(0); + aRightMF .SetMin(0); + aTopMF .SetMin(0); + aBottomMF.SetMin(0); + aLeftMF .SetFirst(0); + aRightMF .SetFirst(0); + aTopMF .SetFirst(0); + aBottomMF.SetFirst(0); + if(!bSpaceModified) + { + aLeftMF .SetValue(0); + aRightMF .SetValue(0); + aTopMF .SetValue(0); + aBottomMF.SetValue(0); + } + } + //fuer Tabellen ist alles erlaubt + USHORT nValid = VALID_TOP|VALID_BOTTOM|VALID_LEFT|VALID_RIGHT; + + //fuer Rahmen und Absatz wird das Edit disabled, wenn keine Border gesetzt ist + if(nSWMode & (SW_BORDER_MODE_FRAME|SW_BORDER_MODE_PARA)) + { + if(bLineSet) + { + nValid = (aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_TOP) == svx::FRAMESTATE_SHOW) ? VALID_TOP : 0; + nValid |= (aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_BOTTOM) == svx::FRAMESTATE_SHOW) ? VALID_BOTTOM : 0; + nValid |= (aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_LEFT) == svx::FRAMESTATE_SHOW) ? VALID_LEFT : 0; + nValid |= (aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_RIGHT ) == svx::FRAMESTATE_SHOW) ? VALID_RIGHT : 0; + } + else + nValid = 0; + } + aLeftFT.Enable(0 != (nValid&VALID_LEFT)); + aRightFT.Enable(0 != (nValid&VALID_RIGHT)); + aTopFT.Enable(0 != (nValid&VALID_TOP)); + aBottomFT.Enable(0 != (nValid&VALID_BOTTOM)); + aLeftMF.Enable(0 != (nValid&VALID_LEFT)); + aRightMF.Enable(0 != (nValid&VALID_RIGHT)); + aTopMF.Enable(0 != (nValid&VALID_TOP)); + aBottomMF.Enable(0 != (nValid&VALID_BOTTOM)); + aSynchronizeCB.Enable( aRightMF.IsEnabled() || aTopMF.IsEnabled() || + aBottomMF.IsEnabled() || aLeftMF.IsEnabled() ); + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxBorderTabPage, ModifyDistanceHdl_Impl, MetricField*, pField) +{ + if ( bSync ) + { + sal_Int64 nVal = pField->GetValue(); + if(pField != &aLeftMF) + aLeftMF.SetValue(nVal); + if(pField != &aRightMF) + aRightMF.SetValue(nVal); + if(pField != &aTopMF) + aTopMF.SetValue(nVal); + if(pField != &aBottomMF) + aBottomMF.SetValue(nVal); + } + return 0; +} + +IMPL_LINK( SvxBorderTabPage, SyncHdl_Impl, CheckBox*, pBox) +{ + bSync = pBox->IsChecked(); + return 0; +} + +/* -----------------------------03.06.2002 10:15------------------------------ + + ---------------------------------------------------------------------------*/ +void SvxBorderTabPage::DataChanged( const DataChangedEvent& rDCEvt ) +{ + if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + FillValueSets(); + + SfxTabPage::DataChanged( rDCEvt ); +} + +void SvxBorderTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 +{ + SFX_ITEMSET_ARG (&aSet,pSWModeItem,SfxUInt16Item,SID_SWMODE_TYPE,sal_False); + SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); + if (pSWModeItem) + { + nSWMode = pSWModeItem->GetValue(); + // --> OD 2005-03-01 #i43593# + // show checkbox for format.paragraph + if ( nSWMode == SW_BORDER_MODE_PARA ) + { + aMergeWithNextCB.Show(); + aPropertiesFL.Show(); + } + // show checkbox for format.paragraph + else if ( nSWMode == SW_BORDER_MODE_TABLE ) + { + aMergeAdjacentBordersCB.Show(); + aPropertiesFL.Show(); + } + // <-- + } + if (pFlagItem) + if ( ( pFlagItem->GetValue() & SVX_HIDESHADOWCTL ) == SVX_HIDESHADOWCTL ) + HideShadowControls(); +} + +// ============================================================================ + diff --git a/cui/source/tabpages/border.hrc b/cui/source/tabpages/border.hrc new file mode 100644 index 000000000000..7ba1b8cfc757 --- /dev/null +++ b/cui/source/tabpages/border.hrc @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: border.hrc,v $ + * $Revision: 1.11 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_BORDER_HRC +#define _SVX_BORDER_HRC + +// defines ------------------------------------------------------------------ + +#define FL_BORDER 10 +#define WIN_PRESETS 11 +#define WIN_FRAMESEL 12 + +#define FL_SEPARATOR1 19 +#define FL_LINE 20 +#define LB_LINESTYLE 21 +#define LB_LINECOLOR 22 + +#define FL_SEPARATOR2 29 +#define FL_SHADOW 30 +#define FT_SHADOWPOS 31 +#define WIN_SHADOWS 32 +#define FT_SHADOWSIZE 33 +#define ED_SHADOWSIZE 34 +#define FT_SHADOWCOLOR 35 +#define LB_SHADOWCOLOR 36 + +#define FT_XSPACE 41 +#define ED_XSPACE 42 + +#define FL_DISTANCE 50 +#define FT_LEFT 51 +#define MF_LEFT 52 +#define FT_RIGHT 53 +#define MF_RIGHT 54 +#define FT_TOP 55 +#define MF_TOP 56 +#define FT_BOTTOM 57 +#define MF_BOTTOM 58 +#define CB_SYNC 59 +#define FT_DEFAULT 60 +#define FT_USERDEF 61 +#define FT_STYLE 62 +#define FT_COLOR 63 +#define FL_PROPERTIES 64 +#define CB_MERGEWITHNEXT 65 +#define CB_MERGEADJACENTBORDERS 66 + +// ImageListe fuer ValueSets: +#define IL_PRE_BITMAPS 1400 +#define ILH_PRE_BITMAPS 1401 +#define IID_PRE_CELL_NONE 1 +#define IID_PRE_CELL_ALL 2 +#define IID_PRE_CELL_LR 3 +#define IID_PRE_CELL_TB 4 +#define IID_PRE_CELL_L 5 +#define IID_PRE_CELL_DIAG 6 +#define IID_PRE_HOR_NONE 7 +#define IID_PRE_HOR_OUTER 8 +#define IID_PRE_HOR_HOR 9 +#define IID_PRE_HOR_ALL 10 +#define IID_PRE_HOR_OUTER2 11 +#define IID_PRE_VER_NONE 12 +#define IID_PRE_VER_OUTER 13 +#define IID_PRE_VER_VER 14 +#define IID_PRE_VER_ALL 15 +#define IID_PRE_VER_OUTER2 16 +#define IID_PRE_TABLE_NONE 17 +#define IID_PRE_TABLE_OUTER 18 +#define IID_PRE_TABLE_OUTERH 19 +#define IID_PRE_TABLE_ALL 20 +#define IID_PRE_TABLE_OUTER2 21 + +#define IL_SDW_BITMAPS 1500 +#define ILH_SDW_BITMAPS 1501 +#define IID_SHADOWNONE 1 +#define IID_SHADOW_BOT_RIGHT 2 +#define IID_SHADOW_BOT_LEFT 3 +#define IID_SHADOW_TOP_RIGHT 4 +#define IID_SHADOW_TOP_LEFT 5 + + +#endif + diff --git a/cui/source/tabpages/border.src b/cui/source/tabpages/border.src new file mode 100644 index 000000000000..27f977a6dc3b --- /dev/null +++ b/cui/source/tabpages/border.src @@ -0,0 +1,431 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: border.src,v $ + * $Revision: 1.64 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include "helpid.hrc" +#include +#include "border.hrc" + // pragma ---------------------------------------------------------------- + + // define --------------------------------------------------------------- +#define STD_MASKCOLOR Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; } + // RID_SVXPAGE_BORDER --------------------------------------------------- +TabPage RID_SVXPAGE_BORDER +{ + Size = MAP_APPFONT ( 260 , 185 ) ; + Helpid = HID_BORDER ; + Hide = TRUE ; + Text [ en-US ] = "Borders" ; + FixedLine FL_BORDER + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Line arrangement" ; + }; + FixedText FT_DEFAULT + { + Pos = MAP_APPFONT ( 12, 14) ; + Size = MAP_APPFONT ( 64, 8) ; + Text [ en-US ] = "~Default"; + }; + Control WIN_PRESETS + { + HelpId = HID_BORDER_CTL_PRESETS ; + Hide = TRUE ; + Pos = MAP_APPFONT ( 12 , 25 ) ; + Size = MAP_APPFONT ( 61 , 12 ) ; + TabStop = TRUE ; + }; + FixedText FT_USERDEF + { + Pos = MAP_APPFONT (12 , 41) ; + Size = MAP_APPFONT ( 64, 8) ; + Text [ en-US ] = "~User-defined"; + }; + Control WIN_FRAMESEL + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 53 ) ; + Size = MAP_APPFONT ( 61 , 65 ) ; + TabStop = TRUE ; + Text = "Border control"; + }; + FixedLine FL_SEPARATOR1 + { + Pos = MAP_APPFONT ( 77 , 14 ) ; + Size = MAP_APPFONT ( 4 , 104 ) ; + Vert = TRUE ; + }; + FixedLine FL_LINE + { + Pos = MAP_APPFONT ( 82 , 3 ) ; + Size = MAP_APPFONT ( 83 , 8 ) ; + Text [ en-US ] = "Line" ; + }; + FixedText FT_STYLE + { + Pos = MAP_APPFONT ( 88, 14) ; + Size = MAP_APPFONT ( 77, 8) ; + Text [ en-US ] = "St~yle"; + }; + ListBox LB_LINESTYLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 88 , 25 ) ; + Size = MAP_APPFONT ( 74 , 66 ) ; + }; + FixedText FT_COLOR + { + Pos = MAP_APPFONT ( 88, 95 ) ; + Size = MAP_APPFONT ( 77, 8 ) ; + Text [ en-US ] = "~Color"; + }; + ListBox LB_LINECOLOR + { + Border = TRUE ; + Pos = MAP_APPFONT ( 88 , 106 ) ; + Size = MAP_APPFONT ( 74 , 68 ) ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + FixedLine FL_SEPARATOR2 + { + Pos = MAP_APPFONT ( 166 , 14 ) ; + Size = MAP_APPFONT ( 4 , 104 ) ; + Vert = TRUE ; + }; + FixedText FT_LEFT + { + Pos = MAP_APPFONT ( 177 , 16 ) ; + Size = MAP_APPFONT ( 34 , 8 ) ; + Text [ en-US ] = "~Left"; + }; + MetricField MF_LEFT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 213 , 14 ) ; + Size = MAP_APPFONT ( 38 , 12 ) ; + Spin = TRUE ; + Repeat = TRUE ; + SpinSize = 10 ; + First = 100 ; + Last = 5000 ; + Maximum = 5000 ; + Minimum = 0 ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + }; + FixedText FT_RIGHT + { + Pos = MAP_APPFONT ( 177 , 32 ) ; + Size = MAP_APPFONT ( 34 , 8 ) ; + Text [ en-US ] = "Right"; + }; + MetricField MF_RIGHT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 213 , 30 ) ; + Size = MAP_APPFONT ( 38 , 12 ) ; + Spin = TRUE ; + Repeat = TRUE ; + SpinSize = 10 ; + First = 100 ; + Last = 5000 ; + Maximum = 5000 ; + Minimum = 0 ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + }; + FixedText FT_TOP + { + Pos = MAP_APPFONT ( 177 , 48 ) ; + Size = MAP_APPFONT ( 34 , 8 ) ; + Text [ en-US ] = "~Top"; + }; + MetricField MF_TOP + { + Border = TRUE ; + Pos = MAP_APPFONT ( 213 , 46 ) ; + Size = MAP_APPFONT ( 38 , 12 ) ; + Spin = TRUE ; + Repeat = TRUE ; + SpinSize = 10 ; + First = 100 ; + Last = 5000 ; + Maximum = 5000 ; + Minimum = 0 ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + }; + FixedText FT_BOTTOM + { + Pos = MAP_APPFONT ( 177 , 64 ) ; + Size = MAP_APPFONT ( 34 , 8 ) ; + Text [ en-US ] = "~Bottom"; + }; + MetricField MF_BOTTOM + { + Border = TRUE ; + Pos = MAP_APPFONT ( 213 , 62 ) ; + Size = MAP_APPFONT ( 38 , 12 ) ; + Spin = TRUE ; + Repeat = TRUE ; + SpinSize = 10 ; + First = 100 ; + Last = 5000 ; + Maximum = 5000 ; + Minimum = 0 ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + }; + CheckBox CB_SYNC + { + Pos = MAP_APPFONT ( 177 , 78 ) ; + Size = MAP_APPFONT ( 74 , 10 ) ; + Text [ en-US ] = "Synchronize"; + }; + FixedLine FL_DISTANCE + { + Pos = MAP_APPFONT ( 171 , 3 ) ; + Size = MAP_APPFONT ( 83 , 8 ) ; + Text [ en-US ] = "Spacing to contents"; + }; + + FixedText FT_SHADOWPOS + { + Pos = MAP_APPFONT ( 12 , 133 ) ; + Size = MAP_APPFONT ( 74 , 8 ) ; + Text [ en-US ] = "~Position" ; + }; + Control WIN_SHADOWS + { + HelpId = HID_BORDER_CTL_SHADOWS ; + Hide = TRUE ; + Pos = MAP_APPFONT ( 12 , 144 ) ; + Size = MAP_APPFONT ( 74 , 12 ) ; + TabStop = TRUE ; + }; + FixedText FT_SHADOWSIZE + { + Pos = MAP_APPFONT ( 88 , 133 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "Distan~ce"; + }; + MetricField ED_SHADOWSIZE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 88 , 144 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Spin = TRUE ; + Repeat = TRUE ; + SpinSize = 10 ; + First = 100 ; + Last = 5000 ; + Maximum = 5000 ; + Minimum = 50 ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + }; + FixedText FT_SHADOWCOLOR + { + Pos = MAP_APPFONT ( 177 , 133 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "C~olor" ; + }; + ListBox LB_SHADOWCOLOR + { + Border = TRUE ; + Pos = MAP_APPFONT ( 177 , 144 ) ; + Size = MAP_APPFONT ( 74 , 68 ) ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + FixedLine FL_SHADOW + { + Pos = MAP_APPFONT ( 6 , 123 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Shadow style" ; + }; + FixedLine FL_PROPERTIES + { + Pos = MAP_APPFONT ( 6 , 162 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Hide = TRUE; + Text [ en-US ] = "Properties" ; + }; + CheckBox CB_MERGEWITHNEXT + { + Pos = MAP_APPFONT ( 12 , 173 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + Hide = TRUE; + Text [ en-US ] = "~Merge with next paragraph" ; + }; + CheckBox CB_MERGEADJACENTBORDERS + { + Pos = MAP_APPFONT ( 12 , 173 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + Hide = TRUE; + Text [ en-US ] = "~Merge adjacent line styles" ; + }; + +#define _PREVIEW_IDLIST_ \ + IdList = \ + { \ + IID_PRE_CELL_NONE ; \ + IID_PRE_CELL_ALL ; \ + IID_PRE_CELL_LR ; \ + IID_PRE_CELL_TB ; \ + IID_PRE_CELL_L ; \ + IID_PRE_CELL_DIAG ; \ + IID_PRE_HOR_NONE ; \ + IID_PRE_HOR_OUTER ; \ + IID_PRE_HOR_HOR ; \ + IID_PRE_HOR_ALL ; \ + IID_PRE_HOR_OUTER2 ; \ + IID_PRE_VER_NONE ; \ + IID_PRE_VER_OUTER ; \ + IID_PRE_VER_VER ; \ + IID_PRE_VER_ALL ; \ + IID_PRE_VER_OUTER2 ; \ + IID_PRE_TABLE_NONE ; \ + IID_PRE_TABLE_OUTER ; \ + IID_PRE_TABLE_OUTERH ; \ + IID_PRE_TABLE_ALL ; \ + IID_PRE_TABLE_OUTER2 ; \ + }; \ + IdCount = { 21 ; }; + + ImageList IL_PRE_BITMAPS + { + Prefix = "pr"; + MaskColor = STD_MASKCOLOR ; + _PREVIEW_IDLIST_ + }; + ImageList ILH_PRE_BITMAPS + { + Prefix = "prh"; + MaskColor = STD_MASKCOLOR ; + _PREVIEW_IDLIST_ + }; + +#define _SHADOW_IDLIST_ \ + IdList = \ + { \ + IID_SHADOWNONE ; \ + IID_SHADOW_BOT_RIGHT ; \ + IID_SHADOW_BOT_LEFT ; \ + IID_SHADOW_TOP_RIGHT ; \ + IID_SHADOW_TOP_LEFT ; \ + }; \ + IdCount = { 5 ; }; + + ImageList IL_SDW_BITMAPS + { + Prefix = "sh"; + MaskColor = STD_MASKCOLOR ; + _SHADOW_IDLIST_ + }; + ImageList ILH_SDW_BITMAPS + { + Prefix = "shh"; + MaskColor = STD_MASKCOLOR ; + _SHADOW_IDLIST_ + }; +}; + +String RID_SVXSTR_TABLE_PRESET_NONE +{ + Text [ en-US ] = "Set No Borders" ; +}; +String RID_SVXSTR_TABLE_PRESET_ONLYOUTER +{ + Text [ en-US ] = "Set Outer Border Only" ; +}; +String RID_SVXSTR_TABLE_PRESET_OUTERHORI +{ + Text [ en-US ] = "Set Outer Border and Horizontal Lines" ; +}; +String RID_SVXSTR_TABLE_PRESET_OUTERALL +{ + Text [ en-US ] = "Set Outer Border and All Inner Lines" ; +}; +String RID_SVXSTR_TABLE_PRESET_OUTERINNER +{ + Text [ en-US ] = "Set Outer Border Without Changing Inner Lines" ; +}; +String RID_SVXSTR_PARA_PRESET_DIAGONAL +{ + Text [ en-US ] = "Set Diagonal Lines Only" ; +}; +String RID_SVXSTR_PARA_PRESET_ALL +{ + Text [ en-US ] = "Set All Four Borders" ; +}; +String RID_SVXSTR_PARA_PRESET_LEFTRIGHT +{ + Text [ en-US ] = "Set Left and Right Borders Only" ; +}; +String RID_SVXSTR_PARA_PRESET_TOPBOTTOM +{ + Text [ en-US ] = "Set Top and Bottom Borders Only" ; +}; +String RID_SVXSTR_PARA_PRESET_ONLYLEFT +{ + Text [ en-US ] = "Set Left Border Only" ; +}; +String RID_SVXSTR_HOR_PRESET_ONLYHOR +{ + Text [ en-US ] = "Set Top and Bottom Borders, and All Inner Lines"; +}; +String RID_SVXSTR_VER_PRESET_ONLYVER +{ + Text [ en-US ] = "Set Left and Right Borders, and All Inner Lines"; +}; +String RID_SVXSTR_SHADOW_STYLE_NONE +{ + Text [ en-US ] = "No Shadow" ; +}; +String RID_SVXSTR_SHADOW_STYLE_BOTTOMRIGHT +{ + Text [ en-US ] = "Cast Shadow to Bottom Right" ; +}; +String RID_SVXSTR_SHADOW_STYLE_TOPRIGHT +{ + Text [ en-US ] = "Cast Shadow to Top Right" ; +}; +String RID_SVXSTR_SHADOW_STYLE_BOTTOMLEFT +{ + Text [ en-US ] = "Cast Shadow to Bottom Left" ; +}; +String RID_SVXSTR_SHADOW_STYLE_TOPLEFT +{ + Text [ en-US ] = "Cast Shadow to Top Left" ; +}; + +// ********************************************************************** diff --git a/cui/source/tabpages/borderconn.cxx b/cui/source/tabpages/borderconn.cxx new file mode 100644 index 000000000000..c117e631abbd --- /dev/null +++ b/cui/source/tabpages/borderconn.cxx @@ -0,0 +1,314 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: borderconn.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +#include "borderconn.hxx" +#include +#include "svx/bolnitem.hxx" +#include +#include +#include + +namespace svx { + +/* ============================================================================ +SvxLineItem connection +---------------------- +Connects an SvxLineItem (that contains the style of one line of a cell border) +with one frame border from a svx::FrameSelector control. If this connection is +used, no additional code is needed in the Reset() and FillItemSet() functions +of the tab page. +============================================================================ */ + +// 1st: item wrappers --------------------------------------------------------- + +class LineItemWrapper : public sfx::SingleItemWrapper< SvxLineItem, const SvxBorderLine* > +{ +public: + inline explicit LineItemWrapper( USHORT nSlot ) : SingleItemWrapperType( nSlot ) {} + + virtual const SvxBorderLine* GetItemValue( const SvxLineItem& rItem ) const + { return rItem.GetLine(); } + virtual void SetItemValue( SvxLineItem& rItem, const SvxBorderLine* pLine ) const + { rItem.SetLine( pLine ); } +}; + +// 2nd: control wrappers ------------------------------------------------------ + +class FrameSelectorWrapper : public sfx::SingleControlWrapper< FrameSelector, const SvxBorderLine* > +{ +public: + inline explicit FrameSelectorWrapper( FrameSelector& rFrameSel, FrameBorderType eBorder ) : + SingleControlWrapperType( rFrameSel ), meBorder( eBorder ) {} + + virtual bool IsControlDontKnow() const; + virtual void SetControlDontKnow( bool bSet ); + + virtual const SvxBorderLine* GetControlValue() const; + virtual void SetControlValue( const SvxBorderLine* pLine ); + +private: + FrameBorderType meBorder; /// The line this wrapper works with. +}; + +bool FrameSelectorWrapper::IsControlDontKnow() const +{ + return GetControl().GetFrameBorderState( meBorder ) == FRAMESTATE_DONTCARE; +} + +void FrameSelectorWrapper::SetControlDontKnow( bool bSet ) +{ + if( bSet ) + GetControl().SetBorderDontCare( meBorder ); +} + +const SvxBorderLine* FrameSelectorWrapper::GetControlValue() const +{ + return GetControl().GetFrameBorderStyle( meBorder ); +} + +void FrameSelectorWrapper::SetControlValue( const SvxBorderLine* pLine ) +{ + GetControl().ShowBorder( meBorder, pLine ); +} + +// 3rd: connection ------------------------------------------------------------ + +typedef sfx::ItemControlConnection< LineItemWrapper, FrameSelectorWrapper > FrameLineConnection; + +/* ============================================================================ +SvxMarginItem connection +------------------------ +Connects an SvxMarginItem (that contains the inner margin of all cell borders) +with the numerical edit controls of the SvxBorderTabPage. If this connection is +used, no additional code is needed in the Reset() and FillItemSet() functions +of the tab page. +============================================================================ */ + +// 1st: item wrappers --------------------------------------------------------- + +typedef sfx::IdentItemWrapper< SvxMarginItem > MarginItemWrapper; + +// 2nd: control wrappers ------------------------------------------------------ + +class MarginControlsWrapper : public sfx::MultiControlWrapper< SvxMarginItem > +{ +public: + explicit MarginControlsWrapper( + MetricField& rMfLeft, MetricField& rMfRight, + MetricField& rMfTop, MetricField& rMfBottom ); + + virtual SvxMarginItem GetControlValue() const; + virtual void SetControlValue( SvxMarginItem aItem ); + +private: + sfx::Int16MetricFieldWrapper maLeftWrp; + sfx::Int16MetricFieldWrapper maRightWrp; + sfx::Int16MetricFieldWrapper maTopWrp; + sfx::Int16MetricFieldWrapper maBottomWrp; +}; + +MarginControlsWrapper::MarginControlsWrapper( + MetricField& rMfLeft, MetricField& rMfRight, MetricField& rMfTop, MetricField& rMfBottom ) : + maLeftWrp( rMfLeft, FUNIT_TWIP ), + maRightWrp( rMfRight, FUNIT_TWIP ), + maTopWrp( rMfTop, FUNIT_TWIP ), + maBottomWrp( rMfBottom, FUNIT_TWIP ) +{ + RegisterControlWrapper( maLeftWrp ); + RegisterControlWrapper( maRightWrp ); + RegisterControlWrapper( maTopWrp ); + RegisterControlWrapper( maBottomWrp ); +} + +SvxMarginItem MarginControlsWrapper::GetControlValue() const +{ + SvxMarginItem aItem( GetDefaultValue() ); + if( !maLeftWrp.IsControlDontKnow() ) + aItem.SetLeftMargin( maLeftWrp.GetControlValue() ); + if( !maRightWrp.IsControlDontKnow() ) + aItem.SetRightMargin( maRightWrp.GetControlValue() ); + if( !maTopWrp.IsControlDontKnow() ) + aItem.SetTopMargin( maTopWrp.GetControlValue() ); + if( !maBottomWrp.IsControlDontKnow() ) + aItem.SetBottomMargin( maBottomWrp.GetControlValue() ); + return aItem; +} + +void MarginControlsWrapper::SetControlValue( SvxMarginItem aItem ) +{ + maLeftWrp.SetControlValue( aItem.GetLeftMargin() ); + maRightWrp.SetControlValue( aItem.GetRightMargin() ); + maTopWrp.SetControlValue( aItem.GetTopMargin() ); + maBottomWrp.SetControlValue( aItem.GetBottomMargin() ); +} + +// 3rd: connection ------------------------------------------------------------ + +class MarginConnection : public sfx::ItemControlConnection< MarginItemWrapper, MarginControlsWrapper > +{ +public: + explicit MarginConnection( const SfxItemSet& rItemSet, + MetricField& rMfLeft, MetricField& rMfRight, + MetricField& rMfTop, MetricField& rMfBottom, + sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT ); +}; + +MarginConnection::MarginConnection( const SfxItemSet& rItemSet, + MetricField& rMfLeft, MetricField& rMfRight, MetricField& rMfTop, MetricField& rMfBottom, + sfx::ItemConnFlags nFlags ) : + ItemControlConnectionType( SID_ATTR_ALIGN_MARGIN, new MarginControlsWrapper( rMfLeft, rMfRight, rMfTop, rMfBottom ), nFlags ) +{ + mxCtrlWrp->SetDefaultValue( maItemWrp.GetDefaultItem( rItemSet ) ); +} + +/* ============================================================================ +SvxShadowItem connection +------------------------ +Connects an SvxShadowItem (that contains shadow position, size, and color) with +the controls of the SvxBorderTabPage. If this connection is used, no additional +code is needed in the Reset() and FillItemSet() functions of the tab page. +============================================================================ */ + +// 1st: item wrappers --------------------------------------------------------- + +typedef sfx::IdentItemWrapper< SvxShadowItem > ShadowItemWrapper; + +// 2nd: control wrappers ------------------------------------------------------ + +typedef sfx::ValueSetWrapper< SvxShadowLocation > ShadowPosWrapper; +static const ShadowPosWrapper::MapEntryType s_pShadowPosMap[] = +{ + { 1, SVX_SHADOW_NONE }, + { 2, SVX_SHADOW_BOTTOMRIGHT }, + { 3, SVX_SHADOW_TOPRIGHT }, + { 4, SVX_SHADOW_BOTTOMLEFT }, + { 5, SVX_SHADOW_TOPLEFT }, + { VALUESET_ITEM_NOTFOUND, SVX_SHADOW_NONE } +}; + +class ShadowControlsWrapper : public sfx::MultiControlWrapper< SvxShadowItem > +{ +public: + explicit ShadowControlsWrapper( ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ); + + virtual SvxShadowItem GetControlValue() const; + virtual void SetControlValue( SvxShadowItem aItem ); + +private: + ShadowPosWrapper maPosWrp; + sfx::UShortMetricFieldWrapper maSizeWrp; + sfx::ColorListBoxWrapper maColorWrp; +}; + +ShadowControlsWrapper::ShadowControlsWrapper( + ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ) : + maPosWrp( rVsPos, s_pShadowPosMap ), + maSizeWrp( rMfSize, FUNIT_TWIP ), + maColorWrp( rLbColor ) +{ + RegisterControlWrapper( maPosWrp ); + RegisterControlWrapper( maSizeWrp ); + RegisterControlWrapper( maColorWrp ); +} + +SvxShadowItem ShadowControlsWrapper::GetControlValue() const +{ + SvxShadowItem aItem( GetDefaultValue() ); + if( !maPosWrp.IsControlDontKnow() ) + aItem.SetLocation( maPosWrp.GetControlValue() ); + if( !maSizeWrp.IsControlDontKnow() ) + aItem.SetWidth( maSizeWrp.GetControlValue() ); + if( !maColorWrp.IsControlDontKnow() ) + aItem.SetColor( maColorWrp.GetControlValue() ); + return aItem; +} + +void ShadowControlsWrapper::SetControlValue( SvxShadowItem aItem ) +{ + maPosWrp.SetControlValue( aItem.GetLocation() ); + maSizeWrp.SetControlValue( aItem.GetWidth() ); + maColorWrp.SetControlValue( aItem.GetColor() ); +} + +// 3rd: connection ------------------------------------------------------------ + +class ShadowConnection : public sfx::ItemControlConnection< ShadowItemWrapper, ShadowControlsWrapper > +{ +public: + explicit ShadowConnection( const SfxItemSet& rItemSet, + ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor, + sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT ); +}; + +ShadowConnection::ShadowConnection( const SfxItemSet& rItemSet, + ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor, sfx::ItemConnFlags nFlags ) : + ItemControlConnectionType( SID_ATTR_BORDER_SHADOW, new ShadowControlsWrapper( rVsPos, rMfSize, rLbColor ), nFlags ) +{ + mxCtrlWrp->SetDefaultValue( maItemWrp.GetDefaultItem( rItemSet ) ); +} + +// ============================================================================ +// ============================================================================ + +sfx::ItemConnectionBase* CreateFrameLineConnection( USHORT nSlot, + FrameSelector& rFrameSel, FrameBorderType eBorder, sfx::ItemConnFlags nFlags ) +{ + return new FrameLineConnection( nSlot, new FrameSelectorWrapper( rFrameSel, eBorder ), nFlags ); +} + +sfx::ItemConnectionBase* CreateFrameBoxConnection( USHORT /*nBoxSlot*/, USHORT /*nBoxInfoSlot*/, + FrameSelector& /*rFrameSel*/, FrameBorderType /*eBorder*/, sfx::ItemConnFlags /*nFlags*/ ) +{ + DBG_ERRORFILE( "svx::CreateFrameBoxConnection - not implemented" ); + return 0; +} + +sfx::ItemConnectionBase* CreateMarginConnection( const SfxItemSet& rItemSet, + MetricField& rMfLeft, MetricField& rMfRight, + MetricField& rMfTop, MetricField& rMfBottom, + sfx::ItemConnFlags nFlags ) +{ + return new MarginConnection( rItemSet, rMfLeft, rMfRight, rMfTop, rMfBottom, nFlags ); +} + +sfx::ItemConnectionBase* CreateShadowConnection( const SfxItemSet& rItemSet, + ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor, + sfx::ItemConnFlags nFlags ) +{ + return new ShadowConnection( rItemSet, rVsPos, rMfSize, rLbColor, nFlags ); +} + +// ============================================================================ + +} // namespace svx + diff --git a/cui/source/tabpages/borderconn.hxx b/cui/source/tabpages/borderconn.hxx new file mode 100644 index 000000000000..740c9c79f283 --- /dev/null +++ b/cui/source/tabpages/borderconn.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: borderconn.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVX_BORDERCONN_HXX +#define SVX_BORDERCONN_HXX + +#include +#include + +class SfxItemSet; +class MetricField; +class ValueSet; +class ColorListBox; + +namespace svx { + +class FrameSelector; + +// ============================================================================ + +/** Creates an item connection object that connects an SvxLineItem with an + svx::FrameSelector control. */ +sfx::ItemConnectionBase* CreateFrameLineConnection( USHORT nSlot, + FrameSelector& rFrameSel, FrameBorderType eBorder, + sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT ); + +/** Creates an item connection object that connects an SvxBoxItem and an + SvxBoxInfoItem with an svx::FrameSelector control. */ +sfx::ItemConnectionBase* CreateFrameBoxConnection( + USHORT nBoxSlot, USHORT nBoxInfoSlot, + FrameSelector& rFrameSel, FrameBorderType eBorder, + sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT ); + +/** Creates an item connection object that connects an SvxMarginItem with the + controls of the SvxBorderTabPage. */ +sfx::ItemConnectionBase* CreateMarginConnection( const SfxItemSet& rItemSet, + MetricField& rMfLeft, MetricField& rMfRight, + MetricField& rMfTop, MetricField& rMfBottom, + sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT ); + +/** Creates an item connection object that connects an SvxShadowItem with the + controls of the SvxBorderTabPage. */ +sfx::ItemConnectionBase* CreateShadowConnection( const SfxItemSet& rItemSet, + ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor, + sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT ); + +// ============================================================================ + +} // namespace svx + +#endif + diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx new file mode 100644 index 000000000000..f942e9db6a43 --- /dev/null +++ b/cui/source/tabpages/chardlg.cxx @@ -0,0 +1,4066 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: chardlg.cxx,v $ + * $Revision: 1.102.148.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define _SVX_CHARDLG_CXX +#include + +#include +#include +#include "chardlg.hrc" + +//Erstmal definieren, damit die Klassendeklarionen angezogen werden. + +#include // XColorTable +#include "chardlg.hxx" +#include "svx/fontitem.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "svx/flstitem.hxx" +#include +#include +#include +#include "svx/drawitem.hxx" +#include "svx/dlgutil.hxx" +#include +#include "svx/htmlmode.hxx" +#include "cuicharmap.hxx" +#include "chardlg.h" +#include +#include +#include +#include +#include +#include +#include +#include //CHINA001 +#include //CHINA001 +#include //CHINA001 +#include //CHINA001 +#include "svx/flagsdef.hxx" //CHINA001 + +using namespace ::com::sun::star; + +// define ---------------------------------------------------------------- + +#define ISITEMSET rSet.GetItemState(nWhich)>=SFX_ITEM_DEFAULT + +#define CLEARTITEM rSet.InvalidateItem(nWhich) + +#define LW_NORMAL 0 +#define LW_GESPERRT 1 +#define LW_SCHMAL 2 + +// static ---------------------------------------------------------------- + +static USHORT pNameRanges[] = +{ + SID_ATTR_CHAR_FONT, + SID_ATTR_CHAR_WEIGHT, + SID_ATTR_CHAR_FONTHEIGHT, + SID_ATTR_CHAR_FONTHEIGHT, + SID_ATTR_CHAR_COLOR, + SID_ATTR_CHAR_COLOR, + SID_ATTR_CHAR_LANGUAGE, + SID_ATTR_CHAR_LANGUAGE, + SID_ATTR_CHAR_CJK_FONT, + SID_ATTR_CHAR_CJK_WEIGHT, + SID_ATTR_CHAR_CTL_FONT, + SID_ATTR_CHAR_CTL_WEIGHT, + 0 +}; + +static USHORT pEffectsRanges[] = +{ + SID_ATTR_CHAR_SHADOWED, + SID_ATTR_CHAR_UNDERLINE, + SID_ATTR_CHAR_COLOR, + SID_ATTR_CHAR_COLOR, + SID_ATTR_CHAR_CASEMAP, + SID_ATTR_CHAR_CASEMAP, + SID_ATTR_FLASH, + SID_ATTR_FLASH, + SID_ATTR_CHAR_EMPHASISMARK, + SID_ATTR_CHAR_EMPHASISMARK, + SID_ATTR_CHAR_RELIEF, + SID_ATTR_CHAR_RELIEF, + SID_ATTR_CHAR_HIDDEN, + SID_ATTR_CHAR_HIDDEN, + SID_ATTR_CHAR_OVERLINE, + SID_ATTR_CHAR_OVERLINE, + 0 +}; + +static USHORT pPositionRanges[] = +{ + SID_ATTR_CHAR_KERNING, + SID_ATTR_CHAR_KERNING, + SID_ATTR_CHAR_ESCAPEMENT, + SID_ATTR_CHAR_ESCAPEMENT, + SID_ATTR_CHAR_AUTOKERN, + SID_ATTR_CHAR_AUTOKERN, + SID_ATTR_CHAR_ROTATED, + SID_ATTR_CHAR_SCALEWIDTH, + SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, + SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, + 0 +}; + +static USHORT pTwoLinesRanges[] = +{ + SID_ATTR_CHAR_TWO_LINES, + SID_ATTR_CHAR_TWO_LINES, + 0 +}; + +// C-Funktion ------------------------------------------------------------ + +inline BOOL StateToAttr( TriState aState ) +{ + return ( STATE_CHECK == aState ); +} + +// class SvxCharBasePage ------------------------------------------------- + +inline SvxFont& SvxCharBasePage::GetPreviewFont() +{ + return m_aPreviewWin.GetFont(); +} + +// ----------------------------------------------------------------------- + +inline SvxFont& SvxCharBasePage::GetPreviewCJKFont() +{ + return m_aPreviewWin.GetCJKFont(); +} +// ----------------------------------------------------------------------- + +inline SvxFont& SvxCharBasePage::GetPreviewCTLFont() +{ + return m_aPreviewWin.GetCTLFont(); +} + +// ----------------------------------------------------------------------- + +SvxCharBasePage::SvxCharBasePage( Window* pParent, const ResId& rResId, const SfxItemSet& rItemset, + USHORT nResIdPrewievWin, USHORT nResIdFontTypeFT ): + SfxTabPage( pParent, rResId, rItemset ), + m_aPreviewWin( this, ResId( nResIdPrewievWin, *rResId.GetResMgr() ) ), + m_aFontTypeFT( this, ResId( nResIdFontTypeFT, *rResId.GetResMgr() ) ), + m_bPreviewBackgroundToCharacter( FALSE ) +{ +} + +// ----------------------------------------------------------------------- + +SvxCharBasePage::~SvxCharBasePage() +{ +} + +// ----------------------------------------------------------------------- + +//void SvxCharBasePage::SetPrevFontAttributes( const SfxItemSet& rSet ) +void SvxCharBasePage::ActivatePage( const SfxItemSet& rSet ) +{ + SvxFont& rFont = GetPreviewFont(); + SvxFont& rCJKFont = GetPreviewCJKFont(); + SvxFont& rCTLFont = GetPreviewCTLFont(); + USHORT nWhich; + + nWhich = GetWhich( SID_CHAR_DLG_PREVIEW_STRING ); + if( ISITEMSET ) + { + const SfxStringItem& rItem = ( SfxStringItem& ) rSet.Get( nWhich ); + ::rtl::OUString aString = rItem.GetValue(); + if( aString.getLength() != 0 ) + m_aPreviewWin.SetPreviewText( aString ); + else + m_aPreviewWin.SetFontNameAsPreviewText(); + } + + // Underline + FontUnderline eUnderline; + nWhich = GetWhich( SID_ATTR_CHAR_UNDERLINE ); + if( ISITEMSET ) + { + const SvxUnderlineItem& rItem = ( SvxUnderlineItem& ) rSet.Get( nWhich ); + eUnderline = ( FontUnderline ) rItem.GetValue(); + m_aPreviewWin.SetTextLineColor( rItem.GetColor() ); + } + else + eUnderline = UNDERLINE_NONE; + + rFont.SetUnderline( eUnderline ); + rCJKFont.SetUnderline( eUnderline ); + rCTLFont.SetUnderline( eUnderline ); + + // Overline + FontUnderline eOverline; + nWhich = GetWhich( SID_ATTR_CHAR_OVERLINE ); + if( ISITEMSET ) + { + const SvxOverlineItem& rItem = ( SvxOverlineItem& ) rSet.Get( nWhich ); + eOverline = ( FontUnderline ) rItem.GetValue(); + m_aPreviewWin.SetOverlineColor( rItem.GetColor() ); + } + else + eOverline = UNDERLINE_NONE; + + rFont.SetOverline( eOverline ); + rCJKFont.SetOverline( eOverline ); + rCTLFont.SetOverline( eOverline ); + + // Strikeout + FontStrikeout eStrikeout; + nWhich = GetWhich( SID_ATTR_CHAR_STRIKEOUT ); + if( ISITEMSET ) + { + const SvxCrossedOutItem& rItem = ( SvxCrossedOutItem& ) rSet.Get( nWhich ); + eStrikeout = ( FontStrikeout ) rItem.GetValue(); + } + else + eStrikeout = STRIKEOUT_NONE; + + rFont.SetStrikeout( eStrikeout ); + rCJKFont.SetStrikeout( eStrikeout ); + rCTLFont.SetStrikeout( eStrikeout ); + + // WordLineMode + nWhich = GetWhich( SID_ATTR_CHAR_WORDLINEMODE ); + if( ISITEMSET ) + { + const SvxWordLineModeItem& rItem = ( SvxWordLineModeItem& ) rSet.Get( nWhich ); + rFont.SetWordLineMode( rItem.GetValue() ); + rCJKFont.SetWordLineMode( rItem.GetValue() ); + rCTLFont.SetWordLineMode( rItem.GetValue() ); + } + + // Emphasis + nWhich = GetWhich( SID_ATTR_CHAR_EMPHASISMARK ); + if( ISITEMSET ) + { + const SvxEmphasisMarkItem& rItem = ( SvxEmphasisMarkItem& ) rSet.Get( nWhich ); + FontEmphasisMark eMark = rItem.GetEmphasisMark(); + rFont.SetEmphasisMark( eMark ); + rCJKFont.SetEmphasisMark( eMark ); + rCTLFont.SetEmphasisMark( eMark ); + } + + // Relief + nWhich = GetWhich( SID_ATTR_CHAR_RELIEF ); + if( ISITEMSET ) + { + const SvxCharReliefItem& rItem = ( SvxCharReliefItem& ) rSet.Get( nWhich ); + FontRelief eFontRelief = ( FontRelief ) rItem.GetValue(); + rFont.SetRelief( eFontRelief ); + rCJKFont.SetRelief( eFontRelief ); + rCTLFont.SetRelief( eFontRelief ); + } + + // Effects + nWhich = GetWhich( SID_ATTR_CHAR_CASEMAP ); + if( ISITEMSET ) + { + const SvxCaseMapItem& rItem = ( SvxCaseMapItem& ) rSet.Get( nWhich ); + SvxCaseMap eCaseMap = ( SvxCaseMap ) rItem.GetValue(); + rFont.SetCaseMap( eCaseMap ); + rCJKFont.SetCaseMap( eCaseMap ); + // #i78474# small caps do not exist in CTL fonts + rCTLFont.SetCaseMap( eCaseMap == SVX_CASEMAP_KAPITAELCHEN ? SVX_CASEMAP_NOT_MAPPED : eCaseMap ); + } + + // Outline + nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR ); + if( ISITEMSET ) + { + const SvxContourItem& rItem = ( SvxContourItem& ) rSet.Get( nWhich ); + BOOL bOutline = rItem.GetValue(); + rFont.SetOutline( bOutline ); + rCJKFont.SetOutline( bOutline ); + rCTLFont.SetOutline( bOutline ); + } + + // Shadow + nWhich = GetWhich( SID_ATTR_CHAR_SHADOWED ); + if( ISITEMSET ) + { + const SvxShadowedItem& rItem = ( SvxShadowedItem& ) rSet.Get( nWhich ); + BOOL bShadow = rItem.GetValue(); + rFont.SetShadow( bShadow ); + rCJKFont.SetShadow( bShadow ); + rCTLFont.SetShadow( bShadow ); + } + + // Background + BOOL bTransparent; + nWhich = GetWhich( m_bPreviewBackgroundToCharacter ? SID_ATTR_BRUSH : SID_ATTR_BRUSH_CHAR ); + if( ISITEMSET ) + { + const SvxBrushItem& rBrush = ( SvxBrushItem& ) rSet.Get( nWhich ); + const Color& rColor = rBrush.GetColor(); + bTransparent = rColor.GetTransparency() > 0; + rFont.SetFillColor( rColor ); + rCJKFont.SetFillColor( rColor ); + rCTLFont.SetFillColor( rColor ); + } + else + bTransparent = TRUE; + + rFont.SetTransparent( bTransparent ); + rCJKFont.SetTransparent( bTransparent ); + rCTLFont.SetTransparent( bTransparent ); + + Color aBackCol( COL_TRANSPARENT ); + if( !m_bPreviewBackgroundToCharacter ) + { + nWhich = GetWhich( SID_ATTR_BRUSH ); + if( ISITEMSET ) + { + const SvxBrushItem& rBrush = ( SvxBrushItem& ) rSet.Get( nWhich ); + if( GPOS_NONE == rBrush.GetGraphicPos() ) + aBackCol = rBrush.GetColor(); + } + } + m_aPreviewWin.SetBackColor( aBackCol ); + + // Font + SetPrevFont( rSet, SID_ATTR_CHAR_FONT, rFont ); + SetPrevFont( rSet, SID_ATTR_CHAR_CJK_FONT, rCJKFont ); + SetPrevFont( rSet, SID_ATTR_CHAR_CTL_FONT, rCTLFont ); + + // Style + SetPrevFontStyle( rSet, SID_ATTR_CHAR_POSTURE, SID_ATTR_CHAR_WEIGHT, rFont ); + SetPrevFontStyle( rSet, SID_ATTR_CHAR_CJK_POSTURE, SID_ATTR_CHAR_CJK_WEIGHT, rCJKFont ); + SetPrevFontStyle( rSet, SID_ATTR_CHAR_CTL_POSTURE, SID_ATTR_CHAR_CTL_WEIGHT, rCTLFont ); + + // Size + SetPrevFontSize( rSet, SID_ATTR_CHAR_FONTHEIGHT, rFont ); + SetPrevFontSize( rSet, SID_ATTR_CHAR_CJK_FONTHEIGHT, rCJKFont ); + SetPrevFontSize( rSet, SID_ATTR_CHAR_CTL_FONTHEIGHT, rCTLFont ); + + // Color + nWhich = GetWhich( SID_ATTR_CHAR_COLOR ); + if( ISITEMSET ) + { + const SvxColorItem& rItem = ( SvxColorItem& ) rSet.Get( nWhich ); + Color aCol( rItem.GetValue() ); + rFont.SetColor( aCol ); + rCJKFont.SetColor( aCol ); + rCTLFont.SetColor( aCol ); + + m_aPreviewWin.AutoCorrectFontColor(); // handle color COL_AUTO + } + + // Kerning + nWhich = GetWhich( SID_ATTR_CHAR_KERNING ); + if( ISITEMSET ) + { + const SvxKerningItem& rItem = ( SvxKerningItem& ) rSet.Get( nWhich ); + short nKern = ( short ) + LogicToLogic( rItem.GetValue(), ( MapUnit ) rSet.GetPool()->GetMetric( nWhich ), MAP_TWIP ); + rFont.SetFixKerning( nKern ); + rCJKFont.SetFixKerning( nKern ); + rCTLFont.SetFixKerning( nKern ); + } + + // Escapement + nWhich = GetWhich( SID_ATTR_CHAR_ESCAPEMENT ); + const BYTE nProp = 100; + short nEsc; + BYTE nEscProp; + if( ISITEMSET ) + { + const SvxEscapementItem& rItem = ( SvxEscapementItem& ) rSet.Get( nWhich ); + nEsc = rItem.GetEsc(); + nEscProp = rItem.GetProp(); + + if( nEsc == DFLT_ESC_AUTO_SUPER ) + nEsc = DFLT_ESC_SUPER; + else if( nEsc == DFLT_ESC_AUTO_SUB ) + nEsc = DFLT_ESC_SUB; + } + else + { + nEsc = 0; + nEscProp = 100; + } + + SetPrevFontEscapement( nProp, nEscProp, nEsc ); + + // Font width scale + SetPrevFontWidthScale( rSet ); + + m_aPreviewWin.Invalidate(); +} + +// ----------------------------------------------------------------------- + +void SvxCharBasePage::SetPrevFontSize( const SfxItemSet& rSet, USHORT nSlot, SvxFont& rFont ) +{ + USHORT nWhich = GetWhich( nSlot ); + long nH; + if( rSet.GetItemState( nWhich ) >= SFX_ITEM_SET ) + { + nH = LogicToLogic( ( ( SvxFontHeightItem& ) rSet.Get( nWhich ) ).GetHeight(), + ( MapUnit ) rSet.GetPool()->GetMetric( nWhich ), + MAP_TWIP ); + } + else + nH = 240; // as default 12pt + + rFont.SetSize( Size( 0, nH ) ); +} + +// ----------------------------------------------------------------------- + +void SvxCharBasePage::SetPrevFont( const SfxItemSet& rSet, USHORT nSlot, SvxFont& rFont ) +{ + USHORT nWhich = GetWhich( nSlot ); + if( ISITEMSET ) + { + const SvxFontItem& rFontItem = ( SvxFontItem& ) rSet.Get( nWhich ); + rFont.SetFamily( rFontItem.GetFamily() ); + rFont.SetName( rFontItem.GetFamilyName() ); + rFont.SetPitch( rFontItem.GetPitch() ); + rFont.SetCharSet( rFontItem.GetCharSet() ); + rFont.SetStyleName( rFontItem.GetStyleName() ); + } +} + +// ----------------------------------------------------------------------- + +void SvxCharBasePage::SetPrevFontStyle( const SfxItemSet& rSet, USHORT nPosture, USHORT nWeight, SvxFont& rFont ) +{ + USHORT nWhich = GetWhich( nPosture ); + if( ISITEMSET ) + { + const SvxPostureItem& rItem = ( SvxPostureItem& ) rSet.Get( nWhich ); + rFont.SetItalic( ( FontItalic ) rItem.GetValue() != ITALIC_NONE ? ITALIC_NORMAL : ITALIC_NONE ); + } + + nWhich = GetWhich( nWeight ); + if( ISITEMSET ) + { + SvxWeightItem& rItem = ( SvxWeightItem& ) rSet.Get( nWhich ); + rFont.SetWeight( ( FontWeight ) rItem.GetValue() != WEIGHT_NORMAL ? WEIGHT_BOLD : WEIGHT_NORMAL ); + } +} + +// ----------------------------------------------------------------------- + +void SvxCharBasePage::SetPrevFontWidthScale( const SfxItemSet& rSet ) +{ + USHORT nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH ); + if( ISITEMSET ) + { + const SvxCharScaleWidthItem& rItem = ( SvxCharScaleWidthItem& ) rSet.Get( nWhich ); + + m_aPreviewWin.SetFontWidthScale( rItem.GetValue() ); + } +} + +// ----------------------------------------------------------------------- +namespace +{ + // ----------------------------------------------------------------------- + void setPrevFontEscapement(SvxFont& _rFont,BYTE nProp, BYTE nEscProp, short nEsc ) + { + _rFont.SetPropr( nProp ); + _rFont.SetProprRel( nEscProp ); + _rFont.SetEscapement( nEsc ); + } + // ----------------------------------------------------------------------- + // ----------------------------------------------------------------------- +} +// ----------------------------------------------------------------------- + +void SvxCharBasePage::SetPrevFontEscapement( BYTE nProp, BYTE nEscProp, short nEsc ) +{ + setPrevFontEscapement(GetPreviewFont(),nProp,nEscProp,nEsc); + setPrevFontEscapement(GetPreviewCJKFont(),nProp,nEscProp,nEsc); + setPrevFontEscapement(GetPreviewCTLFont(),nProp,nEscProp,nEsc); + m_aPreviewWin.Invalidate(); +} + +// SvxCharNamePage_Impl -------------------------------------------------- + +struct SvxCharNamePage_Impl +{ + Timer m_aUpdateTimer; + String m_aNoStyleText; + String m_aTransparentText; + const FontList* m_pFontList; + USHORT m_nExtraEntryPos; + BOOL m_bMustDelete; + BOOL m_bInSearchMode; + + SvxCharNamePage_Impl() : + + m_pFontList ( NULL ), + m_nExtraEntryPos( LISTBOX_ENTRY_NOTFOUND ), + m_bMustDelete ( FALSE ), + m_bInSearchMode ( FALSE ) + + { + m_aUpdateTimer.SetTimeout( 350 ); + } + + ~SvxCharNamePage_Impl() + { + if ( m_bMustDelete ) + delete m_pFontList; + } +}; + +// class SvxCharNamePage ------------------------------------------------- + +SvxCharNamePage::SvxCharNamePage( Window* pParent, const SfxItemSet& rInSet ) : + + SvxCharBasePage( pParent, SVX_RES( RID_SVXPAGE_CHAR_NAME ), rInSet, WIN_CHAR_PREVIEW, FT_CHAR_FONTTYPE ), + m_pImpl ( new SvxCharNamePage_Impl ) +{ + m_pImpl->m_aNoStyleText = String( SVX_RES( STR_CHARNAME_NOSTYLE ) ); + m_pImpl->m_aTransparentText = String( SVX_RES( STR_CHARNAME_TRANSPARENT ) ); + + SvtLanguageOptions aLanguageOptions; + sal_Bool bCJK = ( aLanguageOptions.IsCJKFontEnabled() || aLanguageOptions.IsCTLFontEnabled() ); + + m_pWestLine = new FixedLine( this, SVX_RES( FL_WEST ) ); + m_pWestFontNameFT = new FixedText( this, SVX_RES( bCJK ? FT_WEST_NAME : FT_WEST_NAME_NOCJK ) ); + m_pWestFontNameLB = new FontNameBox( this, SVX_RES( bCJK ? LB_WEST_NAME : LB_WEST_NAME_NOCJK ) ); + m_pWestFontStyleFT = new FixedText( this, SVX_RES( bCJK ? FT_WEST_STYLE : FT_WEST_STYLE_NOCJK ) ); + m_pWestFontStyleLB = new FontStyleBox( this, SVX_RES( bCJK ? LB_WEST_STYLE : LB_WEST_STYLE_NOCJK ) ); + m_pWestFontSizeFT = new FixedText( this, SVX_RES( bCJK ? FT_WEST_SIZE : FT_WEST_SIZE_NOCJK ) ); + m_pWestFontSizeLB = new FontSizeBox( this, SVX_RES( bCJK ? LB_WEST_SIZE : LB_WEST_SIZE_NOCJK ) ); + + if( !bCJK ) + { + m_pColorFL = new FixedLine( this, SVX_RES( FL_COLOR2 ) ); + m_pColorFT = new FixedText( this, SVX_RES( FT_COLOR2 ) ); + m_pColorLB = new ColorListBox( this, SVX_RES( LB_COLOR2 ) ); + } + + m_pWestFontLanguageFT = new FixedText( this, SVX_RES( bCJK ? FT_WEST_LANG : FT_WEST_LANG_NOCJK ) ); + m_pWestFontLanguageLB = new SvxLanguageBox( this, SVX_RES( bCJK ? LB_WEST_LANG : LB_WEST_LANG_NOCJK ) ); + + m_pEastLine = new FixedLine( this, SVX_RES( FL_EAST ) ); + m_pEastFontNameFT = new FixedText( this, SVX_RES( FT_EAST_NAME ) ); + m_pEastFontNameLB = new FontNameBox( this, SVX_RES( LB_EAST_NAME ) ); + m_pEastFontStyleFT = new FixedText( this, SVX_RES( FT_EAST_STYLE ) ); + m_pEastFontStyleLB = new FontStyleBox( this, SVX_RES( LB_EAST_STYLE ) ); + m_pEastFontSizeFT = new FixedText( this, SVX_RES( FT_EAST_SIZE ) ); + m_pEastFontSizeLB = new FontSizeBox( this, SVX_RES( LB_EAST_SIZE ) ); + m_pEastFontLanguageFT = new FixedText( this, SVX_RES( FT_EAST_LANG ) ); + m_pEastFontLanguageLB = new SvxLanguageBox( this, SVX_RES( LB_EAST_LANG ) ); + + m_pCTLLine = new FixedLine( this, SVX_RES( FL_CTL ) ); + m_pCTLFontNameFT = new FixedText( this, SVX_RES( FT_CTL_NAME ) ); + m_pCTLFontNameLB = new FontNameBox( this, SVX_RES( LB_CTL_NAME ) ); + m_pCTLFontStyleFT = new FixedText( this, SVX_RES( FT_CTL_STYLE ) ); + m_pCTLFontStyleLB = new FontStyleBox( this, SVX_RES( LB_CTL_STYLE ) ); + m_pCTLFontSizeFT = new FixedText( this, SVX_RES( FT_CTL_SIZE ) ); + m_pCTLFontSizeLB = new FontSizeBox( this, SVX_RES( LB_CTL_SIZE ) ); + m_pCTLFontLanguageFT = new FixedText( this, SVX_RES( FT_CTL_LANG ) ); + m_pCTLFontLanguageLB = new SvxLanguageBox( this, SVX_RES( LB_CTL_LANG ) ); + + if( bCJK ) + { + m_pColorFL = new FixedLine( this, SVX_RES( FL_COLOR2 ) ); + m_pColorFT = new FixedText( this, SVX_RES( FT_COLOR2 ) ); + m_pColorLB = new ColorListBox( this, SVX_RES( LB_COLOR2 ) ); + } + + m_pWestLine ->Show( bCJK ); + m_pColorFL ->Show( bCJK ); + + bCJK = aLanguageOptions.IsCJKFontEnabled(); + m_pEastLine ->Show( bCJK ); + m_pEastFontNameFT ->Show( bCJK ); + m_pEastFontNameLB ->Show( bCJK ); + m_pEastFontStyleFT ->Show( bCJK ); + m_pEastFontStyleLB ->Show( bCJK ); + m_pEastFontSizeFT ->Show( bCJK ); + m_pEastFontSizeLB ->Show( bCJK ); + m_pEastFontLanguageFT ->Show( bCJK ); + m_pEastFontLanguageLB ->Show( bCJK ); + + sal_Bool bShowCTL = aLanguageOptions.IsCTLFontEnabled(); + if ( bShowCTL && !bCJK ) + { + // move CTL controls to the places of the CJK controls, if these controls aren't visible + m_pCTLLine ->SetPosPixel( m_pEastLine->GetPosPixel() ); + m_pCTLFontNameFT ->SetPosPixel( m_pEastFontNameFT->GetPosPixel() ); + m_pCTLFontNameLB ->SetPosPixel( m_pEastFontNameLB->GetPosPixel() ); + m_pCTLFontStyleFT ->SetPosPixel( m_pEastFontStyleFT->GetPosPixel() ); + m_pCTLFontStyleLB ->SetPosPixel( m_pEastFontStyleLB->GetPosPixel() ); + m_pCTLFontSizeFT ->SetPosPixel( m_pEastFontSizeFT->GetPosPixel() ); + m_pCTLFontSizeLB ->SetPosPixel( m_pEastFontSizeLB->GetPosPixel() ); + m_pCTLFontLanguageFT ->SetPosPixel( m_pEastFontLanguageFT->GetPosPixel() ); + m_pCTLFontLanguageLB ->SetPosPixel( m_pEastFontLanguageLB->GetPosPixel() ); + } + m_pCTLLine ->Show( bShowCTL ); + m_pCTLFontNameFT ->Show( bShowCTL ); + m_pCTLFontNameLB ->Show( bShowCTL ); + m_pCTLFontStyleFT ->Show( bShowCTL ); + m_pCTLFontStyleLB ->Show( bShowCTL ); + m_pCTLFontSizeFT ->Show( bShowCTL ); + m_pCTLFontSizeLB ->Show( bShowCTL ); + m_pCTLFontLanguageFT ->Show( bShowCTL ); + m_pCTLFontLanguageLB ->Show( bShowCTL ); + + FreeResource(); + + m_pWestFontLanguageLB->SetLanguageList( LANG_LIST_WESTERN, TRUE, FALSE, TRUE ); + m_pEastFontLanguageLB->SetLanguageList( LANG_LIST_CJK, TRUE, FALSE, TRUE ); + m_pCTLFontLanguageLB->SetLanguageList( LANG_LIST_CTL, TRUE, FALSE, TRUE ); + + Initialize(); +} + +// ----------------------------------------------------------------------- + +SvxCharNamePage::~SvxCharNamePage() +{ + delete m_pImpl; + + delete m_pWestLine; + delete m_pWestFontNameFT; + delete m_pWestFontNameLB; + delete m_pWestFontStyleFT; + delete m_pWestFontStyleLB; + delete m_pWestFontSizeFT; + delete m_pWestFontSizeLB; + delete m_pWestFontLanguageFT; + delete m_pWestFontLanguageLB; + + delete m_pEastLine; + delete m_pEastFontNameFT; + delete m_pEastFontNameLB; + delete m_pEastFontStyleFT; + delete m_pEastFontStyleLB; + delete m_pEastFontSizeFT; + delete m_pEastFontSizeLB; + delete m_pEastFontLanguageFT; + delete m_pEastFontLanguageLB; + + delete m_pCTLLine; + delete m_pCTLFontNameFT; + delete m_pCTLFontNameLB; + delete m_pCTLFontStyleFT; + delete m_pCTLFontStyleLB; + delete m_pCTLFontSizeFT; + delete m_pCTLFontSizeLB; + delete m_pCTLFontLanguageFT; + delete m_pCTLFontLanguageLB; + + delete m_pColorFL; + delete m_pColorFT; + delete m_pColorLB; +} + +// ----------------------------------------------------------------------- + +void SvxCharNamePage::Initialize() +{ + // to handle the changes of the other pages + SetExchangeSupport(); + + // fill the color box + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + //DBG_ASSERT( pDocSh, "DocShell not found!" ); + XColorTable* pColorTable = NULL; + FASTBOOL bKillTable = FALSE; + const SfxPoolItem* pItem = NULL; + + if ( pDocSh ) + { + pItem = pDocSh->GetItem( SID_COLOR_TABLE ); + if ( pItem != NULL ) + pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); + } + + if ( !pColorTable ) + { + pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); + bKillTable = TRUE; + } + + m_pColorLB->SetUpdateMode( FALSE ); + + { + SfxPoolItem* pDummy; + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocSh ); + if( !pFrame || SFX_ITEM_DEFAULT > pFrame->GetBindings().QueryState( + SID_ATTR_AUTO_COLOR_INVALID, pDummy )) + m_pColorLB->InsertEntry( Color( COL_AUTO ), + SVX_RESSTR( RID_SVXSTR_AUTOMATIC )); + } + for ( long i = 0; i < pColorTable->Count(); i++ ) + { + XColorEntry* pEntry = pColorTable->GetColor(i); + m_pColorLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + } + + m_pColorLB->SetUpdateMode( TRUE ); + + if ( bKillTable ) + delete pColorTable; + + m_pColorLB->SetSelectHdl( LINK( this, SvxCharNamePage, ColorBoxSelectHdl_Impl ) ); + + Link aLink = LINK( this, SvxCharNamePage, FontModifyHdl_Impl ); + m_pWestFontNameLB->SetModifyHdl( aLink ); + m_pWestFontStyleLB->SetModifyHdl( aLink ); + m_pWestFontSizeLB->SetModifyHdl( aLink ); + m_pEastFontNameLB->SetModifyHdl( aLink ); + m_pEastFontStyleLB->SetModifyHdl( aLink ); + m_pEastFontSizeLB->SetModifyHdl( aLink ); + m_pCTLFontNameLB->SetModifyHdl( aLink ); + m_pCTLFontStyleLB->SetModifyHdl( aLink ); + m_pCTLFontSizeLB->SetModifyHdl( aLink ); + + m_pImpl->m_aUpdateTimer.SetTimeoutHdl( LINK( this, SvxCharNamePage, UpdateHdl_Impl ) ); + + m_pColorFL->Hide(); + m_pColorFT->Hide(); + m_pColorLB->Hide(); +} + +// ----------------------------------------------------------------------- + +const FontList* SvxCharNamePage::GetFontList() const +{ + if ( !m_pImpl->m_pFontList ) + { + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + const SfxPoolItem* pItem; + + /* #110771# SvxFontListItem::GetFontList can return NULL */ + if ( pDocSh ) + { + pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ); + if ( pItem != NULL ) + { + DBG_ASSERT(NULL != ( (SvxFontListItem*)pItem )->GetFontList(), + "Where is the font list?"); + m_pImpl->m_pFontList = static_cast(pItem )->GetFontList()->Clone(); + m_pImpl->m_bMustDelete = TRUE; + } + } + if(!m_pImpl->m_pFontList) + { + m_pImpl->m_pFontList = + new FontList( Application::GetDefaultDevice() ); + m_pImpl->m_bMustDelete = TRUE; + } + } + + return m_pImpl->m_pFontList; +} + +// ----------------------------------------------------------------------------- +namespace +{ + FontInfo calcFontInfo( SvxFont& _rFont, + SvxCharNamePage* _pPage, + const FontNameBox* _pFontNameLB, + const FontStyleBox* _pFontStyleLB, + const FontSizeBox* _pFontSizeLB, + const FontList* _pFontList, + USHORT _nFontWhich, + USHORT _nFontHeightWhich) + { + Size aSize = _rFont.GetSize(); + aSize.Width() = 0; + FontInfo aFontInfo; + String sFontName(_pFontNameLB->GetText()); + BOOL bFontAvailable = _pFontList->IsAvailable( sFontName ); + if(bFontAvailable || _pFontNameLB->GetSavedValue() != sFontName) + aFontInfo = _pFontList->Get( sFontName, _pFontStyleLB->GetText() ); + else + { + //get the font from itemset + SfxItemState eState = _pPage->GetItemSet().GetItemState( _nFontWhich ); + if ( eState >= SFX_ITEM_DEFAULT ) + { + const SvxFontItem* pFontItem = (const SvxFontItem*)&( _pPage->GetItemSet().Get( _nFontWhich ) ); + aFontInfo.SetName(pFontItem->GetFamilyName()); + aFontInfo.SetStyleName(pFontItem->GetStyleName()); + aFontInfo.SetFamily(pFontItem->GetFamily()); + aFontInfo.SetPitch(pFontItem->GetPitch()); + aFontInfo.SetCharSet(pFontItem->GetCharSet()); + } + } + if ( _pFontSizeLB->IsRelative() ) + { + DBG_ASSERT( _pPage->GetItemSet().GetParent(), "No parent set" ); + const SvxFontHeightItem& rOldItem = (SvxFontHeightItem&)_pPage->GetItemSet().GetParent()->Get( _nFontHeightWhich ); + + // alter Wert, skaliert + long nHeight; + if ( _pFontSizeLB->IsPtRelative() ) + nHeight = rOldItem.GetHeight() + PointToTwips( static_cast(_pFontSizeLB->GetValue() / 10) ); + else + nHeight = static_cast(rOldItem.GetHeight() * _pFontSizeLB->GetValue() / 100); + + // Umrechnung in twips fuer das Beispiel-Window + aSize.Height() = + ItemToControl( nHeight, _pPage->GetItemSet().GetPool()->GetMetric( _nFontHeightWhich ), SFX_FUNIT_TWIP ); + } + else if ( _pFontSizeLB->GetText().Len() ) + aSize.Height() = PointToTwips( static_cast(_pFontSizeLB->GetValue() / 10) ); + else + aSize.Height() = 200; // default 10pt + aFontInfo.SetSize( aSize ); + + _rFont.SetFamily( aFontInfo.GetFamily() ); + _rFont.SetName( aFontInfo.GetName() ); + _rFont.SetStyleName( aFontInfo.GetStyleName() ); + _rFont.SetPitch( aFontInfo.GetPitch() ); + _rFont.SetCharSet( aFontInfo.GetCharSet() ); + _rFont.SetWeight( aFontInfo.GetWeight() ); + _rFont.SetItalic( aFontInfo.GetItalic() ); + _rFont.SetSize( aFontInfo.GetSize() ); + + return aFontInfo; + } +} + +// ----------------------------------------------------------------------- + +void SvxCharNamePage::UpdatePreview_Impl() +{ + SvxFont& rFont = GetPreviewFont(); + SvxFont& rCJKFont = GetPreviewCJKFont(); + SvxFont& rCTLFont = GetPreviewCTLFont(); + // Size + Size aSize = rFont.GetSize(); + aSize.Width() = 0; + Size aCJKSize = rCJKFont.GetSize(); + aCJKSize.Width() = 0; + Size aCTLSize = rCTLFont.GetSize(); + aCTLSize.Width() = 0; + // Font + const FontList* pFontList = GetFontList(); + FontInfo aFontInfo = + calcFontInfo(rFont,this,m_pWestFontNameLB,m_pWestFontStyleLB,m_pWestFontSizeLB,pFontList,GetWhich( SID_ATTR_CHAR_FONT ),GetWhich( SID_ATTR_CHAR_FONTHEIGHT )); + + calcFontInfo(rCJKFont,this,m_pEastFontNameLB,m_pEastFontStyleLB,m_pEastFontSizeLB,pFontList,GetWhich( SID_ATTR_CHAR_CJK_FONT ),GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT )); + + calcFontInfo(rCTLFont,this,m_pCTLFontNameLB,m_pCTLFontStyleLB,m_pCTLFontSizeLB,pFontList,GetWhich( SID_ATTR_CHAR_CTL_FONT ),GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT )); + + m_aPreviewWin.Invalidate(); + m_aFontTypeFT.SetText( pFontList->GetFontMapText( aFontInfo ) ); +} + +// ----------------------------------------------------------------------- + +void SvxCharNamePage::FillStyleBox_Impl( const FontNameBox* pNameBox ) +{ + const FontList* pFontList = GetFontList(); + DBG_ASSERT( pFontList, "no fontlist" ); + + FontStyleBox* pStyleBox = NULL; + + if ( m_pWestFontNameLB == pNameBox ) + pStyleBox = m_pWestFontStyleLB; + else if ( m_pEastFontNameLB == pNameBox ) + pStyleBox = m_pEastFontStyleLB; + else if ( m_pCTLFontNameLB == pNameBox ) + pStyleBox = m_pCTLFontStyleLB; + else + { + DBG_ERRORFILE( "invalid font name box" ); + } + + pStyleBox->Fill( pNameBox->GetText(), pFontList ); + + if ( m_pImpl->m_bInSearchMode ) + { + // Bei der Suche zus"atzliche Eintr"age: + // "Nicht Fett" und "Nicht Kursiv" + String aEntry = m_pImpl->m_aNoStyleText; + const sal_Char sS[] = "%1"; + aEntry.SearchAndReplaceAscii( sS, pFontList->GetBoldStr() ); + m_pImpl->m_nExtraEntryPos = pStyleBox->InsertEntry( aEntry ); + aEntry = m_pImpl->m_aNoStyleText; + aEntry.SearchAndReplaceAscii( sS, pFontList->GetItalicStr() ); + pStyleBox->InsertEntry( aEntry ); + } +} + +// ----------------------------------------------------------------------- + +void SvxCharNamePage::FillSizeBox_Impl( const FontNameBox* pNameBox ) +{ + const FontList* pFontList = GetFontList(); + DBG_ASSERT( pFontList, "no fontlist" ); + + FontStyleBox* pStyleBox = NULL; + FontSizeBox* pSizeBox = NULL; + + if ( m_pWestFontNameLB == pNameBox ) + { + pStyleBox = m_pWestFontStyleLB; + pSizeBox = m_pWestFontSizeLB; + } + else if ( m_pEastFontNameLB == pNameBox ) + { + pStyleBox = m_pEastFontStyleLB; + pSizeBox = m_pEastFontSizeLB; + } + else if ( m_pCTLFontNameLB == pNameBox ) + { + pStyleBox = m_pCTLFontStyleLB; + pSizeBox = m_pCTLFontSizeLB; + } + else + { + DBG_ERRORFILE( "invalid font name box" ); + } + + FontInfo _aFontInfo( pFontList->Get( pNameBox->GetText(), pStyleBox->GetText() ) ); + pSizeBox->Fill( &_aFontInfo, pFontList ); +} + +// ----------------------------------------------------------------------- + +void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp ) +{ + FixedText* pNameLabel = NULL; + FontNameBox* pNameBox = NULL; + FixedText* pStyleLabel = NULL; + FontStyleBox* pStyleBox = NULL; + FixedText* pSizeLabel = NULL; + FontSizeBox* pSizeBox = NULL; + FixedText* pLangFT = NULL; + SvxLanguageBox* pLangBox = NULL; + USHORT nWhich = 0; + + switch ( eLangGrp ) + { + case Western : + pNameLabel = m_pWestFontNameFT; + pNameBox = m_pWestFontNameLB; + pStyleLabel = m_pWestFontStyleFT; + pStyleBox = m_pWestFontStyleLB; + pSizeLabel = m_pWestFontSizeFT; + pSizeBox = m_pWestFontSizeLB; + pLangFT = m_pWestFontLanguageFT; + pLangBox = m_pWestFontLanguageLB; + nWhich = GetWhich( SID_ATTR_CHAR_FONT ); + break; + + case Asian : + pNameLabel = m_pEastFontNameFT; + pNameBox = m_pEastFontNameLB; + pStyleLabel = m_pEastFontStyleFT; + pStyleBox = m_pEastFontStyleLB; + pSizeLabel = m_pEastFontSizeFT; + pSizeBox = m_pEastFontSizeLB; + pLangFT = m_pEastFontLanguageFT; + pLangBox = m_pEastFontLanguageLB; + nWhich = GetWhich( SID_ATTR_CHAR_CJK_FONT ); + break; + + case Ctl : + pNameLabel = m_pCTLFontNameFT; + pNameBox = m_pCTLFontNameLB; + pStyleLabel = m_pCTLFontStyleFT; + pStyleBox = m_pCTLFontStyleLB; + pSizeLabel = m_pCTLFontSizeFT; + pSizeBox = m_pCTLFontSizeLB; + pLangFT = m_pCTLFontLanguageFT; + pLangBox = m_pCTLFontLanguageLB; + nWhich = GetWhich( SID_ATTR_CHAR_CTL_FONT ); + break; + } + + // die FontListBox fuellen + const FontList* pFontList = GetFontList(); + pNameBox->Fill( pFontList ); + + // Font ermitteln + const SvxFontItem* pFontItem = NULL; + SfxItemState eState = rSet.GetItemState( nWhich ); + + if ( eState >= SFX_ITEM_DEFAULT ) + { + pFontItem = (const SvxFontItem*)&( rSet.Get( nWhich ) ); + pNameBox->SetText( pFontItem->GetFamilyName() ); + } + else + { + pNameBox->SetText( String() ); + } + + FillStyleBox_Impl( pNameBox ); + + FASTBOOL bStyle = FALSE; + FASTBOOL bStyleAvailable = TRUE; + FontItalic eItalic = ITALIC_NONE; + FontWeight eWeight = WEIGHT_NORMAL; + switch ( eLangGrp ) + { + case Western : nWhich = GetWhich( SID_ATTR_CHAR_POSTURE ); break; + case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_POSTURE ); break; + case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_POSTURE ); break; + } + eState = rSet.GetItemState( nWhich ); + + if ( eState >= SFX_ITEM_DEFAULT ) + { + const SvxPostureItem& rItem = (SvxPostureItem&)rSet.Get( nWhich ); + eItalic = (FontItalic)rItem.GetValue(); + bStyle = TRUE; + } + bStyleAvailable = bStyleAvailable && (eState >= SFX_ITEM_DONTCARE); + + switch ( eLangGrp ) + { + case Western : nWhich = GetWhich( SID_ATTR_CHAR_WEIGHT ); break; + case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_WEIGHT ); break; + case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_WEIGHT ); break; + } + eState = rSet.GetItemState( nWhich ); + + if ( eState >= SFX_ITEM_DEFAULT ) + { + SvxWeightItem& rItem = (SvxWeightItem&)rSet.Get( nWhich ); + eWeight = (FontWeight)rItem.GetValue(); + } + else + bStyle = FALSE; + bStyleAvailable = bStyleAvailable && (eState >= SFX_ITEM_DONTCARE); + + // Aktuell eingestellter Font + if ( bStyle && pFontItem ) + { + FontInfo aInfo = pFontList->Get( pFontItem->GetFamilyName(), eWeight, eItalic ); + pStyleBox->SetText( pFontList->GetStyleName( aInfo ) ); + } + else if ( !m_pImpl->m_bInSearchMode || !bStyle ) + { + pStyleBox->SetText( String() ); + } + else if ( bStyle ) + { + FontInfo aInfo = pFontList->Get( String(), eWeight, eItalic ); + pStyleBox->SetText( pFontList->GetStyleName( aInfo ) ); + } + if (!bStyleAvailable) + { + pStyleBox->Disable( ); + pStyleLabel->Disable( ); + } + + // SizeBox fuellen + FillSizeBox_Impl( pNameBox ); + switch ( eLangGrp ) + { + case Western : nWhich = GetWhich( SID_ATTR_CHAR_FONTHEIGHT ); break; + case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT ); break; + case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT ); break; + } + eState = rSet.GetItemState( nWhich ); + + if ( pSizeBox->IsRelativeMode() ) + { + SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich ); + const SvxFontHeightItem& rItem = (SvxFontHeightItem&)rSet.Get( nWhich ); + + if( rItem.GetProp() != 100 || SFX_MAPUNIT_RELATIVE != rItem.GetPropUnit() ) + { + BOOL bPtRel = SFX_MAPUNIT_POINT == rItem.GetPropUnit(); + pSizeBox->SetPtRelative( bPtRel ); + pSizeBox->SetValue( bPtRel ? ((short)rItem.GetProp()) * 10 : rItem.GetProp() ); + } + else + { + pSizeBox->SetRelative(); + pSizeBox->SetValue( (long)CalcToPoint( rItem.GetHeight(), eUnit, 10 ) ); + } + } + else if ( eState >= SFX_ITEM_DEFAULT ) + { + SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich ); + const SvxFontHeightItem& rItem = (SvxFontHeightItem&)rSet.Get( nWhich ); + pSizeBox->SetValue( (long)CalcToPoint( rItem.GetHeight(), eUnit, 10 ) ); + } + else + { + pSizeBox->SetText( String() ); + if ( eState <= SFX_ITEM_READONLY ) + { + pSizeBox->Disable( ); + pSizeLabel->Disable( ); + } + } + + switch ( eLangGrp ) + { + case Western : nWhich = GetWhich( SID_ATTR_CHAR_LANGUAGE ); break; + case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_LANGUAGE ); break; + case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_LANGUAGE ); break; + } + pLangBox->SetNoSelection(); + eState = rSet.GetItemState( nWhich ); + + switch ( eState ) + { + case SFX_ITEM_UNKNOWN: + pLangFT->Hide(); + pLangBox->Hide(); + break; + + case SFX_ITEM_DISABLED: + case SFX_ITEM_READONLY: + pLangFT->Disable(); + pLangBox->Disable(); + break; + + case SFX_ITEM_DEFAULT: + case SFX_ITEM_SET: + { + const SvxLanguageItem& rItem = (SvxLanguageItem&)rSet.Get( nWhich ); + LanguageType eLangType = (LanguageType)rItem.GetValue(); + DBG_ASSERT( eLangType != LANGUAGE_SYSTEM, "LANGUAGE_SYSTEM not allowed" ); + if ( eLangType != LANGUAGE_DONTKNOW ) + pLangBox->SelectLanguage( eLangType ); + break; + } + } + + if ( Western == eLangGrp ) + m_aFontTypeFT.SetText( pFontList->GetFontMapText( + pFontList->Get( pNameBox->GetText(), pStyleBox->GetText() ) ) ); + + // save these settings + pNameBox->SaveValue(); + pStyleBox->SaveValue(); + pSizeBox->SaveValue(); + pLangBox->SaveValue(); +} + +// ----------------------------------------------------------------------- + +BOOL SvxCharNamePage::FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp ) +{ + BOOL bModified = FALSE; + + FontNameBox* pNameBox = NULL; + FontStyleBox* pStyleBox = NULL; + FontSizeBox* pSizeBox = NULL; + SvxLanguageBox* pLangBox = NULL; + USHORT nWhich = 0; + USHORT nSlot = 0; + + switch ( eLangGrp ) + { + case Western : + pNameBox = m_pWestFontNameLB; + pStyleBox = m_pWestFontStyleLB; + pSizeBox = m_pWestFontSizeLB; + pLangBox = m_pWestFontLanguageLB; + nSlot = SID_ATTR_CHAR_FONT; + break; + + case Asian : + pNameBox = m_pEastFontNameLB; + pStyleBox = m_pEastFontStyleLB; + pSizeBox = m_pEastFontSizeLB; + pLangBox = m_pEastFontLanguageLB; + nSlot = SID_ATTR_CHAR_CJK_FONT; + break; + + case Ctl : + pNameBox = m_pCTLFontNameLB; + pStyleBox = m_pCTLFontStyleLB; + pSizeBox = m_pCTLFontSizeLB; + pLangBox = m_pCTLFontLanguageLB; + nSlot = SID_ATTR_CHAR_CTL_FONT; + break; + } + + nWhich = GetWhich( nSlot ); + const SfxPoolItem* pItem = NULL; + const SfxItemSet& rOldSet = GetItemSet(); + const SfxPoolItem* pOld = NULL; + + const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL; + + FASTBOOL bChanged = TRUE; + const String& rFontName = pNameBox->GetText(); + const FontList* pFontList = GetFontList(); + String aStyleBoxText =pStyleBox->GetText(); + USHORT nEntryPos = pStyleBox->GetEntryPos( aStyleBoxText ); + if ( nEntryPos >= m_pImpl->m_nExtraEntryPos ) + aStyleBoxText.Erase(); + FontInfo aInfo( pFontList->Get( rFontName, aStyleBoxText ) ); + SvxFontItem aFontItem( aInfo.GetFamily(), aInfo.GetName(), aInfo.GetStyleName(), + aInfo.GetPitch(), aInfo.GetCharSet(), nWhich ); + pOld = GetOldItem( rSet, nSlot ); + + if ( pOld ) + { + const SvxFontItem& rItem = *( (const SvxFontItem*)pOld ); + + if ( rItem.GetFamilyName() == aFontItem.GetFamilyName() ) + bChanged = FALSE; + } + + if ( !bChanged ) + bChanged = !pNameBox->GetSavedValue().Len(); + + if ( !bChanged && pExampleSet && + pExampleSet->GetItemState( nWhich, FALSE, &pItem ) == SFX_ITEM_SET && + ( (SvxFontItem*)pItem )->GetFamilyName() != aFontItem.GetFamilyName() ) + bChanged = TRUE; + + if ( bChanged && rFontName.Len() ) + { + rSet.Put( aFontItem ); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + rSet.ClearItem( nWhich ); + + + bChanged = TRUE; + switch ( eLangGrp ) + { + case Western : nSlot = SID_ATTR_CHAR_WEIGHT; break; + case Asian : nSlot = SID_ATTR_CHAR_CJK_WEIGHT; break; + case Ctl : nSlot = SID_ATTR_CHAR_CTL_WEIGHT; break; + } + nWhich = GetWhich( nSlot ); + FontWeight eWeight = aInfo.GetWeight(); + if ( nEntryPos >= m_pImpl->m_nExtraEntryPos ) + eWeight = WEIGHT_NORMAL; + SvxWeightItem aWeightItem( eWeight, nWhich ); + pOld = GetOldItem( rSet, nSlot ); + + if ( pOld ) + { + const SvxWeightItem& rItem = *( (const SvxWeightItem*)pOld ); + + if ( rItem.GetValue() == aWeightItem.GetValue() ) + bChanged = FALSE; + } + + if ( !bChanged ) + { + bChanged = !pStyleBox->GetSavedValue().Len(); + + if ( m_pImpl->m_bInSearchMode && bChanged && + aInfo.GetWeight() == WEIGHT_NORMAL && aInfo.GetItalic() != ITALIC_NONE ) + bChanged = FALSE; + } + + if ( !bChanged && pExampleSet && + pExampleSet->GetItemState( nWhich, FALSE, &pItem ) == SFX_ITEM_SET && + ( (SvxWeightItem*)pItem )->GetValue() != aWeightItem.GetValue() ) + bChanged = TRUE; + + if ( nEntryPos >= m_pImpl->m_nExtraEntryPos ) + bChanged = ( nEntryPos == m_pImpl->m_nExtraEntryPos ); + + String aText( pStyleBox->GetText() ); // Tristate, dann Text leer + + if ( bChanged && aText.Len() ) + { + rSet.Put( aWeightItem ); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + bChanged = TRUE; + switch ( eLangGrp ) + { + case Western : nSlot = SID_ATTR_CHAR_POSTURE; break; + case Asian : nSlot = SID_ATTR_CHAR_CJK_POSTURE; break; + case Ctl : nSlot = SID_ATTR_CHAR_CTL_POSTURE; break; + } + nWhich = GetWhich( nSlot ); + FontItalic eItalic = aInfo.GetItalic(); + if ( nEntryPos >= m_pImpl->m_nExtraEntryPos ) + eItalic = ITALIC_NONE; + SvxPostureItem aPostureItem( eItalic, nWhich ); + pOld = GetOldItem( rSet, nSlot ); + + if ( pOld ) + { + const SvxPostureItem& rItem = *( (const SvxPostureItem*)pOld ); + + if ( rItem.GetValue() == aPostureItem.GetValue() ) + bChanged = FALSE; + } + + if ( !bChanged ) + { + bChanged = !pStyleBox->GetSavedValue().Len(); + + if ( m_pImpl->m_bInSearchMode && bChanged && + aInfo.GetItalic() == ITALIC_NONE && aInfo.GetWeight() != WEIGHT_NORMAL ) + bChanged = FALSE; + } + + if ( !bChanged && pExampleSet && + pExampleSet->GetItemState( nWhich, FALSE, &pItem ) == SFX_ITEM_SET && + ( (SvxPostureItem*)pItem )->GetValue() != aPostureItem.GetValue() ) + bChanged = TRUE; + + if ( nEntryPos >= m_pImpl->m_nExtraEntryPos ) + bChanged = ( nEntryPos == ( m_pImpl->m_nExtraEntryPos + 1 ) ); + + if ( bChanged && aText.Len() ) + { + rSet.Put( aPostureItem ); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + // FontSize + long nSize = static_cast(pSizeBox->GetValue()); + + if ( !pSizeBox->GetText().Len() ) // GetValue() gibt dann Min-Wert zurueck + nSize = 0; + long nSavedSize = pSizeBox->GetSavedValue().ToInt32(); + FASTBOOL bRel = TRUE; + + if ( !pSizeBox->IsRelative() ) + { + nSavedSize *= 10; + bRel = FALSE; + } + + switch ( eLangGrp ) + { + case Western : nSlot = SID_ATTR_CHAR_FONTHEIGHT; break; + case Asian : nSlot = SID_ATTR_CHAR_CJK_FONTHEIGHT; break; + case Ctl : nSlot = SID_ATTR_CHAR_CTL_FONTHEIGHT; break; + } + nWhich = GetWhich( nSlot ); + const SvxFontHeightItem* pOldHeight = (const SvxFontHeightItem*)GetOldItem( rSet, nSlot ); + bChanged = ( nSize != nSavedSize ); + + if ( !bChanged && pExampleSet && + pExampleSet->GetItemState( nWhich, FALSE, &pItem ) == SFX_ITEM_SET ) + { + float fSize = (float)nSize / 10; + long nVal = CalcToUnit( fSize, rSet.GetPool()->GetMetric( nWhich ) ); + if ( ( (SvxFontHeightItem*)pItem )->GetHeight() != (UINT32)nVal ) + bChanged = TRUE; + } + + if ( bChanged || !pOldHeight || + bRel != ( SFX_MAPUNIT_RELATIVE != pOldHeight->GetPropUnit() || 100 != pOldHeight->GetProp() ) ) + { + SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich ); + if ( pSizeBox->IsRelative() ) + { + DBG_ASSERT( GetItemSet().GetParent(), "No parent set" ); + const SvxFontHeightItem& rOldItem = + (const SvxFontHeightItem&)GetItemSet().GetParent()->Get( nWhich ); + + SvxFontHeightItem aHeight( 240, 100, nWhich ); + if ( pSizeBox->IsPtRelative() ) + aHeight.SetHeight( rOldItem.GetHeight(), (USHORT)( nSize / 10 ), SFX_MAPUNIT_POINT, eUnit ); + else + aHeight.SetHeight( rOldItem.GetHeight(), (USHORT)nSize, SFX_MAPUNIT_RELATIVE ); + rSet.Put( aHeight ); + } + else + { + float fSize = (float)nSize / 10; + rSet.Put( SvxFontHeightItem( CalcToUnit( fSize, eUnit ), 100, nWhich ) ); + } + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + bChanged = TRUE; + switch ( eLangGrp ) + { + case Western : nSlot = SID_ATTR_CHAR_LANGUAGE; break; + case Asian : nSlot = SID_ATTR_CHAR_CJK_LANGUAGE; break; + case Ctl : nSlot = SID_ATTR_CHAR_CTL_LANGUAGE; break; + } + nWhich = GetWhich( nSlot ); + pOld = GetOldItem( rSet, nSlot ); + USHORT nLangPos = pLangBox->GetSelectEntryPos(); + LanguageType eLangType = (LanguageType)(ULONG)pLangBox->GetEntryData( nLangPos ); + + if ( pOld ) + { + const SvxLanguageItem& rItem = *( (const SvxLanguageItem*)pOld ); + + if ( nLangPos == LISTBOX_ENTRY_NOTFOUND || eLangType == (LanguageType)rItem.GetValue() ) + bChanged = FALSE; + } + + if ( !bChanged ) + bChanged = ( pLangBox->GetSavedValue() == LISTBOX_ENTRY_NOTFOUND ); + + if ( bChanged && nLangPos != LISTBOX_ENTRY_NOTFOUND ) + { + rSet.Put( SvxLanguageItem( eLangType, nWhich ) ); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + return bModified; +} + +// ----------------------------------------------------------------------- + +void SvxCharNamePage::ResetColor_Impl( const SfxItemSet& rSet ) +{ + USHORT nWhich = GetWhich( SID_ATTR_CHAR_COLOR ); + SfxItemState eState = rSet.GetItemState( nWhich ); + + switch ( eState ) + { + case SFX_ITEM_UNKNOWN: + m_pColorLB->Hide(); + break; + + case SFX_ITEM_DISABLED: + case SFX_ITEM_READONLY: + m_pColorLB->Disable(); + break; + + case SFX_ITEM_DONTCARE: + m_pColorLB->SetNoSelection(); + break; + + case SFX_ITEM_DEFAULT: + case SFX_ITEM_SET: + { + SvxFont& rFont = GetPreviewFont(); + SvxFont& rCJKFont = GetPreviewCJKFont(); + SvxFont& rCTLFont = GetPreviewCTLFont(); + const SvxColorItem& rItem = (SvxColorItem&)rSet.Get( nWhich ); + Color aColor = rItem.GetValue(); + rFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); + rCJKFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); + rCTLFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); + m_aPreviewWin.Invalidate(); + USHORT nSelPos = m_pColorLB->GetEntryPos( aColor ); + if ( nSelPos == LISTBOX_ENTRY_NOTFOUND && aColor == Color( COL_TRANSPARENT ) ) + nSelPos = m_pColorLB->GetEntryPos( m_pImpl->m_aTransparentText ); + + if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) + m_pColorLB->SelectEntryPos( nSelPos ); + else + { + nSelPos = m_pColorLB->GetEntryPos( aColor ); + if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) + m_pColorLB->SelectEntryPos( nSelPos ); + else + m_pColorLB->SelectEntryPos( + m_pColorLB->InsertEntry( aColor, String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) ); + } + break; + } + } +} + +// ----------------------------------------------------------------------- + +BOOL SvxCharNamePage::FillItemSetColor_Impl( SfxItemSet& rSet ) +{ + USHORT nWhich = GetWhich( SID_ATTR_CHAR_COLOR ); + const SvxColorItem* pOld = (const SvxColorItem*)GetOldItem( rSet, SID_ATTR_CHAR_COLOR ); + const SvxColorItem* pItem = NULL; + BOOL bChanged = TRUE; + const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL; + const SfxItemSet& rOldSet = GetItemSet(); + + Color aSelectedColor; + if ( m_pColorLB->GetSelectEntry() == m_pImpl->m_aTransparentText ) + aSelectedColor = Color( COL_TRANSPARENT ); + else + aSelectedColor = m_pColorLB->GetSelectEntryColor(); + + if ( pOld && pOld->GetValue() == aSelectedColor ) + bChanged = FALSE; + + if ( !bChanged ) + bChanged = ( m_pColorLB->GetSavedValue() == LISTBOX_ENTRY_NOTFOUND ); + + if ( !bChanged && pExampleSet && + pExampleSet->GetItemState( nWhich, FALSE, (const SfxPoolItem**)&pItem ) == SFX_ITEM_SET && + ( (SvxColorItem*)pItem )->GetValue() != aSelectedColor ) + bChanged = TRUE; + + BOOL bModified = FALSE; + + if ( bChanged && m_pColorLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) + { + rSet.Put( SvxColorItem( aSelectedColor, nWhich ) ); + bModified = TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + return bModified; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharNamePage, UpdateHdl_Impl, Timer*, EMPTYARG ) +{ + UpdatePreview_Impl(); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharNamePage, FontModifyHdl_Impl, void*, pNameBox ) +{ + m_pImpl->m_aUpdateTimer.Start(); + + if ( m_pWestFontNameLB == pNameBox || m_pEastFontNameLB == pNameBox || m_pCTLFontNameLB == pNameBox ) + { + FillStyleBox_Impl( (FontNameBox*)pNameBox ); + FillSizeBox_Impl( (FontNameBox*)pNameBox ); + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharNamePage, ColorBoxSelectHdl_Impl, ColorListBox*, pBox ) +{ + SvxFont& rFont = GetPreviewFont(); + SvxFont& rCJKFont = GetPreviewCJKFont(); + SvxFont& rCTLFont = GetPreviewCTLFont(); + Color aSelectedColor; + if ( pBox->GetSelectEntry() == m_pImpl->m_aTransparentText ) + aSelectedColor = Color( COL_TRANSPARENT ); + else + aSelectedColor = pBox->GetSelectEntryColor(); + rFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); + rCJKFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); + rCTLFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); + m_aPreviewWin.Invalidate(); + return 0; +} + +// ----------------------------------------------------------------------- + +void SvxCharNamePage::ActivatePage( const SfxItemSet& rSet ) +{ + SvxCharBasePage::ActivatePage( rSet ); + + UpdatePreview_Impl(); // instead of asynchronous calling in ctor +} + +// ----------------------------------------------------------------------- + +int SvxCharNamePage::DeactivatePage( SfxItemSet* _pSet ) +{ + if ( _pSet ) + FillItemSet( *_pSet ); + return LEAVE_PAGE; +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxCharNamePage::Create( Window* pParent, const SfxItemSet& rSet ) +{ + return new SvxCharNamePage( pParent, rSet ); +} + +// ----------------------------------------------------------------------- + +USHORT* SvxCharNamePage::GetRanges() +{ + return pNameRanges; +} + +// ----------------------------------------------------------------------- + +void SvxCharNamePage::Reset( const SfxItemSet& rSet ) +{ + Reset_Impl( rSet, Western ); + Reset_Impl( rSet, Asian ); + Reset_Impl( rSet, Ctl ); + ResetColor_Impl( rSet ); + m_pColorLB->SaveValue(); + + SetPrevFontWidthScale( rSet ); + UpdatePreview_Impl(); +} + +// ----------------------------------------------------------------------- + +BOOL SvxCharNamePage::FillItemSet( SfxItemSet& rSet ) +{ + BOOL bModified = FillItemSet_Impl( rSet, Western ); + bModified |= FillItemSet_Impl( rSet, Asian ); + bModified |= FillItemSet_Impl( rSet, Ctl ); +//! bModified |= FillItemSetColor_Impl( rSet ); + return bModified; +} + +// ----------------------------------------------------------------------- + +void SvxCharNamePage::SetFontList( const SvxFontListItem& rItem ) +{ + if ( m_pImpl->m_bMustDelete ) + { + delete m_pImpl->m_pFontList; + } + m_pImpl->m_pFontList = rItem.GetFontList()->Clone(); + m_pImpl->m_bMustDelete = TRUE; +} + +// ----------------------------------------------------------------------- +namespace +{ + void enableRelativeMode( SvxCharNamePage* _pPage, FontSizeBox* _pFontSizeLB, USHORT _nHeightWhich ) + { + _pFontSizeLB->EnableRelativeMode( 5, 995, 5 ); // min 5%, max 995%, step 5 + + const SvxFontHeightItem& rHeightItem = + (SvxFontHeightItem&)_pPage->GetItemSet().GetParent()->Get( _nHeightWhich ); + SfxMapUnit eUnit = _pPage->GetItemSet().GetPool()->GetMetric( _nHeightWhich ); + short nCurHeight = + static_cast< short >( CalcToPoint( rHeightItem.GetHeight(), eUnit, 1 ) * 10 ); + + // ausgehend von der akt. Hoehe: + // - negativ bis minimal 2 pt + // - positiv bis maximal 999 pt + _pFontSizeLB->EnablePtRelativeMode( sal::static_int_cast< short >(-(nCurHeight - 20)), (9999 - nCurHeight), 10 ); + } +} +// ----------------------------------------------------------------------------- + +void SvxCharNamePage::EnableRelativeMode() +{ + DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no ParentSet!" ); + enableRelativeMode(this,m_pWestFontSizeLB,GetWhich( SID_ATTR_CHAR_FONTHEIGHT )); + enableRelativeMode(this,m_pEastFontSizeLB,GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT )); + enableRelativeMode(this,m_pCTLFontSizeLB,GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT )); +} + +// ----------------------------------------------------------------------- + +void SvxCharNamePage::EnableSearchMode() +{ + m_pImpl->m_bInSearchMode = TRUE; +} +// ----------------------------------------------------------------------- +void SvxCharNamePage::DisableControls( USHORT nDisable ) +{ + if ( DISABLE_LANGUAGE & nDisable ) + { + if ( m_pWestFontLanguageFT ) m_pWestFontLanguageFT->Disable(); + if ( m_pWestFontLanguageLB ) m_pWestFontLanguageLB->Disable(); + if ( m_pEastFontLanguageFT ) m_pEastFontLanguageFT->Disable(); + if ( m_pEastFontLanguageLB ) m_pEastFontLanguageLB->Disable(); + if ( m_pCTLFontLanguageFT ) m_pCTLFontLanguageFT->Disable(); + if ( m_pCTLFontLanguageLB ) m_pCTLFontLanguageLB->Disable(); + } + + if ( DISABLE_HIDE_LANGUAGE & nDisable ) + { + if ( m_pWestFontLanguageFT ) m_pWestFontLanguageFT->Hide(); + if ( m_pWestFontLanguageLB ) m_pWestFontLanguageLB->Hide(); + if ( m_pEastFontLanguageFT ) m_pEastFontLanguageFT->Hide(); + if ( m_pEastFontLanguageLB ) m_pEastFontLanguageLB->Hide(); + if ( m_pCTLFontLanguageFT ) m_pCTLFontLanguageFT->Hide(); + if ( m_pCTLFontLanguageLB ) m_pCTLFontLanguageLB->Hide(); + } +} + +// ----------------------------------------------------------------------- +void SvxCharNamePage::SetPreviewBackgroundToCharacter() +{ + m_bPreviewBackgroundToCharacter = sal_True; +} + +// ----------------------------------------------------------------------- +void SvxCharNamePage::PageCreated (SfxAllItemSet aSet) //add CHINA001 +{ + SFX_ITEMSET_ARG (&aSet,pFontListItem,SvxFontListItem,SID_ATTR_CHAR_FONTLIST,sal_False); + SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); + SFX_ITEMSET_ARG (&aSet,pDisalbeItem,SfxUInt16Item,SID_DISABLE_CTL,sal_False); + if (pFontListItem) + SetFontList(*pFontListItem); + //CHINA001 SetFontList(pFontListItem->GetFontList()); + + if (pFlagItem) + { + UINT32 nFlags=pFlagItem->GetValue(); + if ( ( nFlags & SVX_RELATIVE_MODE ) == SVX_RELATIVE_MODE ) + EnableRelativeMode(); + if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER ) + SetPreviewBackgroundToCharacter(); + } + if (pDisalbeItem) + DisableControls(pDisalbeItem->GetValue()); +} +// class SvxCharEffectsPage ---------------------------------------------- + +SvxCharEffectsPage::SvxCharEffectsPage( Window* pParent, const SfxItemSet& rInSet ) : + + SvxCharBasePage( pParent, SVX_RES( RID_SVXPAGE_CHAR_EFFECTS ), rInSet, WIN_EFFECTS_PREVIEW, FT_EFFECTS_FONTTYPE ), + + m_aFontColorFT ( this, SVX_RES( FT_FONTCOLOR ) ), + m_aFontColorLB ( this, SVX_RES( LB_FONTCOLOR ) ), + + m_aEffectsFT ( this, SVX_RES( FT_EFFECTS ) ), + m_aEffectsLB ( this, 0 ), + + m_aEffects2LB ( this, SVX_RES( LB_EFFECTS2 ) ), + + m_aReliefFT ( this, SVX_RES( FT_RELIEF ) ), + m_aReliefLB ( this, SVX_RES( LB_RELIEF ) ), + + m_aOutlineBtn ( this, SVX_RES( CB_OUTLINE ) ), + m_aShadowBtn ( this, SVX_RES( CB_SHADOW ) ), + m_aBlinkingBtn ( this, SVX_RES( CB_BLINKING ) ), + m_aHiddenBtn ( this, SVX_RES( CB_CHARHIDDEN ) ), + + m_aVerticalLine ( this, SVX_RES( FL_EFFECTS_VERTICAL ) ), + + m_aOverlineFT ( this, SVX_RES( FT_OVERLINE ) ), + m_aOverlineLB ( this, SVX_RES( LB_OVERLINE ) ), + m_aOverlineColorFT ( this, SVX_RES( FT_OVERLINE_COLOR ) ), + m_aOverlineColorLB ( this, SVX_RES( LB_OVERLINE_COLOR ) ), + m_aStrikeoutFT ( this, SVX_RES( FT_STRIKEOUT ) ), + m_aStrikeoutLB ( this, SVX_RES( LB_STRIKEOUT ) ), + m_aUnderlineFT ( this, SVX_RES( FT_UNDERLINE ) ), + m_aUnderlineLB ( this, SVX_RES( LB_UNDERLINE ) ), + m_aUnderlineColorFT ( this, SVX_RES( FT_UNDERLINE_COLOR ) ), + m_aUnderlineColorLB ( this, SVX_RES( LB_UNDERLINE_COLOR ) ), + m_aIndividualWordsBtn ( this, SVX_RES( CB_INDIVIDUALWORDS ) ), + + m_aAsianLine ( this, SVX_RES( FL_EFFECTS_ASIAN ) ), + + m_aEmphasisFT ( this, SVX_RES( FT_EMPHASIS ) ), + m_aEmphasisLB ( this, SVX_RES( LB_EMPHASIS ) ), + m_aPositionFT ( this, SVX_RES( FT_POSITION ) ), + m_aPositionLB ( this, SVX_RES( LB_POSITION ) ), + + m_aTransparentColorName ( SVX_RES( STR_CHARNAME_TRANSPARENT ) ) + +{ + m_aEffectsLB.Hide(); + FreeResource(); + Initialize(); +} + +// ----------------------------------------------------------------------- + +void SvxCharEffectsPage::Initialize() +{ + // to handle the changes of the other pages + SetExchangeSupport(); + + // HTML-Mode + const SfxPoolItem* pItem; + SfxObjectShell* pShell; + if ( SFX_ITEM_SET == GetItemSet().GetItemState( SID_HTML_MODE, FALSE, &pItem ) || + ( NULL != ( pShell = SfxObjectShell::Current() ) && + NULL != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) ) + { + m_nHtmlMode = ( (const SfxUInt16Item*)pItem )->GetValue(); + if ( ( m_nHtmlMode & HTMLMODE_ON ) == HTMLMODE_ON ) + { + //!!! hide some controls please + } + } + + // fill the color box + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + DBG_ASSERT( pDocSh, "DocShell not found!" ); + XColorTable* pColorTable = NULL; + FASTBOOL bKillTable = FALSE; + + if ( pDocSh ) + { + pItem = pDocSh->GetItem( SID_COLOR_TABLE ); + if ( pItem != NULL ) + pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); + } + + if ( !pColorTable ) + { + pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); + bKillTable = TRUE; + } + + m_aUnderlineColorLB.SetUpdateMode( FALSE ); + m_aOverlineColorLB.SetUpdateMode( FALSE ); + m_aFontColorLB.SetUpdateMode( FALSE ); + + { + SfxPoolItem* pDummy; + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocSh ); + if ( !pFrame || + SFX_ITEM_DEFAULT > pFrame->GetBindings().QueryState( SID_ATTR_AUTO_COLOR_INVALID, pDummy ) ) + { + m_aUnderlineColorLB.InsertAutomaticEntry(); + m_aOverlineColorLB.InsertAutomaticEntry(); + m_aFontColorLB.InsertAutomaticEntry(); + } + } + for ( long i = 0; i < pColorTable->Count(); i++ ) + { + XColorEntry* pEntry = pColorTable->GetColor(i); + m_aUnderlineColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + m_aOverlineColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + m_aFontColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + } + + m_aUnderlineColorLB.SetUpdateMode( TRUE ); + m_aOverlineColorLB.SetUpdateMode( TRUE ); + m_aFontColorLB.SetUpdateMode( TRUE ); + m_aFontColorLB.SetSelectHdl( LINK( this, SvxCharEffectsPage, ColorBoxSelectHdl_Impl ) ); + + if ( bKillTable ) + delete pColorTable; + + // handler + Link aLink = LINK( this, SvxCharEffectsPage, SelectHdl_Impl ); + m_aUnderlineLB.SetSelectHdl( aLink ); + m_aUnderlineColorLB.SetSelectHdl( aLink ); + m_aOverlineLB.SetSelectHdl( aLink ); + m_aOverlineColorLB.SetSelectHdl( aLink ); + m_aStrikeoutLB.SetSelectHdl( aLink ); + m_aEmphasisLB.SetSelectHdl( aLink ); + m_aPositionLB.SetSelectHdl( aLink ); + m_aEffects2LB.SetSelectHdl( aLink ); + m_aReliefLB.SetSelectHdl( aLink ); + + m_aUnderlineLB.SelectEntryPos( 0 ); + m_aUnderlineColorLB.SelectEntryPos( 0 ); + m_aOverlineLB.SelectEntryPos( 0 ); + m_aOverlineColorLB.SelectEntryPos( 0 ); + m_aStrikeoutLB.SelectEntryPos( 0 ); + m_aEmphasisLB.SelectEntryPos( 0 ); + m_aPositionLB.SelectEntryPos( 0 ); + SelectHdl_Impl( NULL ); + SelectHdl_Impl( &m_aEmphasisLB ); + + m_aEffects2LB.SelectEntryPos( 0 ); + + m_aIndividualWordsBtn.SetClickHdl( LINK( this, SvxCharEffectsPage, CbClickHdl_Impl ) ); + aLink = LINK( this, SvxCharEffectsPage, TristClickHdl_Impl ); + m_aOutlineBtn.SetClickHdl( aLink ); + m_aShadowBtn.SetClickHdl( aLink ); + + if ( !SvtLanguageOptions().IsAsianTypographyEnabled() ) + { + m_aAsianLine.Hide(); + m_aEmphasisFT.Hide(); + m_aEmphasisLB.Hide(); + m_aPositionFT.Hide(); + m_aPositionLB.Hide(); + } +} +// ----------------------------------------------------------------------- + +void SvxCharEffectsPage::UpdatePreview_Impl() +{ + SvxFont& rFont = GetPreviewFont(); + SvxFont& rCJKFont = GetPreviewCJKFont(); + SvxFont& rCTLFont = GetPreviewCTLFont(); + + USHORT nPos = m_aUnderlineLB.GetSelectEntryPos(); + FontUnderline eUnderline = (FontUnderline)(ULONG)m_aUnderlineLB.GetEntryData( nPos ); + nPos = m_aOverlineLB.GetSelectEntryPos(); + FontUnderline eOverline = (FontUnderline)(ULONG)m_aOverlineLB.GetEntryData( nPos ); + nPos = m_aStrikeoutLB.GetSelectEntryPos(); + FontStrikeout eStrikeout = (FontStrikeout)(ULONG)m_aStrikeoutLB.GetEntryData( nPos ); + rFont.SetUnderline( eUnderline ); + rCJKFont.SetUnderline( eUnderline ); + rCTLFont.SetUnderline( eUnderline ); + m_aPreviewWin.SetTextLineColor( m_aUnderlineColorLB.GetSelectEntryColor() ); + rFont.SetOverline( eOverline ); + rCJKFont.SetOverline( eOverline ); + rCTLFont.SetOverline( eOverline ); + m_aPreviewWin.SetOverlineColor( m_aOverlineColorLB.GetSelectEntryColor() ); + rFont.SetStrikeout( eStrikeout ); + rCJKFont.SetStrikeout( eStrikeout ); + rCTLFont.SetStrikeout( eStrikeout ); + + nPos = m_aPositionLB.GetSelectEntryPos(); + BOOL bUnder = ( CHRDLG_POSITION_UNDER == (ULONG)m_aPositionLB.GetEntryData( nPos ) ); + FontEmphasisMark eMark = (FontEmphasisMark)m_aEmphasisLB.GetSelectEntryPos(); + eMark |= bUnder ? EMPHASISMARK_POS_BELOW : EMPHASISMARK_POS_ABOVE; + rFont.SetEmphasisMark( eMark ); + rCJKFont.SetEmphasisMark( eMark ); + rCTLFont.SetEmphasisMark( eMark ); + + USHORT nRelief = m_aReliefLB.GetSelectEntryPos(); + if(LISTBOX_ENTRY_NOTFOUND != nRelief) + { + rFont.SetRelief( (FontRelief)nRelief ); + rCJKFont.SetRelief( (FontRelief)nRelief ); + rCTLFont.SetRelief( (FontRelief)nRelief ); + } + + rFont.SetOutline( StateToAttr( m_aOutlineBtn.GetState() ) ); + rCJKFont.SetOutline( rFont.IsOutline() ); + rCTLFont.SetOutline( rFont.IsOutline() ); + + rFont.SetShadow( StateToAttr( m_aShadowBtn.GetState() ) ); + rCJKFont.SetShadow( rFont.IsShadow() ); + rCTLFont.SetShadow( rFont.IsShadow() ); + + USHORT nCapsPos = m_aEffects2LB.GetSelectEntryPos(); + if ( nCapsPos != LISTBOX_ENTRY_NOTFOUND ) + { + rFont.SetCaseMap( (SvxCaseMap)nCapsPos ); + rCJKFont.SetCaseMap( (SvxCaseMap)nCapsPos ); + // #i78474# small caps do not exist in CTL fonts + rCTLFont.SetCaseMap( static_cast( nCapsPos == SVX_CASEMAP_KAPITAELCHEN ? SVX_CASEMAP_NOT_MAPPED : (SvxCaseMap)nCapsPos) ); + } + + BOOL bWordLine = m_aIndividualWordsBtn.IsChecked(); + rFont.SetWordLineMode( bWordLine ); + rCJKFont.SetWordLineMode( bWordLine ); + rCTLFont.SetWordLineMode( bWordLine ); + + m_aPreviewWin.Invalidate(); +} + +// ----------------------------------------------------------------------- + +void SvxCharEffectsPage::SetCaseMap_Impl( SvxCaseMap eCaseMap ) +{ + if ( SVX_CASEMAP_END > eCaseMap ) + m_aEffects2LB.SelectEntryPos( + sal::static_int_cast< USHORT >( eCaseMap ) ); + else + { + m_aEffects2LB.SetNoSelection(); + eCaseMap = SVX_CASEMAP_NOT_MAPPED; + } + + UpdatePreview_Impl(); +} + +// ----------------------------------------------------------------------- + +void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet& rSet ) +{ + USHORT nWhich = GetWhich( SID_ATTR_CHAR_COLOR ); + SfxItemState eState = rSet.GetItemState( nWhich ); + + switch ( eState ) + { + case SFX_ITEM_UNKNOWN: + m_aFontColorFT.Hide(); + m_aFontColorLB.Hide(); + break; + + case SFX_ITEM_DISABLED: + case SFX_ITEM_READONLY: + m_aFontColorFT.Disable(); + m_aFontColorLB.Disable(); + break; + + case SFX_ITEM_DONTCARE: + m_aFontColorLB.SetNoSelection(); + break; + + case SFX_ITEM_DEFAULT: + case SFX_ITEM_SET: + { + SvxFont& rFont = GetPreviewFont(); + SvxFont& rCJKFont = GetPreviewCJKFont(); + SvxFont& rCTLFont = GetPreviewCTLFont(); + + const SvxColorItem& rItem = (SvxColorItem&)rSet.Get( nWhich ); + Color aColor = rItem.GetValue(); + rFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); + rCJKFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); + rCTLFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); + + m_aPreviewWin.Invalidate(); + USHORT nSelPos = m_aFontColorLB.GetEntryPos( aColor ); + if ( nSelPos == LISTBOX_ENTRY_NOTFOUND && aColor == Color( COL_TRANSPARENT ) ) + nSelPos = m_aFontColorLB.GetEntryPos( m_aTransparentColorName ); + + if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) + m_aFontColorLB.SelectEntryPos( nSelPos ); + else + { + nSelPos = m_aFontColorLB.GetEntryPos( aColor ); + if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) + m_aFontColorLB.SelectEntryPos( nSelPos ); + else + m_aFontColorLB.SelectEntryPos( + m_aFontColorLB.InsertEntry( aColor, String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) ); + } + break; + } + } +} + +// ----------------------------------------------------------------------- + +BOOL SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet& rSet ) +{ + USHORT nWhich = GetWhich( SID_ATTR_CHAR_COLOR ); + const SvxColorItem* pOld = (const SvxColorItem*)GetOldItem( rSet, SID_ATTR_CHAR_COLOR ); + const SvxColorItem* pItem = NULL; + BOOL bChanged = TRUE; + const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL; + const SfxItemSet& rOldSet = GetItemSet(); + + Color aSelectedColor; + if ( m_aFontColorLB.GetSelectEntry() == m_aTransparentColorName ) + aSelectedColor = Color( COL_TRANSPARENT ); + else + aSelectedColor = m_aFontColorLB.GetSelectEntryColor(); + + if ( pOld && pOld->GetValue() == aSelectedColor ) + bChanged = FALSE; + + if ( !bChanged ) + bChanged = ( m_aFontColorLB.GetSavedValue() == LISTBOX_ENTRY_NOTFOUND ); + + if ( !bChanged && pExampleSet && + pExampleSet->GetItemState( nWhich, FALSE, (const SfxPoolItem**)&pItem ) == SFX_ITEM_SET && + ( (SvxColorItem*)pItem )->GetValue() != aSelectedColor ) + bChanged = TRUE; + + BOOL bModified = FALSE; + + if ( bChanged && m_aFontColorLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) + { + rSet.Put( SvxColorItem( aSelectedColor, nWhich ) ); + bModified = TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + return bModified; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharEffectsPage, SelectHdl_Impl, ListBox*, pBox ) +{ + if ( &m_aEmphasisLB == pBox ) + { + USHORT nEPos = m_aEmphasisLB.GetSelectEntryPos(); + BOOL bEnable = ( nEPos > 0 && nEPos != LISTBOX_ENTRY_NOTFOUND ); + m_aPositionFT.Enable( bEnable ); + m_aPositionLB.Enable( bEnable ); + } + else if( &m_aReliefLB == pBox) + { + BOOL bEnable = ( pBox->GetSelectEntryPos() == 0 ); + m_aOutlineBtn.Enable( bEnable ); + m_aShadowBtn.Enable( bEnable ); + } + else if ( &m_aPositionLB != pBox ) + { + USHORT nUPos = m_aUnderlineLB.GetSelectEntryPos(), + nOPos = m_aOverlineLB.GetSelectEntryPos(), + nSPos = m_aStrikeoutLB.GetSelectEntryPos(); + BOOL bUEnable = ( nUPos > 0 && nUPos != LISTBOX_ENTRY_NOTFOUND ); + BOOL bOEnable = ( nOPos > 0 && nOPos != LISTBOX_ENTRY_NOTFOUND ); + m_aUnderlineColorFT.Enable( bUEnable ); + m_aUnderlineColorLB.Enable( bUEnable ); + m_aOverlineColorFT.Enable( bOEnable ); + m_aOverlineColorLB.Enable( bOEnable ); + m_aIndividualWordsBtn.Enable( bUEnable || bOEnable || ( nSPos > 0 && nSPos != LISTBOX_ENTRY_NOTFOUND ) ); + } + UpdatePreview_Impl(); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharEffectsPage, UpdatePreview_Impl, ListBox*, EMPTYARG ) +{ + bool bEnable = ( ( m_aUnderlineLB.GetSelectEntryPos() > 0 ) || + ( m_aOverlineLB.GetSelectEntryPos() > 0 ) || + ( m_aStrikeoutLB.GetSelectEntryPos() > 0 ) ); + m_aIndividualWordsBtn.Enable( bEnable ); + + UpdatePreview_Impl(); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharEffectsPage, CbClickHdl_Impl, CheckBox*, EMPTYARG ) +{ + UpdatePreview_Impl(); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharEffectsPage, TristClickHdl_Impl, TriStateBox*, EMPTYARG ) +{ + UpdatePreview_Impl(); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharEffectsPage, ColorBoxSelectHdl_Impl, ColorListBox*, pBox ) +{ + SvxFont& rFont = GetPreviewFont(); + SvxFont& rCJKFont = GetPreviewCJKFont(); + SvxFont& rCTLFont = GetPreviewCTLFont(); + + Color aSelectedColor; + if ( pBox->GetSelectEntry() == m_aTransparentColorName ) + aSelectedColor = Color( COL_TRANSPARENT ); + else + aSelectedColor = pBox->GetSelectEntryColor(); + rFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); + rCJKFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); + rCTLFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); + + m_aPreviewWin.Invalidate(); + return 0; +} +// ----------------------------------------------------------------------- + +int SvxCharEffectsPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if ( _pSet ) + FillItemSet( *_pSet ); + return LEAVE_PAGE; +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxCharEffectsPage::Create( Window* pParent, const SfxItemSet& rSet ) +{ + return new SvxCharEffectsPage( pParent, rSet ); +} + +// ----------------------------------------------------------------------- + +USHORT* SvxCharEffectsPage::GetRanges() +{ + return pEffectsRanges; +} + +// ----------------------------------------------------------------------- + +void SvxCharEffectsPage::Reset( const SfxItemSet& rSet ) +{ + SvxFont& rFont = GetPreviewFont(); + SvxFont& rCJKFont = GetPreviewCJKFont(); + SvxFont& rCTLFont = GetPreviewCTLFont(); + + BOOL bEnable = FALSE; + + // Underline + USHORT nWhich = GetWhich( SID_ATTR_CHAR_UNDERLINE ); + rFont.SetUnderline( UNDERLINE_NONE ); + rCJKFont.SetUnderline( UNDERLINE_NONE ); + rCTLFont.SetUnderline( UNDERLINE_NONE ); + + m_aUnderlineLB.SelectEntryPos( 0 ); + SfxItemState eState = rSet.GetItemState( nWhich ); + + if ( eState >= SFX_ITEM_DONTCARE ) + { + if ( eState == SFX_ITEM_DONTCARE ) + m_aUnderlineLB.SetNoSelection(); + else + { + const SvxUnderlineItem& rItem = (SvxUnderlineItem&)rSet.Get( nWhich ); + FontUnderline eUnderline = (FontUnderline)rItem.GetValue(); + rFont.SetUnderline( eUnderline ); + rCJKFont.SetUnderline( eUnderline ); + rCTLFont.SetUnderline( eUnderline ); + + if ( eUnderline != UNDERLINE_NONE ) + { + for ( USHORT i = 0; i < m_aUnderlineLB.GetEntryCount(); ++i ) + { + if ( (FontUnderline)(ULONG)m_aUnderlineLB.GetEntryData(i) == eUnderline ) + { + m_aUnderlineLB.SelectEntryPos(i); + bEnable |= TRUE; + break; + } + } + + Color aColor = rItem.GetColor(); + USHORT nPos = m_aUnderlineColorLB.GetEntryPos( aColor ); + + if ( LISTBOX_ENTRY_NOTFOUND != nPos ) + m_aUnderlineColorLB.SelectEntryPos( nPos ); + else + { + nPos = m_aUnderlineColorLB.GetEntryPos( aColor ); + if ( LISTBOX_ENTRY_NOTFOUND != nPos ) + m_aUnderlineColorLB.SelectEntryPos( nPos ); + else + m_aUnderlineColorLB.SelectEntryPos( + m_aUnderlineColorLB.InsertEntry( aColor, + String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) ); + } + } + else + { + m_aUnderlineColorLB.SelectEntry( Color( COL_AUTO )); + m_aUnderlineColorLB.Disable(); + } + } + } + + // Overline + nWhich = GetWhich( SID_ATTR_CHAR_OVERLINE ); + rFont.SetOverline( UNDERLINE_NONE ); + rCJKFont.SetOverline( UNDERLINE_NONE ); + rCTLFont.SetOverline( UNDERLINE_NONE ); + + m_aOverlineLB.SelectEntryPos( 0 ); + eState = rSet.GetItemState( nWhich ); + + if ( eState >= SFX_ITEM_DONTCARE ) + { + if ( eState == SFX_ITEM_DONTCARE ) + m_aOverlineLB.SetNoSelection(); + else + { + const SvxOverlineItem& rItem = (SvxOverlineItem&)rSet.Get( nWhich ); + FontUnderline eOverline = (FontUnderline)rItem.GetValue(); + rFont.SetOverline( eOverline ); + rCJKFont.SetOverline( eOverline ); + rCTLFont.SetOverline( eOverline ); + + if ( eOverline != UNDERLINE_NONE ) + { + for ( USHORT i = 0; i < m_aOverlineLB.GetEntryCount(); ++i ) + { + if ( (FontUnderline)(ULONG)m_aOverlineLB.GetEntryData(i) == eOverline ) + { + m_aOverlineLB.SelectEntryPos(i); + bEnable |= TRUE; + break; + } + } + + Color aColor = rItem.GetColor(); + USHORT nPos = m_aOverlineColorLB.GetEntryPos( aColor ); + + if ( LISTBOX_ENTRY_NOTFOUND != nPos ) + m_aOverlineColorLB.SelectEntryPos( nPos ); + else + { + nPos = m_aOverlineColorLB.GetEntryPos( aColor ); + if ( LISTBOX_ENTRY_NOTFOUND != nPos ) + m_aOverlineColorLB.SelectEntryPos( nPos ); + else + m_aOverlineColorLB.SelectEntryPos( + m_aOverlineColorLB.InsertEntry( aColor, + String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) ); + } + } + else + { + m_aOverlineColorLB.SelectEntry( Color( COL_AUTO )); + m_aOverlineColorLB.Disable(); + } + } + } + + // Strikeout + nWhich = GetWhich( SID_ATTR_CHAR_STRIKEOUT ); + rFont.SetStrikeout( STRIKEOUT_NONE ); + rCJKFont.SetStrikeout( STRIKEOUT_NONE ); + rCTLFont.SetStrikeout( STRIKEOUT_NONE ); + + m_aStrikeoutLB.SelectEntryPos( 0 ); + eState = rSet.GetItemState( nWhich ); + + if ( eState >= SFX_ITEM_DONTCARE ) + { + if ( eState == SFX_ITEM_DONTCARE ) + m_aStrikeoutLB.SetNoSelection(); + else + { + const SvxCrossedOutItem& rItem = (SvxCrossedOutItem&)rSet.Get( nWhich ); + FontStrikeout eStrikeout = (FontStrikeout)rItem.GetValue(); + rFont.SetStrikeout( eStrikeout ); + rCJKFont.SetStrikeout( eStrikeout ); + rCTLFont.SetStrikeout( eStrikeout ); + + if ( eStrikeout != STRIKEOUT_NONE ) + { + for ( USHORT i = 0; i < m_aStrikeoutLB.GetEntryCount(); ++i ) + { + if ( (FontStrikeout)(ULONG)m_aStrikeoutLB.GetEntryData(i) == eStrikeout ) + { + m_aStrikeoutLB.SelectEntryPos(i); + bEnable |= TRUE; + break; + } + } + } + } + } + + // WordLineMode + nWhich = GetWhich( SID_ATTR_CHAR_WORDLINEMODE ); + switch ( eState ) + { + case SFX_ITEM_UNKNOWN: + m_aIndividualWordsBtn.Hide(); + break; + + case SFX_ITEM_DISABLED: + case SFX_ITEM_READONLY: + m_aIndividualWordsBtn.Disable(); + break; + + case SFX_ITEM_DONTCARE: + m_aIndividualWordsBtn.SetState( STATE_DONTKNOW ); + break; + + case SFX_ITEM_DEFAULT: + case SFX_ITEM_SET: + { + const SvxWordLineModeItem& rItem = (SvxWordLineModeItem&)rSet.Get( nWhich ); + rFont.SetWordLineMode( rItem.GetValue() ); + rCJKFont.SetWordLineMode( rItem.GetValue() ); + rCTLFont.SetWordLineMode( rItem.GetValue() ); + + m_aIndividualWordsBtn.Check( rItem.GetValue() ); + m_aIndividualWordsBtn.Enable( bEnable ); + break; + } + } + + // Emphasis + nWhich = GetWhich( SID_ATTR_CHAR_EMPHASISMARK ); + eState = rSet.GetItemState( nWhich ); + + if ( eState >= SFX_ITEM_DEFAULT ) + { + const SvxEmphasisMarkItem& rItem = (SvxEmphasisMarkItem&)rSet.Get( nWhich ); + FontEmphasisMark eMark = rItem.GetEmphasisMark(); + rFont.SetEmphasisMark( eMark ); + rCJKFont.SetEmphasisMark( eMark ); + rCTLFont.SetEmphasisMark( eMark ); + + m_aEmphasisLB.SelectEntryPos( (USHORT)( eMark & EMPHASISMARK_STYLE ) ); + eMark &= ~EMPHASISMARK_STYLE; + ULONG nEntryData = ( eMark == EMPHASISMARK_POS_ABOVE ) + ? CHRDLG_POSITION_OVER + : ( eMark == EMPHASISMARK_POS_BELOW ) ? CHRDLG_POSITION_UNDER : 0; + + for ( USHORT i = 0; i < m_aPositionLB.GetEntryCount(); i++ ) + { + if ( nEntryData == (ULONG)m_aPositionLB.GetEntryData(i) ) + { + m_aPositionLB.SelectEntryPos(i); + break; + } + } + } + else if ( eState == SFX_ITEM_DONTCARE ) + m_aEmphasisLB.SetNoSelection( ); + else if ( eState == SFX_ITEM_UNKNOWN ) + { + m_aEmphasisFT.Hide(); + m_aEmphasisLB.Hide(); + } + else // SFX_ITEM_DISABLED or SFX_ITEM_READONLY + { + m_aEmphasisFT.Disable(); + m_aEmphasisLB.Disable(); + } + + // the select handler for the underline/overline/strikeout list boxes +// SelectHdl_Impl( NULL ); + DBG_ASSERT(m_aUnderlineLB.GetSelectHdl() == m_aOverlineLB.GetSelectHdl(), + "SvxCharEffectsPage::Reset: inconsistence (1)!"); + DBG_ASSERT(m_aUnderlineLB.GetSelectHdl() == m_aStrikeoutLB.GetSelectHdl(), + "SvxCharEffectsPage::Reset: inconsistence (1)!"); + m_aUnderlineLB.GetSelectHdl().Call(NULL); + // don't call SelectHdl_Impl directly! + // in DisableControls, we may have re-reouted the select handler + // 30.05.2001 - 86262 - frank.schoenheit@germany.sun.com + + // the select handler for the emphasis listbox +// SelectHdl_Impl( &m_aEmphasisLB ); + DBG_ASSERT(m_aEmphasisLB.GetSelectHdl() == LINK(this, SvxCharEffectsPage, SelectHdl_Impl), + "SvxCharEffectsPage::Reset: inconsistence (2)!"); + m_aEmphasisLB.GetSelectHdl().Call( &m_aEmphasisLB ); + // this is for consistency only. Here it would be allowed to call SelectHdl_Impl directly ... + + // Effects + SvxCaseMap eCaseMap = SVX_CASEMAP_END; + nWhich = GetWhich( SID_ATTR_CHAR_CASEMAP ); + eState = rSet.GetItemState( nWhich ); + switch ( eState ) + { + case SFX_ITEM_UNKNOWN: + m_aEffectsFT.Hide(); + m_aEffects2LB.Hide(); + break; + + case SFX_ITEM_DISABLED: + case SFX_ITEM_READONLY: + m_aEffectsFT.Disable(); + m_aEffects2LB.Disable(); + break; + + case SFX_ITEM_DONTCARE: + m_aEffects2LB.SetNoSelection(); + break; + + case SFX_ITEM_DEFAULT: + case SFX_ITEM_SET: + { + const SvxCaseMapItem& rItem = (const SvxCaseMapItem&)rSet.Get( nWhich ); + eCaseMap = (SvxCaseMap)rItem.GetValue(); + break; + } + } + SetCaseMap_Impl( eCaseMap ); + + //Relief + nWhich = GetWhich(SID_ATTR_CHAR_RELIEF); + eState = rSet.GetItemState( nWhich ); + switch ( eState ) + { + case SFX_ITEM_UNKNOWN: + m_aReliefFT.Hide(); + m_aReliefLB.Hide(); + break; + + case SFX_ITEM_DISABLED: + case SFX_ITEM_READONLY: + m_aReliefFT.Disable(); + m_aReliefLB.Disable(); + break; + + case SFX_ITEM_DONTCARE: + m_aReliefLB.SetNoSelection(); + break; + + case SFX_ITEM_DEFAULT: + case SFX_ITEM_SET: + { + const SvxCharReliefItem& rItem = (const SvxCharReliefItem&)rSet.Get( nWhich ); + m_aReliefLB.SelectEntryPos(rItem.GetValue()); + SelectHdl_Impl(&m_aReliefLB); + break; + } + } + + // Outline + nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR ); + eState = rSet.GetItemState( nWhich ); + switch ( eState ) + { + case SFX_ITEM_UNKNOWN: + m_aOutlineBtn.Hide(); + break; + + case SFX_ITEM_DISABLED: + case SFX_ITEM_READONLY: + m_aOutlineBtn.Disable(); + break; + + case SFX_ITEM_DONTCARE: + m_aOutlineBtn.SetState( STATE_DONTKNOW ); + break; + + case SFX_ITEM_DEFAULT: + case SFX_ITEM_SET: + { + const SvxContourItem& rItem = (SvxContourItem&)rSet.Get( nWhich ); + m_aOutlineBtn.SetState( (TriState)rItem.GetValue() ); + m_aOutlineBtn.EnableTriState( FALSE ); + break; + } + } + + // Shadow + nWhich = GetWhich( SID_ATTR_CHAR_SHADOWED ); + eState = rSet.GetItemState( nWhich ); + + switch ( eState ) + { + case SFX_ITEM_UNKNOWN: + m_aShadowBtn.Hide(); + break; + + case SFX_ITEM_DISABLED: + case SFX_ITEM_READONLY: + m_aShadowBtn.Disable(); + break; + + case SFX_ITEM_DONTCARE: + m_aShadowBtn.SetState( STATE_DONTKNOW ); + break; + + case SFX_ITEM_DEFAULT: + case SFX_ITEM_SET: + { + const SvxShadowedItem& rItem = (SvxShadowedItem&)rSet.Get( nWhich ); + m_aShadowBtn.SetState( (TriState)rItem.GetValue() ); + m_aShadowBtn.EnableTriState( FALSE ); + break; + } + } + + // Blinking + nWhich = GetWhich( SID_ATTR_FLASH ); + eState = rSet.GetItemState( nWhich ); + + switch ( eState ) + { + case SFX_ITEM_UNKNOWN: + m_aBlinkingBtn.Hide(); + break; + + case SFX_ITEM_DISABLED: + case SFX_ITEM_READONLY: + m_aBlinkingBtn.Disable(); + break; + + case SFX_ITEM_DONTCARE: + m_aBlinkingBtn.SetState( STATE_DONTKNOW ); + break; + + case SFX_ITEM_DEFAULT: + case SFX_ITEM_SET: + { + const SvxBlinkItem& rItem = (SvxBlinkItem&)rSet.Get( nWhich ); + m_aBlinkingBtn.SetState( (TriState)rItem.GetValue() ); + m_aBlinkingBtn.EnableTriState( FALSE ); + break; + } + } + // Hidden + nWhich = GetWhich( SID_ATTR_CHAR_HIDDEN ); + eState = rSet.GetItemState( nWhich ); + + switch ( eState ) + { + case SFX_ITEM_UNKNOWN: + m_aHiddenBtn.Hide(); + break; + + case SFX_ITEM_DISABLED: + case SFX_ITEM_READONLY: + m_aHiddenBtn.Disable(); + break; + + case SFX_ITEM_DONTCARE: + m_aHiddenBtn.SetState( STATE_DONTKNOW ); + break; + + case SFX_ITEM_DEFAULT: + case SFX_ITEM_SET: + { + const SvxCharHiddenItem& rItem = (SvxCharHiddenItem&)rSet.Get( nWhich ); + m_aHiddenBtn.SetState( (TriState)rItem.GetValue() ); + m_aHiddenBtn.EnableTriState( FALSE ); + break; + } + } + + SetPrevFontWidthScale( rSet ); + ResetColor_Impl( rSet ); + + // preview update + m_aPreviewWin.Invalidate(); + + // save this settings + m_aUnderlineLB.SaveValue(); + m_aUnderlineColorLB.SaveValue(); + m_aOverlineLB.SaveValue(); + m_aOverlineColorLB.SaveValue(); + m_aStrikeoutLB.SaveValue(); + m_aIndividualWordsBtn.SaveValue(); + m_aEmphasisLB.SaveValue(); + m_aPositionLB.SaveValue(); + m_aEffects2LB.SaveValue(); + m_aReliefLB.SaveValue(); + m_aOutlineBtn.SaveValue(); + m_aShadowBtn.SaveValue(); + m_aBlinkingBtn.SaveValue(); + m_aHiddenBtn.SaveValue(); + m_aFontColorLB.SaveValue(); +} + +// ----------------------------------------------------------------------- + +BOOL SvxCharEffectsPage::FillItemSet( SfxItemSet& rSet ) +{ + const SfxPoolItem* pOld = 0; + const SfxItemSet& rOldSet = GetItemSet(); + BOOL bModified = FALSE; + FASTBOOL bChanged = TRUE; + + // Underline + USHORT nWhich = GetWhich( SID_ATTR_CHAR_UNDERLINE ); + pOld = GetOldItem( rSet, SID_ATTR_CHAR_UNDERLINE ); + USHORT nPos = m_aUnderlineLB.GetSelectEntryPos(); + FontUnderline eUnder = (FontUnderline)(ULONG)m_aUnderlineLB.GetEntryData( nPos ); + + if ( pOld ) + { + //! if there are different underline styles in the selection the + //! item-state in the 'rOldSet' will be invalid. In this case + //! changing the underline style will be allowed if a style is + //! selected in the listbox. + BOOL bAllowChg = LISTBOX_ENTRY_NOTFOUND != nPos && + SFX_ITEM_DEFAULT > rOldSet.GetItemState( nWhich, TRUE ); + + const SvxUnderlineItem& rItem = *( (const SvxUnderlineItem*)pOld ); + if ( (FontUnderline)rItem.GetValue() == eUnder && + ( UNDERLINE_NONE == eUnder || rItem.GetColor() == m_aUnderlineColorLB.GetSelectEntryColor() ) && + ! bAllowChg ) + bChanged = FALSE; + } + + if ( bChanged ) + { + SvxUnderlineItem aNewItem( eUnder, nWhich ); + aNewItem.SetColor( m_aUnderlineColorLB.GetSelectEntryColor() ); + rSet.Put( aNewItem ); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + bChanged = TRUE; + + // Overline + nWhich = GetWhich( SID_ATTR_CHAR_OVERLINE ); + pOld = GetOldItem( rSet, SID_ATTR_CHAR_OVERLINE ); + nPos = m_aOverlineLB.GetSelectEntryPos(); + FontUnderline eOver = (FontUnderline)(ULONG)m_aOverlineLB.GetEntryData( nPos ); + + if ( pOld ) + { + //! if there are different underline styles in the selection the + //! item-state in the 'rOldSet' will be invalid. In this case + //! changing the underline style will be allowed if a style is + //! selected in the listbox. + BOOL bAllowChg = LISTBOX_ENTRY_NOTFOUND != nPos && + SFX_ITEM_DEFAULT > rOldSet.GetItemState( nWhich, TRUE ); + + const SvxOverlineItem& rItem = *( (const SvxOverlineItem*)pOld ); + if ( (FontUnderline)rItem.GetValue() == eOver && + ( UNDERLINE_NONE == eOver || rItem.GetColor() == m_aOverlineColorLB.GetSelectEntryColor() ) && + ! bAllowChg ) + bChanged = FALSE; + } + + if ( bChanged ) + { + SvxOverlineItem aNewItem( eOver, nWhich ); + aNewItem.SetColor( m_aOverlineColorLB.GetSelectEntryColor() ); + rSet.Put( aNewItem ); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + bChanged = TRUE; + + // Strikeout + nWhich = GetWhich( SID_ATTR_CHAR_STRIKEOUT ); + pOld = GetOldItem( rSet, SID_ATTR_CHAR_STRIKEOUT ); + nPos = m_aStrikeoutLB.GetSelectEntryPos(); + FontStrikeout eStrike = (FontStrikeout)(ULONG)m_aStrikeoutLB.GetEntryData( nPos ); + + if ( pOld ) + { + //! if there are different strikeout styles in the selection the + //! item-state in the 'rOldSet' will be invalid. In this case + //! changing the strikeout style will be allowed if a style is + //! selected in the listbox. + BOOL bAllowChg = LISTBOX_ENTRY_NOTFOUND != nPos && + SFX_ITEM_DEFAULT > rOldSet.GetItemState( nWhich, TRUE ); + + const SvxCrossedOutItem& rItem = *( (const SvxCrossedOutItem*)pOld ); + if ( !m_aStrikeoutLB.IsEnabled() + || ((FontStrikeout)rItem.GetValue() == eStrike && !bAllowChg) ) + bChanged = FALSE; + } + + if ( bChanged ) + { + rSet.Put( SvxCrossedOutItem( eStrike, nWhich ) ); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + bChanged = TRUE; + + // Individual words + nWhich = GetWhich( SID_ATTR_CHAR_WORDLINEMODE ); + pOld = GetOldItem( rSet, SID_ATTR_CHAR_WORDLINEMODE ); + + if ( pOld ) + { + const SvxWordLineModeItem& rItem = *( (const SvxWordLineModeItem*)pOld ); + if ( rItem.GetValue() == m_aIndividualWordsBtn.IsChecked() ) + bChanged = FALSE; + } + + if ( rOldSet.GetItemState( nWhich ) == SFX_ITEM_DONTCARE && + m_aIndividualWordsBtn.IsChecked() == m_aIndividualWordsBtn.GetSavedValue() ) + bChanged = FALSE; + + if ( bChanged ) + { + rSet.Put( SvxWordLineModeItem( m_aIndividualWordsBtn.IsChecked(), nWhich ) ); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + bChanged = TRUE; + + // Emphasis + nWhich = GetWhich( SID_ATTR_CHAR_EMPHASISMARK ); + pOld = GetOldItem( rSet, SID_ATTR_CHAR_EMPHASISMARK ); + USHORT nMarkPos = m_aEmphasisLB.GetSelectEntryPos(); + USHORT nPosPos = m_aPositionLB.GetSelectEntryPos(); + FontEmphasisMark eMark = (FontEmphasisMark)nMarkPos; + if ( m_aPositionLB.IsEnabled() ) + { + eMark |= ( CHRDLG_POSITION_UNDER == (ULONG)m_aPositionLB.GetEntryData( nPosPos ) ) + ? EMPHASISMARK_POS_BELOW : EMPHASISMARK_POS_ABOVE; + } + + if ( pOld ) + { + if( rOldSet.GetItemState( nWhich ) != SFX_ITEM_DONTCARE ) + { + const SvxEmphasisMarkItem& rItem = *( (const SvxEmphasisMarkItem*)pOld ); + if ( rItem.GetEmphasisMark() == eMark ) + bChanged = FALSE; + } + } + + if ( rOldSet.GetItemState( nWhich ) == SFX_ITEM_DONTCARE && + m_aEmphasisLB.GetSavedValue() == nMarkPos && m_aPositionLB.GetSavedValue() == nPosPos ) + bChanged = FALSE; + + if ( bChanged ) + { + rSet.Put( SvxEmphasisMarkItem( eMark, nWhich ) ); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + bChanged = TRUE; + + // Effects + nWhich = GetWhich( SID_ATTR_CHAR_CASEMAP ); + pOld = GetOldItem( rSet, SID_ATTR_CHAR_CASEMAP ); + SvxCaseMap eCaseMap = SVX_CASEMAP_NOT_MAPPED; + FASTBOOL bChecked = FALSE; + USHORT nCapsPos = m_aEffects2LB.GetSelectEntryPos(); + if ( nCapsPos != LISTBOX_ENTRY_NOTFOUND ) + { + eCaseMap = (SvxCaseMap)nCapsPos; + bChecked = TRUE; + } + + if ( pOld ) + { + //! if there are different effect styles in the selection the + //! item-state in the 'rOldSet' will be invalid. In this case + //! changing the effect style will be allowed if a style is + //! selected in the listbox. + BOOL bAllowChg = LISTBOX_ENTRY_NOTFOUND != nPos && + SFX_ITEM_DEFAULT > rOldSet.GetItemState( nWhich, TRUE ); + + const SvxCaseMapItem& rItem = *( (const SvxCaseMapItem*)pOld ); + if ( (SvxCaseMap)rItem.GetValue() == eCaseMap && !bAllowChg ) + bChanged = FALSE; + } + + if ( bChanged && bChecked ) + { + rSet.Put( SvxCaseMapItem( eCaseMap, nWhich ) ); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + bChanged = TRUE; + + //Relief + nWhich = GetWhich(SID_ATTR_CHAR_RELIEF); + if(m_aReliefLB.GetSelectEntryPos() != m_aReliefLB.GetSavedValue()) + { + m_aReliefLB.SaveValue(); + SvxCharReliefItem aRelief((FontRelief)m_aReliefLB.GetSelectEntryPos(), nWhich); + rSet.Put(aRelief); + } + + // Outline + const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL; + nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR ); + pOld = GetOldItem( rSet, SID_ATTR_CHAR_CONTOUR ); + TriState eState = m_aOutlineBtn.GetState(); + const SfxPoolItem* pItem; + + if ( pOld ) + { + const SvxContourItem& rItem = *( (const SvxContourItem*)pOld ); + if ( rItem.GetValue() == StateToAttr( eState ) && m_aOutlineBtn.GetSavedValue() == eState ) + bChanged = FALSE; + } + + if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, FALSE, &pItem ) == SFX_ITEM_SET && + !StateToAttr( eState ) && ( (SvxContourItem*)pItem )->GetValue() ) + bChanged = TRUE; + + if ( bChanged && eState != STATE_DONTKNOW ) + { + rSet.Put( SvxContourItem( StateToAttr( eState ), nWhich ) ); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + bChanged = TRUE; + + // Shadow + nWhich = GetWhich( SID_ATTR_CHAR_SHADOWED ); + pOld = GetOldItem( rSet, SID_ATTR_CHAR_SHADOWED ); + eState = m_aShadowBtn.GetState(); + + if ( pOld ) + { + const SvxShadowedItem& rItem = *( (const SvxShadowedItem*)pOld ); + if ( rItem.GetValue() == StateToAttr( eState ) && m_aShadowBtn.GetSavedValue() == eState ) + bChanged = FALSE; + } + + if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, FALSE, &pItem ) == SFX_ITEM_SET && + !StateToAttr( eState ) && ( (SvxShadowedItem*)pItem )->GetValue() ) + bChanged = TRUE; + + if ( bChanged && eState != STATE_DONTKNOW ) + { + rSet.Put( SvxShadowedItem( StateToAttr( eState ), nWhich ) ); + bModified = TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + bChanged = TRUE; + + // Blinking + nWhich = GetWhich( SID_ATTR_FLASH ); + pOld = GetOldItem( rSet, SID_ATTR_FLASH ); + eState = m_aBlinkingBtn.GetState(); + + if ( pOld ) + { + const SvxBlinkItem& rItem = *( (const SvxBlinkItem*)pOld ); + if ( rItem.GetValue() == StateToAttr( eState ) && m_aBlinkingBtn.GetSavedValue() == eState ) + bChanged = FALSE; + } + + if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, FALSE, &pItem ) == SFX_ITEM_SET && + !StateToAttr( eState ) && ( (SvxBlinkItem*)pItem )->GetValue() ) + bChanged = TRUE; + + if ( bChanged && eState != STATE_DONTKNOW ) + { + rSet.Put( SvxBlinkItem( StateToAttr( eState ), nWhich ) ); + bModified = TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + // Hidden + nWhich = GetWhich( SID_ATTR_CHAR_HIDDEN ); + pOld = GetOldItem( rSet, SID_ATTR_CHAR_HIDDEN ); + eState = m_aHiddenBtn.GetState(); + bChanged = TRUE; + + if ( pOld ) + { + const SvxCharHiddenItem& rItem = *( (const SvxCharHiddenItem*)pOld ); + if ( rItem.GetValue() == StateToAttr( eState ) && m_aHiddenBtn.GetSavedValue() == eState ) + bChanged = FALSE; + } + + if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, FALSE, &pItem ) == SFX_ITEM_SET && + !StateToAttr( eState ) && ( (SvxCharHiddenItem*)pItem )->GetValue() ) + bChanged = TRUE; + + if ( bChanged && eState != STATE_DONTKNOW ) + { + rSet.Put( SvxCharHiddenItem( StateToAttr( eState ), nWhich ) ); + bModified = TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + bModified |= FillItemSetColor_Impl( rSet ); + + return bModified; +} + +void SvxCharEffectsPage::DisableControls( USHORT nDisable ) +{ + if ( ( DISABLE_CASEMAP & nDisable ) == DISABLE_CASEMAP ) + { + m_aEffectsFT.Disable(); + m_aEffects2LB.Disable(); + } + + if ( ( DISABLE_WORDLINE & nDisable ) == DISABLE_WORDLINE ) + m_aIndividualWordsBtn.Disable(); + + if ( ( DISABLE_BLINK & nDisable ) == DISABLE_BLINK ) + m_aBlinkingBtn.Disable(); + + if ( ( DISABLE_UNDERLINE_COLOR & nDisable ) == DISABLE_UNDERLINE_COLOR ) + { + // disable the controls + m_aUnderlineColorFT.Disable( ); + m_aUnderlineColorLB.Disable( ); + // and reroute the selection handler of the controls which normally would affect the color box dis-/enabling + m_aUnderlineLB.SetSelectHdl(LINK(this, SvxCharEffectsPage, UpdatePreview_Impl)); + m_aStrikeoutLB.SetSelectHdl(LINK(this, SvxCharEffectsPage, UpdatePreview_Impl)); + } +} + +void SvxCharEffectsPage::EnableFlash() +{ + if ( !( ( m_nHtmlMode & HTMLMODE_ON ) && !( m_nHtmlMode & HTMLMODE_BLINK ) ) ) + m_aBlinkingBtn.Show(); +} + +// ----------------------------------------------------------------------- +void SvxCharEffectsPage::SetPreviewBackgroundToCharacter() +{ + m_bPreviewBackgroundToCharacter = TRUE; +} + +// ----------------------------------------------------------------------- +void SvxCharEffectsPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 +{ + SFX_ITEMSET_ARG (&aSet,pDisableCtlItem,SfxUInt16Item,SID_DISABLE_CTL,sal_False); + SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); + if (pDisableCtlItem) + DisableControls(pDisableCtlItem->GetValue()); + + if (pFlagItem) + { + UINT32 nFlags=pFlagItem->GetValue(); + if ( ( nFlags & SVX_ENABLE_FLASH ) == SVX_ENABLE_FLASH ) + EnableFlash(); + if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER ) + SetPreviewBackgroundToCharacter(); + } +} + +// class SvxCharPositionPage --------------------------------------------- + +SvxCharPositionPage::SvxCharPositionPage( Window* pParent, const SfxItemSet& rInSet ) : + + SvxCharBasePage( pParent, SVX_RES( RID_SVXPAGE_CHAR_POSITION ), rInSet, WIN_POS_PREVIEW, FT_POS_FONTTYPE ), + + m_aPositionLine ( this, SVX_RES( FL_POSITION ) ), + m_aHighPosBtn ( this, SVX_RES( RB_HIGHPOS ) ), + m_aNormalPosBtn ( this, SVX_RES( RB_NORMALPOS ) ), + m_aLowPosBtn ( this, SVX_RES( RB_LOWPOS ) ), + m_aHighLowFT ( this, SVX_RES( FT_HIGHLOW ) ), + m_aHighLowEdit ( this, SVX_RES( ED_HIGHLOW ) ), + m_aHighLowRB ( this, SVX_RES( CB_HIGHLOW ) ), + m_aFontSizeFT ( this, SVX_RES( FT_FONTSIZE ) ), + m_aFontSizeEdit ( this, SVX_RES( ED_FONTSIZE ) ), + m_aRotationScalingFL( this, SVX_RES( FL_ROTATION_SCALING ) ), + m_aScalingFL ( this, SVX_RES( FL_SCALING ) ), + m_a0degRB ( this, SVX_RES( RB_0_DEG ) ), + m_a90degRB ( this, SVX_RES( RB_90_DEG ) ), + m_a270degRB ( this, SVX_RES( RB_270_DEG ) ), + m_aFitToLineCB ( this, SVX_RES( CB_FIT_TO_LINE ) ), + m_aScaleWidthFT ( this, SVX_RES( FT_SCALE_WIDTH ) ), + m_aScaleWidthMF ( this, SVX_RES( MF_SCALE_WIDTH ) ), + + m_aKerningLine ( this, SVX_RES( FL_KERNING2 ) ), + m_aKerningLB ( this, SVX_RES( LB_KERNING2 ) ), + m_aKerningFT ( this, SVX_RES( FT_KERNING2 ) ), + m_aKerningEdit ( this, SVX_RES( ED_KERNING2 ) ), + m_aPairKerningBtn ( this, SVX_RES( CB_PAIRKERNING ) ), + + m_nSuperEsc ( (short)DFLT_ESC_SUPER ), + m_nSubEsc ( (short)DFLT_ESC_SUB ), + m_nScaleWidthItemSetVal ( 100 ), + m_nScaleWidthInitialVal ( 100 ), + m_nSuperProp ( (BYTE)DFLT_ESC_PROP ), + m_nSubProp ( (BYTE)DFLT_ESC_PROP ) +{ + FreeResource(); + Initialize(); +} + +// ----------------------------------------------------------------------- + +void SvxCharPositionPage::Initialize() +{ + // to handle the changes of the other pages + SetExchangeSupport(); + + GetPreviewFont().SetSize( Size( 0, 240 ) ); + GetPreviewCJKFont().SetSize( Size( 0, 240 ) ); + GetPreviewCTLFont().SetSize( Size( 0, 240 ) ); + + m_aNormalPosBtn.Check(); + PositionHdl_Impl( &m_aNormalPosBtn ); + m_aKerningLB.SelectEntryPos( 0 ); + KerningSelectHdl_Impl( NULL ); + + Link aLink = LINK( this, SvxCharPositionPage, PositionHdl_Impl ); + m_aHighPosBtn.SetClickHdl( aLink ); + m_aNormalPosBtn.SetClickHdl( aLink ); + m_aLowPosBtn.SetClickHdl( aLink ); + + aLink = LINK( this, SvxCharPositionPage, RotationHdl_Impl ); + m_a0degRB .SetClickHdl( aLink ); + m_a90degRB .SetClickHdl( aLink ); + m_a270degRB.SetClickHdl( aLink ); + + aLink = LINK( this, SvxCharPositionPage, FontModifyHdl_Impl ); + m_aHighLowEdit.SetModifyHdl( aLink ); + m_aFontSizeEdit.SetModifyHdl( aLink ); + + aLink = LINK( this, SvxCharPositionPage, LoseFocusHdl_Impl ); + m_aHighLowEdit.SetLoseFocusHdl( aLink ); + m_aFontSizeEdit.SetLoseFocusHdl( aLink ); + + m_aHighLowRB.SetClickHdl( LINK( this, SvxCharPositionPage, AutoPositionHdl_Impl ) ); + m_aFitToLineCB.SetClickHdl( LINK( this, SvxCharPositionPage, FitToLineHdl_Impl ) ); + m_aKerningLB.SetSelectHdl( LINK( this, SvxCharPositionPage, KerningSelectHdl_Impl ) ); + m_aKerningEdit.SetModifyHdl( LINK( this, SvxCharPositionPage, KerningModifyHdl_Impl ) ); + m_aPairKerningBtn.SetClickHdl( LINK( this, SvxCharPositionPage, PairKerningHdl_Impl ) ); + m_aScaleWidthMF.SetModifyHdl( LINK( this, SvxCharPositionPage, ScaleWidthModifyHdl_Impl ) ); +} + +// ----------------------------------------------------------------------- + +void SvxCharPositionPage::UpdatePreview_Impl( BYTE nProp, BYTE nEscProp, short nEsc ) +{ + SetPrevFontEscapement( nProp, nEscProp, nEsc ); +} + +// ----------------------------------------------------------------------- + +void SvxCharPositionPage::SetEscapement_Impl( USHORT nEsc ) +{ + SvxEscapementItem aEscItm( (SvxEscapement)nEsc, SID_ATTR_CHAR_ESCAPEMENT ); + + if ( SVX_ESCAPEMENT_SUPERSCRIPT == nEsc ) + { + aEscItm.GetEsc() = m_nSuperEsc; + aEscItm.GetProp() = m_nSuperProp; + } + else if ( SVX_ESCAPEMENT_SUBSCRIPT == nEsc ) + { + aEscItm.GetEsc() = m_nSubEsc; + aEscItm.GetProp() = m_nSubProp; + } + + short nFac = aEscItm.GetEsc() < 0 ? -1 : 1; + + m_aHighLowEdit.SetValue( aEscItm.GetEsc() * nFac ); + m_aFontSizeEdit.SetValue( aEscItm.GetProp() ); + + if ( SVX_ESCAPEMENT_OFF == nEsc ) + { + m_aHighLowFT.Disable(); + m_aHighLowEdit.Disable(); + m_aFontSizeFT.Disable(); + m_aFontSizeEdit.Disable(); + m_aHighLowRB.Disable(); + } + else + { + m_aFontSizeFT.Enable(); + m_aFontSizeEdit.Enable(); + m_aHighLowRB.Enable(); + + if ( !m_aHighLowRB.IsChecked() ) + { + m_aHighLowFT.Enable(); + m_aHighLowEdit.Enable(); + } + else + AutoPositionHdl_Impl( &m_aHighLowRB ); + } + + UpdatePreview_Impl( 100, aEscItm.GetProp(), aEscItm.GetEsc() ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharPositionPage, PositionHdl_Impl, RadioButton*, pBtn ) +{ + USHORT nEsc = SVX_ESCAPEMENT_OFF; // also when pBtn == NULL + + if ( &m_aHighPosBtn == pBtn ) + nEsc = SVX_ESCAPEMENT_SUPERSCRIPT; + else if ( &m_aLowPosBtn == pBtn ) + nEsc = SVX_ESCAPEMENT_SUBSCRIPT; + + SetEscapement_Impl( nEsc ); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharPositionPage, RotationHdl_Impl, RadioButton*, pBtn ) +{ + BOOL bEnable = FALSE; + if (&m_a90degRB == pBtn || &m_a270degRB == pBtn) + bEnable = TRUE; + else + OSL_ENSURE( &m_a0degRB == pBtn, "unexpected button" ); + m_aFitToLineCB.Enable( bEnable ); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharPositionPage, FontModifyHdl_Impl, MetricField*, EMPTYARG ) +{ + BYTE nEscProp = (BYTE)m_aFontSizeEdit.GetValue(); + short nEsc = (short)m_aHighLowEdit.GetValue(); + nEsc *= m_aLowPosBtn.IsChecked() ? -1 : 1; + UpdatePreview_Impl( 100, nEscProp, nEsc ); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharPositionPage, AutoPositionHdl_Impl, CheckBox*, pBox ) +{ + if ( pBox->IsChecked() ) + { + m_aHighLowFT.Disable(); + m_aHighLowEdit.Disable(); + } + else + PositionHdl_Impl( m_aHighPosBtn.IsChecked() ? &m_aHighPosBtn + : m_aLowPosBtn.IsChecked() ? &m_aLowPosBtn + : &m_aNormalPosBtn ); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharPositionPage, FitToLineHdl_Impl, CheckBox*, pBox ) +{ + if ( &m_aFitToLineCB == pBox) + { + UINT16 nVal = m_nScaleWidthInitialVal; + if (m_aFitToLineCB.IsChecked()) + nVal = m_nScaleWidthItemSetVal; + m_aScaleWidthMF.SetValue( nVal ); + + m_aPreviewWin.SetFontWidthScale( nVal ); + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharPositionPage, KerningSelectHdl_Impl, ListBox*, EMPTYARG ) +{ + if ( m_aKerningLB.GetSelectEntryPos() > 0 ) + { + m_aKerningFT.Enable(); + m_aKerningEdit.Enable(); + + if ( m_aKerningLB.GetSelectEntryPos() == 2 ) + { + // Condensed -> max value == 1/6 of the current font height + SvxFont& rFont = GetPreviewFont(); + long nMax = rFont.GetSize().Height() / 6; + m_aKerningEdit.SetMax( m_aKerningEdit.Normalize( nMax ), FUNIT_TWIP ); + m_aKerningEdit.SetLast( m_aKerningEdit.GetMax( m_aKerningEdit.GetUnit() ) ); + } + else + { + m_aKerningEdit.SetMax( 9999 ); + m_aKerningEdit.SetLast( 9999 ); + } + } + else + { + m_aKerningEdit.SetValue( 0 ); + m_aKerningFT.Disable(); + m_aKerningEdit.Disable(); + } + + KerningModifyHdl_Impl( NULL ); + + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharPositionPage, KerningModifyHdl_Impl, MetricField*, EMPTYARG ) +{ + long nVal = static_cast(m_aKerningEdit.GetValue()); + nVal = LogicToLogic( nVal, MAP_POINT, MAP_TWIP ); + long nKern = (short)m_aKerningEdit.Denormalize( nVal ); + + // Condensed? -> then negative + if ( m_aKerningLB.GetSelectEntryPos() == 2 ) + nKern *= -1; + + SvxFont& rFont = GetPreviewFont(); + SvxFont& rCJKFont = GetPreviewCJKFont(); + SvxFont& rCTLFont = GetPreviewCTLFont(); + + rFont.SetFixKerning( (short)nKern ); + rCJKFont.SetFixKerning( (short)nKern ); + rCTLFont.SetFixKerning( (short)nKern ); + m_aPreviewWin.Invalidate(); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharPositionPage, PairKerningHdl_Impl, CheckBox*, EMPTYARG ) +{ + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharPositionPage, LoseFocusHdl_Impl, MetricField*, pField ) +{ +#ifdef DBG_UTIL + sal_Bool bHigh = m_aHighPosBtn.IsChecked(); +#endif + sal_Bool bLow = m_aLowPosBtn.IsChecked(); + DBG_ASSERT( bHigh || bLow, "normal position is not valid" ); + + if ( &m_aHighLowEdit == pField ) + { + if ( bLow ) + m_nSubEsc = (short)m_aHighLowEdit.GetValue() * -1; + else + m_nSuperEsc = (short)m_aHighLowEdit.GetValue(); + } + else if ( &m_aFontSizeEdit == pField ) + { + if ( bLow ) + m_nSubProp = (BYTE)m_aFontSizeEdit.GetValue(); + else + m_nSuperProp = (BYTE)m_aFontSizeEdit.GetValue(); + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharPositionPage, ScaleWidthModifyHdl_Impl, MetricField*, EMPTYARG ) +{ + m_aPreviewWin.SetFontWidthScale( USHORT( m_aScaleWidthMF.GetValue() ) ); + + return 0; +} + +/* -----------------28.08.2003 12:12----------------- + + --------------------------------------------------*/ +void SvxCharPositionPage::ActivatePage( const SfxItemSet& rSet ) +{ + //update the preview + SvxCharBasePage::ActivatePage( rSet ); + + //the only thing that has to be checked is the max. allowed value for the + //condense edit field + if ( m_aKerningLB.GetSelectEntryPos() == 2 ) + { + // Condensed -> max value == 1/6 of the current font height + SvxFont& rFont = GetPreviewFont(); + long nMax = rFont.GetSize().Height() / 6; + long nKern = (short)m_aKerningEdit.Denormalize( LogicToLogic( static_cast(m_aKerningEdit.GetValue()), MAP_POINT, MAP_TWIP ) ); + m_aKerningEdit.SetMax( m_aKerningEdit.Normalize( nKern > nMax ? nKern : nMax ), FUNIT_TWIP ); + m_aKerningEdit.SetLast( m_aKerningEdit.GetMax( m_aKerningEdit.GetUnit() ) ); + } +} + +// ----------------------------------------------------------------------- + +int SvxCharPositionPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if ( _pSet ) + FillItemSet( *_pSet ); + return LEAVE_PAGE; +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxCharPositionPage::Create( Window* pParent, const SfxItemSet& rSet ) +{ + return new SvxCharPositionPage( pParent, rSet ); +} + +// ----------------------------------------------------------------------- + +USHORT* SvxCharPositionPage::GetRanges() +{ + return pPositionRanges; +} + +// ----------------------------------------------------------------------- +#define ENABLE_AND_CHECK( aCheckBox ) \ + if ( !aCheckBox.IsEnabled() ) \ + aCheckBox.Enable(); \ + aCheckBox.Check( TRUE ) + +void SvxCharPositionPage::Reset( const SfxItemSet& rSet ) +{ + String sUser = GetUserData(); + + if ( sUser.Len() ) + { + m_nSuperEsc = (short)sUser.GetToken( 0 ).ToInt32(); + m_nSubEsc = (short)sUser.GetToken( 1 ).ToInt32(); + m_nSuperProp = (BYTE)sUser.GetToken( 2 ).ToInt32(); + m_nSubProp = (BYTE)sUser.GetToken( 3 ).ToInt32(); + } + + short nEsc = 0; + BYTE nEscProp = 100; + BYTE nProp = 100; + + m_aHighLowFT.Disable(); + m_aHighLowEdit.Disable(); + m_aFontSizeFT.Disable(); + m_aFontSizeEdit.Disable(); + + SvxFont& rFont = GetPreviewFont(); + SvxFont& rCJKFont = GetPreviewCJKFont(); + SvxFont& rCTLFont = GetPreviewCTLFont(); + USHORT nWhich = GetWhich( SID_ATTR_CHAR_ESCAPEMENT ); + + if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT ) + { + const SvxEscapementItem& rItem = (SvxEscapementItem&)rSet.Get( nWhich ); + nEsc = rItem.GetEsc(); + nEscProp = rItem.GetProp(); + + if ( nEsc != 0 ) + { + m_aHighLowFT.Enable(); + m_aHighLowEdit.Enable(); + m_aFontSizeFT.Enable(); + m_aFontSizeEdit.Enable(); + + short nFac; + + if ( nEsc > 0 ) + { + nFac = 1; + m_aHighPosBtn.Check( TRUE ); + if ( nEsc == DFLT_ESC_AUTO_SUPER ) + { + ENABLE_AND_CHECK( m_aHighLowRB ); + nEsc = DFLT_ESC_SUPER; + } + } + else + { + nFac = -1; + m_aLowPosBtn.Check( TRUE ); + if ( nEsc == DFLT_ESC_AUTO_SUB ) + { + ENABLE_AND_CHECK( m_aHighLowRB ); + nEsc = DFLT_ESC_SUB; + } + } + + if ( m_aHighLowRB.IsChecked() ) + { + m_aHighLowFT.Disable(); + m_aHighLowEdit.Disable(); + } + m_aHighLowEdit.SetValue( m_aHighLowEdit.Normalize( nFac * nEsc ) ); + } + else + { + m_aNormalPosBtn.Check( TRUE ); + m_aHighLowRB.Check( TRUE ); + PositionHdl_Impl( NULL ); + } + //the height has to be set after the handler is called to keep the value also if the escapement is zero + m_aFontSizeEdit.SetValue( m_aFontSizeEdit.Normalize( nEscProp ) ); + } + else + { + m_aHighPosBtn.Check( FALSE ); + m_aNormalPosBtn.Check( FALSE ); + m_aLowPosBtn.Check( FALSE ); + } + + // BspFont setzen + SetPrevFontEscapement( nProp, nEscProp, nEsc ); + + // Kerning + nWhich = GetWhich( SID_ATTR_CHAR_KERNING ); + + if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT ) + { + const SvxKerningItem& rItem = (SvxKerningItem&)rSet.Get( nWhich ); + SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich ); + MapUnit eOrgUnit = (MapUnit)eUnit; + MapUnit ePntUnit( MAP_POINT ); + long nBig = static_cast(m_aKerningEdit.Normalize( static_cast(rItem.GetValue()) )); + long nKerning = LogicToLogic( nBig, eOrgUnit, ePntUnit ); + + // Kerning am Font setzen, vorher in Twips umrechnen + long nKern = LogicToLogic( rItem.GetValue(), (MapUnit)eUnit, MAP_TWIP ); + rFont.SetFixKerning( (short)nKern ); + rCJKFont.SetFixKerning( (short)nKern ); + rCTLFont.SetFixKerning( (short)nKern ); + + if ( nKerning > 0 ) + { + m_aKerningLB.SelectEntryPos( LW_GESPERRT ); + } + else if ( nKerning < 0 ) + { + m_aKerningLB.SelectEntryPos( LW_SCHMAL ); + nKerning = -nKerning; + } + else + { + nKerning = 0; + m_aKerningLB.SelectEntryPos( LW_NORMAL ); + } + //enable/disable and set min/max of the Edit + KerningSelectHdl_Impl(&m_aKerningLB); + //the attribute value must be displayed also if it's above the maximum allowed value + long nVal = static_cast(m_aKerningEdit.GetMax()); + if(nVal < nKerning) + m_aKerningEdit.SetMax( nKerning ); + m_aKerningEdit.SetValue( nKerning ); + } + else + m_aKerningEdit.SetText( String() ); + + // Pair kerning + nWhich = GetWhich( SID_ATTR_CHAR_AUTOKERN ); + + if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT ) + { + const SvxAutoKernItem& rItem = (SvxAutoKernItem&)rSet.Get( nWhich ); + m_aPairKerningBtn.Check( rItem.GetValue() ); + } + else + m_aPairKerningBtn.Check( FALSE ); + + // Scale Width + nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH ); + if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT ) + { + const SvxCharScaleWidthItem& rItem = ( SvxCharScaleWidthItem& ) rSet.Get( nWhich ); + m_nScaleWidthInitialVal = rItem.GetValue(); + m_aScaleWidthMF.SetValue( m_nScaleWidthInitialVal ); + } + else + m_aScaleWidthMF.SetValue( 100 ); + + nWhich = GetWhich( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ); + if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT ) + m_nScaleWidthItemSetVal = ((SfxUInt16Item&) rSet.Get( nWhich )).GetValue(); + + // Rotation + nWhich = GetWhich( SID_ATTR_CHAR_ROTATED ); + SfxItemState eState = rSet.GetItemState( nWhich ); + if( SFX_ITEM_UNKNOWN == eState ) + { + m_aRotationScalingFL.Hide(); + m_aScalingFL.Show(); + m_a0degRB.Hide(); + m_a90degRB.Hide(); + m_a270degRB.Hide(); + m_aFitToLineCB.Hide(); + m_aFitToLineCB .Hide(); + + + // move the following controls upwards + Window* aCntrlArr[] = { + &m_aScaleWidthFT, &m_aScaleWidthMF, &m_aKerningLine, + &m_aKerningLB, &m_aKerningFT, &m_aKerningEdit, &m_aPairKerningBtn, + 0 }; + + long nDiff = m_aScaleWidthMF.GetPosPixel().Y() - + m_a0degRB.GetPosPixel().Y(); + + for( Window** ppW = aCntrlArr; *ppW; ++ppW ) + { + Point aPnt( (*ppW)->GetPosPixel() ); + aPnt.Y() -= nDiff; + (*ppW)->SetPosPixel( aPnt ); + } + } + else + { + m_aScalingFL.Hide(); + + Link aOldLink( m_aFitToLineCB.GetClickHdl() ); + m_aFitToLineCB.SetClickHdl( Link() ); + if( eState >= SFX_ITEM_DEFAULT ) + { + const SvxCharRotateItem& rItem = + (SvxCharRotateItem&) rSet.Get( nWhich ); + if (rItem.IsBottomToTop()) + m_a90degRB.Check( TRUE ); + else if (rItem.IsTopToBotton()) + m_a270degRB.Check( TRUE ); + else + { + DBG_ASSERT( 0 == rItem.GetValue(), "incorrect value" ); + m_a0degRB.Check( TRUE ); + } + m_aFitToLineCB.Check( rItem.IsFitToLine() ); + } + else + { + if( eState == SFX_ITEM_DONTCARE ) + { + m_a0degRB.Check( FALSE ); + m_a90degRB.Check( FALSE ); + m_a270degRB.Check( FALSE ); + } + else + m_a0degRB.Check( TRUE ); + + m_aFitToLineCB.Check( FALSE ); + } + m_aFitToLineCB.SetClickHdl( aOldLink ); + m_aFitToLineCB.Enable( !m_a0degRB.IsChecked() ); + + // is this value set? + if( SFX_ITEM_UNKNOWN == rSet.GetItemState( GetWhich( + SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ) )) + m_aFitToLineCB.Hide(); + } + + m_aHighPosBtn.SaveValue(); + m_aNormalPosBtn.SaveValue(); + m_aLowPosBtn.SaveValue(); + m_a0degRB.SaveValue(); + m_a90degRB.SaveValue(); + m_a270degRB.SaveValue(); + m_aFitToLineCB.SaveValue(); + m_aScaleWidthMF.SaveValue(); + m_aKerningLB.SaveValue(); + m_aKerningEdit.SaveValue(); + m_aPairKerningBtn.SaveValue(); +} + +// ----------------------------------------------------------------------- + +BOOL SvxCharPositionPage::FillItemSet( SfxItemSet& rSet ) +{ + // Position (hoch, normal oder tief) + const SfxItemSet& rOldSet = GetItemSet(); + BOOL bModified = FALSE, bChanged = TRUE; + USHORT nWhich = GetWhich( SID_ATTR_CHAR_ESCAPEMENT ); + const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_CHAR_ESCAPEMENT ); + const FASTBOOL bHigh = m_aHighPosBtn.IsChecked(); + short nEsc; + BYTE nEscProp; + + if ( bHigh || m_aLowPosBtn.IsChecked() ) + { + if ( m_aHighLowRB.IsChecked() ) + nEsc = bHigh ? DFLT_ESC_AUTO_SUPER : DFLT_ESC_AUTO_SUB; + else + { + nEsc = (short)m_aHighLowEdit.Denormalize( m_aHighLowEdit.GetValue() ); + nEsc *= bHigh ? 1 : -1; + } + nEscProp = (BYTE)m_aFontSizeEdit.Denormalize( m_aFontSizeEdit.GetValue() ); + } + else + { + nEsc = 0; + nEscProp = 100; + } + + if ( pOld ) + { + const SvxEscapementItem& rItem = *( (const SvxEscapementItem*)pOld ); + if ( rItem.GetEsc() == nEsc && rItem.GetProp() == nEscProp ) + bChanged = FALSE; + } + + if ( !bChanged && !m_aHighPosBtn.GetSavedValue() && + !m_aNormalPosBtn.GetSavedValue() && !m_aLowPosBtn.GetSavedValue() ) + bChanged = TRUE; + + if ( bChanged && + ( m_aHighPosBtn.IsChecked() || m_aNormalPosBtn.IsChecked() || m_aLowPosBtn.IsChecked() ) ) + { + rSet.Put( SvxEscapementItem( nEsc, nEscProp, nWhich ) ); + bModified = TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + bChanged = TRUE; + + // Kerning + nWhich = GetWhich( SID_ATTR_CHAR_KERNING ); + pOld = GetOldItem( rSet, SID_ATTR_CHAR_KERNING ); + USHORT nPos = m_aKerningLB.GetSelectEntryPos(); + short nKerning = 0; + SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich ); + + if ( nPos == LW_GESPERRT || nPos == LW_SCHMAL ) + { + long nTmp = static_cast(m_aKerningEdit.GetValue()); + long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit ); + nKerning = (short)m_aKerningEdit.Denormalize( nVal ); + + if ( nPos == LW_SCHMAL ) + nKerning *= - 1; + } + + if ( pOld ) + { + const SvxKerningItem& rItem = *( (const SvxKerningItem*)pOld ); + if ( rItem.GetValue() == nKerning ) + bChanged = FALSE; + } + + if ( !bChanged && + ( m_aKerningLB.GetSavedValue() == LISTBOX_ENTRY_NOTFOUND || + ( !m_aKerningEdit.GetSavedValue().Len() && m_aKerningEdit.IsEnabled() ) ) ) + bChanged = TRUE; + + if ( bChanged && nPos != LISTBOX_ENTRY_NOTFOUND ) + { + rSet.Put( SvxKerningItem( nKerning, nWhich ) ); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + bChanged = TRUE; + + // Pair-Kerning + nWhich = GetWhich( SID_ATTR_CHAR_AUTOKERN ); + + if ( m_aPairKerningBtn.IsChecked() != m_aPairKerningBtn.GetSavedValue() ) + { + rSet.Put( SvxAutoKernItem( m_aPairKerningBtn.IsChecked(), nWhich ) ); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + // Scale Width + nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH ); + if ( m_aScaleWidthMF.GetText() != m_aScaleWidthMF.GetSavedValue() ) + { + rSet.Put( SvxCharScaleWidthItem( (USHORT)m_aScaleWidthMF.GetValue(), nWhich ) ); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + // Rotation + nWhich = GetWhich( SID_ATTR_CHAR_ROTATED ); + if ( m_a0degRB .IsChecked() != m_a0degRB .GetSavedValue() || + m_a90degRB .IsChecked() != m_a90degRB .GetSavedValue() || + m_a270degRB .IsChecked() != m_a270degRB .GetSavedValue() || + m_aFitToLineCB.IsChecked() != m_aFitToLineCB.GetSavedValue() ) + { + SvxCharRotateItem aItem( 0, m_aFitToLineCB.IsChecked(), nWhich ); + if (m_a90degRB.IsChecked()) + aItem.SetBottomToTop(); + else if (m_a270degRB.IsChecked()) + aItem.SetTopToBotton(); + rSet.Put( aItem ); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + return bModified; +} + +// ----------------------------------------------------------------------- + +void SvxCharPositionPage::FillUserData() +{ + const sal_Unicode cTok = ';'; + + String sUser( UniString::CreateFromInt32( m_nSuperEsc ) ); + sUser.Append( cTok ); + sUser.Append( UniString::CreateFromInt32( m_nSubEsc ) ); + sUser.Append( cTok ); + sUser.Append( UniString::CreateFromInt32( m_nSuperProp ) ); + sUser.Append( cTok ); + sUser.Append( UniString::CreateFromInt32( m_nSubProp ) ); + SetUserData( sUser ); +} + +// ----------------------------------------------------------------------- +void SvxCharPositionPage::SetPreviewBackgroundToCharacter() +{ + m_bPreviewBackgroundToCharacter = TRUE; +} +// ----------------------------------------------------------------------- +void SvxCharPositionPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 +{ + SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); + if (pFlagItem) + { + UINT32 nFlags=pFlagItem->GetValue(); + if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER ) + SetPreviewBackgroundToCharacter(); + } +} +// class SvxCharTwoLinesPage ------------------------------------------------ + +SvxCharTwoLinesPage::SvxCharTwoLinesPage( Window* pParent, const SfxItemSet& rInSet ) : + + SvxCharBasePage( pParent, SVX_RES( RID_SVXPAGE_CHAR_TWOLINES ), rInSet, WIN_TWOLINES_PREVIEW, FT_TWOLINES_FONTTYPE ), + + m_aSwitchOnLine ( this, SVX_RES( FL_SWITCHON ) ), + m_aTwoLinesBtn ( this, SVX_RES( CB_TWOLINES ) ), + + m_aEncloseLine ( this, SVX_RES( FL_ENCLOSE ) ), + m_aStartBracketFT ( this, SVX_RES( FT_STARTBRACKET ) ), + m_aStartBracketLB ( this, SVX_RES( ED_STARTBRACKET ) ), + m_aEndBracketFT ( this, SVX_RES( FT_ENDBRACKET ) ), + m_aEndBracketLB ( this, SVX_RES( ED_ENDBRACKET ) ), + m_nStartBracketPosition( 0 ), + m_nEndBracketPosition( 0 ) +{ + FreeResource(); + Initialize(); +} + +// ----------------------------------------------------------------------- + +void SvxCharTwoLinesPage::Initialize() +{ + Size aSize = m_aStartBracketLB.GetSizePixel(); + aSize.Height() = m_aStartBracketLB.CalcSize( 1, 6 ).Height(); + m_aStartBracketLB.SetSizePixel( aSize ); + aSize = m_aEndBracketLB.GetSizePixel(); + aSize.Height() = m_aEndBracketLB.CalcSize( 1, 6 ).Height(); + m_aEndBracketLB.SetSizePixel( aSize ); + + m_aTwoLinesBtn.Check( FALSE ); + TwoLinesHdl_Impl( NULL ); + + m_aTwoLinesBtn.SetClickHdl( LINK( this, SvxCharTwoLinesPage, TwoLinesHdl_Impl ) ); + + Link aLink = LINK( this, SvxCharTwoLinesPage, CharacterMapHdl_Impl ); + m_aStartBracketLB.SetSelectHdl( aLink ); + m_aEndBracketLB.SetSelectHdl( aLink ); + + SvxFont& rFont = GetPreviewFont(); + SvxFont& rCJKFont = GetPreviewCJKFont(); + SvxFont& rCTLFont = GetPreviewCTLFont(); + rFont.SetSize( Size( 0, 220 ) ); + rCJKFont.SetSize( Size( 0, 220 ) ); + rCTLFont.SetSize( Size( 0, 220 ) ); +} + +// ----------------------------------------------------------------------- + +void SvxCharTwoLinesPage::SelectCharacter( ListBox* pBox ) +{ + //CHINA001 SvxCharacterMap aDlg( this ); + bool bStart = pBox == &m_aStartBracketLB; + //SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + //if(pFact) + { + //AbstractSvxCharacterMap* aDlg = pFact->CreateSvxCharacterMap( this, RID_SVXDLG_CHARMAP ); + SvxCharacterMap* aDlg = new SvxCharacterMap( this ); + aDlg->DisableFontSelection();//CHINA001 aDlg.DisableFontSelection(); + + if ( aDlg->Execute() == RET_OK )//CHINA001 ( aDlg.Execute() == RET_OK ) + { + sal_Unicode cChar = (sal_Unicode) aDlg->GetChar();//CHINA001 aDlg.GetChar(); + SetBracket( cChar, bStart ); + } + else + { + pBox->SelectEntryPos( bStart ? m_nStartBracketPosition : m_nEndBracketPosition ); + } + delete aDlg; //add CHINA001 + } +} + +// ----------------------------------------------------------------------- + +void SvxCharTwoLinesPage::SetBracket( sal_Unicode cBracket, BOOL bStart ) +{ + USHORT nEntryPos = 0; + ListBox* pBox = bStart ? &m_aStartBracketLB : &m_aEndBracketLB; + if ( 0 == cBracket ) + pBox->SelectEntryPos(0); + else + { + FASTBOOL bFound = FALSE; + for ( USHORT i = 1; i < pBox->GetEntryCount(); ++i ) + { + if ( (ULONG)pBox->GetEntryData(i) != CHRDLG_ENCLOSE_SPECIAL_CHAR ) + { + const sal_Unicode cChar = pBox->GetEntry(i).GetChar(0); + if ( cChar == cBracket ) + { + pBox->SelectEntryPos(i); + nEntryPos = i; + bFound = TRUE; + break; + } + } + } + + if ( !bFound ) + { + nEntryPos = pBox->InsertEntry( String( cBracket ) ); + pBox->SelectEntryPos( nEntryPos ); + } + } + if( bStart ) + m_nStartBracketPosition = nEntryPos; + else + m_nEndBracketPosition = nEntryPos; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharTwoLinesPage, TwoLinesHdl_Impl, CheckBox*, EMPTYARG ) +{ + BOOL bChecked = m_aTwoLinesBtn.IsChecked(); + m_aStartBracketFT.Enable( bChecked ); + m_aStartBracketLB.Enable( bChecked ); + m_aEndBracketFT.Enable( bChecked ); + m_aEndBracketLB.Enable( bChecked ); + + UpdatePreview_Impl(); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxCharTwoLinesPage, CharacterMapHdl_Impl, ListBox*, pBox ) +{ + USHORT nPos = pBox->GetSelectEntryPos(); + if ( CHRDLG_ENCLOSE_SPECIAL_CHAR == (ULONG)pBox->GetEntryData( nPos ) ) + SelectCharacter( pBox ); + else + { + bool bStart = pBox == &m_aStartBracketLB; + if( bStart ) + m_nStartBracketPosition = nPos; + else + m_nEndBracketPosition = nPos; + } + UpdatePreview_Impl(); + return 0; +} + +// ----------------------------------------------------------------------- + +void SvxCharTwoLinesPage::ActivatePage( const SfxItemSet& rSet ) +{ + SvxCharBasePage::ActivatePage( rSet ); +} + +// ----------------------------------------------------------------------- + +int SvxCharTwoLinesPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if ( _pSet ) + FillItemSet( *_pSet ); + return LEAVE_PAGE; +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxCharTwoLinesPage::Create( Window* pParent, const SfxItemSet& rSet ) +{ + return new SvxCharTwoLinesPage( pParent, rSet ); +} + +// ----------------------------------------------------------------------- + +USHORT* SvxCharTwoLinesPage::GetRanges() +{ + return pTwoLinesRanges; +} + +// ----------------------------------------------------------------------- + +void SvxCharTwoLinesPage::Reset( const SfxItemSet& rSet ) +{ + m_aTwoLinesBtn.Check( FALSE ); + USHORT nWhich = GetWhich( SID_ATTR_CHAR_TWO_LINES ); + SfxItemState eState = rSet.GetItemState( nWhich ); + + if ( eState >= SFX_ITEM_DONTCARE ) + { + const SvxTwoLinesItem& rItem = (SvxTwoLinesItem&)rSet.Get( nWhich ); + m_aTwoLinesBtn.Check( rItem.GetValue() ); + + if ( rItem.GetValue() ) + { + SetBracket( rItem.GetStartBracket(), TRUE ); + SetBracket( rItem.GetEndBracket(), FALSE ); + } + } + TwoLinesHdl_Impl( NULL ); + + SetPrevFontWidthScale( rSet ); +} + +// ----------------------------------------------------------------------- + +BOOL SvxCharTwoLinesPage::FillItemSet( SfxItemSet& rSet ) +{ + const SfxItemSet& rOldSet = GetItemSet(); + BOOL bModified = FALSE, bChanged = TRUE; + USHORT nWhich = GetWhich( SID_ATTR_CHAR_TWO_LINES ); + const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_CHAR_TWO_LINES ); + sal_Bool bOn = m_aTwoLinesBtn.IsChecked(); + sal_Unicode cStart = ( bOn && m_aStartBracketLB.GetSelectEntryPos() > 0 ) + ? m_aStartBracketLB.GetSelectEntry().GetChar(0) : 0; + sal_Unicode cEnd = ( bOn && m_aEndBracketLB.GetSelectEntryPos() > 0 ) + ? m_aEndBracketLB.GetSelectEntry().GetChar(0) : 0; + + if ( pOld ) + { + const SvxTwoLinesItem& rItem = *( (const SvxTwoLinesItem*)pOld ); + if ( rItem.GetValue() == bOn && + ( !bOn || ( rItem.GetStartBracket() == cStart && rItem.GetEndBracket() == cEnd ) ) ) + bChanged = FALSE; + } + + if ( bChanged ) + { + rSet.Put( SvxTwoLinesItem( bOn, cStart, cEnd, nWhich ) ); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) + CLEARTITEM; + + return bModified; +} +/* -----------------------------04.12.00 09:48-------------------------------- + + ---------------------------------------------------------------------------*/ +void SvxCharTwoLinesPage::UpdatePreview_Impl() +{ + sal_Unicode cStart = m_aStartBracketLB.GetSelectEntryPos() > 0 + ? m_aStartBracketLB.GetSelectEntry().GetChar(0) : 0; + sal_Unicode cEnd = m_aEndBracketLB.GetSelectEntryPos() > 0 + ? m_aEndBracketLB.GetSelectEntry().GetChar(0) : 0; + m_aPreviewWin.SetBrackets(cStart, cEnd); + m_aPreviewWin.SetTwoLines(m_aTwoLinesBtn.IsChecked()); + m_aPreviewWin.Invalidate(); +} +// ----------------------------------------------------------------------- +void SvxCharTwoLinesPage::SetPreviewBackgroundToCharacter() +{ + m_bPreviewBackgroundToCharacter = TRUE; +} + +// ----------------------------------------------------------------------- +void SvxCharTwoLinesPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 +{ + SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); + if (pFlagItem) + { + UINT32 nFlags=pFlagItem->GetValue(); + if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER ) + SetPreviewBackgroundToCharacter(); + } +} diff --git a/cui/source/tabpages/chardlg.h b/cui/source/tabpages/chardlg.h new file mode 100644 index 000000000000..83af82c3118c --- /dev/null +++ b/cui/source/tabpages/chardlg.h @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: chardlg.h,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_CHARDLG_H +#define _SVX_CHARDLG_H + +// define ---------------------------------------------------------------- + +#define CHRDLG_UNDERLINE_NONE 0 +#define CHRDLG_UNDERLINE_SINGLE 1 +#define CHRDLG_UNDERLINE_DOUBLE 2 +#define CHRDLG_UNDERLINE_DOTTED 3 +#define CHRDLG_UNDERLINE_DONTKNOW 4 +#define CHRDLG_UNDERLINE_DASH 5 +#define CHRDLG_UNDERLINE_LONGDASH 6 +#define CHRDLG_UNDERLINE_DASHDOT 7 +#define CHRDLG_UNDERLINE_DASHDOTDOT 8 +#define CHRDLG_UNDERLINE_SMALLWAVE 9 +#define CHRDLG_UNDERLINE_WAVE 10 +#define CHRDLG_UNDERLINE_DOUBLEWAVE 11 +#define CHRDLG_UNDERLINE_BOLD 12 +#define CHRDLG_UNDERLINE_BOLDDOTTED 13 +#define CHRDLG_UNDERLINE_BOLDDASH 14 +#define CHRDLG_UNDERLINE_BOLDLONGDASH 15 +#define CHRDLG_UNDERLINE_BOLDDASHDOT 16 +#define CHRDLG_UNDERLINE_BOLDDASHDOTDOT 17 +#define CHRDLG_UNDERLINE_BOLDWAVE 18 + +#define CHRDLG_STRIKEOUT_NONE 0 +#define CHRDLG_STRIKEOUT_SINGLE 1 +#define CHRDLG_STRIKEOUT_DOUBLE 2 +#define CHRDLG_STRIKEOUT_DONTKNOW 3 +#define CHRDLG_STRIKEOUT_BOLD 4 +#define CHRDLG_STRIKEOUT_SLASH 5 +#define CHRDLG_STRIKEOUT_X 6 + +#define CHRDLG_ENCLOSE_NONE 0 +#define CHRDLG_ENCLOSE_ROUND 1 +#define CHRDLG_ENCLOSE_SQUARE 2 +#define CHRDLG_ENCLOSE_POINTED 3 +#define CHRDLG_ENCLOSE_CURVED 4 +#define CHRDLG_ENCLOSE_SPECIAL_CHAR 5 + +#define CHRDLG_POSITION_OVER 0 +#define CHRDLG_POSITION_UNDER 1 + +#endif + diff --git a/cui/source/tabpages/chardlg.hrc b/cui/source/tabpages/chardlg.hrc new file mode 100644 index 000000000000..63faba788bbe --- /dev/null +++ b/cui/source/tabpages/chardlg.hrc @@ -0,0 +1,184 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: chardlg.hrc,v $ + * $Revision: 1.15.212.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_CHARDLG_HRC +#define _SVX_CHARDLG_HRC + +// defines ------------------------------------------------------------------ + +// NamePage ----------------------------------------------------------------- + +#define FL_WEST 100 +#define FT_WEST_NAME 101 +#define LB_WEST_NAME 102 +#define FT_WEST_STYLE 103 +#define LB_WEST_STYLE 104 +#define FT_WEST_SIZE 105 +#define LB_WEST_SIZE 106 +#define FT_WEST_LANG 107 +#define LB_WEST_LANG 108 + +#define FL_EAST 110 +#define FT_EAST_NAME 111 +#define LB_EAST_NAME 112 +#define FT_EAST_STYLE 113 +#define LB_EAST_STYLE 114 +#define FT_EAST_SIZE 115 +#define LB_EAST_SIZE 116 +#define FT_EAST_LANG 117 +#define LB_EAST_LANG 118 + +#define FL_CTL 120 +#define FT_CTL_NAME 121 +#define LB_CTL_NAME 122 +#define FT_CTL_STYLE 123 +#define LB_CTL_STYLE 124 +#define FT_CTL_SIZE 125 +#define LB_CTL_SIZE 126 +#define FT_CTL_LANG 127 +#define LB_CTL_LANG 128 + +#define WIN_CHAR_PREVIEW 131 +#define FT_CHAR_FONTTYPE 132 + +#define FL_COLOR2 140 +#define FT_COLOR2 141 +#define LB_COLOR2 142 + +#define STR_CHARNAME_NOSTYLE 150 +#define STR_CHARNAME_TRANSPARENT 151 + +// EffectsPage -------------------------------------------------------------- + +#define FT_FONTCOLOR 201 +#define LB_FONTCOLOR 202 + +#define FT_EFFECTS 203 +#define LB_EFFECTS 204 +#define LB_EFFECTS2 205 + +#define FT_RELIEF 206 +#define LB_RELIEF 207 + +#define CB_OUTLINE 208 +#define CB_SHADOW 209 +#define CB_BLINKING 210 +#define CB_CHARHIDDEN 211 + +#define FL_EFFECTS_VERTICAL 220 + +#define FT_OVERLINE 221 +#define LB_OVERLINE 222 +#define FT_OVERLINE_COLOR 223 +#define LB_OVERLINE_COLOR 224 + +#define FT_STRIKEOUT 225 +#define LB_STRIKEOUT 226 + +#define FT_UNDERLINE 227 +#define LB_UNDERLINE 228 +#define FT_UNDERLINE_COLOR 229 +#define LB_UNDERLINE_COLOR 230 + +#define CB_INDIVIDUALWORDS 231 + +#define FL_EFFECTS_ASIAN 240 + +#define FT_EMPHASIS 241 +#define LB_EMPHASIS 242 +#define FT_POSITION 243 +#define LB_POSITION 244 + +#define WIN_EFFECTS_PREVIEW 251 +#define FT_EFFECTS_FONTTYPE 252 + +#define STR_EFFECTS_TRANSPARENT 260 +#define STR_EFFECTS_CAPITALS 261 +#define STR_EFFECTS_LOWERCASE 262 +#define STR_EFFECTS_TITLE 263 +#define STR_EFFECTS_SMALL 264 +#define STR_EFFECTS_OUTLINE 265 +#define STR_EFFECTS_SHADOW 266 +#define STR_EFFECTS_BLINKING 267 + +// PositionPage ------------------------------------------------------------- + +#define FL_POSITION 300 +#define RB_HIGHPOS 301 +#define RB_NORMALPOS 302 +#define RB_LOWPOS 303 +#define FT_HIGHLOW 304 +#define ED_HIGHLOW 305 +#define CB_HIGHLOW 306 +#define FT_FONTSIZE 307 +#define ED_FONTSIZE 308 +#define FL_ROTATION_SCALING 309 +#define FL_SCALING 310 +#define RB_0_DEG 311 +#define RB_90_DEG 312 +#define RB_270_DEG 313 +#define CB_FIT_TO_LINE 314 +#define FT_SCALE_WIDTH 315 +#define MF_SCALE_WIDTH 316 + +#define FL_KERNING2 320 +#define LB_KERNING2 321 +#define FT_KERNING2 322 +#define ED_KERNING2 323 +#define CB_PAIRKERNING 324 + +#define WIN_POS_PREVIEW 331 +#define FT_POS_FONTTYPE 332 + +// TwoLinesPage ------------------------------------------------------------- + +#define FL_SWITCHON 400 +#define CB_TWOLINES 401 + +#define FL_ENCLOSE 410 +#define FT_STARTBRACKET 411 +#define ED_STARTBRACKET 412 +#define FT_ENDBRACKET 413 +#define ED_ENDBRACKET 414 + +#define FL_TWOLINES_PREVIEW 420 +#define WIN_TWOLINES_PREVIEW 421 +#define FT_TWOLINES_FONTTYPE 422 + +#define FT_WEST_NAME_NOCJK 423 +#define LB_WEST_NAME_NOCJK 424 +#define FT_WEST_STYLE_NOCJK 425 +#define LB_WEST_STYLE_NOCJK 426 +#define FT_WEST_SIZE_NOCJK 427 +#define LB_WEST_SIZE_NOCJK 428 +#define FT_WEST_LANG_NOCJK 429 +#define LB_WEST_LANG_NOCJK 430 + +#endif + diff --git a/cui/source/tabpages/chardlg.src b/cui/source/tabpages/chardlg.src new file mode 100644 index 000000000000..19ad1e090435 --- /dev/null +++ b/cui/source/tabpages/chardlg.src @@ -0,0 +1,1133 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: chardlg.src,v $ + * $Revision: 1.78.20.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include "helpid.hrc" +#include +#include "chardlg.hrc" +#include "chardlg.h" + +// unbekannte Zeichenfarbe +String RID_SVXSTR_COLOR_USER +{ + Text [ en-US ] = "User" ; +}; + +// RID_SVXPAGE_CHAR_NAME ---------------------------------------------------- + +TabPage RID_SVXPAGE_CHAR_NAME +{ + HelpId = HID_SVXPAGE_CHAR_NAME ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_WEST + { + Pos = MAP_APPFONT ( 6 , 3 ); + Size = MAP_APPFONT ( 248 , 8 ); + Text [ en-US ] = "Western text font"; + }; + FixedText FT_WEST_NAME + { + Pos = MAP_APPFONT ( 12 , 14 ); + Size = MAP_APPFONT ( 80 , 8 ); + Text [ en-US ] = "Font"; + }; + FixedText FT_WEST_NAME_NOCJK + { + Pos = MAP_APPFONT ( 12 , 6 ); + Size = MAP_APPFONT ( 112 , 8 ); + Text [ en-US ] = "~Font"; + }; + ComboBox LB_WEST_NAME + { + Border = TRUE; + Pos = MAP_APPFONT ( 12 , 25 ); + Size = MAP_APPFONT ( 80 , 72 ); + TabStop = TRUE; + DropDown = TRUE; + }; + ComboBox LB_WEST_NAME_NOCJK + { + Border = TRUE; + Pos = MAP_APPFONT ( 12 , 17 ); + Size = MAP_APPFONT ( 112 , 71 ); + TabStop = TRUE; + DropDown = FALSE; + }; + FixedText FT_WEST_STYLE + { + Pos = MAP_APPFONT ( 96 , 14 ); + Size = MAP_APPFONT ( 40 , 8 ); + Text [ en-US ] = "~Typeface"; + }; + FixedText FT_WEST_STYLE_NOCJK + { + Pos = MAP_APPFONT ( 130 , 6 ); + Size = MAP_APPFONT ( 72 , 8 ); + Text [ en-US ] = "~Typeface"; + }; + ComboBox LB_WEST_STYLE + { + Border = TRUE; + Pos = MAP_APPFONT ( 96 , 25 ); + Size = MAP_APPFONT ( 40 , 48 ); + TabStop = TRUE; + DropDown = TRUE; + StringList [ en-US ] = + { + "Normal" ; + "Italic" ; + "Bold" ; + "Bold italic" ; + }; + }; + ComboBox LB_WEST_STYLE_NOCJK + { + Border = TRUE; + Pos = MAP_APPFONT ( 130 , 17 ); + Size = MAP_APPFONT ( 72 , 71 ); + TabStop = TRUE; + DropDown = FALSE; + StringList [ en-US ] = + { + "Normal" ; + "Italic" ; + "Bold" ; + "Bold italic" ; + }; + }; + FixedText FT_WEST_SIZE + { + Pos = MAP_APPFONT ( 140 , 14 ); + Size = MAP_APPFONT ( 38 , 8 ); + Text [ en-US ] = "Size"; + }; + FixedText FT_WEST_SIZE_NOCJK + { + Pos = MAP_APPFONT ( 208 , 6 ); + Size = MAP_APPFONT ( 40 , 8 ); + Text [ en-US ] = "Size"; + }; + MetricBox LB_WEST_SIZE + { + Border = TRUE; + Pos = MAP_APPFONT ( 140 , 25 ); + Size = MAP_APPFONT ( 38 , 72 ); + TabStop = TRUE; + DropDown = TRUE; + }; + MetricBox LB_WEST_SIZE_NOCJK + { + Border = TRUE; + Pos = MAP_APPFONT ( 208 , 17 ); + Size = MAP_APPFONT ( 40 , 71 ); + TabStop = TRUE; + DropDown = FALSE; + }; + FixedText FT_WEST_LANG + { + Pos = MAP_APPFONT ( 182 , 14 ); + Size = MAP_APPFONT ( 66 , 8 ); + Text [ en-US ] = "Language"; + }; + FixedText FT_WEST_LANG_NOCJK + { + Pos = MAP_APPFONT ( 130 , 94 ); + Size = MAP_APPFONT ( 72 , 8 ); + Text [ en-US ] = "~Language"; + }; + ListBox LB_WEST_LANG + { + Border = TRUE; + Pos = MAP_APPFONT ( 182 , 25 ); + Size = MAP_APPFONT ( 66 , 72 ); + TabStop = TRUE; + Sort = TRUE ; + DropDown = TRUE; + }; + ListBox LB_WEST_LANG_NOCJK + { + Border = TRUE; + Pos = MAP_APPFONT ( 130 , 105 ); + Size = MAP_APPFONT ( 72 , 72 ); + TabStop = TRUE; + Sort = TRUE ; + DropDown = TRUE; + }; + FixedLine FL_EAST + { + Pos = MAP_APPFONT ( 6 , 43 ); + Size = MAP_APPFONT ( 248 , 8 ); + Text [ en-US ] = "Asian text font"; + }; + FixedText FT_EAST_NAME + { + Pos = MAP_APPFONT ( 12 , 54 ); + Size = MAP_APPFONT ( 80 , 8 ); + Text [ en-US ] = "Font"; + }; + ComboBox LB_EAST_NAME + { + Border = TRUE; + Pos = MAP_APPFONT ( 12 , 65 ); + Size = MAP_APPFONT ( 80 , 72 ); + TabStop = TRUE; + DropDown = TRUE; + }; + FixedText FT_EAST_STYLE + { + Pos = MAP_APPFONT ( 96 , 54 ); + Size = MAP_APPFONT ( 40 , 8 ); + Text [ en-US ] = "T~ypeface"; + }; + ComboBox LB_EAST_STYLE + { + Border = TRUE; + Pos = MAP_APPFONT ( 96 , 65 ); + Size = MAP_APPFONT ( 40 , 48 ); + TabStop = TRUE; + DropDown = TRUE; + StringList [ en-US ] = + { + "Normal" ; + "Italic" ; + "Bold" ; + "Bold italic" ; + }; + }; + FixedText FT_EAST_SIZE + { + Pos = MAP_APPFONT ( 140 , 54 ); + Size = MAP_APPFONT ( 38 , 8 ); + Text [ en-US ] = "Size"; + }; + MetricBox LB_EAST_SIZE + { + Border = TRUE; + Pos = MAP_APPFONT ( 140 , 65 ); + Size = MAP_APPFONT ( 38 , 72 ); + TabStop = TRUE; + DropDown = TRUE; + }; + FixedText FT_EAST_LANG + { + Pos = MAP_APPFONT ( 182 , 54 ); + Size = MAP_APPFONT ( 66 , 8 ); + Text [ en-US ] = "Language"; + }; + ListBox LB_EAST_LANG + { + Border = TRUE; + Pos = MAP_APPFONT ( 182 , 65 ); + Size = MAP_APPFONT ( 66 , 72 ); + TabStop = TRUE; + Sort = TRUE ; + DropDown = TRUE; + }; + FixedLine FL_CTL + { + Pos = MAP_APPFONT ( 6 , 83 ); + Size = MAP_APPFONT ( 248 , 8 ); + Text [ en-US ] = "CTL font"; + }; + FixedText FT_CTL_NAME + { + Pos = MAP_APPFONT ( 12 , 94 ); + Size = MAP_APPFONT ( 80 , 8 ); + Text [ en-US ] = "Font"; + }; + ComboBox LB_CTL_NAME + { + Border = TRUE; + Pos = MAP_APPFONT ( 12 , 105 ); + Size = MAP_APPFONT ( 80 , 72 ); + TabStop = TRUE; + DropDown = TRUE; + }; + FixedText FT_CTL_STYLE + { + Pos = MAP_APPFONT ( 96 , 94 ); + Size = MAP_APPFONT ( 40 , 8 ); + Text [ en-US ] = "Ty~peface"; + }; + ComboBox LB_CTL_STYLE + { + Border = TRUE; + Pos = MAP_APPFONT ( 96 , 105 ); + Size = MAP_APPFONT ( 40 , 48 ); + TabStop = TRUE; + DropDown = TRUE; + StringList [ en-US ] = + { + "Normal" ; + "Italic" ; + "Bold" ; + "Bold italic" ; + }; + }; + FixedText FT_CTL_SIZE + { + Pos = MAP_APPFONT ( 140 , 94 ); + Size = MAP_APPFONT ( 38 , 8 ); + Text [ en-US ] = "Size"; + }; + MetricBox LB_CTL_SIZE + { + Border = TRUE; + Pos = MAP_APPFONT ( 140 , 105 ); + Size = MAP_APPFONT ( 38 , 72 ); + TabStop = TRUE; + DropDown = TRUE; + }; + FixedText FT_CTL_LANG + { + Pos = MAP_APPFONT ( 182 , 94 ); + Size = MAP_APPFONT ( 66 , 8 ); + Text [ en-US ] = "Language"; + }; + ListBox LB_CTL_LANG + { + Border = TRUE; + Pos = MAP_APPFONT ( 182 , 105 ); + Size = MAP_APPFONT ( 66 , 72 ); + TabStop = TRUE; + Sort = TRUE ; + DropDown = TRUE; + }; + Window WIN_CHAR_PREVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 149 ) ; + Size = MAP_APPFONT ( 248 , 37 ) ; + Text [ en-US ] = "Example"; + }; + FixedText FT_CHAR_FONTTYPE + { + Pos = MAP_APPFONT ( 6 , 129 ) ; + Size = MAP_APPFONT ( 248 , 16 ) ; + WordBreak = TRUE ; + }; + FixedLine FL_COLOR2 + { + Pos = MAP_APPFONT ( 6 , 83 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Color" ; + }; + FixedText FT_COLOR2 + { + Pos = MAP_APPFONT ( 12 , 94 ); + Size = MAP_APPFONT ( 58 , 8 ); + Text [ en-US ] = "Font ~color" ; + }; + ListBox LB_COLOR2 + { + Border = TRUE; + Pos = MAP_APPFONT ( 12 , 105 ); + Size = MAP_APPFONT ( 58 , 100 ); + TabStop = TRUE; + DropDown = TRUE; + }; + String STR_CHARNAME_NOSTYLE + { + Text [ en-US ] = "No %1"; + }; + String STR_CHARNAME_TRANSPARENT + { + Text [ en-US ] = "Transparent"; + }; +}; + +// RID_SVXPAGE_CHAR_EFFECTS --------------------------------------------------- + +TabPage RID_SVXPAGE_CHAR_EFFECTS +{ + HelpId = HID_SVXPAGE_CHAR_EFFECTS ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedText FT_FONTCOLOR + { + Pos = MAP_APPFONT ( 10 , 4 ); + Size = MAP_APPFONT ( 82 , 8 ); + Text [ en-US ] = "Font ~color" ; + }; + ListBox LB_FONTCOLOR + { + Border = TRUE; + Pos = MAP_APPFONT ( 10 , 15 ); + Size = MAP_APPFONT ( 82 , 72 ); + TabStop = TRUE; + DropDown = TRUE; + }; + FixedText FT_EFFECTS + { + Pos = MAP_APPFONT( 10 , 33 ); + Size = MAP_APPFONT( 82 , 8 ); + Text [ en-US ] = "~Effects" ; + }; + ListBox LB_EFFECTS2 + { + Pos = MAP_APPFONT ( 10 , 44 ) ; + Size = MAP_APPFONT ( 82 , 56 ) ; + DropDown = TRUE; + StringList [ en-US ] = + { + < "(Without)" ; Default ; > ; + < "Capitals" ; Default ; > ; + < "Lowercase" ; Default ; > ; + < "Title" ; Default ; > ; + < "Small capitals" ; Default ; > ; + }; + }; + FixedText FT_RELIEF + { + Pos = MAP_APPFONT ( 10 , 62 ); + Size = MAP_APPFONT ( 82 , 8 ); + Text [ en-US ] = "~Relief"; + }; + ListBox LB_RELIEF + { + Pos = MAP_APPFONT ( 10 , 73 ) ; + Size = MAP_APPFONT ( 82 , 56 ) ; + DropDown = TRUE; + StringList [ en-US ] = + { + < "(Without)" ; Default ; > ; + < "Embossed" ; Default ; > ; + < "Engraved" ; Default ; > ; + }; + }; + TriStateBox CB_OUTLINE + { + Pos = MAP_APPFONT ( 10 , 93 ) ; + Size = MAP_APPFONT ( 82 , 10 ) ; + Text [ en-US ] = "Out~line" ; + }; + TriStateBox CB_SHADOW + { + Pos = MAP_APPFONT ( 10 , 107 ) ; + Size = MAP_APPFONT ( 82 , 10 ) ; + Text [ en-US ] = "Sha~dow" ; + }; + TriStateBox CB_BLINKING + { + Pos = MAP_APPFONT ( 10 , 121 ) ; + Size = MAP_APPFONT ( 82 , 10 ) ; + Hide = TRUE; + Text [ en-US ] = "~Blinking" ; + }; + TriStateBox CB_CHARHIDDEN + { + Pos = MAP_APPFONT ( 10 , 135 ) ; + Size = MAP_APPFONT ( 82 , 10 ) ; + Text [ en-US ] = "H~idden" ; + }; + FixedLine FL_EFFECTS_VERTICAL + { + Pos = MAP_APPFONT ( 100 , 4 ) ; + Size = MAP_APPFONT ( 4 , 142 ) ; + Vert = TRUE; + }; + FixedText FT_OVERLINE + { + Pos = MAP_APPFONT( 110 , 4 ); + Size = MAP_APPFONT( 68 , 8 ); + Text [ en-US ] = "~Overlining" ; + }; + ListBox LB_OVERLINE + { + Border = TRUE; + Pos = MAP_APPFONT ( 110 , 15 ); + Size = MAP_APPFONT ( 68 , 72 ); + TabStop = TRUE; + DropDown = TRUE; + StringList [ en-US ] = + { + < "(Without)" ; CHRDLG_UNDERLINE_NONE ; > ; + < "Single" ; CHRDLG_UNDERLINE_SINGLE ; > ; + < "Double" ; CHRDLG_UNDERLINE_DOUBLE ; > ; + < "Bold"; CHRDLG_UNDERLINE_BOLD; > ; + < "Dotted" ; CHRDLG_UNDERLINE_DOTTED ; > ; + < "Dotted (Bold)" ; CHRDLG_UNDERLINE_BOLDDOTTED; > ; + < "Dash"; CHRDLG_UNDERLINE_DASH; > ; + < "Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASH; > ; + < "Long Dash"; CHRDLG_UNDERLINE_LONGDASH; > ; + < "Long Dash (Bold)"; CHRDLG_UNDERLINE_BOLDLONGDASH; > ; + < "Dot Dash"; CHRDLG_UNDERLINE_DASHDOT; > ; + < "Dot Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASHDOT; > ; + < "Dot Dot Dash"; CHRDLG_UNDERLINE_DASHDOTDOT; > ; + < "Dot Dot Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASHDOTDOT; > ; + < "Wave"; CHRDLG_UNDERLINE_WAVE; > ; + < "Wave (Bold)"; CHRDLG_UNDERLINE_BOLDWAVE; > ; + < "Double Wave"; CHRDLG_UNDERLINE_DOUBLEWAVE; > ; + }; + }; + FixedText FT_OVERLINE_COLOR + { + Pos = MAP_APPFONT ( 184 , 4 ); + Size = MAP_APPFONT ( 68 , 8 ); + Text [ en-US ] = "O~verline color"; + }; + ListBox LB_OVERLINE_COLOR + { + Border = TRUE; + Pos = MAP_APPFONT ( 184 , 15 ); + Size = MAP_APPFONT ( 68 , 100 ); + TabStop = TRUE; + DropDown = TRUE; + }; + FixedText FT_STRIKEOUT + { + Pos = MAP_APPFONT ( 110 , 33 ); + Size = MAP_APPFONT ( 68 , 8 ); + Text [ en-US ] = "~Strikethrough" ; + }; + ListBox LB_STRIKEOUT + { + Border = TRUE; + Pos = MAP_APPFONT ( 110 , 44 ); + Size = MAP_APPFONT ( 68 , 72 ); + TabStop = TRUE; + DropDown = TRUE; + StringList [ en-US ] = + { + < "(Without)" ; CHRDLG_STRIKEOUT_NONE ; > ; + < "Single" ; CHRDLG_STRIKEOUT_SINGLE ; > ; + < "Double" ; CHRDLG_STRIKEOUT_DOUBLE ; > ; + < "Bold" ; CHRDLG_STRIKEOUT_BOLD ; > ; + < "With /" ; CHRDLG_STRIKEOUT_SLASH ; > ; + < "With X" ; CHRDLG_STRIKEOUT_X ; > ; + }; + }; + FixedText FT_UNDERLINE + { + Pos = MAP_APPFONT( 110 , 62 ); + Size = MAP_APPFONT( 68 , 8 ); + Text [ en-US ] = "~Underlining" ; + }; + ListBox LB_UNDERLINE + { + Border = TRUE; + Pos = MAP_APPFONT ( 110 , 73 ); + Size = MAP_APPFONT ( 68 , 72 ); + TabStop = TRUE; + DropDown = TRUE; + StringList [ en-US ] = + { + < "(Without)" ; CHRDLG_UNDERLINE_NONE ; > ; + < "Single" ; CHRDLG_UNDERLINE_SINGLE ; > ; + < "Double" ; CHRDLG_UNDERLINE_DOUBLE ; > ; + < "Bold"; CHRDLG_UNDERLINE_BOLD; > ; + < "Dotted" ; CHRDLG_UNDERLINE_DOTTED ; > ; + < "Dotted (Bold)" ; CHRDLG_UNDERLINE_BOLDDOTTED; > ; + < "Dash"; CHRDLG_UNDERLINE_DASH; > ; + < "Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASH; > ; + < "Long Dash"; CHRDLG_UNDERLINE_LONGDASH; > ; + < "Long Dash (Bold)"; CHRDLG_UNDERLINE_BOLDLONGDASH; > ; + < "Dot Dash"; CHRDLG_UNDERLINE_DASHDOT; > ; + < "Dot Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASHDOT; > ; + < "Dot Dot Dash"; CHRDLG_UNDERLINE_DASHDOTDOT; > ; + < "Dot Dot Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASHDOTDOT; > ; + < "Wave"; CHRDLG_UNDERLINE_WAVE; > ; + < "Wave (Bold)"; CHRDLG_UNDERLINE_BOLDWAVE; > ; + < "Double Wave"; CHRDLG_UNDERLINE_DOUBLEWAVE; > ; + }; + }; + FixedText FT_UNDERLINE_COLOR + { + Pos = MAP_APPFONT ( 184 , 62 ); + Size = MAP_APPFONT ( 68 , 8 ); + Text [ en-US ] = "U~nderline color"; + }; + ListBox LB_UNDERLINE_COLOR + { + Border = TRUE; + Pos = MAP_APPFONT ( 184 , 73 ); + Size = MAP_APPFONT ( 68 , 100 ); + TabStop = TRUE; + DropDown = TRUE; + }; + CheckBox CB_INDIVIDUALWORDS + { + Pos = MAP_APPFONT ( 110 , 93 ); + Size = MAP_APPFONT ( 68 , 10 ); + TabStop = TRUE; + Text [ en-US ] = "Individual ~words" ; + }; + FixedLine FL_EFFECTS_ASIAN + { + Pos = MAP_APPFONT ( 106 , 110 ) ; + Size = MAP_APPFONT ( 148 , 4 ) ; + }; + FixedText FT_EMPHASIS + { + Pos = MAP_APPFONT ( 110 , 117 ); + Size = MAP_APPFONT ( 68 , 8 ); + Text [ en-US ] = "Emp~hasis mark" ; + }; + ListBox LB_EMPHASIS + { + Border = TRUE; + Pos = MAP_APPFONT ( 110 , 128 ); + Size = MAP_APPFONT ( 68 , 72 ); + TabStop = TRUE; + DropDown = TRUE; + StringList [ en-US ] = + { + < "(Without)" ; default ; > ; + < "Dot" ; default ; > ; + < "Circle" ; default ; > ; + < "Disc" ; default ; > ; + < "Accent" ; default ; > ; + }; + }; + FixedText FT_POSITION + { + Pos = MAP_APPFONT ( 184 , 117 ); + Size = MAP_APPFONT ( 68 , 8 ); + Text [ en-US ] = "~Position" ; + }; + ListBox LB_POSITION + { + Border = TRUE; + Pos = MAP_APPFONT ( 184 , 128 ); + Size = MAP_APPFONT ( 68 , 48 ); + TabStop = TRUE; + DropDown = TRUE; + StringList [ en-US ] = + { + < "Above text" ; CHRDLG_POSITION_OVER ; > ; + < "Below text" ; CHRDLG_POSITION_UNDER ; > ; + }; + }; + Window WIN_EFFECTS_PREVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 149 ) ; + Size = MAP_APPFONT ( 248 , 37 ) ; + Text [ en-US ] = "Example"; + }; + FixedText FT_EFFECTS_FONTTYPE + { + Pos = MAP_APPFONT ( 6 , 168 ) ; + Size = MAP_APPFONT ( 248 , 16 ) ; + WordBreak = TRUE ; + Hide = TRUE; + }; + String STR_EFFECTS_CAPITALS + { + Text [ en-US ] = "Capitals" ; + }; + String STR_EFFECTS_LOWERCASE + { + Text [ en-US ] = "Lowercase" ; + }; + String STR_EFFECTS_TITLE + { + Text [ en-US ] = "Title" ; + }; + String STR_EFFECTS_SMALL + { + Text [ en-US ] = "Small Capitals" ; + }; + String STR_EFFECTS_OUTLINE + { + Text [ en-US ] = "Outline" ; + }; + String STR_EFFECTS_SHADOW + { + Text [ en-US ] = "Shadow" ; + }; + String STR_EFFECTS_BLINKING + { + Text [ en-US ] = "Blinking" ; + }; + String STR_CHARNAME_TRANSPARENT + { + Text [ en-US ] = "Transparent"; + }; +}; + +// RID_SVXPAGE_CHAR_POSITION ------------------------------------------------ + +TabPage RID_SVXPAGE_CHAR_POSITION +{ + HelpId = HID_SVXPAGE_CHAR_POSITION ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_POSITION + { + Pos = MAP_APPFONT ( 6 , 3 ); + Size = MAP_APPFONT ( 248 , 8 ); + Text [ en-US ] = "Position" ; + }; + RadioButton RB_HIGHPOS + { + Pos = MAP_APPFONT ( 12 , 16 ); + Size = MAP_APPFONT ( 58 , 10 ); + Text [ en-US ] = "Superscript" ; + TabStop = TRUE; + }; + RadioButton RB_NORMALPOS + { + Pos = MAP_APPFONT ( 12 , 30 ); + Size = MAP_APPFONT ( 58 , 10 ); + Text [ en-US ] = "Normal" ; + TabStop = TRUE; + }; + RadioButton RB_LOWPOS + { + Pos = MAP_APPFONT ( 12 , 44 ); + Size = MAP_APPFONT ( 58 , 10 ); + Text [ en-US ] = "Subscript" ; + TabStop = TRUE; + }; + FixedText FT_HIGHLOW + { + Pos = MAP_APPFONT ( 74 , 16 ); + Size = MAP_APPFONT ( 58 , 8 ); + Text [ en-US ] = "~Raise/lower by" ; + }; + MetricField ED_HIGHLOW + { + Border = TRUE; + Pos = MAP_APPFONT ( 136 , 14 ); + Size = MAP_APPFONT ( 30 , 12 ); + TabStop = TRUE; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 100 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + First = 1 ; + Last = 100 ; + SpinSize = 1 ; + }; + CheckBox CB_HIGHLOW + { + Pos = MAP_APPFONT ( 172 , 16 ); + Size = MAP_APPFONT ( 76 , 10 ); + Text [ en-US ] = "A~utomatic" ; + TabStop = TRUE; + }; + FixedText FT_FONTSIZE + { + Pos = MAP_APPFONT ( 74 , 32 ); + Size = MAP_APPFONT ( 58 , 8 ); + Text [ en-US ] = "Relative font size" ; + }; + MetricField ED_FONTSIZE + { + Border = TRUE; + Pos = MAP_APPFONT ( 136 , 30 ); + Size = MAP_APPFONT ( 30 , 12 ); + TabStop = TRUE; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 100 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + First = 1 ; + Last = 100 ; + SpinSize = 1 ; + }; + FixedLine FL_ROTATION_SCALING + { + Pos = MAP_APPFONT ( 6 , 59 ); + Size = MAP_APPFONT ( 248 , 8 ); + Text [ en-US ] = "Rotation / scaling" ; + }; + FixedLine FL_SCALING + { + Pos = MAP_APPFONT ( 6 , 59 ); + Size = MAP_APPFONT ( 248 , 8 ); + Text [ en-US ] = "Scaling" ; + }; + RadioButton RB_0_DEG + { + Pos = MAP_APPFONT ( 12 , 70 ); + Size = MAP_APPFONT ( 46 , 10 ); + TabStop = TRUE; + Text [ en-US ] = "~0 degrees" ; + }; + RadioButton RB_90_DEG + { + Pos = MAP_APPFONT ( 62 , 70 ); + Size = MAP_APPFONT ( 46 , 10 ); + TabStop = TRUE; + Text [ en-US ] = "~90 degrees" ; + }; + RadioButton RB_270_DEG + { + Pos = MAP_APPFONT ( 112 , 70 ); + Size = MAP_APPFONT ( 46 , 10 ); + TabStop = TRUE; + Text [ en-US ] = "~270 degrees" ; + }; + CheckBox CB_FIT_TO_LINE + { + Pos = MAP_APPFONT ( 162 , 70 ); + Size = MAP_APPFONT ( 86 , 10 ); + TabStop = TRUE; + Text [ en-US ] = "Fit to line" ; + }; + FixedText FT_SCALE_WIDTH + { + Pos = MAP_APPFONT ( 12 , 86 ); + Size = MAP_APPFONT ( 80 , 8 ); + Text [ en-US ] = "Scale ~width" ; + }; + MetricField MF_SCALE_WIDTH + { + Border = TRUE; + Pos = MAP_APPFONT ( 94 , 84 ); + Size = MAP_APPFONT ( 30 , 12 ); + TabStop = TRUE; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 999 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + First = 50 ; + Last = 200 ; + SpinSize = 1 ; + }; + FixedLine FL_KERNING2 + { + Pos = MAP_APPFONT ( 6 , 100 ); + Size = MAP_APPFONT ( 248 , 8 ); + Text [ en-US ] = "Spacing" ; + }; + ListBox LB_KERNING2 + { + Border = TRUE; + Pos = MAP_APPFONT ( 12 , 111 ); + Size = MAP_APPFONT ( 72 , 48 ) ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Default" ; Default ; > ; + < "Expanded" ; Default ; > ; + < "Condensed" ; Default ; > ; + }; + }; + FixedText FT_KERNING2 + { + Pos = MAP_APPFONT ( 86 , 113 ); + Size = MAP_APPFONT ( 24 , 8 ); + Center = TRUE ; + Text [ en-US ] = "b~y" ; + }; + MetricField ED_KERNING2 + { + Border = TRUE; + Pos = MAP_APPFONT ( 112 , 111 ); + Size = MAP_APPFONT ( 40 , 12 ); + TabStop = TRUE; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + DecimalDigits = 1 ; + Unit = FUNIT_POINT ; + SpinSize = 10 ; + }; + CheckBox CB_PAIRKERNING + { + Pos = MAP_APPFONT ( 156 , 113 ); + Size = MAP_APPFONT ( 92 , 10 ); + Text [ en-US ] = "~Pair kerning" ; + TabStop = TRUE; + }; + Window WIN_POS_PREVIEW + { + Text [ en-US ] = "Example" ; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 149 ) ; + Size = MAP_APPFONT ( 248 , 37 ) ; + }; + FixedText FT_POS_FONTTYPE + { + Pos = MAP_APPFONT ( 6 , 168 ) ; + Size = MAP_APPFONT ( 248 , 16 ) ; + WordBreak = TRUE ; + Hide = TRUE; + }; +}; + +TabPage RID_SVXPAGE_CHAR_TWOLINES +{ + HelpId = HID_SVXPAGE_CHAR_TWOLINES ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_SWITCHON + { + Pos = MAP_APPFONT ( 6 , 3 ); + Size = MAP_APPFONT ( 248 , 8 ); + Text [ en-US ] = "Double-lined" ; + }; + CheckBox CB_TWOLINES + { + Pos = MAP_APPFONT ( 12 , 14 ); + Size = MAP_APPFONT ( 236 , 10 ); + Text [ en-US ] = "~Write in double lines" ; + TabStop = TRUE; + }; + FixedLine FL_ENCLOSE + { + Pos = MAP_APPFONT ( 6 , 30 ); + Size = MAP_APPFONT ( 248 , 8 ); + Text [ en-US ] = "Enclosing character" ; + }; + FixedText FT_STARTBRACKET + { + Pos = MAP_APPFONT ( 12 , 41 ); + Size = MAP_APPFONT ( 90 , 8 ); + Text [ en-US ] = "I~nitial character" ; + }; + ListBox ED_STARTBRACKET + { + Pos = MAP_APPFONT ( 12 , 52 ); + Size = MAP_APPFONT ( 90 , 72 ); + TabStop = TRUE; + Border = TRUE; + StringList [ en-US ] = + { + < "(None)" ; CHRDLG_ENCLOSE_NONE ; > ; + < "(" ; CHRDLG_ENCLOSE_ROUND ; > ; + < "[" ; CHRDLG_ENCLOSE_SQUARE ; > ; + < "<" ; CHRDLG_ENCLOSE_POINTED ; > ; + < "{" ; CHRDLG_ENCLOSE_CURVED ; > ; + < "Other Characters..." ; CHRDLG_ENCLOSE_SPECIAL_CHAR ; > ; + }; + }; + FixedText FT_ENDBRACKET + { + Pos = MAP_APPFONT ( 108 , 41 ); + Size = MAP_APPFONT ( 90 , 8 ); + Text [ en-US ] = "Final charact~er" ; + }; + ListBox ED_ENDBRACKET + { + Pos = MAP_APPFONT ( 108 , 52 ); + Size = MAP_APPFONT ( 90 , 72 ); + TabStop = TRUE; + Border = TRUE; + StringList [ en-US ] = + { + < "(None)" ; CHRDLG_ENCLOSE_NONE ; > ; + < ")" ; CHRDLG_ENCLOSE_ROUND ; > ; + < "]" ; CHRDLG_ENCLOSE_SQUARE ; > ; + < ">" ; CHRDLG_ENCLOSE_POINTED ; > ; + < "}" ; CHRDLG_ENCLOSE_CURVED ; > ; + < "Other Characters..." ; CHRDLG_ENCLOSE_SPECIAL_CHAR ; > ; + }; + }; + Window WIN_TWOLINES_PREVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 149 ) ; + Size = MAP_APPFONT ( 248 , 37 ) ; + Text [ en-US ] = "Example" ; + }; + FixedText FT_TWOLINES_FONTTYPE + { + Pos = MAP_APPFONT ( 6 , 168 ) ; + Size = MAP_APPFONT ( 248 , 16 ) ; + WordBreak = TRUE ; + Hide = TRUE; + }; +}; + + // ********************************************************************** EOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/connect.cxx b/cui/source/tabpages/connect.cxx new file mode 100644 index 000000000000..dad2c336043c --- /dev/null +++ b/cui/source/tabpages/connect.cxx @@ -0,0 +1,565 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: connect.cxx,v $ + * $Revision: 1.16 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include +#include "svx/ofaitem.hxx" // add CHINA001 +#include // add CHINA001 +#define _SVX_CONNECT_CXX + +#include +#include +#include +#include + +#include "svx/connctrl.hxx" +#include "connect.hxx" +#include "connect.hrc" +#include +#include "svx/dlgutil.hxx" + +#include + +static USHORT pRanges[] = +{ + SDRATTR_EDGE_FIRST, + SDRATTR_EDGE_LAST, + 0 +}; + +/************************************************************************* +|* +|* Dialog zum Aendern von Konnektoren (Connectors) +|* +\************************************************************************/ + +SvxConnectionDialog::SvxConnectionDialog( Window* pParent, const SfxItemSet& rInAttrs, + const SdrView* pSdrView ) : + SfxSingleTabDialog( pParent, rInAttrs, RID_SVXPAGE_CONNECTION ) +{ + SvxConnectionPage* _pPage = new SvxConnectionPage( this, rInAttrs ); + + _pPage->SetView( pSdrView ); + _pPage->Construct(); + + SetTabPage( _pPage ); + SetText( _pPage->GetText() ); +} + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +SvxConnectionDialog::~SvxConnectionDialog() +{ +} + +/************************************************************************* +|* +|* Seite zum Aendern von Konnektoren (Connectors) +|* +\************************************************************************/ + +SvxConnectionPage::SvxConnectionPage( Window* pWindow, const SfxItemSet& rInAttrs ) : + SfxTabPage ( pWindow, SVX_RES( RID_SVXPAGE_CONNECTION ), + rInAttrs ), + + aFtType ( this, SVX_RES( FT_TYPE ) ), + aLbType ( this, SVX_RES( LB_TYPE ) ), + + aFlDelta ( this, SVX_RES( FL_DELTA ) ), + aFtLine1 ( this, SVX_RES( FT_LINE_1 ) ), + aMtrFldLine1 ( this, SVX_RES( MTR_FLD_LINE_1 ) ), + aFtLine2 ( this, SVX_RES( FT_LINE_2 ) ), + aMtrFldLine2 ( this, SVX_RES( MTR_FLD_LINE_2 ) ), + aFtLine3 ( this, SVX_RES( FT_LINE_3 ) ), + aMtrFldLine3 ( this, SVX_RES( MTR_FLD_LINE_3 ) ), + + aFlDistance ( this, SVX_RES( FL_DISTANCE ) ), + aFtHorz1 ( this, SVX_RES( FT_HORZ_1 ) ), + aMtrFldHorz1 ( this, SVX_RES( MTR_FLD_HORZ_1 ) ), + aFtVert1 ( this, SVX_RES( FT_VERT_1 ) ), + aMtrFldVert1 ( this, SVX_RES( MTR_FLD_VERT_1 ) ), + aFtHorz2 ( this, SVX_RES( FT_HORZ_2 ) ), + aMtrFldHorz2 ( this, SVX_RES( MTR_FLD_HORZ_2 ) ), + aFtVert2 ( this, SVX_RES( FT_VERT_2 ) ), + aMtrFldVert2 ( this, SVX_RES( MTR_FLD_VERT_2 ) ), + + aCtlPreview ( this, SVX_RES( CTL_PREVIEW ), rInAttrs ), + rOutAttrs ( rInAttrs ), + aAttrSet ( *rInAttrs.GetPool() ) +{ + FreeResource(); + + SfxItemPool* pPool = rOutAttrs.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + eUnit = pPool->GetMetric( SDRATTR_EDGENODE1HORZDIST ); + + FillTypeLB(); + + const FieldUnit eFUnit = GetModuleFieldUnit( &rInAttrs ); + SetFieldUnit( aMtrFldHorz1, eFUnit ); + SetFieldUnit( aMtrFldHorz2, eFUnit ); + SetFieldUnit( aMtrFldVert1, eFUnit ); + SetFieldUnit( aMtrFldVert2, eFUnit ); + SetFieldUnit( aMtrFldLine1, eFUnit ); + SetFieldUnit( aMtrFldLine2, eFUnit ); + SetFieldUnit( aMtrFldLine3, eFUnit ); + if( eFUnit == FUNIT_MM ) + { + aMtrFldHorz1.SetSpinSize( 50 ); + aMtrFldHorz2.SetSpinSize( 50 ); + aMtrFldVert1.SetSpinSize( 50 ); + aMtrFldVert2.SetSpinSize( 50 ); + aMtrFldLine1.SetSpinSize( 50 ); + aMtrFldLine2.SetSpinSize( 50 ); + aMtrFldLine3.SetSpinSize( 50 ); + } + + // disable 3D border + aCtlPreview.SetBorderStyle(WINDOW_BORDER_MONO); + + Link aLink( LINK( this, SvxConnectionPage, ChangeAttrHdl_Impl ) ); + aMtrFldHorz1.SetModifyHdl( aLink ); + aMtrFldVert1.SetModifyHdl( aLink ); + aMtrFldHorz2.SetModifyHdl( aLink ); + aMtrFldVert2.SetModifyHdl( aLink ); + aMtrFldLine1.SetModifyHdl( aLink ); + aMtrFldLine2.SetModifyHdl( aLink ); + aMtrFldLine3.SetModifyHdl( aLink ); + aLbType.SetSelectHdl( aLink ); +} + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +SvxConnectionPage::~SvxConnectionPage() +{ +} + +/************************************************************************* +|* +|* Liest uebergebenen Item-Set +|* +\************************************************************************/ + +void __EXPORT SvxConnectionPage::Reset( const SfxItemSet& rAttrs ) +{ + const SfxPoolItem* pItem = GetItem( rAttrs, SDRATTR_EDGENODE1HORZDIST ); + const SfxItemPool* pPool = rAttrs.GetPool(); + + // SdrEdgeNode1HorzDistItem + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE1HORZDIST ); + if( pItem ) + { + long nValue = ( ( const SdrEdgeNode1HorzDistItem* )pItem )->GetValue(); + SetMetricValue( aMtrFldHorz1, nValue, eUnit ); + } + else + aMtrFldHorz1.SetEmptyFieldValue(); + + aMtrFldHorz1.SaveValue(); + + // SdrEdgeNode2HorzDistItem + pItem = GetItem( rAttrs, SDRATTR_EDGENODE2HORZDIST ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE2HORZDIST ); + if( pItem ) + { + long nValue = ( ( const SdrEdgeNode2HorzDistItem* )pItem )->GetValue(); + SetMetricValue( aMtrFldHorz2, nValue, eUnit ); + } + else + aMtrFldHorz2.SetEmptyFieldValue(); + + aMtrFldHorz2.SaveValue(); + + // SdrEdgeNode1VertDistItem + pItem = GetItem( rAttrs, SDRATTR_EDGENODE1VERTDIST ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE1VERTDIST ); + if( pItem ) + { + long nValue = ( ( const SdrEdgeNode1VertDistItem* )pItem )->GetValue(); + SetMetricValue( aMtrFldVert1, nValue, eUnit ); + } + else + aMtrFldVert1.SetEmptyFieldValue(); + + aMtrFldVert1.SaveValue(); + + // SdrEdgeNode2VertDistItem + pItem = GetItem( rAttrs, SDRATTR_EDGENODE2VERTDIST ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE2VERTDIST ); + if( pItem ) + { + long nValue = ( ( const SdrEdgeNode2VertDistItem* )pItem )->GetValue(); + SetMetricValue( aMtrFldVert2, nValue, eUnit ); + } + else + aMtrFldVert2.SetEmptyFieldValue(); + + aMtrFldVert2.SaveValue(); + + // SdrEdgeLine1DeltaItem + pItem = GetItem( rAttrs, SDRATTR_EDGELINE1DELTA ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE1DELTA ); + if( pItem ) + { + long nValue = ( ( const SdrEdgeLine1DeltaItem* )pItem )->GetValue(); + SetMetricValue( aMtrFldLine1, nValue, eUnit ); + } + else + aMtrFldLine1.SetEmptyFieldValue(); + + aMtrFldLine1.SaveValue(); + + // SdrEdgeLine2DeltaItem + pItem = GetItem( rAttrs, SDRATTR_EDGELINE2DELTA ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE2DELTA ); + if( pItem ) + { + long nValue = ( ( const SdrEdgeLine2DeltaItem* )pItem )->GetValue(); + SetMetricValue( aMtrFldLine2, nValue, eUnit ); + } + else + aMtrFldLine2.SetEmptyFieldValue(); + + aMtrFldLine2.SaveValue(); + + // SdrEdgeLine3DeltaItem + pItem = GetItem( rAttrs, SDRATTR_EDGELINE3DELTA ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE3DELTA ); + if( pItem ) + { + long nValue = ( ( const SdrEdgeLine3DeltaItem* )pItem )->GetValue(); + SetMetricValue( aMtrFldLine3, nValue, eUnit ); + } + else + aMtrFldLine3.SetEmptyFieldValue(); + + aMtrFldLine3.SaveValue(); + + // SdrEdgeLineDeltaAnzItem + pItem = GetItem( rAttrs, SDRATTR_EDGELINEDELTAANZ ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINEDELTAANZ ); + if( pItem ) + { + UINT16 nValue = ( ( const SdrEdgeLineDeltaAnzItem* )pItem )->GetValue(); + if( nValue <= 2 ) + { + aFtLine3.Enable( FALSE ); + aMtrFldLine3.Enable( FALSE ); + aMtrFldLine3.SetEmptyFieldValue(); + } + if( nValue <= 1 ) + { + aFtLine2.Enable( FALSE ); + aMtrFldLine2.Enable( FALSE ); + aMtrFldLine2.SetEmptyFieldValue(); + } + if( nValue == 0 ) + { + aFtLine1.Enable( FALSE ); + aMtrFldLine1.Enable( FALSE ); + aMtrFldLine1.SetEmptyFieldValue(); + } + } + + // SdrEdgeKindItem + pItem = GetItem( rAttrs, SDRATTR_EDGEKIND ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_EDGEKIND ); + if( pItem ) + { + SdrEdgeKind nValue = ( ( const SdrEdgeKindItem* )pItem )->GetValue(); + aLbType.SelectEntryPos( sal::static_int_cast< USHORT >(nValue) ); + } + else + aLbType.SetNoSelection(); + aLbType.SaveValue(); +} + +/************************************************************************* +|* +|* Fuellt uebergebenen Item-Set mit Dialogbox-Attributen +|* +\************************************************************************/ + +BOOL SvxConnectionPage::FillItemSet( SfxItemSet& rAttrs) +{ + BOOL bModified = FALSE; + INT32 nValue; + + if( aMtrFldHorz1.GetText() != aMtrFldHorz1.GetSavedValue() ) + { + nValue = GetCoreValue( aMtrFldHorz1, eUnit ); + rAttrs.Put( SdrEdgeNode1HorzDistItem( nValue ) ); + bModified = TRUE; + } + + if( aMtrFldHorz2.GetText() != aMtrFldHorz2.GetSavedValue() ) + { + nValue = GetCoreValue( aMtrFldHorz2, eUnit ); + rAttrs.Put( SdrEdgeNode2HorzDistItem( nValue ) ); + bModified = TRUE; + } + + if( aMtrFldVert1.GetText() != aMtrFldVert1.GetSavedValue() ) + { + nValue = GetCoreValue( aMtrFldVert1, eUnit ); + rAttrs.Put( SdrEdgeNode1VertDistItem( nValue ) ); + bModified = TRUE; + } + + if( aMtrFldVert2.GetText() != aMtrFldVert2.GetSavedValue() ) + { + nValue = GetCoreValue( aMtrFldVert2, eUnit ); + rAttrs.Put( SdrEdgeNode2VertDistItem( nValue ) ); + bModified = TRUE; + } + + if( aMtrFldLine1.GetText() != aMtrFldLine1.GetSavedValue() ) + { + nValue = GetCoreValue( aMtrFldLine1, eUnit ); + rAttrs.Put( SdrEdgeLine1DeltaItem( nValue ) ); + bModified = TRUE; + } + + if( aMtrFldLine2.GetText() != aMtrFldLine2.GetSavedValue() ) + { + nValue = GetCoreValue( aMtrFldLine2, eUnit ); + rAttrs.Put( SdrEdgeLine2DeltaItem( nValue ) ); + bModified = TRUE; + } + + if( aMtrFldLine3.GetText() != aMtrFldLine3.GetSavedValue() ) + { + nValue = GetCoreValue( aMtrFldLine3, eUnit ); + rAttrs.Put( SdrEdgeLine3DeltaItem( nValue ) ); + bModified = TRUE; + } + + + USHORT nPos = aLbType.GetSelectEntryPos(); + if( nPos != aLbType.GetSavedValue() ) + { + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + rAttrs.Put( SdrEdgeKindItem( (SdrEdgeKind) nPos ) ); + bModified = TRUE; + } + } + + return( bModified ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +void SvxConnectionPage::Construct() +{ + DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" ); + + aCtlPreview.SetView( pView ); + aCtlPreview.Construct(); +} + +/************************************************************************* +|* +|* Erzeugt die Seite +|* +\************************************************************************/ + +SfxTabPage* SvxConnectionPage::Create( Window* pWindow, + const SfxItemSet& rAttrs ) +{ + return( new SvxConnectionPage( pWindow, rAttrs ) ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +USHORT* SvxConnectionPage::GetRanges() +{ + return( pRanges ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +IMPL_LINK( SvxConnectionPage, ChangeAttrHdl_Impl, void *, p ) +{ + if( p == &aMtrFldHorz1 ) + { + INT32 nValue = GetCoreValue( aMtrFldHorz1, eUnit ); + aAttrSet.Put( SdrEdgeNode1HorzDistItem( nValue ) ); + } + + if( p == &aMtrFldHorz2 ) + { + INT32 nValue = GetCoreValue( aMtrFldHorz2, eUnit ); + aAttrSet.Put( SdrEdgeNode2HorzDistItem( nValue ) ); + } + + if( p == &aMtrFldVert1 ) + { + INT32 nValue = GetCoreValue( aMtrFldVert1, eUnit ); + aAttrSet.Put( SdrEdgeNode1VertDistItem( nValue ) ); + } + + if( p == &aMtrFldVert2 ) + { + INT32 nValue = GetCoreValue( aMtrFldVert2, eUnit ); + aAttrSet.Put( SdrEdgeNode2VertDistItem( nValue ) ); + } + + if( p == &aMtrFldLine1 ) + { + INT32 nValue = GetCoreValue( aMtrFldLine1, eUnit ); + aAttrSet.Put( SdrEdgeLine1DeltaItem( nValue ) ); + } + + if( p == &aMtrFldLine2 ) + { + INT32 nValue = GetCoreValue( aMtrFldLine2, eUnit ); + aAttrSet.Put( SdrEdgeLine2DeltaItem( nValue ) ); + } + + if( p == &aMtrFldLine3 ) + { + INT32 nValue = GetCoreValue( aMtrFldLine3, eUnit ); + aAttrSet.Put( SdrEdgeLine3DeltaItem( nValue ) ); + } + + + if( p == &aLbType ) + { + USHORT nPos = aLbType.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + aAttrSet.Put( SdrEdgeKindItem( (SdrEdgeKind) nPos ) ); + } + } + + aCtlPreview.SetAttributes( aAttrSet ); + + if( p == &aLbType ) + { + // Anzahl der Linienversaetze ermitteln + USHORT nCount = aCtlPreview.GetLineDeltaAnz(); + + aFtLine3.Enable( nCount > 2 ); + aMtrFldLine3.Enable( nCount > 2 ); + if( nCount > 2 ) + aMtrFldLine3.SetValue( aMtrFldLine3.GetValue() ); + else + aMtrFldLine3.SetEmptyFieldValue(); + + aFtLine2.Enable( nCount > 1 ); + aMtrFldLine2.Enable( nCount > 1 ); + if( nCount > 1 ) + aMtrFldLine2.SetValue( aMtrFldLine2.GetValue() ); + else + aMtrFldLine2.SetEmptyFieldValue(); + + aFtLine1.Enable( nCount > 0 ); + aMtrFldLine1.Enable( nCount > 0 ); + if( nCount > 0 ) + aMtrFldLine1.SetValue( aMtrFldLine1.GetValue() ); + else + aMtrFldLine1.SetEmptyFieldValue(); + + } + + return( 0L ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +void SvxConnectionPage::FillTypeLB() +{ + // ListBox mit Verbindernamen fuellen + const SfxPoolItem* pItem = GetItem( rOutAttrs, SDRATTR_EDGEKIND ); + const SfxItemPool* pPool = rOutAttrs.GetPool(); + + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_EDGEKIND ); + if( pItem ) + { + const SdrEdgeKindItem* pEdgeKindItem = (const SdrEdgeKindItem*) pItem; + USHORT nCount = pEdgeKindItem->GetValueCount(); + String aStr; + + for( USHORT i = 0; i < nCount; i++ ) + { + aStr = pEdgeKindItem->GetValueTextByPos( i ); + aLbType.InsertEntry( aStr ); + } + } +} +void SvxConnectionPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 +{ + SFX_ITEMSET_ARG(&aSet,pOfaPtrItem,OfaPtrItem,SID_OBJECT_LIST,sal_False); + if (pOfaPtrItem) + SetView( static_cast(pOfaPtrItem->GetValue()) ); + + Construct(); +} + diff --git a/cui/source/tabpages/connect.hrc b/cui/source/tabpages/connect.hrc new file mode 100644 index 000000000000..f6c49e5c7d6e --- /dev/null +++ b/cui/source/tabpages/connect.hrc @@ -0,0 +1,48 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: connect.hrc,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define FL_DISTANCE 1 +#define FL_DELTA 2 +#define FT_LINE_1 1 +#define FT_LINE_2 2 +#define FT_LINE_3 3 +#define MTR_FLD_LINE_1 1 +#define MTR_FLD_LINE_2 2 +#define MTR_FLD_LINE_3 3 +#define FT_HORZ_1 4 +#define FT_HORZ_2 5 +#define MTR_FLD_HORZ_1 4 +#define MTR_FLD_HORZ_2 5 +#define MTR_FLD_VERT_1 6 +#define MTR_FLD_VERT_2 7 +#define FT_VERT_2 7 +#define FT_VERT_1 6 +#define FT_TYPE 8 +#define LB_TYPE 1 +#define CTL_PREVIEW 1 diff --git a/cui/source/tabpages/connect.src b/cui/source/tabpages/connect.src new file mode 100644 index 000000000000..a2bd502e1717 --- /dev/null +++ b/cui/source/tabpages/connect.src @@ -0,0 +1,268 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: connect.src,v $ + * $Revision: 1.33 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // pragma ---------------------------------------------------------------- + + // include --------------------------------------------------------------- +#include +#include "connect.hrc" +#include +#include "helpid.hrc" + // RID_SVXPAGE_CONNECTION ------------------------------------------------ +TabPage RID_SVXPAGE_CONNECTION +{ + HelpId = HID_PAGE_CONNECTION ; + SVLook = TRUE ; + Hide = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Text [ en-US ] = "Connector" ; + FixedText FT_TYPE + { + Pos = MAP_APPFONT ( 6 , 8 ) ; + Size = MAP_APPFONT ( 25 , 8 ) ; + Text [ en-US ] = "~Type" ; + }; + ListBox LB_TYPE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 37 , 6 ) ; + Size = MAP_APPFONT ( 83 , 54 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedLine FL_DELTA + { + Pos = MAP_APPFONT ( 6 , 24 ) ; + Size = MAP_APPFONT ( 120 , RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Line skew" ; + }; + FixedText FT_LINE_1 + { + Pos = MAP_APPFONT ( 12 , 37 ) ; + Size = MAP_APPFONT ( 66 , 8 ) ; + Text [ en-US ] = "Line ~1" ; + }; + MetricField MTR_FLD_LINE_1 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 79 , 35 ) ; + Size = MAP_APPFONT ( 41 , 12 ) ; + TabStop = TRUE ; + Spin = TRUE ; + Repeat = TRUE ; + DecimalDigits = 2 ; + Minimum = -10000 ; + First = -10000 ; + Maximum = 10000 ; + Last = 10000 ; + SpinSize = 10 ; + Unit = FUNIT_CM ; + }; + FixedText FT_LINE_2 + { + Pos = MAP_APPFONT ( 12 , 53 ) ; + Size = MAP_APPFONT ( 66 , 8 ) ; + Text [ en-US ] = "Line ~2" ; + }; + MetricField MTR_FLD_LINE_2 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 79 , 51 ) ; + Size = MAP_APPFONT ( 41 , 12 ) ; + TabStop = TRUE ; + Spin = TRUE ; + Repeat = TRUE ; + DecimalDigits = 2 ; + Minimum = -10000 ; + First = -10000 ; + Maximum = 10000 ; + Last = 10000 ; + SpinSize = 10 ; + Unit = FUNIT_CM ; + }; + FixedText FT_LINE_3 + { + Pos = MAP_APPFONT ( 12 , 69 ) ; + Size = MAP_APPFONT ( 66 , 8 ) ; + Text [ en-US ] = "Line ~3" ; + }; + MetricField MTR_FLD_LINE_3 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 79 , 67 ) ; + Size = MAP_APPFONT ( 41 , 12 ) ; + TabStop = TRUE ; + Spin = TRUE ; + Repeat = TRUE ; + DecimalDigits = 2 ; + Minimum = -10000 ; + First = -10000 ; + Maximum = 10000 ; + Last = 10000 ; + SpinSize = 10 ; + Unit = FUNIT_CM ; + }; + FixedLine FL_DISTANCE + { + Pos = MAP_APPFONT ( 6 , 85 ) ; + Size = MAP_APPFONT ( 120 , RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Line spacing" ; + }; + FixedText FT_HORZ_1 + { + Pos = MAP_APPFONT ( 12 , 98 ) ; + Size = MAP_APPFONT ( 66 , 8 ) ; + Text [ en-US ] = "~Begin horizontal" ; + }; + MetricField MTR_FLD_HORZ_1 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 79 , 96 ) ; + Size = MAP_APPFONT ( 41 , 12 ) ; + TabStop = TRUE ; + Spin = TRUE ; + Repeat = TRUE ; + DecimalDigits = 2 ; + Minimum = -10000 ; + First = -10000 ; + Maximum = 10000 ; + Last = 10000 ; + SpinSize = 10 ; + Unit = FUNIT_CM ; + }; + FixedText FT_HORZ_2 + { + Pos = MAP_APPFONT ( 12 , 130 ) ; + Size = MAP_APPFONT ( 66 , 8 ) ; + Text [ en-US ] = "End ~horizontal" ; + }; + MetricField MTR_FLD_HORZ_2 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 79 , 128 ) ; + Size = MAP_APPFONT ( 41 , 12 ) ; + TabStop = TRUE ; + Spin = TRUE ; + Repeat = TRUE ; + DecimalDigits = 2 ; + Minimum = -10000 ; + First = -10000 ; + Maximum = 10000 ; + Last = 10000 ; + SpinSize = 10 ; + Unit = FUNIT_CM ; + }; + FixedText FT_VERT_1 + { + Pos = MAP_APPFONT ( 12 , 114 ) ; + Size = MAP_APPFONT ( 66 , 8 ) ; + Text [ en-US ] = "Begin ~vertical" ; + }; + MetricField MTR_FLD_VERT_1 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 79 , 112 ) ; + Size = MAP_APPFONT ( 41 , 12 ) ; + TabStop = TRUE ; + Spin = TRUE ; + Repeat = TRUE ; + DecimalDigits = 2 ; + Minimum = -10000 ; + First = -10000 ; + Maximum = 10000 ; + Last = 10000 ; + SpinSize = 10 ; + Unit = FUNIT_CM ; + }; + FixedText FT_VERT_2 + { + Pos = MAP_APPFONT ( 12 , 146 ) ; + Size = MAP_APPFONT ( 66 , 8 ) ; + Text [ en-US ] = "~End vertical" ; + }; + MetricField MTR_FLD_VERT_2 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 79 , 144 ) ; + Size = MAP_APPFONT ( 41 , 12 ) ; + TabStop = TRUE ; + Spin = TRUE ; + Repeat = TRUE ; + DecimalDigits = 2 ; + Minimum = -10000 ; + First = -10000 ; + Maximum = 10000 ; + Last = 10000 ; + SpinSize = 10 ; + Unit = FUNIT_CM ; + }; + Control CTL_PREVIEW + { + HelpId = HID_PAGE_CONNECTION_CTL_PREVIEW ; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 + 120 + RSC_SP_FLGR_SPACE_Y + RSC_SP_FLGR_INNERBORDER_LEFT , 35 ) ; + Size = MAP_APPFONT ( 118 , 121 ) ; + QuickHelpText [ en-US ] = "Preview"; + }; +}; + // ******************************************************************* EOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/dstribut.cxx b/cui/source/tabpages/dstribut.cxx new file mode 100644 index 000000000000..43fdfe507627 --- /dev/null +++ b/cui/source/tabpages/dstribut.cxx @@ -0,0 +1,247 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dstribut.cxx,v $ + * $Revision: 1.12 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +#include +#include +#include "dstribut.hxx" +#include "dstribut.hrc" + +#include +#include +#include + +static USHORT pRanges[] = +{ + SDRATTR_MEASURE_FIRST, + SDRATTR_MEASURE_LAST, + 0 +}; + +/************************************************************************* +|* +|* Dialog +|* +\************************************************************************/ + +SvxDistributeDialog::SvxDistributeDialog( + Window* pParent, + const SfxItemSet& rInAttrs, + SvxDistributeHorizontal eHor, + SvxDistributeVertical eVer) +: SfxSingleTabDialog(pParent, rInAttrs, RID_SVXPAGE_DISTRIBUTE ), + mpPage(0L) +{ + mpPage = new SvxDistributePage(this, rInAttrs, eHor, eVer); + SetTabPage(mpPage); + SetText(mpPage->GetText()); +} + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +SvxDistributeDialog::~SvxDistributeDialog() +{ +} + +/************************************************************************* +|* +|* Tabpage +|* +\************************************************************************/ + +SvxDistributePage::SvxDistributePage( + Window* pWindow, + const SfxItemSet& rInAttrs, + SvxDistributeHorizontal eHor, + SvxDistributeVertical eVer) +: SvxTabPage(pWindow, SVX_RES(RID_SVXPAGE_DISTRIBUTE), rInAttrs), + meDistributeHor(eHor), + meDistributeVer(eVer), + maFlHorizontal (this, SVX_RES(FL_HORIZONTAL )), + maBtnHorNone (this, SVX_RES(BTN_HOR_NONE )), + maBtnHorLeft (this, SVX_RES(BTN_HOR_LEFT )), + maBtnHorCenter (this, SVX_RES(BTN_HOR_CENTER )), + maBtnHorDistance (this, SVX_RES(BTN_HOR_DISTANCE )), + maBtnHorRight (this, SVX_RES(BTN_HOR_RIGHT )), + maHorLow (this, SVX_RES(IMG_HOR_LOW )), + maHorCenter (this, SVX_RES(IMG_HOR_CENTER )), + maHorDistance (this, SVX_RES(IMG_HOR_DISTANCE )), + maHorHigh (this, SVX_RES(IMG_HOR_HIGH )), + maFlVertical (this, SVX_RES(FL_VERTICAL )), + maBtnVerNone (this, SVX_RES(BTN_VER_NONE )), + maBtnVerTop (this, SVX_RES(BTN_VER_TOP )), + maBtnVerCenter (this, SVX_RES(BTN_VER_CENTER )), + maBtnVerDistance (this, SVX_RES(BTN_VER_DISTANCE )), + maBtnVerBottom (this, SVX_RES(BTN_VER_BOTTOM )), + maVerLow (this, SVX_RES(IMG_VER_LOW )), + maVerCenter (this, SVX_RES(IMG_VER_CENTER )), + maVerDistance (this, SVX_RES(IMG_VER_DISTANCE )), + maVerHigh (this, SVX_RES(IMG_VER_HIGH )) +{ + maHorLow.SetModeImage( Image( SVX_RES( IMG_HOR_LOW_H ) ), BMP_COLOR_HIGHCONTRAST ); + maHorCenter.SetModeImage( Image( SVX_RES( IMG_HOR_CENTER_H ) ), BMP_COLOR_HIGHCONTRAST ); + maHorDistance.SetModeImage( Image( SVX_RES( IMG_HOR_DISTANCE_H ) ), BMP_COLOR_HIGHCONTRAST ); + maHorHigh.SetModeImage( Image( SVX_RES( IMG_HOR_HIGH_H ) ), BMP_COLOR_HIGHCONTRAST ); + maVerDistance.SetModeImage( Image( SVX_RES( IMG_VER_DISTANCE_H ) ), BMP_COLOR_HIGHCONTRAST ); + maVerLow.SetModeImage( Image( SVX_RES( IMG_VER_LOW_H ) ), BMP_COLOR_HIGHCONTRAST ); + maVerCenter.SetModeImage( Image( SVX_RES( IMG_VER_CENTER_H ) ), BMP_COLOR_HIGHCONTRAST ); + maVerHigh.SetModeImage( Image( SVX_RES( IMG_VER_HIGH_H ) ), BMP_COLOR_HIGHCONTRAST ); + + FreeResource(); +} + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +SvxDistributePage::~SvxDistributePage() +{ +} + +/************************************************************************* +|* +|* create the tabpage +|* +\************************************************************************/ + +SfxTabPage* SvxDistributePage::Create(Window* pWindow, const SfxItemSet& rAttrs, + SvxDistributeHorizontal eHor, SvxDistributeVertical eVer) +{ + return(new SvxDistributePage(pWindow, rAttrs, eHor, eVer)); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +UINT16* SvxDistributePage::GetRanges() +{ + return(pRanges); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +void SvxDistributePage::PointChanged(Window* /*pWindow*/, RECT_POINT /*eRP*/) +{ +} + +/************************************************************************* +|* +|* read the delivered Item-Set +|* +\************************************************************************/ + +void __EXPORT SvxDistributePage::Reset(const SfxItemSet& ) +{ + maBtnHorNone.SetState(FALSE); + maBtnHorLeft.SetState(FALSE); + maBtnHorCenter.SetState(FALSE); + maBtnHorDistance.SetState(FALSE); + maBtnHorRight.SetState(FALSE); + + switch(meDistributeHor) + { + case SvxDistributeHorizontalNone : maBtnHorNone.SetState(TRUE); break; + case SvxDistributeHorizontalLeft : maBtnHorLeft.SetState(TRUE); break; + case SvxDistributeHorizontalCenter : maBtnHorCenter.SetState(TRUE); break; + case SvxDistributeHorizontalDistance : maBtnHorDistance.SetState(TRUE); break; + case SvxDistributeHorizontalRight : maBtnHorRight.SetState(TRUE); break; + } + + maBtnVerNone.SetState(FALSE); + maBtnVerTop.SetState(FALSE); + maBtnVerCenter.SetState(FALSE); + maBtnVerDistance.SetState(FALSE); + maBtnVerBottom.SetState(FALSE); + + switch(meDistributeVer) + { + case SvxDistributeVerticalNone : maBtnVerNone.SetState(TRUE); break; + case SvxDistributeVerticalTop : maBtnVerTop.SetState(TRUE); break; + case SvxDistributeVerticalCenter : maBtnVerCenter.SetState(TRUE); break; + case SvxDistributeVerticalDistance : maBtnVerDistance.SetState(TRUE); break; + case SvxDistributeVerticalBottom : maBtnVerBottom.SetState(TRUE); break; + } +} + +/************************************************************************* +|* +|* Fill the delivered Item-Set with dialogbox-attributes +|* +\************************************************************************/ + +BOOL SvxDistributePage::FillItemSet( SfxItemSet& ) +{ + SvxDistributeHorizontal eDistributeHor(SvxDistributeHorizontalNone); + SvxDistributeVertical eDistributeVer(SvxDistributeVerticalNone); + + if(maBtnHorLeft.IsChecked()) + eDistributeHor = SvxDistributeHorizontalLeft; + else if(maBtnHorCenter.IsChecked()) + eDistributeHor = SvxDistributeHorizontalCenter; + else if(maBtnHorDistance.IsChecked()) + eDistributeHor = SvxDistributeHorizontalDistance; + else if(maBtnHorRight.IsChecked()) + eDistributeHor = SvxDistributeHorizontalRight; + + if(maBtnVerTop.IsChecked()) + eDistributeVer = SvxDistributeVerticalTop; + else if(maBtnVerCenter.IsChecked()) + eDistributeVer = SvxDistributeVerticalCenter; + else if(maBtnVerDistance.IsChecked()) + eDistributeVer = SvxDistributeVerticalDistance; + else if(maBtnVerBottom.IsChecked()) + eDistributeVer = SvxDistributeVerticalBottom; + + if(eDistributeHor != meDistributeHor || eDistributeVer != meDistributeVer) + { + meDistributeHor = eDistributeHor; + meDistributeVer = eDistributeVer; + return TRUE; + } + + return FALSE; +} + + diff --git a/cui/source/tabpages/dstribut.hrc b/cui/source/tabpages/dstribut.hrc new file mode 100644 index 000000000000..0834c8640785 --- /dev/null +++ b/cui/source/tabpages/dstribut.hrc @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dstribut.hrc,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define FL_HORIZONTAL 1 +#define BTN_HOR_NONE 2 +#define BTN_HOR_LEFT 3 +#define BTN_HOR_CENTER 4 +#define BTN_HOR_DISTANCE 5 +#define BTN_HOR_RIGHT 6 +#define FL_VERTICAL 7 +#define BTN_VER_NONE 8 +#define BTN_VER_TOP 9 +#define BTN_VER_CENTER 10 +#define BTN_VER_DISTANCE 11 +#define BTN_VER_BOTTOM 12 +#define IMG_HOR_LOW 14 +#define IMG_HOR_CENTER 15 +#define IMG_HOR_DISTANCE 16 +#define IMG_HOR_HIGH 17 +#define IMG_VER_LOW 18 +#define IMG_VER_CENTER 19 +#define IMG_VER_DISTANCE 20 +#define IMG_VER_HIGH 21 + +#define IMG_HOR_LOW_H 22 +#define IMG_HOR_CENTER_H 23 +#define IMG_HOR_DISTANCE_H 24 +#define IMG_HOR_HIGH_H 25 +#define IMG_VER_LOW_H 26 +#define IMG_VER_CENTER_H 27 +#define IMG_VER_DISTANCE_H 28 +#define IMG_VER_HIGH_H 29 diff --git a/cui/source/tabpages/dstribut.src b/cui/source/tabpages/dstribut.src new file mode 100644 index 000000000000..e9e0ede56590 --- /dev/null +++ b/cui/source/tabpages/dstribut.src @@ -0,0 +1,293 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dstribut.src,v $ + * $Revision: 1.33 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// include --------------------------------------------------------------- +#include +#include "dstribut.hrc" +#include "helpid.hrc" + +// RID_SVXPAGE_DISTRIBUTE --------------------------------------------------- +#define STD_MASKCOLOR Color { Red=0xffff; Green=0x0000; Blue=0xffff; } +TabPage RID_SVXPAGE_DISTRIBUTE +{ + HelpId = HID_PAGE_DISTRIBUTE ; + Hide = TRUE ; + Size = MAP_APPFONT ( 260 , 81 ) ; + Text [ en-US ] = "Distribution" ; + + FixedLine FL_HORIZONTAL + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Horizontal" ; + }; + + RadioButton BTN_HOR_NONE + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 48 , 10 ) ; + Text [ en-US ] = "~None" ; + }; + + RadioButton BTN_HOR_LEFT + { + Pos = MAP_APPFONT ( 56 , 26 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + Text [ en-US ] = "~Left" ; + }; + + RadioButton BTN_HOR_CENTER + { + Pos = MAP_APPFONT ( 105 , 26 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + Text [ en-US ] = "~Center" ; + }; + + RadioButton BTN_HOR_DISTANCE + { + Pos = MAP_APPFONT ( 154 , 26 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + Text [ en-US ] = "~Spacing" ; + }; + + RadioButton BTN_HOR_RIGHT + { + Pos = MAP_APPFONT ( 203 , 26 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + Text [ en-US ] = "~Right" ; + }; + + FixedImage IMG_HOR_LOW { + Pos = MAP_APPFONT ( 65 , 10 ); + Size = MAP_APPFONT ( 15 , 16 ); + Hide = FALSE; + Fixed = Image { + ImageBitmap = Bitmap { File = "dsth_low.bmp"; }; + MaskColor = STD_MASKCOLOR; + }; + }; + + FixedImage IMG_HOR_CENTER { + Pos = MAP_APPFONT ( 114 , 10 ); + Size = MAP_APPFONT ( 15 , 16 ); + Hide = FALSE; + Fixed = Image { + ImageBitmap = Bitmap { File = "dsth_cen.bmp"; }; + MaskColor = STD_MASKCOLOR; + }; + }; + + FixedImage IMG_HOR_DISTANCE { + Pos = MAP_APPFONT ( 163 , 10 ); + Size = MAP_APPFONT ( 15 , 16 ); + Hide = FALSE; + Fixed = Image { + ImageBitmap = Bitmap { File = "dsth_dst.bmp"; }; + MaskColor = STD_MASKCOLOR; + }; + }; + + FixedImage IMG_HOR_HIGH { + Pos = MAP_APPFONT ( 212 , 10 ); + Size = MAP_APPFONT ( 15 , 16 ); + Hide = FALSE; + Fixed = Image { + ImageBitmap = Bitmap { File = "dsth_hig.bmp"; }; + MaskColor = STD_MASKCOLOR; + }; + }; + + FixedLine FL_VERTICAL + { + Pos = MAP_APPFONT ( 6 , 42 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Vertical" ; + }; + + RadioButton BTN_VER_NONE + { + Pos = MAP_APPFONT ( 12 , 53 ) ; + Size = MAP_APPFONT ( 46 , 10 ) ; + Text [ en-US ] = "N~one" ; + }; + + RadioButton BTN_VER_TOP + { + Pos = MAP_APPFONT ( 56 , 65 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + Text [ en-US ] = "~Top" ; + }; + + RadioButton BTN_VER_CENTER + { + Pos = MAP_APPFONT ( 105 , 65 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + Text [ en-US ] = "C~enter" ; + }; + + RadioButton BTN_VER_DISTANCE + { + Pos = MAP_APPFONT ( 154 , 65 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + Text [ en-US ] = "S~pacing" ; + }; + + RadioButton BTN_VER_BOTTOM + { + Pos = MAP_APPFONT ( 203 , 65 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + Text [ en-US ] = "~Bottom" ; + }; + + FixedImage IMG_VER_HIGH { + Pos = MAP_APPFONT ( 65 , 49 ); + Size = MAP_APPFONT ( 15 , 16 ); + Hide = FALSE; + Fixed = Image { + ImageBitmap = Bitmap { File = "dstv_hig.bmp"; }; + MaskColor = STD_MASKCOLOR; + }; + }; + + FixedImage IMG_VER_CENTER { + Pos = MAP_APPFONT ( 114 , 49 ); + Size = MAP_APPFONT ( 15 , 16 ); + Hide = FALSE; + Fixed = Image { + ImageBitmap = Bitmap { File = "dstv_cen.bmp"; }; + MaskColor = STD_MASKCOLOR; + }; + }; + + FixedImage IMG_VER_DISTANCE { + Pos = MAP_APPFONT ( 163 , 49 ); + Size = MAP_APPFONT ( 15 , 16 ); + Hide = FALSE; + Fixed = Image { + ImageBitmap = Bitmap { File = "dstv_dst.bmp"; }; + MaskColor = STD_MASKCOLOR; + }; + }; + + FixedImage IMG_VER_LOW { + Pos = MAP_APPFONT ( 212 , 49 ); + Size = MAP_APPFONT ( 15 , 16 ); + Hide = FALSE; + Fixed = Image { + ImageBitmap = Bitmap { File = "dstv_low.bmp"; }; + MaskColor = STD_MASKCOLOR; + }; + }; + + + Image IMG_HOR_LOW_H + { + ImageBitmap = Bitmap { File = "dsth_low_h.bmp" ; }; + MaskColor = STD_MASKCOLOR ; + }; + + Image IMG_HOR_DISTANCE_H + { + ImageBitmap = Bitmap { File = "dsth_dst_h.bmp" ; }; + MaskColor = STD_MASKCOLOR ; + }; + + Image IMG_HOR_CENTER_H + { + ImageBitmap = Bitmap { File = "dsth_cen_h.bmp" ; }; + MaskColor = STD_MASKCOLOR ; + }; + + Image IMG_HOR_HIGH_H + { + ImageBitmap = Bitmap { File = "dsth_hig_h.bmp" ; }; + MaskColor = STD_MASKCOLOR ; + }; + + Image IMG_VER_HIGH_H + { + ImageBitmap = Bitmap { File = "dstv_hig_h.bmp" ; }; + MaskColor = STD_MASKCOLOR ; + }; + + Image IMG_VER_CENTER_H + { + ImageBitmap = Bitmap { File = "dstv_cen_h.bmp" ; }; + MaskColor = STD_MASKCOLOR ; + }; + + Image IMG_VER_DISTANCE_H + { + ImageBitmap = Bitmap { File = "dstv_dst_h.bmp" ; }; + MaskColor = STD_MASKCOLOR ; + }; + + Image IMG_VER_LOW_H + { + ImageBitmap = Bitmap { File = "dstv_low_h.bmp" ; }; + MaskColor = STD_MASKCOLOR ; + }; + +}; + +// ********************************************************************** EOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx new file mode 100644 index 000000000000..4b3087c7a9b2 --- /dev/null +++ b/cui/source/tabpages/grfpage.cxx @@ -0,0 +1,838 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: grfpage.cxx,v $ + * $Revision: 1.20 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define CM_1_TO_TWIP 567 + + +inline long lcl_GetValue( MetricField& rMetric, FieldUnit eUnit ) +{ + return static_cast(rMetric.Denormalize( rMetric.GetValue( eUnit ))); +} + +/*-------------------------------------------------------------------- + Beschreibung: Grafik zuschneiden + --------------------------------------------------------------------*/ + +SvxGrfCropPage::SvxGrfCropPage ( Window *pParent, const SfxItemSet &rSet ) + : SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_GRFCROP ), rSet ), + aCropFL( this, SVX_RES( FL_CROP )), + aZoomConstRB( this, SVX_RES( RB_ZOOMCONST)), + aSizeConstRB( this, SVX_RES( RB_SIZECONST)), + aLeftFT( this, SVX_RES( FT_LEFT )), + aLeftMF( this, SVX_RES( MF_LEFT )), + aRightFT( this, SVX_RES( FT_RIGHT )), + aRightMF( this, SVX_RES( MF_RIGHT )), + aTopFT( this, SVX_RES( FT_TOP )), + aTopMF( this, SVX_RES( MF_TOP )), + aBottomFT( this, SVX_RES( FT_BOTTOM )), + aBottomMF( this, SVX_RES( MF_BOTTOM )), + aZoomFL( this, SVX_RES( FL_ZOOM )), + aWidthZoomFT( this, SVX_RES( FT_WIDTHZOOM )), + aWidthZoomMF( this, SVX_RES( MF_WIDTHZOOM )), + aHeightZoomFT( this, SVX_RES( FT_HEIGHTZOOM)), + aHeightZoomMF( this, SVX_RES( MF_HEIGHTZOOM)), + aSizeFL( this, SVX_RES( FL_SIZE )), + aWidthFT( this, SVX_RES( FT_WIDTH )), + aWidthMF( this, SVX_RES( MF_WIDTH )), + aHeightFT( this, SVX_RES( FT_HEIGHT )), + aHeightMF( this, SVX_RES( MF_HEIGHT )), + aOrigSizeFT( this, SVX_RES(FT_ORIG_SIZE)), + aOrigSizePB( this, SVX_RES( PB_ORGSIZE )), + aExampleWN( this, SVX_RES( WN_BSP )), + pLastCropField(0), + bInitialized(FALSE), + bSetOrigSize(FALSE) +{ + FreeResource(); + + SetExchangeSupport(); + + // set the correct metric + const FieldUnit eMetric = GetModuleFieldUnit( &rSet ); + + SetFieldUnit( aWidthMF, eMetric ); + SetFieldUnit( aHeightMF, eMetric ); + SetFieldUnit( aLeftMF, eMetric ); + SetFieldUnit( aRightMF, eMetric ); + SetFieldUnit( aTopMF , eMetric ); + SetFieldUnit( aBottomMF, eMetric ); + + Link aLk = LINK(this, SvxGrfCropPage, SizeHdl); + aWidthMF.SetModifyHdl( aLk ); + aHeightMF.SetModifyHdl( aLk ); + + aLk = LINK(this, SvxGrfCropPage, ZoomHdl); + aWidthZoomMF.SetModifyHdl( aLk ); + aHeightZoomMF.SetModifyHdl( aLk ); + + aLk = LINK(this, SvxGrfCropPage, CropHdl); + aLeftMF.SetDownHdl( aLk ); + aRightMF.SetDownHdl( aLk ); + aTopMF.SetDownHdl( aLk ); + aBottomMF.SetDownHdl( aLk ); + aLeftMF.SetUpHdl( aLk ); + aRightMF.SetUpHdl( aLk ); + aTopMF.SetUpHdl( aLk ); + aBottomMF.SetUpHdl( aLk ); + + aLk = LINK(this, SvxGrfCropPage, CropModifyHdl); + aLeftMF.SetModifyHdl( aLk ); + aRightMF.SetModifyHdl( aLk ); + aTopMF.SetModifyHdl( aLk ); + aBottomMF.SetModifyHdl( aLk ); + + aLk = LINK(this, SvxGrfCropPage, CropLoseFocusHdl); + aLeftMF.SetLoseFocusHdl( aLk ); + aRightMF.SetLoseFocusHdl( aLk ); + aTopMF.SetLoseFocusHdl( aLk ); + aBottomMF.SetLoseFocusHdl( aLk ); + + aLk = LINK(this, SvxGrfCropPage, OrigSizeHdl); + aOrigSizePB.SetClickHdl( aLk ); + + aTimer.SetTimeoutHdl(LINK(this, SvxGrfCropPage, Timeout)); + aTimer.SetTimeout( 1500 ); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SvxGrfCropPage::~SvxGrfCropPage() +{ + aTimer.Stop(); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SfxTabPage* SvxGrfCropPage::Create(Window *pParent, const SfxItemSet &rSet) +{ + return new SvxGrfCropPage( pParent, rSet ); +} +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +void SvxGrfCropPage::Reset( const SfxItemSet &rSet ) +{ + const SfxPoolItem* pItem; + const SfxItemPool& rPool = *rSet.GetPool(); + + if(SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( + SID_ATTR_GRAF_KEEP_ZOOM ), TRUE, &pItem )) + { + if( ((const SfxBoolItem*)pItem)->GetValue() ) + aZoomConstRB.Check(); + else + aSizeConstRB.Check(); + aZoomConstRB.SaveValue(); + } + + USHORT nW = rPool.GetWhich( SID_ATTR_GRAF_CROP ); + if( SFX_ITEM_SET == rSet.GetItemState( nW, TRUE, &pItem)) + { + FieldUnit eUnit = MapToFieldUnit( rSet.GetPool()->GetMetric( nW )); + + SvxGrfCrop* pCrop = (SvxGrfCrop*)pItem; + + aExampleWN.SetLeft( pCrop->GetLeft()); + aExampleWN.SetRight( pCrop->GetRight()); + aExampleWN.SetTop( pCrop->GetTop()); + aExampleWN.SetBottom( pCrop->GetBottom()); + + aLeftMF.SetValue( aLeftMF.Normalize( pCrop->GetLeft()), eUnit ); + aRightMF.SetValue( aRightMF.Normalize( pCrop->GetRight()), eUnit ); + aTopMF.SetValue( aTopMF.Normalize( pCrop->GetTop()), eUnit ); + aBottomMF.SetValue( aBottomMF.Normalize( pCrop->GetBottom()), eUnit ); + } + else + { + aLeftMF.SetValue( 0 ); + aRightMF.SetValue( 0 ); + aTopMF.SetValue( 0 ); + aBottomMF.SetValue( 0 ); + } + + nW = rPool.GetWhich( SID_ATTR_PAGE_SIZE ); + if ( SFX_ITEM_SET == rSet.GetItemState( nW, FALSE, &pItem ) ) + { + // Orientation und Size aus dem PageItem + FieldUnit eUnit = MapToFieldUnit( rSet.GetPool()->GetMetric( nW )); + + aPageSize = ((const SvxSizeItem*)pItem)->GetSize(); + + sal_Int64 nTmp = aHeightMF.Normalize(aPageSize.Height()); + aHeightMF.SetMax( nTmp, eUnit ); + nTmp = aWidthMF.Normalize(aPageSize.Width()); + aWidthMF.SetMax( nTmp, eUnit ); + nTmp = aWidthMF.Normalize( 23 ); + aHeightMF.SetMin( nTmp, eUnit ); + aWidthMF.SetMin( nTmp, eUnit ); + } + else + { + aPageSize = OutputDevice::LogicToLogic( + Size( CM_1_TO_TWIP, CM_1_TO_TWIP ), + MapMode( MAP_TWIP ), + MapMode( (MapUnit)rSet.GetPool()->GetMetric( nW ) ) ); + } + + BOOL bFound = FALSE; + if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRAF_GRAPHIC, FALSE, &pItem ) ) + { + const Graphic* pGrf = ((SvxBrushItem*)pItem)->GetGraphic(); + if( pGrf ) + aOrigSize = GetGrfOrigSize( *pGrf ); + + if( aOrigSize.Width() && aOrigSize.Height() ) + { + CalcMinMaxBorder(); + aExampleWN.SetGraphic( *pGrf ); + aExampleWN.SetFrameSize( aOrigSize ); + + bFound = TRUE; + if( ((SvxBrushItem*)pItem)->GetGraphicLink() ) + aGraphicName = *((SvxBrushItem*)pItem)->GetGraphicLink(); + } + } + + GraphicHasChanged( bFound ); + bReset = TRUE; + ActivatePage( rSet ); + bReset = FALSE; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +BOOL SvxGrfCropPage::FillItemSet(SfxItemSet &rSet) +{ + const SfxItemPool& rPool = *rSet.GetPool(); + BOOL bModified = FALSE; + if( aWidthMF.GetSavedValue() != aWidthMF.GetText() || + aHeightMF.GetSavedValue() != aHeightMF.GetText() ) + { + USHORT nW = rPool.GetWhich( SID_ATTR_GRAF_FRMSIZE ); + FieldUnit eUnit = MapToFieldUnit( rSet.GetPool()->GetMetric( nW )); + + SvxSizeItem aSz( nW ); + + // die Groesse koennte schon von einer anderen Page gesetzt worden sein + // #44204# + const SfxItemSet* pExSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL; + const SfxPoolItem* pItem = 0; + if( pExSet && SFX_ITEM_SET == + pExSet->GetItemState( nW, FALSE, &pItem ) ) + aSz = *(const SvxSizeItem*)pItem; + else + aSz = (const SvxSizeItem&)GetItemSet().Get( nW ); + + Size aTmpSz( aSz.GetSize() ); + if( aWidthMF.GetText() != aWidthMF.GetSavedValue() ) + aTmpSz.Width() = lcl_GetValue( aWidthMF, eUnit ); + if( aHeightMF.GetText() != aHeightMF.GetSavedValue() ) + aTmpSz.Height() = lcl_GetValue( aHeightMF, eUnit ); + aSz.SetSize( aTmpSz ); + aWidthMF.SaveValue(); + aHeightMF.SaveValue(); + + bModified |= 0 != rSet.Put( aSz ); + + if( bSetOrigSize ) + { + bModified |= 0 != rSet.Put( SvxSizeItem( rPool.GetWhich( + SID_ATTR_GRAF_FRMSIZE_PERCENT ), Size( 0, 0 )) ); + } + } + if( aLeftMF.IsModified() || aRightMF.IsModified() || + aTopMF.IsModified() || aBottomMF.IsModified() ) + { + USHORT nW = rPool.GetWhich( SID_ATTR_GRAF_CROP ); + FieldUnit eUnit = MapToFieldUnit( rSet.GetPool()->GetMetric( nW )); + SvxGrfCrop* pNew = (SvxGrfCrop*)rSet.Get( nW ).Clone(); + + pNew->SetLeft( lcl_GetValue( aLeftMF, eUnit ) ); + pNew->SetRight( lcl_GetValue( aRightMF, eUnit ) ); + pNew->SetTop( lcl_GetValue( aTopMF, eUnit ) ); + pNew->SetBottom( lcl_GetValue( aBottomMF, eUnit ) ); + bModified |= 0 != rSet.Put( *pNew ); + delete pNew; + } + + if( aZoomConstRB.GetSavedValue() != aZoomConstRB.IsChecked() ) + { + bModified |= 0 != rSet.Put( SfxBoolItem( rPool.GetWhich( + SID_ATTR_GRAF_KEEP_ZOOM), aZoomConstRB.IsChecked() ) ); + } + + bInitialized = FALSE; + + return bModified; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +void SvxGrfCropPage::ActivatePage(const SfxItemSet& rSet) +{ +#ifdef DBG_UTIL + SfxItemPool* pPool = GetItemSet().GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); +#endif + + bSetOrigSize = FALSE; + + // Size + Size aSize; + const SfxPoolItem* pItem; + if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRAF_FRMSIZE, FALSE, &pItem ) ) + aSize = ((const SvxSizeItem*)pItem)->GetSize(); + + nOldWidth = aSize.Width(); + nOldHeight = aSize.Height(); + + sal_Int64 nWidth = aWidthMF.Normalize(nOldWidth); + sal_Int64 nHeight = aHeightMF.Normalize(nOldHeight); + + if (nWidth != aWidthMF.GetValue(FUNIT_TWIP)) + { + if(!bReset) + { + // Wert wurde von Umlauf-Tabpage geaendert und muss + // mit Modify-Flag gesetzt werden + aWidthMF.SetUserValue(nWidth, FUNIT_TWIP); + } + else + aWidthMF.SetValue(nWidth, FUNIT_TWIP); + } + aWidthMF.SaveValue(); + + if (nHeight != aHeightMF.GetValue(FUNIT_TWIP)) + { + if (!bReset) + { + // Wert wurde von Umlauf-Tabpage geaendert und muss + // mit Modify-Flag gesetzt werden + aHeightMF.SetUserValue(nHeight, FUNIT_TWIP); + } + else + aHeightMF.SetValue(nHeight, FUNIT_TWIP); + } + aHeightMF.SaveValue(); + bInitialized = TRUE; + + if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRAF_GRAPHIC, FALSE, &pItem ) ) + { + const SvxBrushItem& rBrush = *(SvxBrushItem*)pItem; + if( rBrush.GetGraphicLink() && + aGraphicName != *rBrush.GetGraphicLink() ) + aGraphicName = *rBrush.GetGraphicLink(); + + const Graphic* pGrf = rBrush.GetGraphic(); + if( pGrf ) + { + aExampleWN.SetGraphic( *pGrf ); + aOrigSize = GetGrfOrigSize( *pGrf ); + aExampleWN.SetFrameSize(aOrigSize); + GraphicHasChanged( aOrigSize.Width() && aOrigSize.Height() ); + CalcMinMaxBorder(); + } + else + GraphicHasChanged( FALSE ); + } + + CalcZoom(); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +int SvxGrfCropPage::DeactivatePage(SfxItemSet *_pSet) +{ + if ( _pSet ) + FillItemSet( *_pSet ); + return TRUE; +} + +/*-------------------------------------------------------------------- + Beschreibung: Massstab geaendert, Groesse anpassen + --------------------------------------------------------------------*/ + +IMPL_LINK( SvxGrfCropPage, ZoomHdl, MetricField *, pField ) +{ + SfxItemPool* pPool = GetItemSet().GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich( + SID_ATTR_GRAF_CROP ) ) ); + + if( pField == &aWidthZoomMF ) + { + long nLRBorders = lcl_GetValue(aLeftMF, eUnit) + +lcl_GetValue(aRightMF, eUnit); + aWidthMF.SetValue( aWidthMF.Normalize( + ((aOrigSize.Width() - nLRBorders) * pField->GetValue())/100L), + eUnit); + } + else + { + long nULBorders = lcl_GetValue(aTopMF, eUnit) + +lcl_GetValue(aBottomMF, eUnit); + aHeightMF.SetValue( aHeightMF.Normalize( + ((aOrigSize.Height() - nULBorders ) * pField->GetValue())/100L) , + eUnit ); + } + + return 0; +} + +/*-------------------------------------------------------------------- + Beschreibung: Groesse aendern, Massstab anpassen + --------------------------------------------------------------------*/ + +IMPL_LINK( SvxGrfCropPage, SizeHdl, MetricField *, pField ) +{ + SfxItemPool* pPool = GetItemSet().GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich( + SID_ATTR_GRAF_CROP ) ) ); + + Size aSize( lcl_GetValue(aWidthMF, eUnit), + lcl_GetValue(aHeightMF, eUnit) ); + + if(pField == &aWidthMF) + { + long nWidth = aOrigSize.Width() - + ( lcl_GetValue(aLeftMF, eUnit) + + lcl_GetValue(aRightMF, eUnit) ); + if(!nWidth) + nWidth++; + USHORT nZoom = (USHORT)( aSize.Width() * 100L / nWidth); + aWidthZoomMF.SetValue(nZoom); + } + else + { + long nHeight = aOrigSize.Height() - + ( lcl_GetValue(aTopMF, eUnit) + + lcl_GetValue(aBottomMF, eUnit)); + if(!nHeight) + nHeight++; + USHORT nZoom = (USHORT)( aSize.Height() * 100L/ nHeight); + aHeightZoomMF.SetValue(nZoom); + } + + return 0; +} + +/*-------------------------------------------------------------------- + Beschreibung: Raender auswerten + --------------------------------------------------------------------*/ + +IMPL_LINK( SvxGrfCropPage, CropHdl, const MetricField *, pField ) +{ + SfxItemPool* pPool = GetItemSet().GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich( + SID_ATTR_GRAF_CROP ) ) ); + + BOOL bZoom = aZoomConstRB.IsChecked(); + if( pField == &aLeftMF || pField == &aRightMF ) + { + long nLeft = lcl_GetValue( aLeftMF, eUnit ); + long nRight = lcl_GetValue( aRightMF, eUnit ); + long nWidthZoom = static_cast(aWidthZoomMF.GetValue()); + if(bZoom && ( ( ( aOrigSize.Width() - (nLeft + nRight )) * nWidthZoom ) + / 100 >= aPageSize.Width() ) ) + { + if(pField == &aLeftMF) + { +// nLeft = aPageSize.Width() - +// ((nRight + aOrigSize.Width()) * nWidthZoom) / 100; + nLeft = aOrigSize.Width() - + ( aPageSize.Width() * 100 / nWidthZoom + nRight ); + aLeftMF.SetValue( aLeftMF.Normalize( nLeft ), eUnit ); + } + else + { +// nRight = aPageSize.Width() - +// ((nLeft - aOrigSize.Width()) * nWidthZoom) / 100; + nRight = aOrigSize.Width() - + ( aPageSize.Width() * 100 / nWidthZoom + nLeft ); + aRightMF.SetValue( aRightMF.Normalize( nRight ), eUnit ); + } + } + aExampleWN.SetLeft(nLeft); + aExampleWN.SetRight(nRight); + if(bZoom) + { + //Massstab bleibt -> Breite neu berechnen + ZoomHdl(&aWidthZoomMF); + } + } + else + { + long nTop = lcl_GetValue( aTopMF, eUnit ); + long nBottom = lcl_GetValue( aBottomMF, eUnit ); + long nHeightZoom = static_cast(aHeightZoomMF.GetValue()); + if(bZoom && ( ( ( aOrigSize.Height() - (nTop + nBottom )) * nHeightZoom) + / 100 >= aPageSize.Height())) + { + if(pField == &aTopMF) + { +// nTop = aPageSize.Height() - +// ((aOrigSize.Height() - nBottom) * nHeightZoom)/ 100; + nTop = aOrigSize.Height() - + ( aPageSize.Height() * 100 / nHeightZoom + nBottom); + aTopMF.SetValue( aWidthMF.Normalize( nTop ), eUnit ); + } + else + { +// nBottom = aPageSize.Height() - +// ((aOrigSize.Height() - nTop)*nHeightZoom) / 100; + nBottom = aOrigSize.Height() - + ( aPageSize.Height() * 100 / nHeightZoom + nTop); + aBottomMF.SetValue( aWidthMF.Normalize( nBottom ), eUnit ); + } + } + aExampleWN.SetTop( nTop ); + aExampleWN.SetBottom( nBottom ); + if(bZoom) + { + //Massstab bleibt -> Hoehe neu berechnen + ZoomHdl(&aHeightZoomMF); + } + } + aExampleWN.Invalidate(); + //Groesse und Raender veraendert -> Massstab neu berechnen + if(!bZoom) + CalcZoom(); + CalcMinMaxBorder(); + return 0; +} +/*-------------------------------------------------------------------- + Beschreibung: Originalgroesse einstellen + --------------------------------------------------------------------*/ + +IMPL_LINK( SvxGrfCropPage, OrigSizeHdl, PushButton *, EMPTYARG ) +{ + SfxItemPool* pPool = GetItemSet().GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich( + SID_ATTR_GRAF_CROP ) ) ); + + long nWidth = aOrigSize.Width() - + lcl_GetValue( aLeftMF, eUnit ) - + lcl_GetValue( aRightMF, eUnit ); + aWidthMF.SetValue( aWidthMF.Normalize( nWidth ), eUnit ); + long nHeight = aOrigSize.Height() - + lcl_GetValue( aTopMF, eUnit ) - + lcl_GetValue( aBottomMF, eUnit ); + aHeightMF.SetValue( aHeightMF.Normalize( nHeight ), eUnit ); + aWidthZoomMF.SetValue(100); + aHeightZoomMF.SetValue(100); + bSetOrigSize = TRUE; + return 0; +} +/*-------------------------------------------------------------------- + Beschreibung: Massstab berechnen + --------------------------------------------------------------------*/ + +void SvxGrfCropPage::CalcZoom() +{ + SfxItemPool* pPool = GetItemSet().GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich( + SID_ATTR_GRAF_CROP ) ) ); + + long nWidth = lcl_GetValue( aWidthMF, eUnit ); + long nHeight = lcl_GetValue( aHeightMF, eUnit ); + long nLRBorders = lcl_GetValue( aLeftMF, eUnit ) + + lcl_GetValue( aRightMF, eUnit ); + long nULBorders = lcl_GetValue( aTopMF, eUnit ) + + lcl_GetValue( aBottomMF, eUnit ); + USHORT nZoom = 0; + long nDen; + if( (nDen = aOrigSize.Width() - nLRBorders) > 0) + nZoom = (USHORT)((( nWidth * 1000L / nDen )+5)/10); + aWidthZoomMF.SetValue(nZoom); + if( (nDen = aOrigSize.Height() - nULBorders) > 0) + nZoom = (USHORT)((( nHeight * 1000L / nDen )+5)/10); + else + nZoom = 0; + aHeightZoomMF.SetValue(nZoom); +} + +/*-------------------------------------------------------------------- + Beschreibung: Minimal-/Maximalwerte fuer die Raender setzen + --------------------------------------------------------------------*/ + +void SvxGrfCropPage::CalcMinMaxBorder() +{ + SfxItemPool* pPool = GetItemSet().GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich( + SID_ATTR_GRAF_CROP ) ) ); + long nR = lcl_GetValue(aRightMF, eUnit ); + long nMinWidth = (aOrigSize.Width() * 10) /11; + long nMin = nMinWidth - (nR >= 0 ? nR : 0); + aLeftMF.SetMax( aLeftMF.Normalize(nMin), eUnit ); + + long nL = lcl_GetValue(aLeftMF, eUnit ); + nMin = nMinWidth - (nL >= 0 ? nL : 0); + aRightMF.SetMax( aRightMF.Normalize(nMin), eUnit ); + + // Zoom nicht unter 2% +/* nMin = (aOrigSize.Width() * 102) /100; + aLeftMF.SetMax(aPageSize.Width() - nR - nMin); + aRightMF.SetMax(aPageSize.Width() - nL - nMin); +*/ + long nUp = lcl_GetValue( aTopMF, eUnit ); + long nMinHeight = (aOrigSize.Height() * 10) /11; + nMin = nMinHeight - (nUp >= 0 ? nUp : 0); + aBottomMF.SetMax( aBottomMF.Normalize(nMin), eUnit ); + + long nLow = lcl_GetValue(aBottomMF, eUnit ); + nMin = nMinHeight - (nLow >= 0 ? nLow : 0); + aTopMF.SetMax( aTopMF.Normalize(nMin), eUnit ); + + // Zoom nicht unter 2% +/* nMin = (aOrigSize.Height() * 102) /100; + aTopMF.SetMax(aPageSize.Height() - nLow - nMin); + aBottomMF.SetMax(aPageSize.Height() - nUp - nMin);*/ +} +/*-------------------------------------------------------------------- + Beschreibung: Spinsize auf 1/20 der Originalgroesse setzen, + FixedText mit der Originalgroesse fuellen + --------------------------------------------------------------------*/ + +void SvxGrfCropPage::GraphicHasChanged( BOOL bFound ) +{ + if( bFound ) + { + SfxItemPool* pPool = GetItemSet().GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich( + SID_ATTR_GRAF_CROP ) )); + + sal_Int64 nSpin = aLeftMF.Normalize(aOrigSize.Width()) / 20; + nSpin = MetricField::ConvertValue( nSpin, aOrigSize.Width(), 0, + eUnit, aLeftMF.GetUnit()); + + // Ist der Rand zu gross, wird er auf beiden Seiten auf 1/3 eingestellt. + long nR = lcl_GetValue( aRightMF, eUnit ); + long nL = lcl_GetValue( aLeftMF, eUnit ); + if((nL + nR) < - aOrigSize.Width()) + { + long nVal = aOrigSize.Width() / -3; + aRightMF.SetValue( aRightMF.Normalize( nVal ), eUnit ); + aLeftMF.SetValue( aLeftMF.Normalize( nVal ), eUnit ); + aExampleWN.SetLeft(nVal); + aExampleWN.SetRight(nVal); + } + long nUp = lcl_GetValue(aTopMF, eUnit ); + long nLow = lcl_GetValue(aBottomMF, eUnit ); + if((nUp + nLow) < - aOrigSize.Height()) + { + long nVal = aOrigSize.Height() / -3; + aTopMF.SetValue( aTopMF.Normalize( nVal ), eUnit ); + aBottomMF.SetValue( aBottomMF.Normalize( nVal ), eUnit ); + aExampleWN.SetTop(nVal); + aExampleWN.SetBottom(nVal); + } + + aLeftMF.SetSpinSize(nSpin); + aRightMF.SetSpinSize(nSpin); + nSpin = aTopMF.Normalize(aOrigSize.Height()) / 20; + nSpin = MetricField::ConvertValue( nSpin, aOrigSize.Width(), 0, + eUnit, aLeftMF.GetUnit() ); + aTopMF.SetSpinSize(nSpin); + aBottomMF.SetSpinSize(nSpin); + + //Originalgroesse anzeigen + const FieldUnit eMetric = GetModuleFieldUnit( &GetItemSet() ); + + MetricField aFld(this, WB_HIDE); + SetFieldUnit( aFld, eMetric ); + aFld.SetDecimalDigits( aWidthMF.GetDecimalDigits() ); + aFld.SetMax( LONG_MAX - 1 ); + + aFld.SetValue( aFld.Normalize( aOrigSize.Width() ), eUnit ); + String sTemp = aFld.GetText(); + aFld.SetValue( aFld.Normalize( aOrigSize.Height() ), eUnit ); + sTemp += UniString::CreateFromAscii(" x "); + sTemp += aFld.GetText(); + aOrigSizeFT.SetText(sTemp); + } + aLeftFT .Enable(bFound); + aLeftMF .Enable(bFound); + aRightFT .Enable(bFound); + aRightMF .Enable(bFound); + aTopFT .Enable(bFound); + aTopMF .Enable(bFound); + aBottomFT .Enable(bFound); + aBottomMF .Enable(bFound); + aSizeConstRB .Enable(bFound); + aZoomConstRB .Enable(bFound); + aWidthFT .Enable(bFound); + aWidthMF .Enable(bFound); + aHeightFT .Enable(bFound); + aHeightMF .Enable(bFound); + aWidthZoomFT .Enable(bFound); + aWidthZoomMF .Enable(bFound); + aHeightZoomFT .Enable(bFound); + aHeightZoomMF .Enable(bFound); + aExampleWN .Enable(bFound); + aOrigSizePB .Enable(bFound); + aOrigSizeFT .Enable(bFound); +} + +IMPL_LINK( SvxGrfCropPage, Timeout, Timer *, EMPTYARG ) +{ + DBG_ASSERT(pLastCropField,"Timeout ohne Feld?"); + CropHdl(pLastCropField); + pLastCropField = 0; + return 0; +} + + +IMPL_LINK( SvxGrfCropPage, CropLoseFocusHdl, MetricField*, pField ) +{ + aTimer.Stop(); + CropHdl(pField); + pLastCropField = 0; + return 0; +} + + +IMPL_LINK( SvxGrfCropPage, CropModifyHdl, MetricField *, pField ) +{ + aTimer.Start(); + pLastCropField = pField; + return 0; +} + +Size SvxGrfCropPage::GetGrfOrigSize( const Graphic& rGrf ) const +{ + const MapMode aMapTwip( MAP_TWIP ); + Size aSize( rGrf.GetPrefSize() ); + if( MAP_PIXEL == rGrf.GetPrefMapMode().GetMapUnit() ) + aSize = PixelToLogic( aSize, aMapTwip ); + else + aSize = OutputDevice::LogicToLogic( aSize, + rGrf.GetPrefMapMode(), aMapTwip ); + return aSize; +} + +/*****************************************************************/ + +SvxGrfCropPage::SvxCropExample::SvxCropExample( Window* pPar, + const ResId& rResId ) + : Window( pPar, rResId ), + aFrameSize( OutputDevice::LogicToLogic( + Size( CM_1_TO_TWIP / 2, CM_1_TO_TWIP / 2 ), + MapMode( MAP_TWIP ), GetMapMode() )), + aTopLeft(0,0), aBottomRight(0,0) +{ + SetBorderStyle( WINDOW_BORDER_MONO ); +} + +void SvxGrfCropPage::SvxCropExample::Paint( const Rectangle& ) +{ + Size aWinSize( PixelToLogic(GetOutputSizePixel() )); + SetLineColor(); + SetFillColor( GetSettings().GetStyleSettings().GetWindowColor() ); + SetRasterOp( ROP_OVERPAINT ); + DrawRect( Rectangle( Point(), aWinSize ) ); + + SetLineColor( Color( COL_WHITE ) ); + Rectangle aRect(Point((aWinSize.Width() - aFrameSize.Width())/2, + (aWinSize.Height() - aFrameSize.Height())/2), + aFrameSize ); + aGrf.Draw( this, aRect.TopLeft(), aRect.GetSize() ); + + Size aSz( 2, 0 ); + aSz = PixelToLogic( aSz ); + SetFillColor( Color( COL_TRANSPARENT ) ); + SetRasterOp( ROP_INVERT ); + aRect.Left() += aTopLeft.Y(); + aRect.Top() += aTopLeft.X(); + aRect.Right() -= aBottomRight.Y(); + aRect.Bottom() -= aBottomRight.X(); + DrawRect( aRect ); +} + +void SvxGrfCropPage::SvxCropExample::SetFrameSize( const Size& rSz ) +{ + aFrameSize = rSz; + if(!aFrameSize.Width()) + aFrameSize.Width() = 1; + if(!aFrameSize.Height()) + aFrameSize.Height() = 1; + Size aWinSize( GetOutputSizePixel() ); + Fraction aXScale( aWinSize.Width() * 4, aFrameSize.Width() * 5 ); + Fraction aYScale( aWinSize.Height() * 4, aFrameSize.Height() * 5 ); + + if( aYScale < aXScale ) + aXScale = aYScale; + + MapMode aMapMode( GetMapMode() ); + + aMapMode.SetScaleX( aXScale ); + aMapMode.SetScaleY( aXScale ); + + SetMapMode( aMapMode ); + Invalidate(); +} + + + + diff --git a/cui/source/tabpages/grfpage.hrc b/cui/source/tabpages/grfpage.hrc new file mode 100644 index 000000000000..5743645f3eb0 --- /dev/null +++ b/cui/source/tabpages/grfpage.hrc @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: grfpage.hrc,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define FT_BOTTOM 1 +#define FT_HEIGHT 2 +#define FT_HEIGHTZOOM 3 +#define FT_LEFT 4 +#define FT_ORIG_SIZE 5 +#define FT_RIGHT 6 +#define FT_TOP 7 +#define FT_WIDTH 8 +#define FT_WIDTHZOOM 9 +#define FL_CROP 10 +#define FL_SIZE 12 +#define FL_ZOOM 13 +#define MF_BOTTOM 14 +#define MF_HEIGHT 15 +#define MF_HEIGHTZOOM 16 +#define MF_LEFT 17 +#define MF_RIGHT 18 +#define MF_TOP 19 +#define MF_WIDTH 20 +#define MF_WIDTHZOOM 21 +#define PB_ORGSIZE 22 +#define RB_SIZECONST 23 +#define RB_ZOOMCONST 24 +#define WN_BSP 25 + + diff --git a/cui/source/tabpages/grfpage.src b/cui/source/tabpages/grfpage.src new file mode 100644 index 000000000000..0d6791fd917d --- /dev/null +++ b/cui/source/tabpages/grfpage.src @@ -0,0 +1,334 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: grfpage.src,v $ + * $Revision: 1.30 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include +#include "helpid.hrc" +#include "grfpage.hrc" + +/************************************************************/ +/* */ +/* */ +/* Crop-Page */ +/* */ +/* */ +/************************************************************/ +TabPage RID_SVXPAGE_GRFCROP +{ + Hide = TRUE ; + HelpID = HID_SVXPAGE_GRFCROP; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedLine FL_CROP + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 164 , 8 ) ; + Text [ en-US ] = "Crop" ; + }; + FixedText FT_LEFT + { + Pos = MAP_APPFONT ( 12 , 44 ) ; + Size = MAP_APPFONT ( 28 , 8 ) ; + Text [ en-US ] = "~Left" ; + }; + MetricField MF_LEFT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 42 , 42 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Text = "12,99" ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -9999 ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 0 ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_RIGHT + { + Pos = MAP_APPFONT ( 12 , 60 ) ; + Size = MAP_APPFONT ( 28 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "~Right" ; + }; + MetricField MF_RIGHT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 42 , 58 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -9999 ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 0 ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_TOP + { + Pos = MAP_APPFONT ( 94 , 44 ) ; + Size = MAP_APPFONT ( 28 , 8 ) ; + Text [ en-US ] = "~Top" ; + }; + MetricField MF_TOP + { + Border = TRUE ; + Pos = MAP_APPFONT ( 124 , 42 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Text = "12,99" ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -9999 ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 0 ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_BOTTOM + { + Pos = MAP_APPFONT ( 94 , 60 ) ; + Size = MAP_APPFONT ( 28 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "~Bottom" ; + }; + MetricField MF_BOTTOM + { + Border = TRUE ; + Pos = MAP_APPFONT ( 124 , 58 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -9999 ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 0 ; + Last = 9999 ; + SpinSize = 10 ; + }; + RadioButton RB_SIZECONST + { + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 152 , 10 ) ; + Text [ en-US ] = "Keep image si~ze" ; + }; + RadioButton RB_ZOOMCONST + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 152 , 10 ) ; + Check = TRUE ; + Text [ en-US ] = "Keep ~scale" ; + }; + Window WN_BSP + { + Pos = MAP_APPFONT ( 176 , 6 ) ; + Size = MAP_APPFONT ( 78 , 78 ) ; + Border = TRUE ; + }; + FixedLine FL_ZOOM + { + Pos = MAP_APPFONT ( 6, 76 ) ; + Size = MAP_APPFONT ( 164 , 8 ) ; + Text [ en-US ] = "Scale" ; + }; + FixedText FT_WIDTHZOOM + { + Left = TRUE ; + Pos = MAP_APPFONT ( 12 , 89 ) ; + Size = MAP_APPFONT ( 28 , 8 ) ; + Text [ en-US ] = "~Width" ; + }; + MetricField MF_WIDTHZOOM + { + Border = TRUE ; + Pos = MAP_APPFONT ( 42 , 87 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Text = "12,99" ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 9999 ; + First = 5 ; + Last = 1000 ; + Maximum = 9999 ; + Value = 100 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 10 ; + }; + FixedText FT_HEIGHTZOOM + { + Pos = MAP_APPFONT ( 12 , 105 ) ; + Size = MAP_APPFONT ( 28 , 8 ) ; + Text [ en-US ] = "H~eight" ; + Left = TRUE ; + }; + MetricField MF_HEIGHTZOOM + { + Border = TRUE ; + Pos = MAP_APPFONT ( 42 , 103 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 9999 ; + First = 5 ; + Last = 1000 ; + Maximum = 9999 ; + Value = 100 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 10 ; + }; + FixedLine FL_SIZE + { + Pos = MAP_APPFONT ( 6 , 121 ) ; + Size = MAP_APPFONT ( 164 , 8 ) ; + Text [ en-US ] = "Image size" ; + }; + FixedText FT_WIDTH + { + Pos = MAP_APPFONT ( 12 , 134 ) ; + Size = MAP_APPFONT ( 28 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "~Width" ; + }; + MetricField MF_WIDTH + { + Border = TRUE ; + Pos = MAP_APPFONT ( 42 , 132 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Text = "12,99" ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 5 ; + Maximum = 20000 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 5 ; + Last = 20000 ; + SpinSize = 10 ; + }; + FixedText FT_HEIGHT + { + Pos = MAP_APPFONT ( 12 , 150 ) ; + Size = MAP_APPFONT ( 28 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "H~eight" ; + }; + MetricField MF_HEIGHT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 42 , 148 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 5 ; + Maximum = 20000 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 5 ; + Last = 20000 ; + SpinSize = 10 ; + }; + FixedText FT_ORIG_SIZE + { + Pos = MAP_APPFONT ( 176 , 132 ) ; + Size = MAP_APPFONT ( 74 , 8 ) ; + }; + PushButton PB_ORGSIZE + { + Pos = MAP_APPFONT ( 176 , 143 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Original Size" ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/labdlg.cxx b/cui/source/tabpages/labdlg.cxx new file mode 100644 index 000000000000..259e32a5aaae --- /dev/null +++ b/cui/source/tabpages/labdlg.cxx @@ -0,0 +1,653 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: labdlg.cxx,v $ + * $Revision: 1.19 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include +#include + +#define _SVX_LABDLG_CXX + +#include +#include +#include +#include "svx/dlgutil.hxx" +#include "transfrm.hxx" + +#include "labdlg.hrc" +#include "labdlg.hxx" + +// define ---------------------------------------------------------------- + +#define AZ_OPTIMAL 0 +#define AZ_VON_OBEN 1 +#define AZ_VON_LINKS 2 +#define AZ_HORIZONTAL 3 +#define AZ_VERTIKAL 4 + +#define AT_OBEN 0 +#define AT_MITTE 1 +#define AT_UNTEN 2 + +#define WK_OPTIMAL 0 +#define WK_30 1 +#define WK_45 2 +#define WK_60 3 +#define WK_90 4 + +// static ---------------------------------------------------------------- + +static USHORT pCaptionRanges[] = +{ + SDRATTR_CAPTIONTYPE, + SDRATTR_CAPTIONFIXEDANGLE, + SDRATTR_CAPTIONANGLE, + SDRATTR_CAPTIONGAP, + SDRATTR_CAPTIONESCDIR, + SDRATTR_CAPTIONESCISREL, + SDRATTR_CAPTIONESCREL, + SDRATTR_CAPTIONESCABS, + SDRATTR_CAPTIONLINELEN, + SDRATTR_CAPTIONFITLINELEN, + 0 +}; + +// ----------------------------------------------------------------------- + +SvxCaptionTabPage::SvxCaptionTabPage(Window* pParent, const SfxItemSet& rInAttrs) + : SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_CAPTION ), rInAttrs ), + + aCT_CAPTTYPE( this, SVX_RES( CT_CAPTTYPE ) ), + aFT_ABSTAND( this, SVX_RES( FT_ABSTAND ) ), + aMF_ABSTAND( this, SVX_RES( MF_ABSTAND ) ), + aFT_WINKEL( this, SVX_RES( FT_WINKEL ) ), + aLB_WINKEL( this, SVX_RES( LB_WINKEL ) ), + aFT_ANSATZ( this, SVX_RES( FT_ANSATZ ) ), + aLB_ANSATZ( this, SVX_RES( LB_ANSATZ ) ), + aFT_UM( this, SVX_RES( FT_UM ) ), + aMF_ANSATZ( this, SVX_RES( MF_ANSATZ ) ), + aFT_ANSATZ_REL( this, SVX_RES( FT_ANSATZ_REL ) ), + aLB_ANSATZ_REL( this, SVX_RES( LB_ANSATZ_REL ) ), + aFT_LAENGE( this, SVX_RES( FT_LAENGE ) ), + aMF_LAENGE( this, SVX_RES( MF_LAENGE ) ), + aCB_LAENGE( this, SVX_RES( CB_LAENGE ) ), + + aStrHorzList( SVX_RES(STR_HORZ_LIST) ), + aStrVertList( SVX_RES(STR_VERT_LIST) ), + + rOutAttrs ( rInAttrs ) +{ + //------------NYI------------------------------------------- + aFT_WINKEL.Hide(); + aLB_WINKEL.Hide(); + + //------------Positionen korrigieren------------------------- + aFT_ANSATZ_REL.SetPosPixel( aFT_UM.GetPosPixel() ); + aLB_ANSATZ_REL.SetPosPixel( + Point( + aFT_ANSATZ_REL.GetPosPixel().X()+aFT_ANSATZ_REL.GetSizePixel().Width()+6, + aLB_ANSATZ.GetPosPixel().Y() ) + ); + + aMF_ANSATZ.SetPosPixel( + Point( + aFT_UM.GetPosPixel().X()+aFT_UM.GetSizePixel().Width()+6, + aLB_ANSATZ.GetPosPixel().Y() ) + ); + + sal_uInt16 nBitmap; + for( nBitmap = 0; nBitmap < CAPTYPE_BITMAPS_COUNT; nBitmap++ ) + { + mpBmpCapTypes[nBitmap] = new Image(Bitmap(SVX_RES(BMP_CAPTTYPE_1 + nBitmap)), COL_LIGHTMAGENTA ); + mpBmpCapTypesH[nBitmap] = new Image(Bitmap(SVX_RES(BMP_CAPTTYPE_1_H + nBitmap)), COL_LIGHTMAGENTA ); + } + + //------------ValueSet installieren-------------------------- + aCT_CAPTTYPE.SetStyle( aCT_CAPTTYPE.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD ); + aCT_CAPTTYPE.SetColCount(5);//XXX + aCT_CAPTTYPE.SetLineCount(1); + aCT_CAPTTYPE.SetSelectHdl(LINK( this, SvxCaptionTabPage, SelectCaptTypeHdl_Impl)); + + Image aImage; + aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_1, aImage, String(SVX_RES(STR_CAPTTYPE_1))); + aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_2, aImage, String(SVX_RES(STR_CAPTTYPE_2))); + aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_3, aImage, String(SVX_RES(STR_CAPTTYPE_3))); + + FillValueSet(); + + aLB_ANSATZ.SetSelectHdl(LINK(this,SvxCaptionTabPage,AnsatzSelectHdl_Impl)); + aLB_ANSATZ_REL.SetSelectHdl(LINK(this,SvxCaptionTabPage,AnsatzRelSelectHdl_Impl)); + aCB_LAENGE.SetClickHdl(LINK(this,SvxCaptionTabPage,LineOptHdl_Impl)); + + FreeResource(); +} + +// ----------------------------------------------------------------------- + +SvxCaptionTabPage::~SvxCaptionTabPage() +{ + sal_uInt16 nBitmap; + for( nBitmap = 0; nBitmap < CAPTYPE_BITMAPS_COUNT; nBitmap++ ) + { + delete mpBmpCapTypes[nBitmap]; + delete mpBmpCapTypesH[nBitmap]; + } +} + +// ----------------------------------------------------------------------- + +void SvxCaptionTabPage::Construct() +{ + // Setzen des Rechtecks und der Workingarea + DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" ); +} + +// ----------------------------------------------------------------------- + +BOOL SvxCaptionTabPage::FillItemSet( SfxItemSet& _rOutAttrs) +{ + SfxItemPool* pPool = _rOutAttrs.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + + SfxMapUnit eUnit; + + nCaptionType = aCT_CAPTTYPE.GetSelectItemId()-1; + + _rOutAttrs.Put( SdrCaptionTypeItem( (SdrCaptionType) nCaptionType ) ); + + if( aMF_ABSTAND.IsValueModified() ) + { + eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONGAP ) ); + _rOutAttrs.Put( SdrCaptionGapItem( GetCoreValue(aMF_ABSTAND, eUnit ) ) ); + } + + // Sonderbehandlung!!! XXX + if( nCaptionType==SDRCAPT_TYPE1 ) + { + switch( nEscDir ) + { + case SDRCAPT_ESCHORIZONTAL: nEscDir=SDRCAPT_ESCVERTICAL;break; + case SDRCAPT_ESCVERTICAL: nEscDir=SDRCAPT_ESCHORIZONTAL;break; + } + } + + _rOutAttrs.Put( SdrCaptionEscDirItem( (SdrCaptionEscDir)nEscDir ) ); + + bEscRel = aLB_ANSATZ_REL.IsVisible(); + _rOutAttrs.Put( SdrCaptionEscIsRelItem( bEscRel ) ); + + if( bEscRel ) + { + long nVal = 0; + + switch( aLB_ANSATZ_REL.GetSelectEntryPos() ) + { + case AT_OBEN: nVal=0;break; + case AT_MITTE: nVal=5000;break; + case AT_UNTEN: nVal=10000;break; + } + _rOutAttrs.Put( SdrCaptionEscRelItem( nVal ) ); + } + else + { + if( aMF_ANSATZ.IsValueModified() ) + { + eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONESCABS ) ); + _rOutAttrs.Put( SdrCaptionEscAbsItem( GetCoreValue(aMF_ANSATZ, eUnit ) ) ); + } + } + + bFitLineLen = aCB_LAENGE.IsChecked(); + _rOutAttrs.Put( SdrCaptionFitLineLenItem( bFitLineLen ) ); + + if( ! bFitLineLen ) + { + if( aMF_LAENGE.IsValueModified() ) + { + eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONLINELEN ) ); + _rOutAttrs.Put( SdrCaptionLineLenItem( GetCoreValue(aMF_LAENGE, eUnit ) ) ); + } + } + +//NYI-------------die Winkel muessen noch hier rein!!! XXX---------------------- + + return( TRUE ); +} + +// ----------------------------------------------------------------------- + +void SvxCaptionTabPage::Reset( const SfxItemSet& ) +{ + + //------------Metrik einstellen----------------------------- + + FieldUnit eFUnit = GetModuleFieldUnit( &rOutAttrs ); + + switch ( eFUnit ) + { + case FUNIT_CM: + case FUNIT_M: + case FUNIT_KM: + eFUnit = FUNIT_MM; + break; + default: ;//prevent warning + } + SetFieldUnit( aMF_ABSTAND, eFUnit ); + SetFieldUnit( aMF_ANSATZ, eFUnit ); + SetFieldUnit( aMF_LAENGE, eFUnit ); + + SfxItemPool* pPool = rOutAttrs.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + + USHORT nWhich; + SfxMapUnit eUnit; + + //------- Winkel ---------- + nWhich = GetWhich( SDRATTR_CAPTIONANGLE ); + nFixedAngle = ( ( const SdrCaptionAngleItem& ) rOutAttrs.Get( nWhich ) ).GetValue(); + + //------- absolute Ansatzentfernung ---------- + nWhich = GetWhich( SDRATTR_CAPTIONESCABS ); + eUnit = pPool->GetMetric( nWhich ); + nEscAbs = ( ( const SdrCaptionEscAbsItem& ) rOutAttrs.Get( nWhich ) ).GetValue(); + SetMetricValue( aMF_ANSATZ, nEscAbs, eUnit ); + nEscAbs = static_cast(aMF_ANSATZ.GetValue()); + + //------- relative Ansatzentfernung ---------- + nWhich = GetWhich( SDRATTR_CAPTIONESCREL ); + nEscRel = (long)( ( const SdrCaptionEscRelItem& ) rOutAttrs.Get( nWhich ) ).GetValue(); + + //------- Linienlaenge ---------- + nWhich = GetWhich( SDRATTR_CAPTIONLINELEN ); + eUnit = pPool->GetMetric( nWhich ); + nLineLen = ( ( const SdrCaptionLineLenItem& ) rOutAttrs.Get( nWhich ) ).GetValue(); + SetMetricValue( aMF_LAENGE, nLineLen, eUnit ); + nLineLen = static_cast(aMF_LAENGE.GetValue()); + + //------- Abstand zur Box ---------- + nWhich = GetWhich( SDRATTR_CAPTIONGAP ); + eUnit = pPool->GetMetric( nWhich ); + nGap = ( ( const SdrCaptionGapItem& ) rOutAttrs.Get( nWhich ) ).GetValue(); + SetMetricValue( aMF_ABSTAND, nGap, eUnit ); + nGap = static_cast(aMF_ABSTAND.GetValue()); + + nCaptionType = (short)( ( const SdrCaptionTypeItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONTYPE ) ) ).GetValue(); + bFixedAngle = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFIXEDANGLE ) ) ).GetValue(); + bFitLineLen = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFITLINELEN ) ) ).GetValue(); + nEscDir = (short)( ( const SdrCaptionEscDirItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCDIR ) ) ).GetValue(); + bEscRel = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCISREL ) ) ).GetValue(); + + // Sonderbehandlung!!! XXX + if( nCaptionType==SDRCAPT_TYPE1 ) + { + switch( nEscDir ) + { + case SDRCAPT_ESCHORIZONTAL: nEscDir=SDRCAPT_ESCVERTICAL;break; + case SDRCAPT_ESCVERTICAL: nEscDir=SDRCAPT_ESCHORIZONTAL;break; + } + } + + nAnsatzRelPos=AT_MITTE; + nAnsatzTypePos=AZ_OPTIMAL; + nWinkelTypePos=WK_OPTIMAL; + + aMF_ABSTAND.SetValue( nGap ); + + if( nEscDir == SDRCAPT_ESCHORIZONTAL ) + { + if( bEscRel ) + { + if( nEscRel < 3333 ) + nAnsatzRelPos = AT_OBEN; + if( nEscRel > 6666 ) + nAnsatzRelPos = AT_UNTEN; + nAnsatzTypePos = AZ_HORIZONTAL; + } + else + { + nAnsatzTypePos = AZ_VON_OBEN; + aMF_ANSATZ.SetValue( nEscAbs ); + } + } + else if( nEscDir == SDRCAPT_ESCVERTICAL ) + { + if( bEscRel ) + { + if( nEscRel < 3333 ) + nAnsatzRelPos = AT_OBEN; + if( nEscRel > 6666 ) + nAnsatzRelPos = AT_UNTEN; + nAnsatzTypePos = AZ_VERTIKAL; + } + else + { + nAnsatzTypePos = AZ_VON_LINKS; + aMF_ANSATZ.SetValue( nEscAbs ); + } + } + else if( nEscDir == SDRCAPT_ESCBESTFIT ) + { + nAnsatzTypePos = AZ_OPTIMAL; + } + + if( bFixedAngle ) + { + if( nFixedAngle <= 3000 ) + nWinkelTypePos=WK_30; + else if( nFixedAngle <= 4500 ) + nWinkelTypePos=WK_45; + else if( nFixedAngle <= 6000 ) + nWinkelTypePos=WK_60; + else + nWinkelTypePos=WK_90; + } + + aCB_LAENGE.Check( bFitLineLen ); + aMF_LAENGE.SetValue( nLineLen ); + + aLB_ANSATZ.SelectEntryPos( nAnsatzTypePos ); + aLB_WINKEL.SelectEntryPos( nWinkelTypePos ); + + SetupAnsatz_Impl( nAnsatzTypePos ); + aCT_CAPTTYPE.SelectItem( nCaptionType+1 );// Enum beginnt bei 0! + SetupType_Impl( nCaptionType+1 ); +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxCaptionTabPage::Create( Window* pWindow, + const SfxItemSet& rOutAttrs ) +{ + return( new SvxCaptionTabPage( pWindow, rOutAttrs ) ); +} + +//------------------------------------------------------------------------ + +USHORT* SvxCaptionTabPage::GetRanges() +{ + return( pCaptionRanges ); +} + +//------------------------------------------------------------------------ + +void SvxCaptionTabPage::SetupAnsatz_Impl( USHORT nType ) +{ + xub_StrLen nCnt=0, nIdx=0; + + switch( nType ) + { + case AZ_OPTIMAL: +// aMF_ANSATZ.Hide(); //XXX auch bei OPTIMAL werden Abswerte genommen +// aFT_UM.Hide(); + aMF_ANSATZ.Show(); + aFT_UM.Show(); + aFT_ANSATZ_REL.Hide(); + aLB_ANSATZ_REL.Hide(); + nEscDir = SDRCAPT_ESCBESTFIT; + break; + + case AZ_VON_OBEN: + aMF_ANSATZ.Show(); + aFT_UM.Show(); + aFT_ANSATZ_REL.Hide(); + aLB_ANSATZ_REL.Hide(); + nEscDir = SDRCAPT_ESCHORIZONTAL; + break; + + case AZ_VON_LINKS: + aMF_ANSATZ.Show(); + aFT_UM.Show(); + aFT_ANSATZ_REL.Hide(); + aLB_ANSATZ_REL.Hide(); + nEscDir = SDRCAPT_ESCVERTICAL; + break; + + case AZ_HORIZONTAL: + aLB_ANSATZ_REL.Clear(); + nCnt = aStrHorzList.GetTokenCount(); + for( nIdx=0 ; nIdx(rPage); + rSwPage.EnableAnchorTypes(nAnchorCtrls); + rSwPage.SetValidateFramePosLink( aValidateLink ); + } + break; + + case RID_SVXPAGE_CAPTION: + ( (SvxCaptionTabPage&) rPage ).SetView( pView ); + ( (SvxCaptionTabPage&) rPage ).Construct(); + break; + } +} +/*-- 05.03.2004 13:54:26--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvxCaptionTabDialog::SetValidateFramePosLink( const Link& rLink ) +{ + aValidateLink = rLink; +} + + diff --git a/cui/source/tabpages/labdlg.hrc b/cui/source/tabpages/labdlg.hrc new file mode 100644 index 000000000000..82ea64c1620c --- /dev/null +++ b/cui/source/tabpages/labdlg.hrc @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: labdlg.hrc,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +//#define RID_SVXPAGE_CAPTION 1000 +//#define RID_SVXDLG_CAPTION 1001 + +#define TAB_CONTROL 1 +#define BTN_OK 1 +#define BTN_CANCEL 1 +#define BTN_HELP 1 + +#define FT_ABSTAND 1 +#define FT_WINKEL 2 +#define FT_ANSATZ 3 +#define FT_LAENGE 4 +#define FT_UM 5 +#define FT_ANSATZ_REL 6 + +#define CT_CAPTTYPE 1 + +#define MF_ABSTAND 1 +#define MF_ANSATZ 2 +#define MF_LAENGE 3 + +#define CB_LAENGE 1 + +#define CM_LAENGE 1 + +#define LB_WINKEL 1 +#define LB_ANSATZ 2 +#define LB_ANSATZ_REL 3 + +#define STR_CAPTTYPE_1 1 +#define STR_CAPTTYPE_2 2 +#define STR_CAPTTYPE_3 3 +#define STR_CAPTTYPE_4 4 +#define STR_HORZ_LIST 10 +#define STR_VERT_LIST 11 + +#define BMP_CAPTTYPE_1 1 +#define BMP_CAPTTYPE_2 2 +#define BMP_CAPTTYPE_3 3 +#define BMP_CAPTTYPE_4 4 + +#define BMP_CAPTTYPE_1_H 5 +#define BMP_CAPTTYPE_2_H 6 +#define BMP_CAPTTYPE_3_H 7 +#define BMP_CAPTTYPE_4_H 8 + +#define SHOW_HORZ 1 +#define SHOW_VERT 2 +#define SHOW_ABS 3 +#define SHOW_NONE 4 diff --git a/cui/source/tabpages/labdlg.src b/cui/source/tabpages/labdlg.src new file mode 100644 index 000000000000..f3d464a1558e --- /dev/null +++ b/cui/source/tabpages/labdlg.src @@ -0,0 +1,301 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: labdlg.src,v $ + * $Revision: 1.34 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include "helpid.hrc" +#include "labdlg.hrc" + // pragma ---------------------------------------------------------------- + + // RID_SVXPAGE_CAPTION --------------------------------------------------- +TabPage RID_SVXPAGE_CAPTION +{ + HelpId = HID_CAPTION ; + Hide = TRUE ; + //Size = MAP_APPFONT ( 189 , 97 ) ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Text [ en-US ] = "Callouts" ; + Control CT_CAPTTYPE + { + HelpId = HID_CAPTION_CTL_TYPE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 6 ) ; + Size = MAP_APPFONT ( 187 , 38 ) ; + TabStop = TRUE ; + }; + FixedText FT_ABSTAND + { + Pos = MAP_APPFONT ( 6 , 53 ) ; + Size = MAP_APPFONT ( 42 , 8 ) ; + Text [ en-US ] = "~Spacing" ; + }; + MetricField MF_ABSTAND + { + Border = TRUE ; + Pos = MAP_APPFONT ( 50 , 51 ) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 240000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + SpinSize = 50 ; + }; + FixedText FT_WINKEL + { + Pos = MAP_APPFONT ( 106 , 53 ) ; + Size = MAP_APPFONT ( 35 , 8 ) ; + Text [ en-US ] = "~Angle" ; + }; + ListBox LB_WINKEL + { + Border = TRUE ; + Pos = MAP_APPFONT ( 143 , 51 ) ; + Size = MAP_APPFONT ( 50 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + CurPos = 0 ; + StringList [ en-US ] = + { + < "Free" ; 1 ; > ; + < "30 Degrees" ; 3000 ; > ; + < "45 Degrees" ; 4500 ; > ; + < "60 Degrees" ; 6000 ; > ; + < "90 Degrees" ; 9000 ; > ; + }; + }; + FixedText FT_ANSATZ + { + Pos = MAP_APPFONT ( 6 , 69 ) ; + Size = MAP_APPFONT ( 42 , 8 ) ; + Text [ en-US ] = "~Extension" ; + }; + ListBox LB_ANSATZ + { + Border = TRUE ; + Pos = MAP_APPFONT ( 50 , 67 ) ; + Size = MAP_APPFONT ( 50 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + CurPos = 0 ; + StringList [ en-US ] = + { + < "Optimal" ; 4 ; > ; + < "From top" ; 3 ; > ; + < "From left" ; 3 ; > ; + < "Horizontal" ; 1 ; > ; + < "Vertical" ; 2 ; > ; + }; + }; + FixedText FT_UM + { + Pos = MAP_APPFONT ( 106 , 69 ) ; + Size = MAP_APPFONT ( 35 , 8 ) ; + Text [ en-US ] = "~By" ; + }; + MetricField MF_ANSATZ + { + Border = TRUE ; + Pos = MAP_APPFONT ( 143 , 67 ) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 240000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + SpinSize = 50 ; + }; + FixedText FT_ANSATZ_REL + { + Pos = MAP_APPFONT ( 106 , 69 ) ; + Size = MAP_APPFONT ( 35 , 8 ) ; + Text [ en-US ] = "~Position" ; + }; + ListBox LB_ANSATZ_REL + { + Border = TRUE ; + Pos = MAP_APPFONT ( 143 , 67 ) ; + Size = MAP_APPFONT ( 50 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_LAENGE + { + Pos = MAP_APPFONT ( 6 , 85 ) ; + Size = MAP_APPFONT ( 42 , 8 ) ; + /* ### ACHTUNG: Neuer Text in Resource? ~Länge : ~Lõnge */ + /* ### ACHTUNG: Neuer Text in Resource? ~Länge : ~Lõnge */ + Text [ en-US ] = "~Length" ; + }; + MetricField MF_LAENGE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 50 , 83 ) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 240000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + SpinSize = 50 ; + }; + CheckBox CB_LAENGE + { + Pos = MAP_APPFONT ( 106 , 84 ) ; + Size = MAP_APPFONT ( 50 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Optimal" ; + }; + String STR_CAPTTYPE_1 + { + Text [ en-US ] = "Straight Line" ; + }; + String STR_CAPTTYPE_2 + { + Text [ en-US ] = "Angled Line" ; + }; + String STR_CAPTTYPE_3 + { + Text [ en-US ] = "Angled Connector Line" ; + }; + String STR_CAPTTYPE_4 + { + Text [ en-US ] = "Double-angled line" ; + }; + String STR_HORZ_LIST + { + Text [ en-US ] = "Top;Middle;Bottom" ; + }; + String STR_VERT_LIST + { + Text [ en-US ] = "Left;Middle;Right" ; + }; + Bitmap BMP_CAPTTYPE_1 + { + File = "legtyp1.bmp" ; + }; + Bitmap BMP_CAPTTYPE_2 + { + File = "legtyp2.bmp" ; + }; + Bitmap BMP_CAPTTYPE_3 + { + File = "legtyp3.bmp" ; + }; + Bitmap BMP_CAPTTYPE_4 + { + File = "legtyp4.bmp" ; + }; + Bitmap BMP_CAPTTYPE_1_H + { + File = "legtyp1_hc.bmp" ; + }; + Bitmap BMP_CAPTTYPE_2_H + { + File = "legtyp2_hc.bmp" ; + }; + Bitmap BMP_CAPTTYPE_3_H + { + File = "legtyp3_hc.bmp" ; + }; + Bitmap BMP_CAPTTYPE_4_H + { + File = "legtyp4_hc.bmp" ; + }; +}; + // RID_SVXDLG_CAPTION ---------------------------------------------------- + +#define _POS_SIZE_TEXT \ + Text [ en-US ] = "Position and Size" ; \ + +TabDialog RID_SVXDLG_CAPTION\ +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 237 , 161 ) ; + Text [ en-US ] = "Callouts" ;\ + Moveable = TRUE ; + TabControl TAB_CONTROL\ + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 3 , 3 ) ; + Size = MAP_APPFONT ( 189 , 97 ) ; + PageList = + { + PageItem\ + { + Identifier = RID_SVXPAGE_POSITION_SIZE ; + PageResID = RID_SVXPAGE_POSITION_SIZE ; + _POS_SIZE_TEXT + }; + PageItem + { + Identifier = RID_SVXPAGE_SWPOSSIZE; + PageResID = RID_SVXPAGE_SWPOSSIZE; + _POS_SIZE_TEXT + }; + PageItem + { + Identifier = RID_SVXPAGE_CAPTION ; + PageResID = RID_SVXPAGE_CAPTION ; + Text [ en-US ] = "Callout" ; + }; + }; + }; +}; + // ********************************************************************** EOF + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx new file mode 100644 index 000000000000..b75ce5b8ebd4 --- /dev/null +++ b/cui/source/tabpages/macroass.cxx @@ -0,0 +1,719 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: macropg.cxx,v $ + * $Revision: 1.21 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +#define ITEMID_MACRO 0 +#include +#undef ITEMID_MACRO + +#include "macroass.hxx" + +#include +#include + +#define _SVSTDARR_STRINGSDTOR +#include + +#include +#include "cfgutil.hxx" +#include +#include +#include "macroass.hrc" +#include "svx/dialogs.hrc" +#include +#include "headertablistbox.hxx" + +using ::com::sun::star::uno::Reference; +using ::com::sun::star::frame::XFrame; + +class _SfxMacroTabPage_Impl +{ +public: + _SfxMacroTabPage_Impl( void ); + ~_SfxMacroTabPage_Impl(); + + String maStaticMacroLBLabel; + PushButton* pAssignPB; + PushButton* pDeletePB; + String* pStrEvent; + String* pAssignedMacro; + ListBox* pScriptTypeLB; + _HeaderTabListBox* pEventLB; + SfxConfigGroupListBox_Impl* pGroupLB; + FixedText* pFT_MacroLBLabel; + SfxConfigFunctionListBox_Impl* pMacroLB; + + FixedText* pMacroFT; + String* pMacroStr; + FNGetRangeHdl fnGetRange; + FNGetMacrosOfRangeHdl fnGetMacroOfRange; + + BOOL bReadOnly; + Timer maFillGroupTimer; + BOOL bGotEvents; +}; + +_SfxMacroTabPage_Impl::_SfxMacroTabPage_Impl( void ) : + pAssignPB( NULL ), + pDeletePB( NULL ), + pStrEvent( NULL ), + pAssignedMacro( NULL ), + pScriptTypeLB( NULL ), + pEventLB( NULL ), + pGroupLB( NULL ), + pFT_MacroLBLabel( NULL ), + pMacroLB( NULL ), + pMacroFT( NULL ), + pMacroStr( NULL ), + fnGetRange( NULL ), + fnGetMacroOfRange( NULL ), + bReadOnly( FALSE ), + bGotEvents( FALSE ) +{ +} + +_SfxMacroTabPage_Impl::~_SfxMacroTabPage_Impl() +{ + delete pAssignPB; + delete pDeletePB; + delete pStrEvent; + delete pAssignedMacro; + delete pScriptTypeLB; + delete pEventLB; + delete pGroupLB; + delete pMacroLB; + delete pFT_MacroLBLabel; + delete pMacroFT; + delete pMacroStr; +} + + +SvStringsDtor* _ImpGetRangeHdl( _SfxMacroTabPage*, const String& rLanguage ); +SvStringsDtor* _ImpGetMacrosOfRangeHdl( _SfxMacroTabPage*, const String& rLanguage, const String& rRange ); + +static USHORT __FAR_DATA aPageRg[] = { + SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, + 0 +}; + +// Achtung im Code wird dieses Array direkt (0, 1, ...) indiziert +static long nTabs[] = + { + 2, // Number of Tabs + 0, 90 + }; + +#define TAB_WIDTH_MIN 10 + +// IDs for items in HeaderBar of EventLB +#define ITEMID_EVENT 1 +#define ITMEID_ASSMACRO 2 + + +#define LB_EVENTS_ITEMPOS 1 +#define LB_MACROS_ITEMPOS 2 + +String ConvertToUIName_Impl( SvxMacro *pMacro, const String& /*rLanguage*/ ) +{ + String aName( pMacro->GetMacName() ); + String aEntry; + if ( ! pMacro->GetLanguage().EqualsAscii("JavaScript") ) + { + USHORT nCount = aName.GetTokenCount('.'); + aEntry = aName.GetToken( nCount-1, '.' ); + if ( nCount > 2 ) + { + aEntry += '('; + aEntry += aName.GetToken( 0, '.' ); + aEntry += '.'; + aEntry += aName.GetToken( nCount-2, '.' ); + aEntry += ')'; + } + return aEntry; + } + else + return aName; +} + +void _SfxMacroTabPage::EnableButtons( const String& rLangName ) +{ + // Solange die Eventbox leer ist, nichts tun + const SvLBoxEntry* pE = mpImpl->pEventLB->GetListBox().FirstSelected(); + if ( pE ) + { + // Gebundenes Macro holen + const SvxMacro* pM = aTbl.Get( (USHORT)(ULONG) pE->GetUserData() ); + mpImpl->pDeletePB->Enable( 0 != pM && !mpImpl->bReadOnly ); + + // Bei gleichem ScriptType Zuweisung nur, wenn Macro sich + // ge"andert hat; bei verschiedenem ScriptType, wenn Script nicht leer + String sEventMacro; + sEventMacro = ((SvLBoxString*)pE->GetItem( LB_MACROS_ITEMPOS ))->GetText(); + if ( rLangName.EqualsAscii("JavaScript") ) + { + DBG_ERROR( "_SfxMacroTabPage::EnableButtons(): this is not an up to date usage!" ); + } + else + { + SfxMacroInfo* pInfo = mpImpl->pMacroLB->GetMacroInfo(); + String sSelMacro; + if ( pInfo ) + sSelMacro = pInfo->GetMacroName(); + if( pM && rLangName != pM->GetLanguage() ) + mpImpl->pAssignPB->Enable( pInfo != 0 && !mpImpl->bReadOnly ); + else + mpImpl->pAssignPB->Enable( pInfo && !mpImpl->bReadOnly && !sSelMacro.EqualsIgnoreCaseAscii( sEventMacro ) ); + } + } +} + +_SfxMacroTabPage::_SfxMacroTabPage( Window* pParent, const ResId& rResId, const SfxItemSet& rAttrSet ) + : SfxTabPage( pParent, rResId, rAttrSet ) + +{ + mpImpl = new _SfxMacroTabPage_Impl; + mpImpl->fnGetRange = &_ImpGetRangeHdl; + mpImpl->fnGetMacroOfRange = &_ImpGetMacrosOfRangeHdl; +} + +_SfxMacroTabPage::~_SfxMacroTabPage() +{ + DELETEZ( mpImpl ); +} + +void _SfxMacroTabPage::AddEvent( const String & rEventName, USHORT nEventId ) +{ + String sTmp( rEventName ); + sTmp += '\t'; + + // falls die Tabelle schon gueltig ist + SvxMacro* pM = aTbl.Get( nEventId ); + if( pM ) + { + String sNew( ConvertToUIName_Impl( pM, mpImpl->pScriptTypeLB->GetSelectEntry() ) ); + sTmp += sNew; + } + + SvLBoxEntry* pE = mpImpl->pEventLB->GetListBox().InsertEntry( sTmp ); + pE->SetUserData( reinterpret_cast< void* >( sal::static_int_cast< sal_IntPtr >( nEventId )) ); +} + +void _SfxMacroTabPage::ScriptChanged( const String& aLangName ) +{ + // neue Bereiche und deren Funktionen besorgen + { + mpImpl->pGroupLB->SetScriptType( aLangName ); + mpImpl->pGroupLB->Show(); + mpImpl->pMacroLB->Show(); + mpImpl->pMacroFT->SetText( *mpImpl->pMacroStr ); + } + + EnableButtons( aLangName ); +} + +void _SfxMacroTabPage::SetGetRangeLink( FNGetRangeHdl pFn ) +{ + mpImpl->fnGetRange = pFn; +} + +FNGetRangeHdl _SfxMacroTabPage::GetGetRangeLink() const +{ + return mpImpl->fnGetRange; +} + +void _SfxMacroTabPage::SetGetMacrosOfRangeLink( FNGetMacrosOfRangeHdl pFn ) +{ + mpImpl->fnGetMacroOfRange = pFn; +} + +FNGetMacrosOfRangeHdl _SfxMacroTabPage::GetGetMacrosOfRangeLink() const +{ + return mpImpl->fnGetMacroOfRange; +} + +BOOL _SfxMacroTabPage::FillItemSet( SfxItemSet& rSet ) +{ + SvxMacroItem aItem( GetWhich( aPageRg[0] ) ); + ((SvxMacroTableDtor&)aItem.GetMacroTable()) = aTbl; + + const SfxPoolItem* pItem; + if( SFX_ITEM_SET != GetItemSet().GetItemState( aItem.Which(), TRUE, &pItem ) + || aItem != *(SvxMacroItem*)pItem ) + { + rSet.Put( aItem ); + return TRUE; + } + return FALSE; +} + +void _SfxMacroTabPage::PageCreated (SfxAllItemSet aSet) +{ + const SfxPoolItem* pEventsItem; + if( !mpImpl->bGotEvents && SFX_ITEM_SET == aSet.GetItemState( SID_EVENTCONFIG, TRUE, &pEventsItem ) ) + { + mpImpl->bGotEvents = TRUE; + const SfxEventNamesList& rList = ((SfxEventNamesItem*)pEventsItem)->GetEvents(); + for ( USHORT nNo = 0; nNo < rList.Count(); ++nNo ) + { + const SfxEventName *pOwn = rList.GetObject(nNo); + AddEvent( pOwn->maUIName, pOwn->mnId ); + } + } +} + +void _SfxMacroTabPage::Reset( const SfxItemSet& rSet ) +{ + const SfxPoolItem* pItem; + if( SFX_ITEM_SET == rSet.GetItemState( GetWhich( aPageRg[0] ), TRUE, &pItem )) + aTbl = ((SvxMacroItem*)pItem)->GetMacroTable(); + + const SfxPoolItem* pEventsItem; + if( !mpImpl->bGotEvents && SFX_ITEM_SET == rSet.GetItemState( SID_EVENTCONFIG, TRUE, &pEventsItem ) ) + { + mpImpl->bGotEvents = TRUE; + const SfxEventNamesList& rList = ((SfxEventNamesItem*)pEventsItem)->GetEvents(); + for ( USHORT nNo = 0; nNo < rList.Count(); ++nNo ) + { + const SfxEventName *pOwn = rList.GetObject(nNo); + AddEvent( pOwn->maUIName, pOwn->mnId ); + } + } + + FillEvents(); + + SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox(); + SvLBoxEntry* pE = rListBox.GetEntry( 0 ); + if( pE ) + rListBox.SetCurEntry( pE ); +} + +void _SfxMacroTabPage::SetReadOnly( BOOL bSet ) +{ + mpImpl->bReadOnly = bSet; +} + +BOOL _SfxMacroTabPage::IsReadOnly() const +{ + return mpImpl->bReadOnly; +} + +IMPL_STATIC_LINK( _SfxMacroTabPage, SelectEvent_Impl, SvTabListBox*, EMPTYARG ) +{ + _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl; + SvHeaderTabListBox& rListBox = pImpl->pEventLB->GetListBox(); + SvLBoxEntry* pE = rListBox.FirstSelected(); + ULONG nPos; + if( !pE || LISTBOX_ENTRY_NOTFOUND == + ( nPos = rListBox.GetModel()->GetAbsPos( pE ) ) ) + { + DBG_ASSERT( pE, "wo kommt der leere Eintrag her?" ); + return 0; + } + + USHORT nEventId = (USHORT)(ULONG)pE->GetUserData(); + String aLanguage = pImpl->pScriptTypeLB->GetSelectEntry(); + + const SvxMacro* pM = pThis->aTbl.Get( nEventId ); + if( pM ) + { + if( aLanguage != pM->GetLanguage() ) + { + pImpl->pScriptTypeLB->SelectEntry( pM->GetLanguage() ); + pThis->ScriptChanged( pM->GetLanguage() ); + } + else + { + DBG_ASSERT( !aLanguage.EqualsAscii("JavaScript"), "_SfxMacroTabPage, SelectEvent_Impl(): outdated use!" ); + } + } + + pThis->EnableButtons( aLanguage ); + return 0; +} + +IMPL_STATIC_LINK( _SfxMacroTabPage, SelectGroup_Impl, ListBox*, EMPTYARG ) +{ + _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl; + String sSel( pImpl->pGroupLB->GetGroup() ); + String aLanguage = pImpl->pScriptTypeLB->GetSelectEntry(); + if( !aLanguage.EqualsAscii( "JavaScript" ) ) + { + pImpl->pGroupLB->GroupSelected(); + SfxMacroInfo* pMacro = pImpl->pMacroLB->GetMacroInfo(); + String aLabelText; + if( pMacro ) + { + aLabelText = pImpl->maStaticMacroLBLabel; + aLabelText += pMacro->GetModuleName(); + } + else + { + // Wenn dort ein Macro drin ist, wurde es selektiert und der + // AssignButton schon in SelectMacro richtig enabled + pImpl->pAssignPB->Enable( FALSE ); + } + + pImpl->pFT_MacroLBLabel->SetText( aLabelText ); + } + return 0; +} + +IMPL_STATIC_LINK( _SfxMacroTabPage, SelectMacro_Impl, ListBox*, EMPTYARG ) +{ + _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl; + pImpl->pMacroLB->FunctionSelected(); + pThis->EnableButtons( pImpl->pScriptTypeLB->GetSelectEntry() ); + return 0; +} + +IMPL_STATIC_LINK( _SfxMacroTabPage, GetFocus_Impl, Edit*, EMPTYARG ) +{ + pThis->EnableButtons( DEFINE_CONST_UNICODE("JavaScript") ); + return 0; +} + +IMPL_STATIC_LINK( _SfxMacroTabPage, AssignDeleteHdl_Impl, PushButton*, pBtn ) +{ + _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl; + SvHeaderTabListBox& rListBox = pImpl->pEventLB->GetListBox(); + SvLBoxEntry* pE = rListBox.FirstSelected(); + ULONG nPos; + if( !pE || LISTBOX_ENTRY_NOTFOUND == + ( nPos = rListBox.GetModel()->GetAbsPos( pE ) ) ) + { + DBG_ASSERT( pE, "wo kommt der leere Eintrag her?" ); + return 0; + } + + const BOOL bAssEnabled = pBtn != pImpl->pDeletePB && pImpl->pAssignPB->IsEnabled(); + + // aus der Tabelle entfernen + USHORT nEvent = (USHORT)(ULONG)pE->GetUserData(); + SvxMacro *pRemoveMacro = pThis->aTbl.Remove( nEvent ); + delete pRemoveMacro; + + String aLanguage = pImpl->pScriptTypeLB->GetSelectEntry(); + String sNew; + if( bAssEnabled ) + { + String sGroup; + String sMacro; + String aEntryText( sNew ); + DBG_ASSERT( !aLanguage.EqualsAscii("JavaScript"), "_SfxMacroTabPage, AssignDeleteHdl_Impl(): outdated use!" ); + + SfxMacroInfo* pMacro = pImpl->pMacroLB->GetMacroInfo(); + sMacro = pMacro->GetQualifiedName(); + sGroup = pImpl->pGroupLB->GetGroup(); + sNew = pMacro->GetMacroName(); + + if( sMacro.CompareToAscii( "vnd.sun.star.script:", 20 ) == COMPARE_EQUAL ) + { + OSL_TRACE("ASSIGN_DELETE: Its a script"); + pThis->aTbl.Insert( + nEvent, new SvxMacro( sMacro, String::CreateFromAscii("Script") ) ); + } + else + { + OSL_TRACE("ASSIGN_DELETE: Its a basic macro"); + String sBasicName/*(SfxResId(STR_BASICNAME))*/; + if ( aLanguage == sBasicName ) + pThis->aTbl.Insert( nEvent, new SvxMacro( sMacro, sGroup, STARBASIC ) ); + else + pThis->aTbl.Insert( nEvent, new SvxMacro( sMacro, aLanguage ) ); + } + } + + pImpl->pEventLB->SetUpdateMode( FALSE ); + pE->ReplaceItem( new SvLBoxString( pE, 0, sNew ), LB_MACROS_ITEMPOS ); + rListBox.GetModel()->InvalidateEntry( pE ); + rListBox.Select( pE ); + rListBox.MakeVisible( pE ); + rListBox.SetUpdateMode( TRUE ); + + pThis->EnableButtons( aLanguage ); + return 0; +} + +IMPL_STATIC_LINK( _SfxMacroTabPage, ChangeScriptHdl_Impl, RadioButton*, EMPTYARG ) +{ + pThis->ScriptChanged( pThis->mpImpl->pScriptTypeLB->GetSelectEntry() ); + return 0; +} + +IMPL_STATIC_LINK( _SfxMacroTabPage, TimeOut_Impl, Timer*, EMPTYARG ) +{ + // FillMacroList() can take a long time -> show wait cursor and disable input + SfxTabDialog* pTabDlg = pThis->GetTabDialog(); + // perhaps the tabpage is part of a SingleTabDialog then pTabDlg == NULL + if ( pTabDlg ) + { + pTabDlg->EnterWait(); + pTabDlg->EnableInput( FALSE ); + } + pThis->FillMacroList(); + if ( pTabDlg ) + { + pTabDlg->EnableInput( TRUE ); + pTabDlg->LeaveWait(); + } + return 0; +} + +void _SfxMacroTabPage::InitAndSetHandler() +{ + // Handler installieren + SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox(); + HeaderBar& rHeaderBar = mpImpl->pEventLB->GetHeaderBar(); + Link aLnk(STATIC_LINK(this, _SfxMacroTabPage, AssignDeleteHdl_Impl )); + mpImpl->pMacroLB->SetDoubleClickHdl( aLnk ); + mpImpl->pDeletePB->SetClickHdl( aLnk ); + mpImpl->pAssignPB->SetClickHdl( aLnk ); + rListBox.SetDoubleClickHdl( aLnk ); + + rListBox.SetSelectHdl( STATIC_LINK( this, _SfxMacroTabPage, SelectEvent_Impl )); + mpImpl->pGroupLB->SetSelectHdl( STATIC_LINK( this, _SfxMacroTabPage, SelectGroup_Impl )); + mpImpl->pMacroLB->SetSelectHdl( STATIC_LINK( this, _SfxMacroTabPage, SelectMacro_Impl )); + + mpImpl->pScriptTypeLB->SetSelectHdl( STATIC_LINK( this, _SfxMacroTabPage, ChangeScriptHdl_Impl )); + + rListBox.SetSelectionMode( SINGLE_SELECTION ); + rListBox.SetTabs( &nTabs[0], MAP_APPFONT ); + Size aSize( nTabs[ 2 ], 0 ); + rHeaderBar.InsertItem( ITEMID_EVENT, *mpImpl->pStrEvent, LogicToPixel( aSize, MapMode( MAP_APPFONT ) ).Width() ); + aSize.Width() = 1764; // don't know what, so 42^2 is best to use... + rHeaderBar.InsertItem( ITMEID_ASSMACRO, *mpImpl->pAssignedMacro, LogicToPixel( aSize, MapMode( MAP_APPFONT ) ).Width() ); + rListBox.SetSpaceBetweenEntries( 0 ); + + mpImpl->pEventLB->Show(); + mpImpl->pEventLB->ConnectElements(); + + mpImpl->pEventLB->Enable( TRUE ); + mpImpl->pGroupLB->Enable( TRUE ); + mpImpl->pMacroLB->Enable( TRUE ); + + mpImpl->pScriptTypeLB->SetDropDownLineCount( 3 ); + String sBasicName/*(SfxResId(STR_BASICNAME))*/; + mpImpl->pScriptTypeLB->InsertEntry( sBasicName ); + mpImpl->pScriptTypeLB->SelectEntry( sBasicName ); + + mpImpl->pGroupLB->SetFunctionListBox( mpImpl->pMacroLB ); + + mpImpl->maFillGroupTimer.SetTimeoutHdl( STATIC_LINK( this, _SfxMacroTabPage, TimeOut_Impl ) ); + mpImpl->maFillGroupTimer.SetTimeout( 0 ); + mpImpl->maFillGroupTimer.Start(); +} + +void _SfxMacroTabPage::FillMacroList() +{ + String aLanguage = mpImpl->pScriptTypeLB->GetSelectEntry(); + if( ! aLanguage.EqualsAscii("JavaScript") ) + { + // 2 Listboxen + SvStringsDtor* pArr = (*mpImpl->fnGetRange)( this, String(/*SfxResId(STR_BASICNAME)*/) ); + if( pArr ) + { + mpImpl->pGroupLB->Init( + ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory >(), + GetFrame(), + ::rtl::OUString() ); + + delete pArr; + } + } +} + +void _SfxMacroTabPage::FillEvents() +{ + SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox(); + + String aLanguage = mpImpl->pScriptTypeLB->GetSelectEntry(); + ULONG nEntryCnt = rListBox.GetEntryCount(); + + // Events aus der Tabelle holen und die EventListBox entsprechen fuellen + for( ULONG n = 0 ; n < nEntryCnt ; ++n ) + { + SvLBoxEntry* pE = rListBox.GetEntry( n ); + if( pE ) + { + SvLBoxString* pLItem = ( SvLBoxString* ) pE->GetItem( LB_MACROS_ITEMPOS ); + DBG_ASSERT( pLItem && SV_ITEM_ID_LBOXSTRING == pLItem->IsA(), "_SfxMacroTabPage::FillEvents(): no LBoxString" ); + + String sOld( pLItem->GetText() ); + String sNew; + USHORT nEventId = ( USHORT ) ( ULONG ) pE->GetUserData(); + if( aTbl.IsKeyValid( nEventId ) ) + sNew = ConvertToUIName_Impl( aTbl.Get( nEventId ), aLanguage ); + + if( sOld != sNew ) + { + pE->ReplaceItem( new SvLBoxString( pE, 0, sNew ), LB_MACROS_ITEMPOS ); + rListBox.GetModel()->InvalidateEntry( pE ); + } + } + } +} + +void _SfxMacroTabPage::SelectEvent( const String & /*rEventName*/, USHORT nEventId ) +{ + SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox(); + ULONG nEntryCnt = rListBox.GetEntryCount(); + + for( ULONG n = 0 ; n < nEntryCnt ; ++n ) + { + SvLBoxEntry* pE = rListBox.GetEntry( n ); + if( pE && ( USHORT ) ( ULONG ) pE->GetUserData() == nEventId ) + { + rListBox.SetCurEntry( pE ); + rListBox.MakeVisible( pE ); + break; + } + } +} + + +SvStringsDtor* __EXPORT _ImpGetRangeHdl( _SfxMacroTabPage* /*pTbPg*/, const String& rLanguage ) +{ + SvStringsDtor* pNew = new SvStringsDtor; + SfxApplication* pSfxApp = SFX_APP(); + + if ( !rLanguage.EqualsAscii("JavaScript") ) + { + pSfxApp->EnterBasicCall(); + + // AppBasic einf"ugen + String* pNewEntry = new String( pSfxApp->GetName() ); + pNew->Insert( pNewEntry, pNew->Count() ); + + // Aktuelles Dokument + SfxObjectShell* pDoc = SfxObjectShell::Current(); + if ( pDoc ) + { + String aTitle = pDoc->GetTitle(); + + // Hack f"ur Aufruf aus der Basic-IDE : das Basic ermitteln, das + // gerade bearbeitet wird + + String aAppName(DEFINE_CONST_UNICODE("BASIC - ")); + USHORT nLen = aAppName.Len(); + if ( aTitle.CompareIgnoreCaseToAscii( aAppName, nLen ) == COMPARE_EQUAL ) + { + // Basic-Namensprefix entfernen + aTitle.Erase( 0, nLen ); + USHORT nIndex=0, nCount=aTitle.GetTokenCount('.'); + if ( nCount > 1 ) + { + // Namen der Library entfernen + aTitle.GetToken( nCount-2, '.', nIndex ); + aTitle.Erase( nIndex-1 ); + } + + // Wenn das App-Basic gerade in der Basic-IDE bearbeitet wird, kein + // Dokument verwenden + pDoc = SfxObjectShell::GetFirst(); + while( pDoc ) + { + if ( aTitle == pDoc->GetTitle() ) + break; + pDoc = SfxObjectShell::GetNext( *pDoc ); + } + } + + if ( pDoc && pDoc->GetBasicManager() != SFX_APP()->GetBasicManager() && + pDoc->GetBasicManager()->GetLibCount() ) + { + pNewEntry = new String( aTitle ); + pNew->Insert( pNewEntry, pNew->Count() ); + } + } + + pSfxApp->LeaveBasicCall(); + } + + return pNew; +} + +// besorgen der Funktionen eines Bereiches +SvStringsDtor* __EXPORT _ImpGetMacrosOfRangeHdl( + _SfxMacroTabPage* /*pTbPg*/, + const String& /*rLanguage*/, + const String& /*rRange*/ ) +{ + SvStringsDtor* pNew = new SvStringsDtor; + return pNew; +} + + +SfxMacroTabPage::SfxMacroTabPage( Window* pParent, const ResId& rResId, const Reference< XFrame >& rxDocumentFrame, const SfxItemSet& rSet ) + : _SfxMacroTabPage( pParent, rResId, rSet ) +{ + mpImpl->pStrEvent = new String( SVX_RES( STR_EVENT ) ); + mpImpl->pAssignedMacro = new String( SVX_RES( STR_ASSMACRO ) ); + mpImpl->pEventLB = new _HeaderTabListBox( this, SVX_RES( LB_EVENT ) ); + mpImpl->pAssignPB = new PushButton( this, SVX_RES( PB_ASSIGN ) ); + mpImpl->pDeletePB = new PushButton( this, SVX_RES( PB_DELETE ) ); + mpImpl->pScriptTypeLB = new ListBox(this, SVX_RES( LB_SCRIPTTYPE ) ); + mpImpl->pScriptTypeLB->Hide(); + mpImpl->pMacroFT = new FixedText( this, SVX_RES( FT_MACRO ) ); + mpImpl->pGroupLB = new SfxConfigGroupListBox_Impl( this, SVX_RES( LB_GROUP ) ); + mpImpl->pFT_MacroLBLabel = new FixedText( this, SVX_RES( FT_LABEL4LB_MACROS ) ); + mpImpl->maStaticMacroLBLabel= mpImpl->pFT_MacroLBLabel->GetText(); + mpImpl->pMacroLB = new SfxConfigFunctionListBox_Impl( this, SVX_RES( LB_MACROS ) ); + mpImpl->pMacroStr = new String( SVX_RES( STR_MACROS ) ); + + FreeResource(); + + SetFrame( rxDocumentFrame ); + + InitAndSetHandler(); + + ScriptChanged( String( /*SfxResId(STR_BASICNAME)*/ ) ); +} + +SfxTabPage* SfxMacroTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) +{ + return new SfxMacroTabPage( pParent, SVX_RES( RID_SVXPAGE_EVENTASSIGN ), NULL, rAttrSet ); +} + +SfxMacroAssignDlg::SfxMacroAssignDlg( Window* pParent, const Reference< XFrame >& rxDocumentFrame, const SfxItemSet& rSet ) + : SfxSingleTabDialog( pParent, rSet, 0 ) +{ + SfxTabPage* pPage = SfxMacroTabPage::Create( this, rSet ); + pPage->SetFrame( rxDocumentFrame ); + SetTabPage( pPage ); +} + +SfxMacroAssignDlg::~SfxMacroAssignDlg() +{ +} + + diff --git a/cui/source/tabpages/macroass.hrc b/cui/source/tabpages/macroass.hrc new file mode 100644 index 000000000000..626cf010adf9 --- /dev/null +++ b/cui/source/tabpages/macroass.hrc @@ -0,0 +1,85 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: macropg.hrc,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _MACROASS_HRC +#define _MACROASS_HRC + +#ifndef _SVT_CONTROLDIMS_HRC_ +#include +#endif + +#define LB_EVENT 2 +#define PB_ASSIGN 3 +#define PB_DELETE 4 +#define FT_MACRO 5 +#define LB_GROUP 6 +#define LB_MACROS 7 +#define LB_SCRIPTTYPE 8 +#define FT_LABEL4LB_MACROS 9 +#define STR_JAVASCRIPT 10 +#define STR_MACROS 11 +#define ED_JAVASCRIPT 12 +#define STR_EVENT 13 +#define STR_ASSMACRO 14 + + +// COL0<---------------WIDTH_1_2--------------->COL3<->COL4<----WIDTH4---->COL5 +// <--WIDTH1-->COL1<-SPACE1->COL2<--WIDTH2-> + +#define WIDTH_TP 260 // of whole tabpage +#define COL5 (WIDTH_TP-RSC_SP_DLG_INNERBORDER_RIGHT) +#define COL4 (COL5-RSC_CD_PUSHBUTTON_WIDTH) +#define COL3 (COL4-RSC_SP_CTRL_X) +#define COL0 (RSC_SP_TBPG_INNERBORDER_LEFT) +#define WIDTH1_2 (COL3-COL0) // width of upper listbox +#define SPACE1 4 // space between lower listboxes +#define WIDTH1 ((WIDTH1_2-SPACE1)/2) // width of lower left listbox +#define WIDTH2 (WIDTH1_2-WIDTH1-SPACE1) // width of lower right listbox +#define COL1 (COL0+WIDTH1) +#define COL2 (COL1+SPACE1) + +#define HEIGHT_TP 185 // of whole tabpage +#define HEIGHT0 62 // of upper listbox +#define ROW0 6 // more than RSC_SP_FLGR_INNERBORDER_TOP cause of bad design +#define ROW1 (ROW0+RSC_CD_PUSHBUTTON_HEIGHT) // Assign button +#define ROW2 (ROW1+RSC_SP_CTRL_GROUP_Y) +#define ROW3 (ROW2+RSC_CD_PUSHBUTTON_HEIGHT) // Remove button +#define ROW4 (ROW3+RSC_SP_CTRL_GROUP_Y) +#define ROW5 (ROW4+RSC_CD_DROPDOWN_HEIGHT) // script type listbox (hidden) +#define ROW6 (ROW0+HEIGHT0) +#define ROW7 (ROW6+RSC_SP_CTRL_Y) +#define HEIGHT_EXTRA7 (RSC_CD_FIXEDTEXT_HEIGHT) // additional height for FT_LABEL4LB_MACROS +#define ROW7A (ROW7+HEIGHT_EXTRA7) +#define ROW8 (ROW7+RSC_CD_FIXEDTEXT_HEIGHT+HEIGHT_EXTRA7)// label for lower listboxes (2 lines!) +#define ROW9 (HEIGHT_TP-RSC_SP_TBPG_INNERBORDER_BOTTOM) +#define HEIGHT8 (ROW9-ROW8) // of lower listboxes + +#endif + diff --git a/cui/source/tabpages/macroass.src b/cui/source/tabpages/macroass.src new file mode 100644 index 000000000000..bb56baae45f6 --- /dev/null +++ b/cui/source/tabpages/macroass.src @@ -0,0 +1,143 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: macropg.src,v $ + * $Revision: 1.39 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macroass.hrc" +#include "svx/dialogs.hrc" +#include "helpid.hrc" +TabPage RID_SVXPAGE_EVENTASSIGN +{ + Hide = TRUE ; + SVLook = TRUE ; + DialogControl = TRUE ; + Size = MAP_APPFONT ( WIDTH_TP , HEIGHT_TP ) ; + Text [ en-US ] = "Assign Macro" ; + String STR_EVENT + { + Text [ en-US ] = "Event" ; + }; + String STR_ASSMACRO + { + Text [ en-US ] = "Assigned macro"; + }; + Control LB_EVENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( COL0 , ROW0 ) ; + Size = MAP_APPFONT ( WIDTH1_2 , HEIGHT0 ) ; + TabStop = TRUE ; + DialogControl = TRUE ; + ClipChildren = TRUE ; + Disable = TRUE ; + Group = TRUE ; + HelpID = HID_MACRO_LB_EVENT ; + }; + FixedText FT_MACRO + { + Pos = MAP_APPFONT ( COL0 , ROW7A ) ; + Size = MAP_APPFONT ( WIDTH1 , RSC_CD_FIXEDTEXT_HEIGHT ) ; + Group = TRUE ; + }; + Control LB_GROUP + { + Border = TRUE ; + Pos = MAP_APPFONT ( COL0 , ROW8 ) ; + Size = MAP_APPFONT ( WIDTH1 , HEIGHT8 ) ; + TabStop = TRUE ; + Group = TRUE ; + HelpId = HID_MACRO_GROUP ; + }; + FixedText FT_LABEL4LB_MACROS + { + Pos = MAP_APPFONT ( COL2 , ROW7 ) ; + Size = MAP_APPFONT ( WIDTH1 , RSC_CD_FIXEDTEXT_HEIGHT + HEIGHT_EXTRA7 ) ; + WordBreak = TRUE; + Text [ en-US ] = "~Existing macros in:\n" ; + }; + Control LB_MACROS + { + Border = TRUE ; + Pos = MAP_APPFONT ( COL2 , ROW8 ) ; + Size = MAP_APPFONT ( WIDTH2 , HEIGHT8 ) ; + TabStop = TRUE ; + HelpId = HID_MACRO_MACROS ; + }; + PushButton PB_ASSIGN + { + Pos = MAP_APPFONT ( COL4 , ROW0 ) ; + Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; + // ### ACHTUNG: Neuer Text in Resource? Z~uweisen : Zuweisen + Disable = TRUE ; + TabStop = TRUE ; + Text [ en-US ] = "~Assign" ; + }; + PushButton PB_DELETE + { + Pos = MAP_APPFONT ( COL4 , ROW2 ) ; + Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; + Disable = TRUE ; + TabStop = TRUE ; + Text [ en-US ] = "~Remove" ; + }; + ListBox LB_SCRIPTTYPE + { + Pos = MAP_APPFONT ( COL4 , ROW4 ) ; + Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , 60 ) ; + // en-US was missing + Text [ en-US ] = "~Scripting Language" ; + TabStop = TRUE ; + Disable = FALSE ; + DropDown = TRUE ; + }; + String STR_MACROS + { + Text [ en-US ] = "Macros" ; + }; +}; + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/makefile.mk b/cui/source/tabpages/makefile.mk new file mode 100755 index 000000000000..a43bf143c2a6 --- /dev/null +++ b/cui/source/tabpages/makefile.mk @@ -0,0 +1,112 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.65 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* +PRJ=..$/.. +PRJNAME=cui +TARGET=tabpages +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +.IF "$(ENABLE_LAYOUT)" == "TRUE" +CFLAGS+= -DENABLE_LAYOUT=1 -I../$(PRJ)/layout/inc -I../$(PRJ)/layout/$(INPATH)/inc +.ENDIF # ENABLE_LAYOUT == TRUE + +# --- Files -------------------------------------------------------- + +SRS1NAME=tabpages +SRC1FILES = \ + align.src \ + autocdlg.src \ + backgrnd.src \ + bbdlg.src \ + border.src \ + chardlg.src \ + connect.src \ + dstribut.src \ + grfpage.src \ + macroass.src \ + measure.src \ + numfmt.src \ + numpages.src \ + page.src \ + paragrph.src \ + swpossizetabpage.src \ + tabstpge.src \ + textanim.src \ + textattr.src \ + labdlg.src \ + tabarea.src \ + tabline.src \ + transfrm.src + + +SLOFILES+=\ + $(SLO)$/align.obj \ + $(SLO)$/autocdlg.obj \ + $(SLO)$/backgrnd.obj \ + $(SLO)$/bbdlg.obj \ + $(SLO)$/border.obj \ + $(SLO)$/borderconn.obj \ + $(SLO)$/chardlg.obj \ + $(SLO)$/connect.obj \ + $(SLO)$/dstribut.obj \ + $(SLO)$/grfpage.obj \ + $(SLO)$/labdlg.obj \ + $(SLO)$/macroass.obj \ + $(SLO)$/measure.obj \ + $(SLO)$/numfmt.obj \ + $(SLO)$/numpages.obj \ + $(SLO)$/page.obj \ + $(SLO)$/paragrph.obj \ + $(SLO)$/swpossizetabpage.obj \ + $(SLO)$/tabarea.obj \ + $(SLO)$/tabline.obj \ + $(SLO)$/tabstpge.obj \ + $(SLO)$/textanim.obj \ + $(SLO)$/textattr.obj \ + $(SLO)$/tparea.obj \ + $(SLO)$/tpbitmap.obj \ + $(SLO)$/tpcolor.obj \ + $(SLO)$/tpgradnt.obj \ + $(SLO)$/tphatch.obj \ + $(SLO)$/tpline.obj \ + $(SLO)$/tplnedef.obj \ + $(SLO)$/tplneend.obj \ + $(SLO)$/tpshadow.obj \ + $(SLO)$/transfrm.obj \ + + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx new file mode 100644 index 000000000000..dc964f3f0080 --- /dev/null +++ b/cui/source/tabpages/measure.cxx @@ -0,0 +1,876 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: measure.cxx,v $ + * $Revision: 1.18 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include + +#include + +#define _SVX_MEASURE_CXX + +#include +#include +#include +#include + +#include "svx/measctrl.hxx" +#include "measure.hxx" +#include "measure.hrc" +#include +#include "svx/dlgutil.hxx" +#include +#include //add CHINA001 +#include "svx/ofaitem.hxx" //add CHINA001 + +static USHORT pRanges[] = +{ + SDRATTR_MEASURE_FIRST, + SDRATTR_MEASURE_LAST, + 0 +}; + +/************************************************************************* +|* +|* Dialog to change measure-attributes +|* +\************************************************************************/ + +SvxMeasureDialog::SvxMeasureDialog( Window* pParent, const SfxItemSet& rInAttrs, + const SdrView* pSdrView ) : + SfxSingleTabDialog( pParent, rInAttrs, RID_SVXPAGE_MEASURE ) +{ + SvxMeasurePage* _pPage = new SvxMeasurePage( this, rInAttrs ); + + _pPage->SetView( pSdrView ); + _pPage->Construct(); + + SetTabPage( _pPage ); + SetText( _pPage->GetText() ); +} + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +SvxMeasureDialog::~SvxMeasureDialog() +{ +} + +/************************************************************************* +|* +|* Tabpage for changing measure-attributes +|* +\************************************************************************/ + +SvxMeasurePage::SvxMeasurePage( Window* pWindow, const SfxItemSet& rInAttrs ) : + SvxTabPage ( pWindow, SVX_RES( RID_SVXPAGE_MEASURE ), + rInAttrs ), + + aFlLine ( this, SVX_RES( FL_LINE ) ), + aFtLineDist ( this, SVX_RES( FT_LINE_DIST ) ), + aMtrFldLineDist ( this, SVX_RES( MTR_LINE_DIST ) ), + aFtHelplineOverhang ( this, SVX_RES( FT_HELPLINE_OVERHANG ) ), + aMtrFldHelplineOverhang ( this, SVX_RES( MTR_FLD_HELPLINE_OVERHANG ) ), + aFtHelplineDist ( this, SVX_RES( FT_HELPLINE_DIST ) ), + aMtrFldHelplineDist ( this, SVX_RES( MTR_FLD_HELPLINE_DIST ) ), + aFtHelpline1Len ( this, SVX_RES( FT_HELPLINE1_LEN ) ), + aMtrFldHelpline1Len ( this, SVX_RES( MTR_FLD_HELPLINE1_LEN ) ), + aFtHelpline2Len ( this, SVX_RES( FT_HELPLINE2_LEN ) ), + aMtrFldHelpline2Len ( this, SVX_RES( MTR_FLD_HELPLINE2_LEN ) ), + aTsbBelowRefEdge ( this, SVX_RES( TSB_BELOW_REF_EDGE ) ), + aFtDecimalPlaces ( this, SVX_RES( FT_DECIMALPLACES ) ), + aMtrFldDecimalPlaces ( this, SVX_RES( MTR_FLD_DECIMALPLACES ) ), + + aFlLabel ( this, SVX_RES( FL_LABEL ) ), + aFtPosition ( this, SVX_RES( FT_POSITION ) ), + aCtlPosition ( this, SVX_RES( CTL_POSITION ) ), + aTsbAutoPosV ( this, SVX_RES( TSB_AUTOPOSV ) ), + aTsbAutoPosH ( this, SVX_RES( TSB_AUTOPOSH ) ), + aTsbShowUnit ( this, SVX_RES( TSB_SHOW_UNIT ) ), + aLbUnit ( this, SVX_RES( LB_UNIT ) ), + aTsbParallel ( this, SVX_RES( TSB_PARALLEL ) ), + aCtlPreview ( this, SVX_RES( CTL_PREVIEW ), rInAttrs ), + + aFlVert ( this, SVX_RES( FL_VERT ) ), + rOutAttrs ( rInAttrs ), + aAttrSet ( *rInAttrs.GetPool() ), + pView( 0 ), + + bPositionModified ( FALSE ) +{ + FillUnitLB(); + + FreeResource(); + + const FieldUnit eFUnit = GetModuleFieldUnit( &rInAttrs ); + SetFieldUnit( aMtrFldLineDist, eFUnit ); + SetFieldUnit( aMtrFldHelplineOverhang, eFUnit ); + SetFieldUnit( aMtrFldHelplineDist, eFUnit ); + SetFieldUnit( aMtrFldHelpline1Len, eFUnit ); + SetFieldUnit( aMtrFldHelpline2Len, eFUnit ); + if( eFUnit == FUNIT_MM ) + { + aMtrFldLineDist.SetSpinSize( 50 ); + aMtrFldHelplineOverhang.SetSpinSize( 50 ); + aMtrFldHelplineDist.SetSpinSize( 50 ); + aMtrFldHelpline1Len.SetSpinSize( 50 ); + aMtrFldHelpline2Len.SetSpinSize( 50 ); + } + + aTsbAutoPosV.SetClickHdl( LINK( this, SvxMeasurePage, ClickAutoPosHdl_Impl ) ); + aTsbAutoPosH.SetClickHdl( LINK( this, SvxMeasurePage, ClickAutoPosHdl_Impl ) ); + + // set background and border of iconchoicectrl + const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); + aCtlPreview.SetBackground ( rStyles.GetWindowColor() ); + aCtlPreview.SetBorderStyle(WINDOW_BORDER_MONO); + + Link aLink( LINK( this, SvxMeasurePage, ChangeAttrHdl_Impl ) ); + aMtrFldLineDist.SetModifyHdl( aLink ); + aMtrFldHelplineOverhang.SetModifyHdl( aLink ); + aMtrFldHelplineDist.SetModifyHdl( aLink ); + aMtrFldHelpline1Len.SetModifyHdl( aLink ); + aMtrFldHelpline2Len.SetModifyHdl( aLink ); + aMtrFldDecimalPlaces.SetModifyHdl( aLink ); + aTsbBelowRefEdge.SetClickHdl( aLink ); + aTsbParallel.SetClickHdl( aLink ); + aTsbShowUnit.SetClickHdl( aLink ); + aLbUnit.SetSelectHdl( aLink ); +} + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +SvxMeasurePage::~SvxMeasurePage() +{ +} + +/************************************************************************* +|* +|* read the delivered Item-Set +|* +\************************************************************************/ + +void __EXPORT SvxMeasurePage::Reset( const SfxItemSet& rAttrs ) +{ + SfxItemPool* pPool = rAttrs.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + eUnit = pPool->GetMetric( SDRATTR_MEASURELINEDIST ); + + const SfxPoolItem* pItem = GetItem( rAttrs, SDRATTR_MEASURELINEDIST ); + + // SdrMeasureLineDistItem + if( pItem == NULL ) + pItem = &pPool->GetDefaultItem( SDRATTR_MEASURELINEDIST ); + if( pItem ) + { + long nValue = ( ( const SdrMeasureLineDistItem* )pItem )->GetValue(); + SetMetricValue( aMtrFldLineDist, nValue, eUnit ); + } + else + { + aMtrFldLineDist.SetText( String() ); + } + aMtrFldLineDist.SaveValue(); + + // SdrMeasureHelplineOverhangItem + pItem = GetItem( rAttrs, SDRATTR_MEASUREHELPLINEOVERHANG ); + if( pItem == NULL ) + pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINEOVERHANG ); + if( pItem ) + { + long nValue = ( ( const SdrMeasureHelplineOverhangItem* )pItem )->GetValue(); + SetMetricValue( aMtrFldHelplineOverhang, nValue, eUnit ); + } + else + { + aMtrFldHelplineOverhang.SetText( String() ); + } + aMtrFldHelplineOverhang.SaveValue(); + + // SdrMeasureHelplineDistItem + pItem = GetItem( rAttrs, SDRATTR_MEASUREHELPLINEDIST ); + if( pItem == NULL ) + pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINEDIST ); + if( pItem ) + { + long nValue = ( ( const SdrMeasureHelplineDistItem* )pItem )->GetValue(); + SetMetricValue( aMtrFldHelplineDist, nValue, eUnit ); + } + else + { + aMtrFldHelplineDist.SetText( String() ); + } + aMtrFldHelplineDist.SaveValue(); + + // SdrMeasureHelpline1LenItem + pItem = GetItem( rAttrs, SDRATTR_MEASUREHELPLINE1LEN ); + if( pItem == NULL ) + pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINE1LEN ); + if( pItem ) + { + long nValue = ( ( const SdrMeasureHelpline1LenItem* )pItem )->GetValue(); + SetMetricValue( aMtrFldHelpline1Len, nValue, eUnit ); + } + else + { + aMtrFldHelpline1Len.SetText( String() ); + } + aMtrFldHelpline1Len.SaveValue(); + + // SdrMeasureHelpline2LenItem + pItem = GetItem( rAttrs, SDRATTR_MEASUREHELPLINE2LEN ); + if( pItem == NULL ) + pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINE2LEN ); + if( pItem ) + { + long nValue = ( ( const SdrMeasureHelpline2LenItem* )pItem )->GetValue(); + SetMetricValue( aMtrFldHelpline2Len, nValue, eUnit ); + } + else + { + aMtrFldHelpline2Len.SetText( String() ); + } + aMtrFldHelpline2Len.SaveValue(); + + // SdrMeasureBelowRefEdgeItem + if( rAttrs.GetItemState( SDRATTR_MEASUREBELOWREFEDGE ) != SFX_ITEM_DONTCARE ) + { + aTsbBelowRefEdge.SetState( ( ( const SdrMeasureBelowRefEdgeItem& )rAttrs.Get( SDRATTR_MEASUREBELOWREFEDGE ) ). + GetValue() ? STATE_CHECK : STATE_NOCHECK ); + aTsbBelowRefEdge.EnableTriState( FALSE ); + } + else + { + aTsbBelowRefEdge.SetState( STATE_DONTKNOW ); + } + aTsbBelowRefEdge.SaveValue(); + + // SdrMeasureDecimalPlacesItem + pItem = GetItem( rAttrs, SDRATTR_MEASUREDECIMALPLACES ); + if( pItem == NULL ) + pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREDECIMALPLACES ); + if( pItem ) + { + INT16 nValue = ( ( const SdrMeasureDecimalPlacesItem* )pItem )->GetValue(); + aMtrFldDecimalPlaces.SetValue( nValue ); + } + else + { + aMtrFldDecimalPlaces.SetText( String() ); + } + aMtrFldDecimalPlaces.SaveValue(); + + // SdrMeasureTextRota90Item + // Attention: negate ! + if( rAttrs.GetItemState( SDRATTR_MEASURETEXTROTA90 ) != SFX_ITEM_DONTCARE ) + { + aTsbParallel.SetState( ( ( const SdrMeasureTextRota90Item& )rAttrs.Get( SDRATTR_MEASURETEXTROTA90 ) ). + GetValue() ? STATE_NOCHECK : STATE_CHECK ); + aTsbParallel.EnableTriState( FALSE ); + } + else + { + aTsbParallel.SetState( STATE_DONTKNOW ); + } + aTsbParallel.SaveValue(); + + // SdrMeasureShowUnitItem + if( rAttrs.GetItemState( SDRATTR_MEASURESHOWUNIT ) != SFX_ITEM_DONTCARE ) + { + aTsbShowUnit.SetState( ( ( const SdrMeasureShowUnitItem& )rAttrs.Get( SDRATTR_MEASURESHOWUNIT ) ). + GetValue() ? STATE_CHECK : STATE_NOCHECK ); + aTsbShowUnit.EnableTriState( FALSE ); + } + else + { + aTsbShowUnit.SetState( STATE_DONTKNOW ); + } + aTsbShowUnit.SaveValue(); + + // SdrMeasureUnitItem + if( rAttrs.GetItemState( SDRATTR_MEASUREUNIT ) != SFX_ITEM_DONTCARE ) + { + long nFieldUnit = (long) ( ( const SdrMeasureUnitItem& )rAttrs. + Get( SDRATTR_MEASUREUNIT ) ).GetValue(); + + for( USHORT i = 0; i < aLbUnit.GetEntryCount(); ++i ) + { + if ( (long)aLbUnit.GetEntryData( i ) == nFieldUnit ) + { + aLbUnit.SelectEntryPos( i ); + break; + } + } + } + else + { + aLbUnit.SetNoSelection(); + } + aLbUnit.SaveValue(); + + // Position + if ( rAttrs.GetItemState( SDRATTR_MEASURETEXTVPOS ) != SFX_ITEM_DONTCARE ) + { + SdrMeasureTextVPos eVPos = (SdrMeasureTextVPos) + ( ( const SdrMeasureTextVPosItem& )rAttrs.Get( SDRATTR_MEASURETEXTVPOS ) ).GetValue(); + { + if ( rAttrs.GetItemState( SDRATTR_MEASURETEXTHPOS ) != SFX_ITEM_DONTCARE ) + { + aTsbAutoPosV.EnableTriState( FALSE ); + aTsbAutoPosH.EnableTriState( FALSE ); + + SdrMeasureTextHPos eHPos = (SdrMeasureTextHPos) + ( ( const SdrMeasureTextHPosItem& )rAttrs.Get( SDRATTR_MEASURETEXTHPOS ) ).GetValue(); + RECT_POINT eRP = RP_MM; + switch( eVPos ) + { + case SDRMEASURE_ABOVE: + switch( eHPos ) + { + case SDRMEASURE_TEXTLEFTOUTSIDE: eRP = RP_LT; break; + case SDRMEASURE_TEXTINSIDE: eRP = RP_MT; break; + case SDRMEASURE_TEXTRIGHTOUTSIDE: eRP = RP_RT; break; + case SDRMEASURE_TEXTHAUTO: eRP = RP_MT; break; + } + break; + case SDRMEASURETEXT_VERTICALCENTERED: + switch( eHPos ) + { + case SDRMEASURE_TEXTLEFTOUTSIDE: eRP = RP_LM; break; + case SDRMEASURE_TEXTINSIDE: eRP = RP_MM; break; + case SDRMEASURE_TEXTRIGHTOUTSIDE: eRP = RP_RM; break; + case SDRMEASURE_TEXTHAUTO: eRP = RP_MM; break; + } + break; + case SDRMEASURE_BELOW: + switch( eHPos ) + { + case SDRMEASURE_TEXTLEFTOUTSIDE: eRP = RP_LB; break; + case SDRMEASURE_TEXTINSIDE: eRP = RP_MB; break; + case SDRMEASURE_TEXTRIGHTOUTSIDE: eRP = RP_RB; break; + case SDRMEASURE_TEXTHAUTO: eRP = RP_MB; break; + } + break; + case SDRMEASURE_TEXTVAUTO: + switch( eHPos ) + { + case SDRMEASURE_TEXTLEFTOUTSIDE: eRP = RP_LM; break; + case SDRMEASURE_TEXTINSIDE: eRP = RP_MM; break; + case SDRMEASURE_TEXTRIGHTOUTSIDE: eRP = RP_RM; break; + case SDRMEASURE_TEXTHAUTO: eRP = RP_MM; break; + } + break; + default: ;//prevent warning + } + + CTL_STATE nState = 0; + + if( eHPos == SDRMEASURE_TEXTHAUTO ) + { + aTsbAutoPosH.SetState( STATE_CHECK ); + nState = CS_NOHORZ; + } + + if( eVPos == SDRMEASURE_TEXTVAUTO ) + { + aTsbAutoPosV.SetState( STATE_CHECK ); + nState |= CS_NOVERT; + } + + aCtlPosition.SetState( nState ); + aCtlPosition.SetActualRP( eRP ); + } + } + } + else + { + aCtlPosition.Reset(); + aTsbAutoPosV.SetState( STATE_DONTKNOW ); + aTsbAutoPosH.SetState( STATE_DONTKNOW ); + } + + // put the attributes to the preview-control, + // otherwise the control don't know about + // the settings of the dialog (#67930) + ChangeAttrHdl_Impl( &aTsbShowUnit ); + aCtlPreview.SetAttributes( rAttrs ); + + bPositionModified = FALSE; +} + +/************************************************************************* +|* +|* Fill the delivered Item-Set with dialogbox-attributes +|* +\************************************************************************/ + +BOOL SvxMeasurePage::FillItemSet( SfxItemSet& rAttrs) +{ + BOOL bModified = FALSE; + INT32 nValue; + TriState eState; + + if( aMtrFldLineDist.GetText() != aMtrFldLineDist.GetSavedValue() ) + { + nValue = GetCoreValue( aMtrFldLineDist, eUnit ); + rAttrs.Put( SdrMeasureLineDistItem( nValue ) ); + bModified = TRUE; + } + + if( aMtrFldHelplineOverhang.GetText() != aMtrFldHelplineOverhang.GetSavedValue() ) + { + nValue = GetCoreValue( aMtrFldHelplineOverhang, eUnit ); + rAttrs.Put( SdrMeasureHelplineOverhangItem( nValue ) ); + bModified = TRUE; + } + + if( aMtrFldHelplineDist.GetText() != aMtrFldHelplineDist.GetSavedValue() ) + { + nValue = GetCoreValue( aMtrFldHelplineDist, eUnit ); + rAttrs.Put( SdrMeasureHelplineDistItem( nValue ) ); + bModified = TRUE; + } + + if( aMtrFldHelpline1Len.GetText() != aMtrFldHelpline1Len.GetSavedValue() ) + { + nValue = GetCoreValue( aMtrFldHelpline1Len, eUnit ); + rAttrs.Put( SdrMeasureHelpline1LenItem( nValue ) ); + bModified = TRUE; + } + + if( aMtrFldHelpline2Len.GetText() != aMtrFldHelpline2Len.GetSavedValue() ) + { + nValue = GetCoreValue( aMtrFldHelpline2Len, eUnit ); + rAttrs.Put( SdrMeasureHelpline2LenItem( nValue ) ); + bModified = TRUE; + } + + eState = aTsbBelowRefEdge.GetState(); + if( eState != aTsbBelowRefEdge.GetSavedValue() ) + { + rAttrs.Put( SdrMeasureBelowRefEdgeItem( (BOOL) STATE_CHECK == eState ) ); + bModified = TRUE; + } + + if( aMtrFldDecimalPlaces.GetText() != aMtrFldDecimalPlaces.GetSavedValue() ) + { + nValue = static_cast(aMtrFldDecimalPlaces.GetValue()); + rAttrs.Put( + SdrMeasureDecimalPlacesItem( + sal::static_int_cast< INT16 >( nValue ) ) ); + bModified = TRUE; + } + + eState = aTsbParallel.GetState(); + if( eState != aTsbParallel.GetSavedValue() ) + { + rAttrs.Put( SdrMeasureTextRota90Item( (BOOL) STATE_NOCHECK == eState ) ); + bModified = TRUE; + } + + eState = aTsbShowUnit.GetState(); + if( eState != aTsbShowUnit.GetSavedValue() ) + { + rAttrs.Put( SdrMeasureShowUnitItem( (BOOL) STATE_CHECK == eState ) ); + bModified = TRUE; + } + + USHORT nPos = aLbUnit.GetSelectEntryPos(); + if( nPos != aLbUnit.GetSavedValue() ) + { + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + USHORT nFieldUnit = (USHORT)(long)aLbUnit.GetEntryData( nPos ); + FieldUnit _eUnit = (FieldUnit) nFieldUnit; + rAttrs.Put( SdrMeasureUnitItem( _eUnit ) ); + bModified = TRUE; + } + } + +//enum SdrMeasureTextHPos {SDRMEASURE_TEXTHAUTO,SDRMEASURE_TEXTLEFTOUTSIDE,SDRMEASURE_TEXTINSIDE,SDRMEASURE_TEXTRIGHTOUTSIDE}; +//enum SdrMeasureTextVPos {SDRMEASURE_TEXTVAUTO,SDRMEASURE_ABOVE,SDRMEASURETEXT_VERTICALCENTERED,SDRMEASURE_BELOW}; + + if( bPositionModified ) + { + // Position + SdrMeasureTextVPos eVPos, eOldVPos; + SdrMeasureTextHPos eHPos, eOldHPos; + + RECT_POINT eRP = aCtlPosition.GetActualRP(); + switch( eRP ) + { + default: + case RP_LT: eVPos = SDRMEASURE_ABOVE; + eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break; + case RP_LM: eVPos = SDRMEASURETEXT_VERTICALCENTERED; + eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break; + case RP_LB: eVPos = SDRMEASURE_BELOW; + eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break; + case RP_MT: eVPos = SDRMEASURE_ABOVE; + eHPos = SDRMEASURE_TEXTINSIDE; break; + case RP_MM: eVPos = SDRMEASURETEXT_VERTICALCENTERED; + eHPos = SDRMEASURE_TEXTINSIDE; break; + case RP_MB: eVPos = SDRMEASURE_BELOW; + eHPos = SDRMEASURE_TEXTINSIDE; break; + case RP_RT: eVPos = SDRMEASURE_ABOVE; + eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break; + case RP_RM: eVPos = SDRMEASURETEXT_VERTICALCENTERED; + eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break; + case RP_RB: eVPos = SDRMEASURE_BELOW; + eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break; + } + if( aTsbAutoPosH.GetState() == STATE_CHECK ) + eHPos = SDRMEASURE_TEXTHAUTO; + + if( aTsbAutoPosV.GetState() == STATE_CHECK ) + eVPos = SDRMEASURE_TEXTVAUTO; + + if ( rAttrs.GetItemState( SDRATTR_MEASURETEXTVPOS ) != SFX_ITEM_DONTCARE ) + { + eOldVPos = (SdrMeasureTextVPos) + ( ( const SdrMeasureTextVPosItem& )rOutAttrs.Get( SDRATTR_MEASURETEXTVPOS ) ).GetValue(); + if( eOldVPos != eVPos ) + { + rAttrs.Put( SdrMeasureTextVPosItem( eVPos ) ); + bModified = TRUE; + } + } + else + { + rAttrs.Put( SdrMeasureTextVPosItem( eVPos ) ); + bModified = TRUE; + } + + if ( rAttrs.GetItemState( SDRATTR_MEASURETEXTHPOS ) != SFX_ITEM_DONTCARE ) + { + eOldHPos = (SdrMeasureTextHPos) + ( ( const SdrMeasureTextHPosItem& )rOutAttrs.Get( SDRATTR_MEASURETEXTHPOS ) ).GetValue(); + if( eOldHPos != eHPos ) + { + rAttrs.Put( SdrMeasureTextHPosItem( eHPos ) ); + bModified = TRUE; + } + } + else + { + rAttrs.Put( SdrMeasureTextHPosItem( eHPos ) ); + bModified = TRUE; + } + } + + return( bModified ); +} + +/************************************************************************* +|* +|* The View have to set at the measure-object to be able to notify +|* unit and floatingpoint-values +|* +\************************************************************************/ + +void SvxMeasurePage::Construct() +{ + DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" ); + + aCtlPreview.pMeasureObj->SetModel( pView->GetModel() ); + aCtlPreview.Invalidate(); +} + +/************************************************************************* +|* +|* create the tabpage +|* +\************************************************************************/ + +SfxTabPage* SvxMeasurePage::Create( Window* pWindow, + const SfxItemSet& rAttrs ) +{ + return( new SvxMeasurePage( pWindow, rAttrs ) ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +USHORT* SvxMeasurePage::GetRanges() +{ + return( pRanges ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +void SvxMeasurePage::PointChanged( Window* pWindow, RECT_POINT /*eRP*/ ) +{ + ChangeAttrHdl_Impl( pWindow ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +IMPL_LINK( SvxMeasurePage, ClickAutoPosHdl_Impl, void *, p ) +{ + if( aTsbAutoPosH.GetState() == STATE_CHECK ) + { + switch( aCtlPosition.GetActualRP() ) + { + case RP_LT: + case RP_RT: + aCtlPosition.SetActualRP( RP_MT ); + break; + + case RP_LM: + case RP_RM: + aCtlPosition.SetActualRP( RP_MM ); + break; + + case RP_LB: + case RP_RB: + aCtlPosition.SetActualRP( RP_MB ); + break; + default: ;//prevent warning + } + } + if( aTsbAutoPosV.GetState() == STATE_CHECK ) + { + switch( aCtlPosition.GetActualRP() ) + { + case RP_LT: + case RP_LB: + aCtlPosition.SetActualRP( RP_LM ); + break; + + case RP_MT: + case RP_MB: + aCtlPosition.SetActualRP( RP_MM ); + break; + + case RP_RT: + case RP_RB: + aCtlPosition.SetActualRP( RP_RM ); + break; + default: ;//prevent warning + } + } + ChangeAttrHdl_Impl( p ); + + return( 0L ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +IMPL_LINK( SvxMeasurePage, ChangeAttrHdl_Impl, void *, p ) +{ + + if( p == &aMtrFldLineDist ) + { + INT32 nValue = GetCoreValue( aMtrFldLineDist, eUnit ); + aAttrSet.Put( SdrMeasureLineDistItem( nValue ) ); + } + + if( p == &aMtrFldHelplineOverhang ) + { + INT32 nValue = GetCoreValue( aMtrFldHelplineOverhang, eUnit ); + aAttrSet.Put( SdrMeasureHelplineOverhangItem( nValue) ); + } + + if( p == &aMtrFldHelplineDist ) + { + INT32 nValue = GetCoreValue( aMtrFldHelplineDist, eUnit ); + aAttrSet.Put( SdrMeasureHelplineDistItem( nValue) ); + } + + if( p == &aMtrFldHelpline1Len ) + { + INT32 nValue = GetCoreValue( aMtrFldHelpline1Len, eUnit ); + aAttrSet.Put( SdrMeasureHelpline1LenItem( nValue ) ); + } + + if( p == &aMtrFldHelpline2Len ) + { + INT32 nValue = GetCoreValue( aMtrFldHelpline2Len, eUnit ); + aAttrSet.Put( SdrMeasureHelpline2LenItem( nValue ) ); + } + + if( p == &aTsbBelowRefEdge ) + { + TriState eState = aTsbBelowRefEdge.GetState(); + if( eState != STATE_DONTKNOW ) + aAttrSet.Put( SdrMeasureBelowRefEdgeItem( (BOOL) STATE_CHECK == eState ) ); + } + + if( p == &aMtrFldDecimalPlaces ) + { + INT16 nValue = sal::static_int_cast< INT16 >( + aMtrFldDecimalPlaces.GetValue() ); + aAttrSet.Put( SdrMeasureDecimalPlacesItem( nValue ) ); + } + + if( p == &aTsbParallel ) + { + TriState eState = aTsbParallel.GetState(); + if( eState != STATE_DONTKNOW ) + aAttrSet.Put( SdrMeasureTextRota90Item( (BOOL) !STATE_CHECK == eState ) ); + } + + if( p == &aTsbShowUnit ) + { + TriState eState = aTsbShowUnit.GetState(); + if( eState != STATE_DONTKNOW ) + aAttrSet.Put( SdrMeasureShowUnitItem( (BOOL) STATE_CHECK == eState ) ); + } + + if( p == &aLbUnit ) + { + USHORT nPos = aLbUnit.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + USHORT nFieldUnit = (USHORT)(long)aLbUnit.GetEntryData( nPos ); + FieldUnit _eUnit = (FieldUnit) nFieldUnit; + aAttrSet.Put( SdrMeasureUnitItem( _eUnit ) ); + } + } + + if( p == &aTsbAutoPosV || p == &aTsbAutoPosH || p == &aCtlPosition ) + { + bPositionModified = TRUE; + + // Position + RECT_POINT eRP = aCtlPosition.GetActualRP(); + SdrMeasureTextVPos eVPos; + SdrMeasureTextHPos eHPos; + + switch( eRP ) + { + default: + case RP_LT: eVPos = SDRMEASURE_ABOVE; + eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break; + case RP_LM: eVPos = SDRMEASURETEXT_VERTICALCENTERED; + eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break; + case RP_LB: eVPos = SDRMEASURE_BELOW; + eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break; + case RP_MT: eVPos = SDRMEASURE_ABOVE; + eHPos = SDRMEASURE_TEXTINSIDE; break; + case RP_MM: eVPos = SDRMEASURETEXT_VERTICALCENTERED; + eHPos = SDRMEASURE_TEXTINSIDE; break; + case RP_MB: eVPos = SDRMEASURE_BELOW; + eHPos = SDRMEASURE_TEXTINSIDE; break; + case RP_RT: eVPos = SDRMEASURE_ABOVE; + eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break; + case RP_RM: eVPos = SDRMEASURETEXT_VERTICALCENTERED; + eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break; + case RP_RB: eVPos = SDRMEASURE_BELOW; + eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break; + } + + CTL_STATE nState = 0; + + if( aTsbAutoPosH.GetState() == STATE_CHECK ) + { + eHPos = SDRMEASURE_TEXTHAUTO; + nState = CS_NOHORZ; + } + + if( aTsbAutoPosV.GetState() == STATE_CHECK ) + { + eVPos = SDRMEASURE_TEXTVAUTO; + nState |= CS_NOVERT; + } + + if( p == &aTsbAutoPosV || p == &aTsbAutoPosH ) + aCtlPosition.SetState( nState ); + + aAttrSet.Put( SdrMeasureTextVPosItem( eVPos ) ); + aAttrSet.Put( SdrMeasureTextHPosItem( eHPos ) ); + } + + aCtlPreview.SetAttributes( aAttrSet ); + aCtlPreview.Invalidate(); + + return( 0L ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +void SvxMeasurePage::FillUnitLB() +{ + // fill ListBox with metrics + SvxStringArray aMetricArr( RID_SVXSTR_FIELDUNIT_TABLE ); + + long nUnit = FUNIT_NONE; + String aStrMetric( SVX_RES( STR_MEASURE_AUTOMATIC ) ); + USHORT nPos = aLbUnit.InsertEntry( aStrMetric ); + aLbUnit.SetEntryData( nPos, (void*)nUnit ); + + for( USHORT i = 0; i < aMetricArr.Count(); ++i ) + { + aStrMetric = aMetricArr.GetStringByPos( i ); + nUnit = aMetricArr.GetValue( i ); + nPos = aLbUnit.InsertEntry( aStrMetric ); + aLbUnit.SetEntryData( nPos, (void*)nUnit ); + } +} +void SvxMeasurePage::PageCreated (SfxAllItemSet aSet) //add CHINA001 +{ + SFX_ITEMSET_ARG (&aSet,pOfaPtrItem,OfaPtrItem,SID_OBJECT_LIST,sal_False); + + if (pOfaPtrItem) + SetView( static_cast(pOfaPtrItem->GetValue())); + + Construct(); +} + diff --git a/cui/source/tabpages/measure.hrc b/cui/source/tabpages/measure.hrc new file mode 100644 index 000000000000..b06a36775b3b --- /dev/null +++ b/cui/source/tabpages/measure.hrc @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: measure.hrc,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define FL_LINE 1 +#define FL_LABEL 2 +#define FL_VERT 3 + +#define FT_LINE_DIST 1 +#define FT_HELPLINE_OVERHANG 2 +#define FT_HELPLINE_DIST 3 +#define FT_HELPLINE1_LEN 4 +#define FT_HELPLINE2_LEN 5 +#define FT_POSITION 6 +#define FT_DECIMALPLACES 7 +#define MTR_LINE_DIST 1 +#define MTR_FLD_HELPLINE_OVERHANG 2 +#define MTR_FLD_HELPLINE_DIST 3 +#define MTR_FLD_HELPLINE1_LEN 4 +#define MTR_FLD_HELPLINE2_LEN 5 +#define MTR_FLD_DECIMALPLACES 6 +#define TSB_BELOW_REF_EDGE 1 +#define TSB_SHOW_UNIT 2 +#define TSB_AUTOPOSV 3 +#define TSB_AUTOPOSH 4 +#define TSB_PARALLEL 5 +#define CTL_POSITION 1 +#define CTL_PREVIEW 2 +#define LB_UNIT 1 + +#define STR_MEASURE_AUTOMATIC 1 diff --git a/cui/source/tabpages/measure.src b/cui/source/tabpages/measure.src new file mode 100644 index 000000000000..df394e4bdbe3 --- /dev/null +++ b/cui/source/tabpages/measure.src @@ -0,0 +1,310 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: measure.src,v $ + * $Revision: 1.30 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include +#include "measure.hrc" +#include "helpid.hrc" +#define DELTA 20 + // pragma ---------------------------------------------------------------- + + // RID_SVXPAGE_MEASURE --------------------------------------------------- +TabPage RID_SVXPAGE_MEASURE +{ + HelpId = HID_PAGE_MEASURE ; + Hide = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Text [ en-US ] = "Dimensioning" ; + + FixedLine FL_LINE + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 120 , 8 ) ; + Text [ en-US ] = "Line"; + }; + FixedText FT_LINE_DIST + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 65 , 8 ) ; + Text [ en-US ] = "Line ~distance" ; + }; + MetricField MTR_LINE_DIST + { + Border = TRUE ; + Pos = MAP_APPFONT ( 78 , 14 ) ; + Size = MAP_APPFONT ( 42 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Unit = FUNIT_MM ; + DecimalDigits = 2 ; + Minimum = -10000 ; + First = -10000 ; + Maximum = 10000 ; + Last = 10000 ; + SpinSize = 10 ; + }; + FixedText FT_HELPLINE_OVERHANG + { + Pos = MAP_APPFONT ( 12 , 32 ) ; + Size = MAP_APPFONT ( 65 , 8 ) ; + Text [ en-US ] = "Guide ~overhang" ; + }; + MetricField MTR_FLD_HELPLINE_OVERHANG + { + Border = TRUE ; + Pos = MAP_APPFONT ( 78 , 30 ) ; + Size = MAP_APPFONT ( 42 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Unit = FUNIT_MM ; + DecimalDigits = 2 ; + Minimum = -10000 ; + First = -10000 ; + Maximum = 10000 ; + Last = 10000 ; + SpinSize = 10 ; + }; + FixedText FT_HELPLINE_DIST + { + Pos = MAP_APPFONT ( 12 , 48 ) ; + Size = MAP_APPFONT ( 65 , 8 ) ; + Text [ en-US ] = "~Guide distance" ; + }; + MetricField MTR_FLD_HELPLINE_DIST + { + Border = TRUE ; + Pos = MAP_APPFONT ( 78 , 46 ) ; + Size = MAP_APPFONT ( 42 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Unit = FUNIT_MM ; + DecimalDigits = 2 ; + Minimum = -10000 ; + First = -10000 ; + Maximum = 10000 ; + Last = 10000 ; + SpinSize = 10 ; + }; + FixedText FT_HELPLINE1_LEN + { + Pos = MAP_APPFONT ( 12 , 64 ) ; + Size = MAP_APPFONT ( 65 , 8 ) ; + Text [ en-US ] = "~Left guide" ; + }; + MetricField MTR_FLD_HELPLINE1_LEN + { + Border = TRUE ; + Pos = MAP_APPFONT ( 78 , 62 ) ; + Size = MAP_APPFONT ( 42 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Unit = FUNIT_MM ; + DecimalDigits = 2 ; + Minimum = -10000 ; + First = -10000 ; + Maximum = 10000 ; + Last = 10000 ; + SpinSize = 10 ; + }; + FixedText FT_HELPLINE2_LEN + { + Pos = MAP_APPFONT ( 12 , 80 ) ; + Size = MAP_APPFONT ( 65 , 8 ) ; + Text [ en-US ] = "~Right guide" ; + }; + MetricField MTR_FLD_HELPLINE2_LEN + { + Border = TRUE ; + Pos = MAP_APPFONT ( 78 , 78 ) ; + Size = MAP_APPFONT ( 42 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Unit = FUNIT_MM ; + DecimalDigits = 2 ; + Minimum = -10000 ; + First = -10000 ; + Maximum = 10000 ; + Last = 10000 ; + SpinSize = 10 ; + }; + TriStateBox TSB_BELOW_REF_EDGE + { + Pos = MAP_APPFONT ( 12 , 96 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Measure ~below object"; + }; + FixedText FT_DECIMALPLACES + { + Pos = MAP_APPFONT ( 12 , 112 ) ; + Size = MAP_APPFONT ( 65 , 8 ) ; + + Text [ en-US ] = "Decimal places" ; + }; + MetricField MTR_FLD_DECIMALPLACES + { + Border = TRUE ; + Pos = MAP_APPFONT ( 78 , 110 ) ; + Size = MAP_APPFONT ( 42 , 12 ) ; + TabStop = TRUE ; + Right = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 99 ; + StrictFormat = TRUE ; + Last = 99 ; + SpinSize = 1 ; + }; + FixedLine FL_VERT + { + Pos = MAP_APPFONT ( 127 , 14 ) ; + Size = MAP_APPFONT ( 4 , 108 ) ; + Vert = TRUE ; + }; + FixedLine FL_LABEL + { + Pos = MAP_APPFONT ( 132 , 3 ) ; + Size = MAP_APPFONT ( 122 , 8 ) ; + Text [ en-US ] = "Legend"; + }; + FixedText FT_POSITION + { + Pos = MAP_APPFONT ( 138 , 14 ) ; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "~Text position" ; + }; + Control CTL_POSITION + { + HelpId = HID_MEASURE_CTL_POSITION ; + Border = TRUE ; + Pos = MAP_APPFONT ( 154 , 25 ) ; + Size = MAP_APPFONT ( 60 , 24 ) ; + TabStop = TRUE ; + }; + TriStateBox TSB_AUTOPOSV + { + Pos = MAP_APPFONT ( 154 , 54 ) ; + Size = MAP_APPFONT ( 101 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~AutoVertical" ; + }; + TriStateBox TSB_AUTOPOSH + { + Pos = MAP_APPFONT ( 154 , 68 ) ; + Size = MAP_APPFONT ( 101 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "A~utoHorizontal" ; + }; + TriStateBox TSB_PARALLEL + { + Pos = MAP_APPFONT ( 138 , 82 ) ; + Size = MAP_APPFONT ( 110 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Parallel to line"; + }; + TriStateBox TSB_SHOW_UNIT + { + Pos = MAP_APPFONT ( 138 , 96 ) ; + Size = MAP_APPFONT ( 64+40 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Show ~meas. units" ; + }; + ListBox LB_UNIT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 154 , 110 ) ; + Size = MAP_APPFONT ( 60 , 80+35 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + Control CTL_PREVIEW + { + HelpId = HID_MEASURE_CTL_PREVIEW ; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 132 ) ; + Size = MAP_APPFONT ( 248 , 47 ) ; + }; + String STR_MEASURE_AUTOMATIC + { + Text [ en-US ] = "Automatic" ; + }; +}; + // ********************************************************************** EOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx new file mode 100644 index 000000000000..1dbd8e46963d --- /dev/null +++ b/cui/source/tabpages/numfmt.cxx @@ -0,0 +1,1953 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: numfmt.cxx,v $ + * $Revision: 1.32.128.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if !ENABLE_LAYOUT_EXPERIMENTAL +//#undef ENABLE_LAYOUT +#endif + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include +#include +#include +#include + +#define _SVSTDARR_STRINGS +#define _SVSTDARR_STRINGSDTOR +#include +#include + +#define _SVX_NUMFMT_CXX + +#include +#include "numfmt.hrc" + +#include + +#include "numfmt.hxx" +#include +#include +#include //CHINA001 +#include //CHINA001 +#include +#include "svx/flagsdef.hxx" //CHINA001 + +#define NUMKEY_UNDEFINED SAL_MAX_UINT32 + +// static ---------------------------------------------------------------- + +static USHORT pRanges[] = +{ + SID_ATTR_NUMBERFORMAT_VALUE, + SID_ATTR_NUMBERFORMAT_INFO, + SID_ATTR_NUMBERFORMAT_NOLANGUAGE, + SID_ATTR_NUMBERFORMAT_NOLANGUAGE, + SID_ATTR_NUMBERFORMAT_ONE_AREA, + SID_ATTR_NUMBERFORMAT_ONE_AREA, + SID_ATTR_NUMBERFORMAT_SOURCE, + SID_ATTR_NUMBERFORMAT_SOURCE, + 0 +}; + +/************************************************************************* +#* Methode: SvxNumberPreviewImpl Datum:02.10.97 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberPreview +#* +#* Funktion: Konstruktor der Klasse SvxNumberPreviewImpl +#* +#* Input: Fenster, Resource-ID +#* +#* Output: --- +#* +#************************************************************************/ + +SvxNumberPreviewImpl::SvxNumberPreviewImpl( Window* pParent, const ResId& rResId ) : + + Window( pParent, rResId ) + +{ + Font aFont( GetFont() ); + aFont.SetTransparent( TRUE ); + aFont.SetColor( Application::GetSettings().GetStyleSettings().GetFieldColor() ); + SetFont( aFont ); + InitSettings( TRUE, TRUE ); + SetBorderStyle( WINDOW_BORDER_MONO ); +} + +/************************************************************************* +#* Methode: SvxNumberPreviewImpl Datum:02.10.97 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberPreview +#* +#* Funktion: Destruktor der Klasse SvxNumberPreviewImpl +#* +#* Input: --- +#* +#* Output: --- +#* +#************************************************************************/ + +SvxNumberPreviewImpl::~SvxNumberPreviewImpl() +{ +} + +/************************************************************************* +#* Methode: NotifyChange Datum:02.10.97 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberPreviewImpl +#* +#* Funktion: Funktion fuer das Aendern des Preview- Strings +#* +#* Input: String, Farbe +#* +#* Output: --- +#* +#************************************************************************/ + +void SvxNumberPreviewImpl::NotifyChange( const String& rPrevStr, + const Color* pColor ) +{ + aPrevStr = rPrevStr; + svtools::ColorConfig aColorConfig; + Color aWindowTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); + aPrevCol = pColor ? *pColor : aWindowTextColor; + Invalidate(); + Update(); +} + +/************************************************************************* +#* Methode: Paint Datum:02.10.97 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberPreviewImpl +#* +#* Funktion: Funktion fuer das neu zeichnen des Fensters. +#* +#* Input: --- +#* +#* Output: --- +#* +#************************************************************************/ + +void SvxNumberPreviewImpl::Paint( const Rectangle& ) +{ + Font aDrawFont = GetFont(); + Size aSzWnd = GetOutputSizePixel(); + Point aPosText = Point( (aSzWnd.Width() - GetTextWidth( aPrevStr )) /2, + (aSzWnd.Height() - GetTextHeight())/2 ); + + aDrawFont.SetColor( aPrevCol ); + SetFont( aDrawFont ); + DrawText( aPosText, aPrevStr ); +} + +// ----------------------------------------------------------------------- + +void SvxNumberPreviewImpl::InitSettings( BOOL bForeground, BOOL bBackground ) +{ + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + + if ( bForeground ) + { + svtools::ColorConfig aColorConfig; + Color aTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); + + if ( IsControlForeground() ) + aTextColor = GetControlForeground(); + SetTextColor( aTextColor ); + } + + if ( bBackground ) + { + if ( IsControlBackground() ) + SetBackground( GetControlBackground() ); + else + SetBackground( rStyleSettings.GetWindowColor() ); + } + Invalidate(); +} + +// ----------------------------------------------------------------------- + +void SvxNumberPreviewImpl::StateChanged( StateChangedType nType ) +{ + if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) + InitSettings( TRUE, FALSE ); + else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) + InitSettings( FALSE, TRUE ); + + Window::StateChanged( nType ); +} + +// ----------------------------------------------------------------------- + +void SvxNumberPreviewImpl::DataChanged( const DataChangedEvent& rDCEvt ) +{ + Window::DataChanged( rDCEvt ); + + if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) + InitSettings( TRUE, TRUE ); +} + +// class SvxNumberFormatTabPage ------------------------------------------ + +#define REMOVE_DONTKNOW() \ + if ( !aFtLanguage.IsEnabled() ) \ + { \ + aFtLanguage .Enable(); \ + aLbLanguage .Enable(); \ + aLbLanguage .SelectLanguage( pNumFmtShell->GetCurLanguage() ); \ + } + +#define HDL(hdl) LINK( this, SvxNumberFormatTabPage, hdl ) + +#include + +#if ENABLE_LAYOUT +#undef SVX_RES +#define SVX_RES(x) #x +#define SVX_RES_PLAIN(x) ResId (x, DIALOG_MGR ()) +#define THIS_SVX_RES(x) this, #x +#undef SfxTabPage +#define SfxTabPage( parent, id, args ) SfxTabPage( parent, "number-format.xml", id, &args ) +#else /* !ENABLE_LAYOUT */ +#define SVX_RES_PLAIN SVX_RES +#define THIS_SVX_RES SVX_RES +#endif /* !ENABLE_LAYOUT */ + +SvxNumberFormatTabPage::SvxNumberFormatTabPage( Window* pParent, + const SfxItemSet& rCoreAttrs ) + + : SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_NUMBERFORMAT ), rCoreAttrs ), + + aFtCategory ( this, SVX_RES( FT_CATEGORY ) ), + aLbCategory ( this, SVX_RES( LB_CATEGORY ) ), + aFtFormat ( this, SVX_RES( FT_FORMAT ) ), + aLbCurrency ( this, SVX_RES( LB_CURRENCY) ), + aLbFormat ( this, SVX_RES( LB_FORMAT ) ), + aFtLanguage ( this, SVX_RES( FT_LANGUAGE ) ), + aLbLanguage ( this, SVX_RES( LB_LANGUAGE ), FALSE ), + aCbSourceFormat ( this, SVX_RES( CB_SOURCEFORMAT ) ), + aFtDecimals ( this, SVX_RES( FT_DECIMALS ) ), + aEdDecimals ( this, SVX_RES( ED_DECIMALS ) ), + aFtLeadZeroes ( this, SVX_RES( FT_LEADZEROES ) ), + aEdLeadZeroes ( this, SVX_RES( ED_LEADZEROES ) ), + aBtnNegRed ( this, SVX_RES( BTN_NEGRED ) ), + aBtnThousand ( this, SVX_RES( BTN_THOUSAND ) ), + aFlOptions ( this, SVX_RES( FL_OPTIONS ) ), + + aFtEdFormat ( this, SVX_RES( FT_EDFORMAT ) ), + aEdFormat ( this, SVX_RES( ED_FORMAT ) ), + aIbAdd ( this, SVX_RES( IB_ADD ) ), + aIbInfo ( this, SVX_RES( IB_INFO ) ), + aIbRemove ( this, SVX_RES( IB_REMOVE ) ), + aFtComment ( this, SVX_RES( FT_COMMENT ) ), + aEdComment ( this, SVX_RES( ED_COMMENT ) ), + +#if ENABLE_LAYOUT + aWndPreview ( LAYOUT_THIS_WINDOW(this), SVX_RES_PLAIN( WND_NUMBER_PREVIEW ) ), +#else + aWndPreview ( this, SVX_RES_PLAIN( WND_NUMBER_PREVIEW ) ), +#endif + pNumItem ( NULL ), + pNumFmtShell ( NULL ), + nInitFormat ( ULONG_MAX ), + + sAutomaticEntry ( THIS_SVX_RES( STR_AUTO_ENTRY)), + pLastActivWindow( NULL ) +{ +#if ENABLE_LAYOUT + aLbFormat.Clear (); +#endif /* ENABLE_LAYOUT */ + + Init_Impl(); + SetExchangeSupport(); // diese Page braucht ExchangeSupport + FreeResource(); + nFixedCategory=-1; +} + +SvxNumberFormatTabPage::~SvxNumberFormatTabPage() +{ + delete pNumFmtShell; + delete pNumItem; +} + +void SvxNumberFormatTabPage::Init_Impl() +{ + ImageList aIconList( SVX_RES_PLAIN ( IL_ICON ) ); + ImageList aIconListHC( SVX_RES_PLAIN ( IL_ICON_HC ) ); + + bNumItemFlag=TRUE; + bOneAreaFlag=FALSE; + + nCatHeight=aLbCategory.GetSizePixel().Height(); + + nCurFormatY =aLbFormat.GetPosPixel().Y(); + nCurFormatHeight=aLbFormat.GetSizePixel().Height(); + nStdFormatY =aLbCurrency.GetPosPixel().Y(); + nStdFormatHeight=nCurFormatY-nStdFormatY+nCurFormatHeight; + + aIbAdd. SetModeImage( aIconList.GetImage( IID_ADD ) ); + aIbAdd. SetModeImage( aIconListHC.GetImage( IID_ADD ), BMP_COLOR_HIGHCONTRAST ); + + aIbRemove. SetModeImage( aIconList.GetImage( IID_REMOVE ) ); + aIbRemove. SetModeImage( aIconListHC.GetImage( IID_REMOVE ), BMP_COLOR_HIGHCONTRAST ); + + aIbInfo. SetModeImage( aIconList.GetImage( IID_INFO ) ); + aIbInfo. SetModeImage( aIconListHC.GetImage( IID_INFO ), BMP_COLOR_HIGHCONTRAST ); + + aIbAdd.Enable(FALSE ); + aIbRemove.Enable(FALSE ); + aIbInfo.Enable(FALSE ); + + aEdComment.SetText(aLbCategory.GetEntry(1)); //String fuer Benutzerdefiniert + //holen + aEdComment.Hide(); + + aCbSourceFormat.Check( FALSE ); + aCbSourceFormat.Disable(); + aCbSourceFormat.Hide(); + +// Handler verbinden + Link aLink = LINK( this, SvxNumberFormatTabPage, SelFormatHdl_Impl ); + + aLbCategory .SetSelectHdl( aLink ); + aLbFormat .SetSelectHdl( aLink ); + aLbLanguage .SetSelectHdl( aLink ); + aLbCurrency .SetSelectHdl( aLink ); + aCbSourceFormat .SetClickHdl( aLink ); + + aLink = LINK( this, SvxNumberFormatTabPage, OptHdl_Impl ); + + aEdDecimals .SetModifyHdl( aLink ); + aEdLeadZeroes .SetModifyHdl( aLink ); + aBtnNegRed .SetClickHdl( aLink ); + aBtnThousand .SetClickHdl( aLink ); + aLbFormat .SetDoubleClickHdl( HDL( DoubleClickHdl_Impl ) ); + aEdFormat .SetModifyHdl( HDL( EditHdl_Impl ) ); + aIbAdd.SetClickHdl( HDL( ClickHdl_Impl ) ); + aIbRemove.SetClickHdl( HDL( ClickHdl_Impl ) ); + aIbInfo.SetClickHdl( HDL( ClickHdl_Impl ) ); + + aLink = LINK( this, SvxNumberFormatTabPage, LostFocusHdl_Impl); + + aEdComment .SetLoseFocusHdl( aLink); + aResetWinTimer .SetTimeoutHdl(LINK( this, SvxNumberFormatTabPage, TimeHdl_Impl)); + aResetWinTimer .SetTimeout( 10); + + // Sprachen-ListBox initialisieren + + aLbLanguage.InsertLanguage( LANGUAGE_SYSTEM ); + // Don't list ambiguous locales where we won't be able to convert the + // LanguageType back to an identical Language_Country name and therefore + // couldn't load the i18n LocaleData. Show DebugMsg in non-PRODUCT version. + ::com::sun::star::uno::Sequence< sal_uInt16 > xLang = + LocaleDataWrapper::getInstalledLanguageTypes(); + sal_Int32 nCount = xLang.getLength(); + for ( sal_Int32 i=0; iGetValue()) + { + HideLanguage(); + } + else + { + HideLanguage(FALSE); + } + + } + + eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_INFO ),TRUE,&pItem); + + if(eState==SFX_ITEM_SET) + { + if(pNumItem==NULL) + { + bNumItemFlag=TRUE; + pNumItem= (SvxNumberInfoItem *) pItem->Clone(); + } + else + { + bNumItemFlag=FALSE; + } + } + else + { + bNumItemFlag=FALSE; + } + + + eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_ONE_AREA )); + + if(eState==SFX_ITEM_SET) + { + const SfxBoolItem* pBoolItem = (const SfxBoolItem*) + GetItem( rSet, SID_ATTR_NUMBERFORMAT_ONE_AREA); + + if(pBoolItem!=NULL) + { + bOneAreaFlag= pBoolItem->GetValue(); + } + } + //bOneAreaFlag=TRUE; //@@ Debug-Test + + eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_SOURCE ) ); + + if ( eState == SFX_ITEM_SET ) + { + const SfxBoolItem* pBoolItem = (const SfxBoolItem*) + GetItem( rSet, SID_ATTR_NUMBERFORMAT_SOURCE ); + if ( pBoolItem ) + aCbSourceFormat.Check( pBoolItem->GetValue() ); + else + aCbSourceFormat.Check( FALSE ); + aCbSourceFormat.Enable(); + aCbSourceFormat.Show(); + } + else + { + BOOL bInit = FALSE; // set to TRUE for debug test + aCbSourceFormat.Check( bInit ); + aCbSourceFormat.Enable( bInit ); + aCbSourceFormat.Show( bInit ); + } + + // pNumItem muss von aussen gesetzt worden sein! + DBG_ASSERT( pNumItem, "No NumberInfo, no NumberFormatter, good bye.CRASH. :-(" ); + + // aktuellen Zahlenformat-Tabellenindex holen + eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_VALUE ) ); + + if ( SFX_ITEM_DONTCARE != eState ) + pValFmtAttr = (const SfxUInt32Item*) + GetItem( rSet, SID_ATTR_NUMBERFORMAT_VALUE ); + + eValType = pNumItem->GetValueType(); + + switch ( eValType ) + { + case SVX_VALUE_TYPE_STRING: + aValString = pNumItem->GetValueString(); + break; + case SVX_VALUE_TYPE_NUMBER: + // #50441# string may be set in addition to the value + aValString = pNumItem->GetValueString(); + nValDouble = pNumItem->GetValueDouble(); + break; + case SVX_VALUE_TYPE_UNDEFINED: + default: + break; + } + + // nun sind alle Informationen fuer die Formatierer-Shell beisammen: + + if ( pNumFmtShell ) + delete pNumFmtShell; // ggF. alte Shell loeschen (==Reset) + + nInitFormat = ( pValFmtAttr ) // Init-Key merken + ? pValFmtAttr->GetValue() // (fuer FillItemSet()) + : ULONG_MAX; // == DONT_KNOW + + + if ( eValType == SVX_VALUE_TYPE_STRING ) + pNumFmtShell =SvxNumberFormatShell::Create( + pNumItem->GetNumberFormatter(), + (pValFmtAttr) ? nInitFormat : 0L, + eValType, + aValString ); + else + pNumFmtShell =SvxNumberFormatShell::Create( + pNumItem->GetNumberFormatter(), + (pValFmtAttr) ? nInitFormat : 0L, + eValType, + nValDouble, + &aValString ); + + FillCurrencyBox(); + + String aPrevString; + Color* pDummy = NULL; + pNumFmtShell->GetInitSettings( nCatLbSelPos, eLangType, nFmtLbSelPos, + aFmtEntryList, aPrevString, pDummy ); + + aLbCurrency.SelectEntryPos((USHORT)pNumFmtShell->GetCurrencySymbol()); + + nFixedCategory=nCatLbSelPos; + if(bOneAreaFlag) + { + String sFixedCategory=aLbCategory.GetEntry(nFixedCategory); + aLbCategory.Clear(); + aLbCategory.InsertEntry(sFixedCategory); + SetCategory(0); + } + else + { + SetCategory(nCatLbSelPos ); + } + eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_ADD_AUTO ) ); + if(SFX_ITEM_SET == eState) + pAutoEntryAttr = (const SfxBoolItem*) + GetItem( rSet, SID_ATTR_NUMBERFORMAT_ADD_AUTO ); + // no_NO is an alias for nb_NO and normally isn't listed, we need it for + // backwards compatibility, but only if the format passed is of + // LanguageType no_NO. + if ( eLangType == LANGUAGE_NORWEGIAN ) + { + aLbLanguage.RemoveLanguage( eLangType ); // in case we're already called + aLbLanguage.InsertLanguage( eLangType ); + } + aLbLanguage.SelectLanguage( eLangType ); + if(pAutoEntryAttr) + AddAutomaticLanguage_Impl(eLangType, pAutoEntryAttr->GetValue()); + UpdateFormatListBox_Impl(FALSE,TRUE); + +//! erAck 26.01.01 +//! This spoils everything because it rematches currency formats based on +//! the selected aLbCurrency entry instead of the current format. +//! Besides that everything seems to be initialized by now, so why call it? +// SelFormatHdl_Impl( &aLbCategory ); + + if ( pValFmtAttr ) + { + EditHdl_Impl( &aEdFormat ); // UpdateOptions_Impl() als Seiteneffekt + } + else // DONT_KNOW + { + // Kategoriewechsel und direkte Eingabe sind moeglich, sonst nix: + Obstructing(); + } + + if ( aCbSourceFormat.IsChecked() ) + { + // everything disabled except SourceFormat checkbox + EnableBySourceFormat_Impl(); + } + + DeleteEntryList_Impl(aFmtEntryList); +} + +/************************************************************************* +#* Methode: Obstructing Datum:02.10.97 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberFormatTabPage +#* +#* Funktion: Sperren der Controls mit Ausnahme von Kategoriewechsel +#* und direkter Eingabe. +#* +#* Input: --- +#* +#* Output: --- +#* +#************************************************************************/ +void SvxNumberFormatTabPage::Obstructing() +{ + aLbFormat .SetNoSelection(); + aLbLanguage .SetNoSelection(); + aFtLanguage .Disable(); + aLbLanguage .Disable(); + + aIbAdd.Enable(FALSE ); + aIbRemove.Enable(FALSE ); + aIbInfo.Enable(FALSE ); + + aBtnNegRed .Disable(); + aBtnThousand .Disable(); + aFtLeadZeroes .Disable(); + aFtDecimals .Disable(); + aEdLeadZeroes .Disable(); + aEdDecimals .Disable(); + aFlOptions .Disable(); + aEdDecimals .SetText( String() ); + aEdLeadZeroes .SetText( String() ); + aBtnNegRed .Check( FALSE ); + aBtnThousand .Check( FALSE ); + aWndPreview .NotifyChange( String() ); + + aLbCategory .SelectEntryPos( 0 ); + aEdFormat .SetText( String() ); + aFtComment .SetText( String() ); + aEdComment .SetText(aLbCategory.GetEntry(1)); //String fuer Benutzerdefiniert + //holen + + aEdFormat .GrabFocus(); +} + + +/************************************************************************* +#* Enable/Disable dialog parts depending on the value of the SourceFormat +#* checkbox. +#************************************************************************/ +void SvxNumberFormatTabPage::EnableBySourceFormat_Impl() +{ + BOOL bEnable = !aCbSourceFormat.IsChecked(); + if ( !bEnable ) + aCbSourceFormat.GrabFocus(); + aFtCategory .Enable( bEnable ); + aLbCategory .Enable( bEnable ); + aFtFormat .Enable( bEnable ); + aLbCurrency .Enable( bEnable ); + aLbFormat .Enable( bEnable ); + aFtLanguage .Enable( bEnable ); + aLbLanguage .Enable( bEnable ); + aFtDecimals .Enable( bEnable ); + aEdDecimals .Enable( bEnable ); + aFtLeadZeroes .Enable( bEnable ); + aEdLeadZeroes .Enable( bEnable ); + aBtnNegRed .Enable( bEnable ); + aBtnThousand .Enable( bEnable ); + aFlOptions .Enable( bEnable ); + aFtEdFormat .Enable( bEnable ); + aEdFormat .Enable( bEnable ); + aIbAdd .Enable( bEnable ); + aIbRemove .Enable( bEnable ); + aIbInfo .Enable( bEnable ); + aFtComment .Enable( bEnable ); + aEdComment .Enable( bEnable ); + aLbFormat.Invalidate(); // #i43322# +} + + +/************************************************************************* +#* Methode: HideLanguage Datum:14.05.98 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberFormatTabPage +#* +#* Funktion: Versteckt die Spracheinstellung: +#* +#* Input: BOOL nFlag +#* +#* Output: --- +#* +#************************************************************************/ + +void SvxNumberFormatTabPage::HideLanguage(BOOL nFlag) +{ + Size aSize=aLbCategory.GetSizePixel(); + + if(nFlag) + { + aSize.Height()=aLbFormat.GetSizePixel().Height(); + } + else + { + aSize.Height()=nCatHeight; + } + + aLbCategory.SetSizePixel(aSize); + + aFtLanguage.Show(!nFlag); + aLbLanguage.Show(!nFlag); +} + +/************************************************************************* +#* Methode: FillItemSet Datum:02.10.97 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberFormatTabPage +#* +#* Funktion: Stellt die Attribute im ItemSet ein, +#* sowie in der DocShell den numItem, wenn +#* bNumItemFlag nicht gesetzt ist. +#* +#* Input: SfxItemSet +#* +#* Output: --- +#* +#************************************************************************/ + +BOOL SvxNumberFormatTabPage::FillItemSet( SfxItemSet& rCoreAttrs ) +{ + BOOL bDataChanged = aFtLanguage.IsEnabled() || aCbSourceFormat.IsEnabled(); + if ( bDataChanged ) + { + const SfxItemSet& rMyItemSet = GetItemSet(); + USHORT nWhich = GetWhich( SID_ATTR_NUMBERFORMAT_VALUE ); + SfxItemState eItemState = rMyItemSet.GetItemState( nWhich, FALSE ); + + // OK chosen - Is format code input entered already taken over? + // If not, simulate Add. Upon syntax error ignore input and prevent Put. + String aFormat = aEdFormat.GetText(); + sal_uInt32 nCurKey = pNumFmtShell->GetCurNumFmtKey(); + + if ( aIbAdd.IsEnabled() || pNumFmtShell->IsTmpCurrencyFormat(aFormat) ) + { // #79599# It is not sufficient to just add the format code (or + // delete it in case of bOneAreaFlag and resulting category change). + // Upon switching tab pages we need all settings to be consistent + // in case this page will be redisplayed later. + bDataChanged = (ClickHdl_Impl( &aIbAdd ) != 0); + nCurKey = pNumFmtShell->GetCurNumFmtKey(); + } + else if(nCurKey == NUMKEY_UNDEFINED) + { // something went wrong, e.g. in Writer #70281# + pNumFmtShell->FindEntry(aFormat, &nCurKey); + } + + //--------------------------------------------------------------- + // Chosen format: + // -------------- + if ( bDataChanged ) + { + bDataChanged = ( nInitFormat != nCurKey ); + + if (bDataChanged) + { + rCoreAttrs.Put( SfxUInt32Item( nWhich, nCurKey ) ); + } + else if(SFX_ITEM_DEFAULT == eItemState) + { + rCoreAttrs.ClearItem( nWhich ); + } + } + + // -------------------------------------------------------------- + // List of changed user defined formats: + // ------------------------------------- + const sal_uInt32 nDelCount = pNumFmtShell->GetUpdateDataCount(); + + if ( nDelCount > 0 ) + { + sal_uInt32* pDelArr = new sal_uInt32[nDelCount]; + + pNumFmtShell->GetUpdateData( pDelArr, nDelCount ); + pNumItem->SetDelFormatArray( pDelArr, nDelCount ); + + if(bNumItemFlag==TRUE) + { + rCoreAttrs.Put( *pNumItem ); + } + else + { + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + + DBG_ASSERT( pDocSh, "DocShell not found!" ); + + + if ( pDocSh ) + pDocSh->PutItem( *pNumItem ); + } + delete [] pDelArr; + } + + //--------------------------------------------------------------- + // Whether source format is to be taken or not: + // -------------------------------------------- + if ( aCbSourceFormat.IsEnabled() ) + { + USHORT _nWhich = GetWhich( SID_ATTR_NUMBERFORMAT_SOURCE ); + SfxItemState _eItemState = rMyItemSet.GetItemState( _nWhich, FALSE ); + const SfxBoolItem* pBoolItem = (const SfxBoolItem*) + GetItem( rMyItemSet, SID_ATTR_NUMBERFORMAT_SOURCE ); + BOOL bOld = (pBoolItem ? pBoolItem->GetValue() : FALSE); + rCoreAttrs.Put( SfxBoolItem( _nWhich, aCbSourceFormat.IsChecked() ) ); + if ( !bDataChanged ) + bDataChanged = (bOld != (BOOL) aCbSourceFormat.IsChecked() || + _eItemState != SFX_ITEM_SET); + } + + // FillItemSet is only called on OK, here we can notify the + // NumberFormatShell that all new user defined formats are valid. + pNumFmtShell->ValidateNewEntries(); + if(aLbLanguage.IsVisible() && + LISTBOX_ENTRY_NOTFOUND != aLbLanguage.GetEntryPos(sAutomaticEntry)) + rCoreAttrs.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ADD_AUTO, + aLbLanguage.GetSelectEntry() == sAutomaticEntry)); + } + + return bDataChanged; +} + + +int SvxNumberFormatTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ +/* if ( (ULONG_MAX != nInitFormat) && _pSet ) + { + const ULONG nCurKey = pNumFmtShell->GetCurNumFmtKey(); + const USHORT nWhich = GetWhich( SID_ATTR_NUMBERFORMAT_VALUE ); + SfxItemState eItemState = GetItemSet().GetItemState( nWhich, FALSE ); + + if ( (nInitFormat == nCurKey) && (SFX_ITEM_DEFAULT == eItemState) ) + _pSet->ClearItem( nWhich ); + else + _pSet->Put( SfxUInt32Item( nWhich, nCurKey ) ); + } + */ + if ( _pSet ) + FillItemSet( *_pSet ); + return LEAVE_PAGE; +} + +void SvxNumberFormatTabPage::SetInfoItem( const SvxNumberInfoItem& rItem ) +{ + if(pNumItem==NULL) + { + pNumItem = (SvxNumberInfoItem*)rItem.Clone(); + } +} + +void SvxNumberFormatTabPage::FillFormatListBox_Impl( SvxDelStrgs& rEntries ) +{ + String* pEntry; + String aTmpString; + String aTmpCatString; + Font aFont=aLbCategory.GetFont(); + USHORT i = 0; + short nTmpCatPos; + short aPrivCat; + + aLbFormat.Clear(); + aLbFormat.SetUpdateMode( FALSE ); + + USHORT nCount = rEntries.Count(); + + if(nCount<1) return; + + if(bOneAreaFlag) + { + nTmpCatPos=nFixedCategory; + } + else + { + nTmpCatPos=aLbCategory.GetSelectEntryPos(); + } + + switch (nTmpCatPos) + { + case CAT_ALL: + case CAT_TEXT: + case CAT_NUMBER: i=1; + pEntry=rEntries[0]; + if(pEntry!=NULL) + { + if (nTmpCatPos == CAT_TEXT) + aTmpString=*pEntry; + else + aTmpString = pNumFmtShell->GetStandardName(); + aPrivCat=pNumFmtShell->GetCategory4Entry(0); + aLbFormat.InsertFontEntry( aTmpString, aFont ); + } + break; + + default: break; + } + + if(pNumFmtShell!=NULL) + { + for ( ; i < nCount; ++i ) + { + pEntry = rEntries[i]; + aPrivCat=pNumFmtShell->GetCategory4Entry(i); + if(aPrivCat!=CAT_TEXT) + { + Color* pPreviewColor = NULL; + String aPreviewString( GetExpColorString( pPreviewColor, *pEntry, aPrivCat ) ); + Font aEntryFont( aLbFormat.GetFont() ); + aLbFormat.InsertFontEntry( aPreviewString, aEntryFont, pPreviewColor ); + } + else + { + aLbFormat.InsertFontEntry(*pEntry,aFont); + } + } + } + aLbFormat.SetUpdateMode( TRUE ); + DeleteEntryList_Impl(rEntries); +} + + +/************************************************************************* +#* Methode: DeleteEntryList_Impl Datum:02.10.97 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberFormatTabPage +#* +#* Funktion: Loescht eine SvStrings- Liste +#* +#* Input: String-liste +#* +#* Output: --- +#* +#************************************************************************/ + +void SvxNumberFormatTabPage::DeleteEntryList_Impl( SvxDelStrgs& rEntries ) +{ + USHORT nCount = rEntries.Count(); + rEntries.DeleteAndDestroy(0,nCount); +} + + +/************************************************************************* +#* Methode: UpdateOptions_Impl Datum:02.10.97 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberFormatTabPage +#* +#* Funktion: Stellt je nach eingestelltem Format die Options- +#* attribute neu ein. +#* +#* Input: Flag, ob sich die Kategorie geaendert hat. +#* +#* Output: --- +#* +#***?********************************************************************/ + +void SvxNumberFormatTabPage::UpdateOptions_Impl( BOOL bCheckCatChange /*= FALSE*/ ) +{ + SvxDelStrgs aEntryList; + String theFormat = aEdFormat.GetText(); + USHORT nCurCategory = aLbCategory.GetSelectEntryPos(); + USHORT nCategory = nCurCategory; + USHORT nDecimals = 0; + USHORT nZeroes = 0; + BOOL bNegRed = FALSE; + BOOL bThousand = FALSE; + short nTmpCatPos; + USHORT nCurrencyPos =aLbCurrency.GetSelectEntryPos(); + + if(bOneAreaFlag) + { + nTmpCatPos=nFixedCategory; + nCurCategory=nFixedCategory; + } + else + { + nTmpCatPos=nCurCategory; + } + + + pNumFmtShell->GetOptions( theFormat, + bThousand, bNegRed, + nDecimals, nZeroes, + nCategory ); + BOOL bDoIt=FALSE; + if(nCategory==CAT_CURRENCY) + { + USHORT nTstPos=pNumFmtShell->FindCurrencyFormat(theFormat); + if(nCurrencyPos!=nTstPos && nTstPos!=(USHORT)-1) + { + aLbCurrency.SelectEntryPos(nTstPos); + pNumFmtShell->SetCurrencySymbol(nTstPos); + bDoIt=TRUE; + } + } + + + + if ( nCategory != nCurCategory || bDoIt) + { + if ( bCheckCatChange ) + { + if(bOneAreaFlag) + SetCategory(0); + else + SetCategory(nCategory ); + + UpdateFormatListBox_Impl( TRUE, FALSE ); + } + } + else if ( aLbFormat.GetEntryCount() > 0 ) + { + sal_uInt32 nCurEntryKey=NUMKEY_UNDEFINED; + if(!pNumFmtShell->FindEntry( aEdFormat.GetText(),&nCurEntryKey)) + { + aLbFormat.SetNoSelection(); + } + } + if(bOneAreaFlag) + { + nCategory=nFixedCategory; + } + + switch ( nCategory ) + { + case CAT_NUMBER: + case CAT_PERCENT: + case CAT_CURRENCY: + aFlOptions.Enable(); + aFtDecimals.Enable(); + aEdDecimals.Enable(); + aFtLeadZeroes.Enable(); + aEdLeadZeroes.Enable(); + aBtnNegRed.Enable(); + aBtnThousand.Enable(); + /* + aEdDecimals .SetValue( nDecimals ); + aEdLeadZeroes.SetValue( nZeroes ); + */ + aEdDecimals .SetText( UniString::CreateFromInt32( nDecimals ) ); + aEdLeadZeroes.SetText( UniString::CreateFromInt32( nZeroes ) ); + aBtnNegRed .Check( bNegRed ); + aBtnThousand .Check( bThousand ); + break; + + case CAT_ALL: + case CAT_USERDEFINED: + case CAT_TEXT: + case CAT_DATE: + case CAT_TIME: + case CAT_BOOLEAN: + case CAT_SCIENTIFIC: + case CAT_FRACTION: + default: + aFlOptions .Disable(); + aFtDecimals .Disable(); + aEdDecimals .Disable(); + aFtLeadZeroes .Disable(); + aEdLeadZeroes .Disable(); + aBtnNegRed .Disable(); + aBtnThousand .Disable(); + aEdDecimals .SetText( UniString::CreateFromInt32( 0 ) ); + aEdLeadZeroes .SetText( UniString::CreateFromInt32( 0 ) ); + aBtnNegRed .Check( FALSE ); + aBtnThousand .Check( FALSE ); + } +} + + +/************************************************************************* +#* Methode: UpdateFormatListBox_Impl Datum:02.10.97 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberFormatTabPage +#* +#* Funktion: Aktualisiert die Format- Listbox und zusaetzlich +#* wird abhaengig vom bUpdateEdit- Flag der String +#* in der Editbox geaendert. +#* +#* Input: Flags fuer Kategorie und Editbox +#* +#* Output: --- +#* +#************************************************************************/ + +void SvxNumberFormatTabPage::UpdateFormatListBox_Impl + ( + USHORT bCat, // Category oder Land/Sprache ListBox? + BOOL bUpdateEdit // Format-Edit aktualisieren? + ) +{ + SvxDelStrgs aEntryList; + short nFmtLbSelPos = 0; + short nTmpCatPos; + + if(bOneAreaFlag) + { + nTmpCatPos=nFixedCategory; + } + else + { + nTmpCatPos=aLbCategory.GetSelectEntryPos(); + } + + + if ( bCat ) + { + Point aPos=aLbFormat.GetPosPixel(); + Size aSize=aLbFormat.GetSizePixel(); + + if(nTmpCatPos!=CAT_CURRENCY) + { + aPos.Y()=nStdFormatY; + aSize.Height()=nStdFormatHeight; + aLbFormat.SetPosSizePixel(aPos,aSize); +#if ENABLE_LAYOUT + aLbCurrency.Disable(); +#else /* !ENABLE_LAYOUT */ + aLbCurrency.Hide(); +#endif /* !ENABLE_LAYOUT */ + } + else + { + aPos.Y()=nCurFormatY; + aSize.Height()=nCurFormatHeight; + aLbFormat.SetPosSizePixel(aPos,aSize); +#if ENABLE_LAYOUT + aLbCurrency.Enable(); +#else /* !ENABLE_LAYOUT */ + aLbCurrency.Show(); +#endif /* !ENABLE_LAYOUT */ + } + + pNumFmtShell->CategoryChanged( nTmpCatPos,nFmtLbSelPos, aEntryList ); + } + else + pNumFmtShell->LanguageChanged( aLbLanguage.GetSelectLanguage(), + nFmtLbSelPos,aEntryList ); + + REMOVE_DONTKNOW() // ggF. UI-Enable + + + if ( (aEntryList.Count() > 0) && (nFmtLbSelPos != SELPOS_NONE) ) + { + if(bUpdateEdit) + { + String aFormat=*aEntryList[nFmtLbSelPos]; + aEdFormat.SetText(aFormat); + aFtComment.SetText(pNumFmtShell->GetComment4Entry(nFmtLbSelPos)); + + //@23.09.97 aEdFormat.SetText( aLbFormat.GetSelectEntry() ); + } + + if(!bOneAreaFlag || !bCat) + { + FillFormatListBox_Impl( aEntryList ); + aLbFormat.SelectEntryPos( nFmtLbSelPos ); + + aFtComment.SetText(pNumFmtShell->GetComment4Entry(nFmtLbSelPos)); + if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos)) + { + if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).Len()==0) + { + aFtComment.SetText(aLbCategory.GetEntry(1)); + } + } + ChangePreviewText( (USHORT)nFmtLbSelPos ); + } + + } + else + { + FillFormatListBox_Impl( aEntryList ); + if(nFmtLbSelPos != SELPOS_NONE) + { + aLbFormat.SelectEntryPos( (USHORT)nFmtLbSelPos ); + + aFtComment.SetText(pNumFmtShell->GetComment4Entry(nFmtLbSelPos)); + if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos)) + { + if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).Len()==0) + { + aFtComment.SetText(aLbCategory.GetEntry(1)); + } + } + } + else + { + aLbFormat.SetNoSelection(); + } + + if ( bUpdateEdit ) + { + aEdFormat.SetText( String() ); + aWndPreview.NotifyChange( String() ); + } + } +} + + +/************************************************************************* +#* Handle: DoubleClickHdl_Impl Datum:02.10.97 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberFormatTabPage +#* +#* Funktion: Bei einem Doppelklick in die Format- Listbox +#* wird der Wert uebernommen und der OK-Button +#* ausgeloest +#* +#* Input: Pointer auf Listbox +#* +#* Output: --- +#* +#************************************************************************/ + +IMPL_LINK( SvxNumberFormatTabPage, DoubleClickHdl_Impl, SvxFontListBox*, pLb ) +{ + if ( pLb == &aLbFormat ) + { + SelFormatHdl_Impl( pLb ); + + if ( fnOkHdl.IsSet() ) + { // Uebergangsloesung, sollte von SfxTabPage angeboten werden + fnOkHdl.Call( NULL ); + } + else + { + SfxSingleTabDialog* pParent = dynamic_cast< SfxSingleTabDialog* >( GetParent() ); + OKButton* pOKButton = pParent ? pParent->GetOKButton() : NULL; + if ( pOKButton ) + pOKButton->Click(); + } + } + return 0; +} + + +/************************************************************************* +#* Methode: SelFormatHdl_Impl Datum:02.10.97 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberFormatTabPage +#* +#* Funktion: Wird aufgerufen, wenn sich die Sprache, die Kategorie +#* oder das Format aendert. Dem entsprechend werden die +#* Einstellungen geaendert. +#* +#* Input: Pointer auf Listbox +#* +#* Output: --- +#* +#************************************************************************/ + +IMPL_LINK( SvxNumberFormatTabPage, SelFormatHdl_Impl, void *, pLb ) +{ + if ( (CheckBox*)pLb == &aCbSourceFormat ) + { + EnableBySourceFormat_Impl(); // enable/disable everything else + if ( aCbSourceFormat.IsChecked() ) + return 0; // just disabled everything else + + // Reinit options enable/disable for current selection. + +#if ENABLE_LAYOUT + if (aLbFormat.GetSelectEntryPos () == LISTBOX_ENTRY_NOTFOUND) +#else /* !ENABLE_LAYOUT */ + // Current category may be UserDefined with no format entries defined. + // And yes, aLbFormat is a SvxFontListBox with ULONG list positions, + // implementation returns a LIST_APPEND if empty, comparison with + // USHORT LISTBOX_ENTRY_NOTFOUND wouldn't match. + if ( aLbFormat.GetSelectEntryPos() == LIST_APPEND ) +#endif /* !ENABLE_LAYOUT */ + pLb = &aLbCategory; // continue with the current category selected + else + pLb = &aLbFormat; // continue with the current format selected + } + + short nTmpCatPos; + + if(bOneAreaFlag) + { + nTmpCatPos=nFixedCategory; + } + else + { + nTmpCatPos=aLbCategory.GetSelectEntryPos(); + } + + USHORT nCurrencyPos=LISTBOX_ENTRY_NOTFOUND ; + + if(nTmpCatPos==CAT_CURRENCY && (ListBox *)pLb == &aLbCurrency ) + { + nCurrencyPos=aLbCurrency.GetSelectEntryPos(); + pNumFmtShell->SetCurrencySymbol(nCurrencyPos); + } + + //-------------------------------------------------------------------- + // Format-ListBox ---------------------------------------------------- + if ( (SvxFontListBox *)pLb == &aLbFormat ) + { + USHORT nSelPos = (USHORT) aLbFormat.GetSelectEntryPos(); + String aFormat = aLbFormat.GetSelectEntry(); + String aComment; + SvxDelStrgs aEntryList; + + short nFmtLbSelPos = nSelPos; + + aFormat=pNumFmtShell->GetFormat4Entry(nSelPos); + aComment=pNumFmtShell->GetComment4Entry(nSelPos); + if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos)) + { + if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).Len()==0) + { + aComment=aLbCategory.GetEntry(1); + } + } + + if ( aFormat.Len() > 0 ) + { + if(!aEdFormat.HasFocus()) aEdFormat.SetText( aFormat ); + aFtComment.SetText(aComment); + ChangePreviewText( nSelPos ); + } + + REMOVE_DONTKNOW() // ggF. UI-Enable + + if ( pNumFmtShell->FindEntry( aFormat) ) + { + aIbAdd.Enable(FALSE ); + BOOL bIsUserDef=pNumFmtShell->IsUserDefined( aFormat ); + aIbRemove.Enable(bIsUserDef); + aIbInfo.Enable(bIsUserDef); + + } + else + { + aIbAdd.Enable(TRUE ); + aIbInfo.Enable(TRUE ); + aIbRemove.Enable(FALSE ); + aFtComment.SetText(aEdComment.GetText()); + + } + UpdateOptions_Impl( FALSE ); + + //------- + return 0; + //------- + } + + //-------------------------------------------------------------------- + // Kategorie-ListBox ------------------------------------------------- + if ( pLb == &aLbCategory || pLb == &aLbCurrency) + { + UpdateFormatListBox_Impl( TRUE, TRUE ); + EditHdl_Impl( NULL ); + UpdateOptions_Impl( FALSE ); + + //------- + return 0; + //------- + } + + //-------------------------------------------------------------------- + // Sprache/Land-ListBox ---------------------------------------------- + if ( pLb == &aLbLanguage ) + { + UpdateFormatListBox_Impl( FALSE, TRUE ); + EditHdl_Impl( &aEdFormat ); + + //------- + return 0; + //------- + } + return 0; +} + + +/************************************************************************* +#* Methode: ClickHdl_Impl, ImageButton* pIB Datum:02.10.97 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberFormatTabPage +#* +#* Funktion: Wenn, der Hinzufuegen- oder Entfernen- Button +#* wird diese Funktion aufgerufen und die Zahlenformat- +#* Liste den entsprechend geaendert. +#* +#* Input: Toolbox- Button +#* +#* Output: --- +#* +#************************************************************************/ + +IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, ImageButton*, pIB) +{ + BOOL bAdded = FALSE; + BOOL bDeleted = FALSE; + ULONG nReturn = 0; + const ULONG nReturnChanged = 0x1; // THE boolean return value + const ULONG nReturnAdded = 0x2; // temp: format added + const ULONG nReturnOneArea = 0x4; // temp: one area but category changed => ignored + + if(pIB==&aIbAdd) + { // Also called from FillItemSet() if a temporary currency format has + // to be added, not only if the Add button is enabled. + String aFormat = aEdFormat.GetText(); + SvxDelStrgs aEntryList; + SvxDelStrgs a2EntryList; + USHORT nCatLbSelPos = 0; + short nFmtLbSelPos = SELPOS_NONE; + xub_StrLen nErrPos=0; + + pNumFmtShell->SetCurCurrencyEntry(NULL); + bAdded = pNumFmtShell->AddFormat( aFormat, nErrPos, + nCatLbSelPos, nFmtLbSelPos, + aEntryList); + if ( bAdded ) + nReturn |= nReturnChanged | nReturnAdded; + + if(pLastActivWindow== (Window *) &aEdComment) + { + aEdFormat.GrabFocus(); + aEdComment.Hide(); + aFtComment.Show(); + aFtComment.SetText(aEdComment.GetText()); + } + + if ( !nErrPos ) // Syntax ok? + { + if(nCatLbSelPos==CAT_CURRENCY) + { + aLbCurrency.SelectEntryPos((USHORT)pNumFmtShell->GetCurrencySymbol()); + } + + if(bOneAreaFlag && (nFixedCategory!=nCatLbSelPos)) + { + if(bAdded) DeleteEntryList_Impl(aEntryList); + bDeleted = pNumFmtShell->RemoveFormat( aFormat, + nCatLbSelPos, + nFmtLbSelPos, + a2EntryList); + if(bDeleted) DeleteEntryList_Impl(a2EntryList); + aEdFormat.GrabFocus(); + aEdFormat.SetSelection( Selection( (short)nErrPos, SELECTION_MAX ) ); + nReturn |= nReturnOneArea; + } + else + { + if ( bAdded && (nFmtLbSelPos != SELPOS_NONE) ) + { + // Alles klar + if(bOneAreaFlag) //@@ ??? + SetCategory(0); + else + SetCategory(nCatLbSelPos ); + + FillFormatListBox_Impl( aEntryList ); + if(aEdComment.GetText()!=aLbCategory.GetEntry(1)) + { + pNumFmtShell->SetComment4Entry(nFmtLbSelPos, + aEdComment.GetText()); + } + else + { + pNumFmtShell->SetComment4Entry(nFmtLbSelPos, + String()); + } + aLbFormat.SelectEntryPos( (USHORT)nFmtLbSelPos ); + aEdFormat.SetText( aFormat ); + + //aEdComment.SetText(String()); //@@ ??? + aEdComment.SetText(aLbCategory.GetEntry(1)); //String fuer Benutzerdefiniert + //holen + ChangePreviewText( (USHORT)nFmtLbSelPos ); + } + } + } + else // Syntaxfehler + { + aEdFormat.GrabFocus(); + aEdFormat.SetSelection( Selection( (short)nErrPos, SELECTION_MAX ) ); + } + EditHdl_Impl( &aEdFormat ); + nReturn = ((nReturn & nReturnOneArea) ? 0 : (nReturn & nReturnChanged)); + } + else if(pIB==&aIbRemove) + { + String aFormat = aEdFormat.GetText(); + SvxDelStrgs aEntryList; + USHORT nCatLbSelPos = 0; + short nFmtLbSelPos = SELPOS_NONE; + + bDeleted = pNumFmtShell->RemoveFormat( aFormat, + nCatLbSelPos, + nFmtLbSelPos, + aEntryList ); + + aEdComment.SetText(aLbCategory.GetEntry(1)); + if ( bDeleted ) + { + if(nFmtLbSelPos>=0 && nFmtLbSelPosFindEntry( aFormat, &nCurKey ) ) + { + aIbAdd.Enable(FALSE ); + BOOL bUserDef=pNumFmtShell->IsUserDefined( aFormat ); + + aIbRemove.Enable(bUserDef); + aIbInfo.Enable(bUserDef); + + if(bUserDef) + { + USHORT nTmpCurPos=pNumFmtShell->FindCurrencyFormat(aFormat ); + + if(nTmpCurPos!=(USHORT)-1) + aLbCurrency.SelectEntryPos(nTmpCurPos); + } + short nPosi=pNumFmtShell->GetListPos4Entry(aFormat); + if(nPosi>=0) + aLbFormat.SelectEntryPos( (USHORT)nPosi); + + } + else + { + + aIbAdd.Enable(TRUE ); + aIbInfo.Enable(TRUE); + aIbRemove.Enable(FALSE ); + + aFtComment.SetText(aEdComment.GetText()); + + } + } + + if ( pEdFormat ) + { + pNumFmtShell->SetCurNumFmtKey( nCurKey ); + UpdateOptions_Impl( TRUE ); + } + + return 0; +} + + +/************************************************************************* +#* Methode: NotifyChange Datum:02.10.97 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberFormatTabPage +#* +#* Funktion: Fuehrt Aenderungen in den Zahlen- Attributen durch. +#* +#* Input: Options- Controls +#* +#* Output: --- +#* +#************************************************************************/ + +IMPL_LINK( SvxNumberFormatTabPage, OptHdl_Impl, void *, pOptCtrl ) +{ + if ( ((NumericField*)pOptCtrl == &aEdLeadZeroes) + || ((NumericField*)pOptCtrl == &aEdDecimals) + || ((CheckBox*) pOptCtrl == &aBtnNegRed) + || ((CheckBox*) pOptCtrl == &aBtnThousand) ) + { + String aFormat; + BOOL bThousand = aBtnThousand.IsEnabled() + && aBtnThousand.IsChecked(); + BOOL bNegRed = aBtnNegRed.IsEnabled() + && aBtnNegRed.IsChecked(); + USHORT nPrecision = (aEdDecimals.IsEnabled()) + ? (USHORT)aEdDecimals.GetValue() + : (USHORT)0; + USHORT nLeadZeroes = (aEdLeadZeroes.IsEnabled()) + ? (USHORT)aEdLeadZeroes.GetValue() + : (USHORT)0; + + pNumFmtShell->MakeFormat( aFormat, + bThousand, bNegRed, + nPrecision, nLeadZeroes, + (USHORT)aLbFormat.GetSelectEntryPos() ); + + aEdFormat.SetText( aFormat ); + //aFtComment.SetText(String()); + MakePreviewText( aFormat ); + + if ( pNumFmtShell->FindEntry( aFormat ) ) + { + aIbAdd.Enable(FALSE ); + BOOL bUserDef=pNumFmtShell->IsUserDefined( aFormat ); + aIbRemove.Enable(bUserDef); + aIbInfo.Enable(bUserDef); + EditHdl_Impl( &aEdFormat); + + } + else + { + EditHdl_Impl( NULL ); + aLbFormat.SetNoSelection(); + } + } + return 0; +} + +IMPL_LINK( SvxNumberFormatTabPage, TimeHdl_Impl, Timer*, EMPTYARG) +{ + pLastActivWindow=NULL; + return 0; +} + + +/************************************************************************* +#* Methode: LostFocusHdl_Impl Datum:30.10.97 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberFormatTabPage +#* +#* Funktion: Fuehrt Aenderungen in den Zahlen- Attributen durch. +#* +#* Input: Options- Controls +#* +#* Output: --- +#* +#************************************************************************/ + +IMPL_LINK( SvxNumberFormatTabPage, LostFocusHdl_Impl, Edit *, pEd) +{ + if (pEd==&aEdComment) + { + aResetWinTimer.Start(); + aFtComment.SetText(aEdComment.GetText()); + aEdComment.Hide(); + aFtComment.Show(); + if(!aIbAdd.IsEnabled()) + { + USHORT nSelPos = (USHORT) aLbFormat.GetSelectEntryPos(); + pNumFmtShell->SetComment4Entry(nSelPos, + aEdComment.GetText()); + aEdComment.SetText(aLbCategory.GetEntry(1)); //String fuer Benutzerdefiniert + //holen + } + } + return 0; +} + +/************************************************************************* +#* Methode: NotifyChange Datum:02.10.97 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberFormatTabPage +#* +#* Funktion: Fuehrt Aenderungen in den Zahlen- Attributen durch. +#* +#* Input: Options- Controls +#* +#* Output: --- +#* +#************************************************************************/ + +String SvxNumberFormatTabPage::GetExpColorString( + Color*& rpPreviewColor, const String& rFormatStr, short nTmpCatPos) +{ + double nVal = 0; + switch (nTmpCatPos) + { + case CAT_CURRENCY: nVal=SVX_NUMVAL_CURRENCY; break; + + case CAT_SCIENTIFIC: + case CAT_FRACTION: + case CAT_NUMBER: nVal=SVX_NUMVAL_STANDARD; break; + + case CAT_PERCENT: nVal=SVX_NUMVAL_PERCENT; break; + + case CAT_ALL: nVal=SVX_NUMVAL_STANDARD; break; + + case CAT_TIME: nVal=SVX_NUMVAL_TIME; break; + case CAT_DATE: nVal=SVX_NUMVAL_DATE; break; + + case CAT_BOOLEAN: nVal=SVX_NUMVAL_BOOLEAN; break; + + case CAT_USERDEFINED: + case CAT_TEXT: + default: nVal=0;break; + } + + String aPreviewString; + pNumFmtShell->MakePrevStringFromVal( rFormatStr, aPreviewString, rpPreviewColor, nVal ); + return aPreviewString; +} + +void SvxNumberFormatTabPage::MakePreviewText( const String& rFormat ) +{ + String aPreviewString; + Color* pPreviewColor = NULL; + pNumFmtShell->MakePreviewString( rFormat, aPreviewString, pPreviewColor ); + aWndPreview.NotifyChange( aPreviewString, pPreviewColor ); +} + +void SvxNumberFormatTabPage::ChangePreviewText( USHORT nPos ) +{ + String aPreviewString; + Color* pPreviewColor = NULL; + pNumFmtShell->FormatChanged( nPos, aPreviewString, pPreviewColor ); + aWndPreview.NotifyChange( aPreviewString, pPreviewColor ); +} + +long SvxNumberFormatTabPage::PreNotify( NotifyEvent& rNEvt ) +{ + if(rNEvt.GetType()==EVENT_LOSEFOCUS) + { + if ( rNEvt.GetWindow() == dynamic_cast< Window* >( &aEdComment ) && !aEdComment.IsVisible() ) + { + pLastActivWindow = NULL; + } + else + { + pLastActivWindow = rNEvt.GetWindow(); + } + } + + return SfxTabPage::PreNotify( rNEvt ); +} +/************************************************************************* +#* Methode: SetOkHdl Datum:01.11.97 +#*------------------------------------------------------------------------ +#* +#* Klasse: SvxNumberFormatTabPage +#* +#* Funktion: Setzt den OkHandler neu. +#* +#* Input: Neuer OkHandler +#* +#* Output: --- +#* +#************************************************************************/ + +void SvxNumberFormatTabPage::SetOkHdl( const Link& rOkHandler ) +{ + fnOkHdl = rOkHandler; +} + +void SvxNumberFormatTabPage::FillCurrencyBox() +{ + SvStringsDtor aList; + NfShCurrencyEntries rEntries; + XubString* pEntry = NULL; + USHORT nPos=0; + USHORT nSelPos=0; + + pNumFmtShell->GetCurrencySymbols( aList, &nSelPos); + + for(USHORT i=1;iGetValue()); +} diff --git a/cui/source/tabpages/numfmt.hrc b/cui/source/tabpages/numfmt.hrc new file mode 100644 index 000000000000..102c5a212ac6 --- /dev/null +++ b/cui/source/tabpages/numfmt.hrc @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: numfmt.hrc,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_NUMFMT_HRC +#define _SVX_NUMFMT_HRC + +// defines ------------------------------------------------------------------ + +//================================================ +// Zahlen-TabPage: +#define WND_NUMBER_PREVIEW 2 +#define FT_CATEGORY 3 +#define FT_FORMAT 4 +#define FT_OPTIONS 5 +#define FT_EDFORMAT 6 +#define LB_CATEGORY 9 +#define LB_FORMAT 10 +#define FL_OPTIONS 11 +#define FT_LANGUAGE 12 +#define LB_LANGUAGE 13 +#define ED_FORMAT 14 +#define BTN_ADD 15 +#define BTN_REMOVE 16 +#define BMP_CHECK 17 +#define BMP_DCHECK 18 +#define BMP_CROSS 19 +#define BMP_DCROSS 20 +#define FT_DECIMALS 21 +#define ED_DECIMALS 22 +#define FT_LEADZEROES 23 +#define ED_LEADZEROES 24 +#define BTN_NEGRED 25 +#define BTN_THOUSAND 26 +#define FT_COMMENT 27 +#define ED_COMMENT 28 +#define IB_ADD 29 +#define IB_REMOVE 30 +#define IB_INFO 31 +#define IL_ICON 32 +#define LB_CURRENCY 33 +#define CB_SOURCEFORMAT 34 +#define IL_ICON_HC 35 +#define STR_AUTO_ENTRY 36 + +#define TBX_ADDREMOVE 1 +#define IID_ADD 1 +#define IID_REMOVE 2 +#define IID_INFO 3 + +#endif + diff --git a/cui/source/tabpages/numfmt.src b/cui/source/tabpages/numfmt.src new file mode 100644 index 000000000000..96269bb9ec09 --- /dev/null +++ b/cui/source/tabpages/numfmt.src @@ -0,0 +1,297 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: numfmt.src,v $ + * $Revision: 1.51 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include +#include "helpid.hrc" +#include "numfmt.hrc" + // pragma ---------------------------------------------------------------- + + // RID_SVXPAGE_NUMBERFORMAT ---------------------------------------------- +TabPage RID_SVXPAGE_NUMBERFORMAT +{ + HelpId = HID_NUMBERFORMAT ; + Hide = TRUE ; + Text [ en-US ] = "Number Format" ; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedText FT_CATEGORY + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "~Category" ; + }; + ListBox LB_CATEGORY + { + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 14 ) ; + Size = MAP_APPFONT ( 70 , 71 ) ; + AutoHScroll = TRUE ; + StringList [ en-US ] = + { + < "All" ; Default ; > ; + < "User-defined" ; Default ; > ; + < "Number" ; Default ; > ; + < "Percent" ; Default ; > ; + < "Currency" ; Default ; > ; + < "Date" ; Default ; > ; + < "Time" ; Default ; > ; + < "Scientific" ; Default ; > ; + < "Fraction" ; Default ; > ; + < "Boolean Value" ; Default ; > ; + < "Text" ; Default ; > ; + }; + }; + FixedText FT_EDFORMAT + { + Pos = MAP_APPFONT ( 6 , 136 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "~Format code" ; + }; + Edit ED_FORMAT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 147 ) ; + Size = MAP_APPFONT ( 200 , 12 ) ; + }; + FixedText FT_COMMENT + { + Pos = MAP_APPFONT ( 6 , 163 ) ; + Size = MAP_APPFONT ( 248 , 16 ) ; + WordBreak = TRUE ; + NoLabel = TRUE ; + }; + Edit ED_COMMENT + { + Hide = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 163 ) ; + Size = MAP_APPFONT ( 248 , 12 ) ; + }; + FixedText FT_FORMAT + { + Pos = MAP_APPFONT ( 82 , 3 ) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "F~ormat" ; + }; + + ListBox LB_CURRENCY + { + Border = TRUE ; + Pos = MAP_APPFONT ( 82 , 14 ) ; + Size = MAP_APPFONT ( 90 , 71 ) ; + DropDown = TRUE ; + TabStop = TRUE ; + StringList [ en-US ] = + { + < "Automatically" ; Default ; > ; + }; + }; + + Control LB_FORMAT + { + HelpId = HID_NUMBERFORMAT_LB_FORMAT ; + Border = TRUE ; + Pos = MAP_APPFONT ( 82 , 27 ) ; + Size = MAP_APPFONT ( 90 , 58 ) ; + TabStop = TRUE ; + }; + + FixedText FT_DECIMALS + { + Pos = MAP_APPFONT ( 12 , 104 ) ; + Size = MAP_APPFONT ( 69 , 8 ) ; + Text [ en-US ] = "~Decimal places" ; + }; + NumericField ED_DECIMALS + { + Border = TRUE ; + Pos = MAP_APPFONT ( 84 , 102 ) ; + Size = MAP_APPFONT ( 24 , 12 ) ; + Spin = TRUE ; + Maximum = 20 ; + Last = 15 ; + First = 0 ; + StrictFormat = TRUE ; + SpinSize = 1 ; + Repeat = TRUE ; + }; + FixedText FT_LEADZEROES + { + Pos = MAP_APPFONT ( 12 , 120 ) ; + Size = MAP_APPFONT ( 69 , 8 ) ; + /* ### ACHTUNG: Neuer Text in Resource? Führende ~Nullen : F³hrende ~Nullen */ + Text [ en-US ] = "Leading ~zeroes" ; + }; + NumericField ED_LEADZEROES + { + Border = TRUE ; + Pos = MAP_APPFONT ( 84 , 118 ) ; + Size = MAP_APPFONT ( 24 , 12 ) ; + Spin = TRUE ; + Maximum = 20 ; + Last = 15 ; + First = 0 ; + StrictFormat = TRUE ; + SpinSize = 1 ; + Repeat = TRUE ; + }; + CheckBox BTN_NEGRED + { + Pos = MAP_APPFONT ( 133 , 104 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + Text [ en-US ] = "~Negative numbers red" ; + }; + CheckBox BTN_THOUSAND + { + Pos = MAP_APPFONT ( 133 , 120 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + Text [ en-US ] = "~Thousands separator" ; + }; + FixedLine FL_OPTIONS + { + Pos = MAP_APPFONT ( 6 , 91 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Options" ; + }; + FixedText FT_LANGUAGE + { + Pos = MAP_APPFONT ( 178 , 3 ) ; + Size = MAP_APPFONT ( 76 , 8 ) ; + Text [ en-US ] = "~Language" ; + }; + ListBox LB_LANGUAGE + { + Border = TRUE ; + Sort = TRUE ; + Pos = MAP_APPFONT ( 178 , 14 ) ; + Size = MAP_APPFONT ( 76 , 71 ) ; + DropDown = TRUE ; + }; + CheckBox CB_SOURCEFORMAT + { + Pos = MAP_APPFONT ( 178 , 42 ) ; + Size = MAP_APPFONT ( 76 , 10 ) ; + Text [ en-US ] = "So~urce format" ; + }; + Window WND_NUMBER_PREVIEW + { + Border = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 178 , 67 ) ; + Size = MAP_APPFONT ( 76 , 18 ) ; + HelpId = HID_NUMBERFORMAT_WND_NUMBER_PREVIEW ; + }; + ImageButton IB_ADD + { + SVLook = TRUE ; + Pos = MAP_APPFONT ( 208 , 146 ) ; + Size = MAP_APPFONT ( 14 , 14 ) ; + HelpId = HID_NUMBERFORMAT_TBI_ADD ; + QuickHelpText [ en-US ] = "Add" ; + }; + ImageButton IB_REMOVE + { + SVLook = TRUE ; + Pos = MAP_APPFONT ( 240 , 146 ) ; + Size = MAP_APPFONT ( 14 , 14 ) ; + HelpId = HID_NUMBERFORMAT_TBI_REMOVE ; + QuickHelpText [ en-US ] = "Remove" ; + }; + ImageButton IB_INFO + { + SVLook = TRUE ; + Pos = MAP_APPFONT ( 224 , 146 ) ; + Size = MAP_APPFONT ( 14 , 14 ) ; + HelpId = HID_NUMBERFORMAT_TBI_INFO ; + QuickHelpText [ en-US ] = "Edit Comment" ; + }; + ImageList IL_ICON + { + Prefix = "nu"; + MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; + IdList = + { + IID_ADD ; + IID_REMOVE ; + IID_INFO ; + }; + IdCount = { 3 ; }; + }; + ImageList IL_ICON_HC + { + Prefix = "nuh"; + MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; + IdList = + { + IID_ADD ; + IID_REMOVE ; + IID_INFO ; + }; + IdCount = { 3 ; }; + }; + + String STR_AUTO_ENTRY + { + Text [ en-US ] = "Automatic"; + }; + +}; + // ********************************************************************** EOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx new file mode 100644 index 000000000000..e8852c666b6c --- /dev/null +++ b/cui/source/tabpages/numpages.cxx @@ -0,0 +1,4038 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: numpages.cxx,v $ + * $Revision: 1.64 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cuicharmap.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "svx/opengrf.hxx" + +#include //CHINA001 +#include //CHINA001 +#include //add CHINA001 +#include //add CHINA001 +#include //add CHINA001 + +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; +using namespace com::sun::star::lang; +using namespace com::sun::star::i18n; +using namespace com::sun::star::text; +using namespace com::sun::star::container; +using namespace com::sun::star::style; +using rtl::OUString; +#define C2U(cChar) OUString::createFromAscii(cChar) + +SV_IMPL_PTRARR(SvxNumSettingsArr_Impl,SvxNumSettings_ImplPtr); + +/*-----------------07.02.97 15.37------------------- + +--------------------------------------------------*/ +#define NUM_PAGETYPE_BULLET 0 +#define NUM_PAGETYPE_SINGLENUM 1 +#define NUM_PAGETYPE_NUM 2 +#define NUM_PAGETYPE_BMP 3 +#define PAGETYPE_USER_START 10 + +#define SHOW_NUMBERING 0 +#define SHOW_BULLET 1 +#define SHOW_BITMAP 2 + +#define MAX_BMP_WIDTH 16 +#define MAX_BMP_HEIGHT 16 + +static BOOL bLastRelative = FALSE; +static const sal_Char cNumberingType[] = "NumberingType"; +static const sal_Char cValue[] = "Value"; +static const sal_Char cParentNumbering[] = "ParentNumbering"; +static const sal_Char cPrefix[] = "Prefix"; +static const sal_Char cSuffix[] = "Suffix"; +static const sal_Char cBulletChar[] = "BulletChar"; +static const sal_Char cBulletFontName[] = "BulletFontName"; +/* -----------------------------31.01.01 10:23-------------------------------- + + ---------------------------------------------------------------------------*/ +Reference lcl_GetNumberingProvider() +{ + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + Reference < XInterface > xI = xMSF->createInstance( + ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); + Reference xRet(xI, UNO_QUERY); + DBG_ASSERT(xRet.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\""); + + return xRet; +} +/* -----------------------------31.01.01 11:40-------------------------------- + + ---------------------------------------------------------------------------*/ +SvxNumSettings_ImplPtr lcl_CreateNumSettingsPtr(const Sequence& rLevelProps) +{ + const PropertyValue* pValues = rLevelProps.getConstArray(); + SvxNumSettings_ImplPtr pNew = new SvxNumSettings_Impl; + for(sal_Int32 j = 0; j < rLevelProps.getLength(); j++) + { + if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cNumberingType))) + pValues[j].Value >>= pNew->nNumberType; + else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cPrefix))) + pValues[j].Value >>= pNew->sPrefix; + else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cSuffix))) + pValues[j].Value >>= pNew->sSuffix; + else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cParentNumbering))) + pValues[j].Value >>= pNew->nParentNumbering; + else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cBulletChar))) + pValues[j].Value >>= pNew->sBulletChar; + else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cBulletFontName))) + pValues[j].Value >>= pNew->sBulletFont; + } + return pNew; +} +/* -----------------28.10.98 08:32------------------- + * + * --------------------------------------------------*/ +// Die Auswahl an Bullets aus den StarSymbol +static const sal_Unicode aBulletTypes[] = +{ + 0x2022, + 0x25cf, + 0xe00c, + 0xe00a, + 0x2794, + 0x27a2, + 0x2717, + 0x2714 +}; +/* -----------------28.10.98 09:42------------------- + * + * --------------------------------------------------*/ +static sal_Char __READONLY_DATA aNumChar[] = +{ + 'A', //CHARS_UPPER_LETTER + 'a', //CHARS_LOWER_LETTER + 'I', //ROMAN_UPPER + 'i', //ROMAN_LOWER + '1', //ARABIC + ' ' +}; + +/*-----------------18.03.98 08:35------------------- + Ist eins der maskierten Formate gesetzt? +--------------------------------------------------*/ +BOOL lcl_IsNumFmtSet(SvxNumRule* pNum, USHORT nLevelMask) +{ + BOOL bRet = FALSE; + USHORT nMask = 1; + for( USHORT i = 0; i < SVX_MAX_NUM && !bRet; i++ ) + { + if(nLevelMask & nMask) + bRet |= 0 != pNum->Get( i ); + nMask <<= 1 ; + } + return bRet; +} +/* -----------------28.10.98 08:50------------------- + * + * --------------------------------------------------*/ + +Font& lcl_GetDefaultBulletFont() +{ + static BOOL bInit = 0; + static Font aDefBulletFont( UniString::CreateFromAscii( + RTL_CONSTASCII_STRINGPARAM( "StarSymbol" ) ), + String(), Size( 0, 14 ) ); + if(!bInit) + { + aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL ); + aDefBulletFont.SetFamily( FAMILY_DONTKNOW ); + aDefBulletFont.SetPitch( PITCH_DONTKNOW ); + aDefBulletFont.SetWeight( WEIGHT_DONTKNOW ); + aDefBulletFont.SetTransparent( TRUE ); + bInit = TRUE; + } + return aDefBulletFont; +} + + +/**************************************************************************/ +/* */ +/* */ +/**************************************************************************/ + + +SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(Window* pParent, + const SfxItemSet& rSet) : + SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_PICK_SINGLE_NUM ), rSet ), + aValuesFL( this, SVX_RES(FL_VALUES) ), + pExamplesVS( new SvxNumValueSet(this, SVX_RES(VS_VALUES), NUM_PAGETYPE_SINGLENUM )), + pActNum(0), + pSaveNum(0), + nActNumLvl( USHRT_MAX ), + bModified(FALSE), + bPreset(FALSE), + nNumItemId(SID_ATTR_NUMBERING_RULE) +{ + FreeResource(); + SetExchangeSupport(); + pExamplesVS->SetSelectHdl(LINK(this, SvxSingleNumPickTabPage, NumSelectHdl_Impl)); + pExamplesVS->SetDoubleClickHdl(LINK(this, SvxSingleNumPickTabPage, DoubleClickHdl_Impl)); + pExamplesVS->SetHelpId(HID_VALUESET_SINGLENUM ); + + Reference xDefNum = lcl_GetNumberingProvider(); + if(xDefNum.is()) + { + Sequence< Sequence< PropertyValue > > aNumberings; + LanguageType eLang = Application::GetSettings().GetLanguage(); + Locale aLocale = SvxCreateLocale(eLang); + try + { + aNumberings = + xDefNum->getDefaultContinuousNumberingLevels( aLocale ); + + + sal_Int32 nLength = aNumberings.getLength() > NUM_VALUSET_COUNT ? NUM_VALUSET_COUNT :aNumberings.getLength(); + + const Sequence* pValuesArr = aNumberings.getConstArray(); + for(sal_Int32 i = 0; i < nLength; i++) + { + SvxNumSettings_ImplPtr pNew = lcl_CreateNumSettingsPtr(pValuesArr[i]); + aNumSettingsArr.Insert(pNew, aNumSettingsArr.Count()); + } + } + catch(Exception&) + { + } + Reference xFormat(xDefNum, UNO_QUERY); + pExamplesVS->SetNumberingSettings(aNumberings, xFormat, aLocale); + } +} +/*-----------------07.02.97 12.08------------------- + +--------------------------------------------------*/ + + SvxSingleNumPickTabPage::~SvxSingleNumPickTabPage() +{ + delete pActNum; + delete pExamplesVS; + delete pSaveNum; + aNumSettingsArr.DeleteAndDestroy(0, aNumSettingsArr.Count()); +} + +/*-----------------07.02.97 12.13------------------- + +--------------------------------------------------*/ + +SfxTabPage* SvxSingleNumPickTabPage::Create( Window* pParent, + const SfxItemSet& rAttrSet) +{ + return new SvxSingleNumPickTabPage(pParent, rAttrSet); +} + +/*-----------------07.02.97 12.09------------------- + +--------------------------------------------------*/ + + +BOOL SvxSingleNumPickTabPage::FillItemSet( SfxItemSet& rSet ) +{ + if(bPreset || bModified && pSaveNum) + { + *pSaveNum = *pActNum; + rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); + rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset)); + } + + return bModified; +} + +/*-----------------08.02.97 16.27------------------- + +--------------------------------------------------*/ + +void SvxSingleNumPickTabPage::ActivatePage(const SfxItemSet& rSet) +{ + const SfxPoolItem* pItem; + bPreset = FALSE; + BOOL bIsPreset = FALSE; + const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); + if(pExampleSet) + { + if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem)) + bIsPreset = ((const SfxBoolItem*)pItem)->GetValue(); + if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem)) + nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); + } + if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem)) + { + delete pSaveNum; + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + } + if(*pSaveNum != *pActNum) + { + *pActNum = *pSaveNum; + pExamplesVS->SetNoSelection(); + } + // ersten Eintrag vorselektieren + if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)) + { + pExamplesVS->SelectItem(1); + NumSelectHdl_Impl(pExamplesVS); + bPreset = TRUE; + } + bPreset |= bIsPreset; + + bModified = FALSE; +} + +/*-----------------08.02.97 11.28------------------- + +--------------------------------------------------*/ + +int SvxSingleNumPickTabPage::DeactivatePage(SfxItemSet *_pSet) +{ + if(_pSet) + FillItemSet(*_pSet); + return TRUE; +} + +/*-----------------07.02.97 12.09------------------- + +--------------------------------------------------*/ + + +void SvxSingleNumPickTabPage::Reset( const SfxItemSet& rSet ) +{ + const SfxPoolItem* pItem; +// nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); + delete pSaveNum; + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + + if(!pActNum) + pActNum = new SvxNumRule(*pSaveNum); + else if(*pSaveNum != *pActNum) + *pActNum = *pSaveNum; +} +/*-----------------08.02.97 11.40------------------- + +--------------------------------------------------*/ + +IMPL_LINK(SvxSingleNumPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG) +{ + if(pActNum) + { + bPreset = FALSE; + bModified = TRUE; + USHORT nIdx = pExamplesVS->GetSelectItemId() - 1; + DBG_ASSERT(aNumSettingsArr.Count() > nIdx, "wrong index"); + if(aNumSettingsArr.Count() <= nIdx) + return 0; + SvxNumSettings_ImplPtr _pSet = aNumSettingsArr.GetObject(nIdx); + sal_Int16 eNewType = _pSet->nNumberType; + const sal_Unicode cLocalPrefix = _pSet->sPrefix.getLength() ? _pSet->sPrefix.getStr()[0] : 0; + const sal_Unicode cLocalSuffix = _pSet->sSuffix.getLength() ? _pSet->sSuffix.getStr()[0] : 0; + + USHORT nMask = 1; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aFmt(pActNum->GetLevel(i)); + aFmt.SetNumberingType(eNewType); + String aEmptyStr; + if(cLocalPrefix == ' ') + aFmt.SetPrefix( aEmptyStr ); + else + aFmt.SetPrefix(_pSet->sPrefix); + if(cLocalSuffix == ' ') + aFmt.SetSuffix( aEmptyStr ); + else + aFmt.SetSuffix(_pSet->sSuffix); + aFmt.SetCharFmtName(sNumCharFmtName); + // #62069# // #92724# + aFmt.SetBulletRelSize(100); + pActNum->SetLevel(i, aFmt); + } + nMask <<= 1 ; + } + } + return 0; +} + +/*-----------------06.06.97 11.15------------------- + +--------------------------------------------------*/ +IMPL_LINK(SvxSingleNumPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG) +{ + NumSelectHdl_Impl(pExamplesVS); + OKButton& rOk = GetTabDialog()->GetOKButton(); + rOk.GetClickHdl().Call(&rOk); + return 0; +} + +/**************************************************************************/ +/* */ +/* */ +/**************************************************************************/ + + +SvxBulletPickTabPage::SvxBulletPickTabPage(Window* pParent, + const SfxItemSet& rSet) : + SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_PICK_BULLET ), rSet ), + aValuesFL( this, SVX_RES(FL_VALUES) ), + pExamplesVS( new SvxNumValueSet(this, SVX_RES(VS_VALUES), NUM_PAGETYPE_BULLET )), + pActNum(0), + pSaveNum(0), + nActNumLvl( USHRT_MAX ), + bModified(FALSE), + bPreset(FALSE), + nNumItemId(SID_ATTR_NUMBERING_RULE) +{ + FreeResource(); + SetExchangeSupport(); + pExamplesVS->SetSelectHdl(LINK(this, SvxBulletPickTabPage, NumSelectHdl_Impl)); + pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBulletPickTabPage, DoubleClickHdl_Impl)); + pExamplesVS->SetHelpId(HID_VALUESET_BULLET ); + +} +/*-----------------07.02.97 12.10------------------- + +--------------------------------------------------*/ + + + SvxBulletPickTabPage::~SvxBulletPickTabPage() +{ + delete pActNum; + delete pExamplesVS; + delete pSaveNum; +} +/*-----------------07.02.97 12.10------------------- + +--------------------------------------------------*/ + + +SfxTabPage* SvxBulletPickTabPage::Create( Window* pParent, + const SfxItemSet& rAttrSet) +{ + return new SvxBulletPickTabPage(pParent, rAttrSet); +} + +/*-----------------07.02.97 12.10------------------- + +--------------------------------------------------*/ + + +BOOL SvxBulletPickTabPage::FillItemSet( SfxItemSet& rSet ) +{ + if(bPreset || bModified && pActNum) + { + *pSaveNum = *pActNum; + rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); + rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset)); + } + return bModified; +} +/*-----------------08.02.97 16.28------------------- + +--------------------------------------------------*/ + +void SvxBulletPickTabPage::ActivatePage(const SfxItemSet& rSet) +{ + const SfxPoolItem* pItem; + bPreset = FALSE; + BOOL bIsPreset = FALSE; + const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); + if(pExampleSet) + { + if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem)) + bIsPreset = ((const SfxBoolItem*)pItem)->GetValue(); + if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem)) + nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); + } + if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem)) + { + delete pSaveNum; + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + } + if(*pSaveNum != *pActNum) + { + *pActNum = *pSaveNum; + pExamplesVS->SetNoSelection(); + } + // ersten Eintrag vorselektieren + if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)) + { + pExamplesVS->SelectItem(1); + NumSelectHdl_Impl(pExamplesVS); + bPreset = TRUE; + } + bPreset |= bIsPreset; + bModified = FALSE; +} +/*-----------------08.02.97 11.28------------------- + +--------------------------------------------------*/ + +int SvxBulletPickTabPage::DeactivatePage(SfxItemSet *_pSet) +{ + if(_pSet) + FillItemSet(*_pSet); + return TRUE; +} + +/*-----------------07.02.97 12.11------------------- + +--------------------------------------------------*/ + + +void SvxBulletPickTabPage::Reset( const SfxItemSet& rSet ) +{ + const SfxPoolItem* pItem; + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); + delete pSaveNum; + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + +// nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); + + if(!pActNum) + pActNum = new SvxNumRule(*pSaveNum); + else if(*pSaveNum != *pActNum) + *pActNum = *pSaveNum; +} +/*-----------------08.02.97 11.58------------------- + +--------------------------------------------------*/ + +IMPL_LINK(SvxBulletPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG) +{ + if(pActNum) + { + bPreset = FALSE; + bModified = TRUE; + sal_Unicode cChar = aBulletTypes[pExamplesVS->GetSelectItemId() - 1]; + Font& rActBulletFont = lcl_GetDefaultBulletFont(); + + USHORT nMask = 1; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aFmt(pActNum->GetLevel(i)); + aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL ); + aFmt.SetBulletFont(&rActBulletFont); + aFmt.SetBulletChar(cChar ); + aFmt.SetCharFmtName(sBulletCharFmtName); + // #62069# // #92724# + aFmt.SetBulletRelSize(45); + pActNum->SetLevel(i, aFmt); + } + nMask <<= 1; + } + } + + return 0; +} + +/*-----------------06.06.97 11.16------------------- + +--------------------------------------------------*/ +IMPL_LINK(SvxBulletPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG) +{ + NumSelectHdl_Impl(pExamplesVS); + OKButton& rOk = GetTabDialog()->GetOKButton(); + rOk.GetClickHdl().Call(&rOk); + return 0; +} + +//Add CHINA001 +void SvxBulletPickTabPage::PageCreated(SfxAllItemSet aSet) +{ + + SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False); + + if (pBulletCharFmt) + SetCharFmtName( pBulletCharFmt->GetValue()); + + +} +//end of add CHINA001 +/**************************************************************************/ +/* */ +/* */ +/**************************************************************************/ + + +SvxNumPickTabPage::SvxNumPickTabPage(Window* pParent, + const SfxItemSet& rSet) : + SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_PICK_NUM ), rSet ), + aValuesFL( this, SVX_RES(FL_VALUES) ), + pExamplesVS( new SvxNumValueSet(this, SVX_RES(VS_VALUES), NUM_PAGETYPE_NUM )), + pActNum(0), + pSaveNum(0), + nActNumLvl( USHRT_MAX ), + nNumItemId(SID_ATTR_NUMBERING_RULE), + bModified(FALSE), + bPreset(FALSE) +{ + + FreeResource(); + + SetExchangeSupport(); + + pExamplesVS->SetSelectHdl(LINK(this, SvxNumPickTabPage, NumSelectHdl_Impl)); + pExamplesVS->SetDoubleClickHdl(LINK(this, SvxNumPickTabPage, DoubleClickHdl_Impl)); + pExamplesVS->SetHelpId(HID_VALUESET_NUM ); + + Reference xDefNum = lcl_GetNumberingProvider(); + if(xDefNum.is()) + { + Sequence > aOutlineAccess; + LanguageType eLang = Application::GetSettings().GetLanguage(); + Locale aLocale = SvxCreateLocale(eLang); + try + { + aOutlineAccess = xDefNum->getDefaultOutlineNumberings( aLocale ); + + for(sal_Int32 nItem = 0; + nItem < aOutlineAccess.getLength() && nItem < NUM_VALUSET_COUNT; + nItem++ ) + { + SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[ nItem ]; + + Reference xLevel = aOutlineAccess.getConstArray()[nItem]; + for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++) + { + Any aValueAny = xLevel->getByIndex(nLevel); + Sequence aLevelProps; + aValueAny >>= aLevelProps; + SvxNumSettings_ImplPtr pNew = lcl_CreateNumSettingsPtr(aLevelProps); + rItemArr.Insert( pNew, rItemArr.Count() ); + } + } + } + catch(Exception&) + { + } + Reference xFormat(xDefNum, UNO_QUERY); + pExamplesVS->SetOutlineNumberingSettings(aOutlineAccess, xFormat, aLocale); + } +} +/*-----------------07.02.97 12.12------------------- + +--------------------------------------------------*/ + + + SvxNumPickTabPage::~SvxNumPickTabPage() +{ + delete pActNum; + delete pExamplesVS; + delete pSaveNum; +} + +/*-----------------07.02.97 12.12------------------- + +--------------------------------------------------*/ + + +SfxTabPage* SvxNumPickTabPage::Create( Window* pParent, + const SfxItemSet& rAttrSet) +{ + return new SvxNumPickTabPage(pParent, rAttrSet); +} + +/*-----------------07.02.97 12.12------------------- + +--------------------------------------------------*/ + + +BOOL SvxNumPickTabPage::FillItemSet( SfxItemSet& rSet ) +{ + if(bPreset || bModified && pActNum) + { + *pSaveNum = *pActNum; + rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); + rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset)); + } + return bModified; +} +/*-----------------08.02.97 16.28------------------- + +--------------------------------------------------*/ + +void SvxNumPickTabPage::ActivatePage(const SfxItemSet& rSet) +{ + const SfxPoolItem* pItem; + bPreset = FALSE; + BOOL bIsPreset = FALSE; + const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); + if(pExampleSet) + { + if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem)) + bIsPreset = ((const SfxBoolItem*)pItem)->GetValue(); + if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem)) + nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); + } + if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem)) + { + delete pSaveNum; + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + } + if(*pSaveNum != *pActNum) + { + *pActNum = *pSaveNum; + pExamplesVS->SetNoSelection(); + } + // ersten Eintrag vorselektieren + if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)) + { + pExamplesVS->SelectItem(1); + NumSelectHdl_Impl(pExamplesVS); + bPreset = TRUE; + } + bPreset |= bIsPreset; + bModified = FALSE; +} + +/* -----------------08.02.97 11.29------------------- + +--------------------------------------------------*/ + +int SvxNumPickTabPage::DeactivatePage(SfxItemSet *_pSet) +{ + if(_pSet) + FillItemSet(*_pSet); + return TRUE; +} + +/*-----------------07.02.97 12.12------------------- + +--------------------------------------------------*/ + +void SvxNumPickTabPage::Reset( const SfxItemSet& rSet ) +{ + const SfxPoolItem* pItem; + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); + delete pSaveNum; + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + +// nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); + if(!pActNum) + pActNum = new SvxNumRule(*pSaveNum); + else if(*pSaveNum != *pActNum) + *pActNum = *pSaveNum; + +} + +/*-----------------08.02.97 11.58------------------- + Hier werden alle Ebenen veraendert, +--------------------------------------------------*/ + +IMPL_LINK(SvxNumPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG) +{ + if(pActNum) + { + bPreset = FALSE; + bModified = TRUE; + + const FontList* pList = 0; + + SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[pExamplesVS->GetSelectItemId() - 1]; + + Font& rActBulletFont = lcl_GetDefaultBulletFont(); + SvxNumSettings_ImplPtr pLevelSettings = 0; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(rItemArr.Count() > i) + pLevelSettings = rItemArr[i]; + if(!pLevelSettings) + break; + SvxNumberFormat aFmt(pActNum->GetLevel(i)); + aFmt.SetNumberingType( pLevelSettings->nNumberType ); + USHORT nUpperLevelOrChar = (USHORT)pLevelSettings->nParentNumbering; + if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL) + { + if( pLevelSettings->sBulletFont.getLength() && + pLevelSettings->sBulletFont.compareTo( + rActBulletFont.GetName())) + { + //search for the font + if(!pList) + { + SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); + const SvxFontListItem* pFontListItem = + (const SvxFontListItem* )pCurDocShell + ->GetItem( SID_ATTR_CHAR_FONTLIST ); + pList = pFontListItem ? pFontListItem->GetFontList() : 0; + } + if(pList && pList->IsAvailable( pLevelSettings->sBulletFont ) ) + { + FontInfo aInfo = pList->Get( + pLevelSettings->sBulletFont,WEIGHT_NORMAL, ITALIC_NONE); + Font aFont(aInfo); + aFmt.SetBulletFont(&aFont); + } + else + { + //if it cannot be found then create a new one + Font aCreateFont( pLevelSettings->sBulletFont, + String(), Size( 0, 14 ) ); + aCreateFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW ); + aCreateFont.SetFamily( FAMILY_DONTKNOW ); + aCreateFont.SetPitch( PITCH_DONTKNOW ); + aCreateFont.SetWeight( WEIGHT_DONTKNOW ); + aCreateFont.SetTransparent( TRUE ); + aFmt.SetBulletFont( &aCreateFont ); + } + } + else + aFmt.SetBulletFont( &rActBulletFont ); + + aFmt.SetBulletChar( pLevelSettings->sBulletChar.getLength() + ? pLevelSettings->sBulletChar.getStr()[0] + : 0 ); + aFmt.SetCharFmtName( sBulletCharFmtName ); + // #62069# // #92724# + aFmt.SetBulletRelSize(45); + } + else + { + aFmt.SetIncludeUpperLevels(sal::static_int_cast< BYTE >(0 != nUpperLevelOrChar ? pActNum->GetLevelCount() : 0)); + aFmt.SetCharFmtName(sNumCharFmtName); + // #62069# // #92724# + aFmt.SetBulletRelSize(100); + } + aFmt.SetPrefix(pLevelSettings->sPrefix); + aFmt.SetSuffix(pLevelSettings->sSuffix); + pActNum->SetLevel(i, aFmt); + } + } + return 0; +} + +/*-----------------06.06.97 11.16------------------- + +--------------------------------------------------*/ +IMPL_LINK(SvxNumPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG) +{ + NumSelectHdl_Impl(pExamplesVS); + OKButton& rOk = GetTabDialog()->GetOKButton(); + rOk.GetClickHdl().Call(&rOk); + return 0; +} + +//add CHINA001 begin +void SvxNumPickTabPage::PageCreated(SfxAllItemSet aSet) +{ + SFX_ITEMSET_ARG (&aSet,pNumCharFmt,SfxStringItem,SID_NUM_CHAR_FMT,sal_False); + SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False); + + + if (pNumCharFmt &&pBulletCharFmt) + SetCharFmtNames( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue()); +} +//end of CHINA001 +/*-----------------07.02.97 15.59------------------- + +--------------------------------------------------*/ +void lcl_PaintLevel(OutputDevice* pVDev, sal_Int16 nNumberingType, + const OUString& rBulletChar, const OUString& rText, const OUString& rFontName, + Point& rLeft, Font& rRuleFont, const Font& rTextFont) +{ + + if(NumberingType::CHAR_SPECIAL == nNumberingType ) + { + rRuleFont.SetStyleName(rFontName); + pVDev->SetFont(rRuleFont); + pVDev->DrawText(rLeft, rBulletChar); + rLeft.X() += pVDev->GetTextWidth(rBulletChar); + } + else + { + pVDev->SetFont(rTextFont); + pVDev->DrawText(rLeft, rText); + rLeft.X() += pVDev->GetTextWidth(rText); + } +} + +/**************************************************************************/ +/* */ +/* */ +/**************************************************************************/ + +SvxBitmapPickTabPage::SvxBitmapPickTabPage(Window* pParent, + const SfxItemSet& rSet) : + SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_PICK_BMP ), rSet ), + aValuesFL( this, SVX_RES(FL_VALUES) ), + pExamplesVS( new SvxBmpNumValueSet(this, SVX_RES(VS_VALUES)/*, aGrfNames*/ )), + aErrorText( this, SVX_RES(FT_ERROR)), + aLinkedCB( this, SVX_RES(CB_LINKED)), + pActNum(0), + pSaveNum(0), + nActNumLvl( USHRT_MAX ), + nNumItemId(SID_ATTR_NUMBERING_RULE), + bModified(FALSE), + bPreset(FALSE) +{ + FreeResource(); + SetExchangeSupport(); + eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE)); + pExamplesVS->SetSelectHdl(LINK(this, SvxBitmapPickTabPage, NumSelectHdl_Impl)); + pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBitmapPickTabPage, DoubleClickHdl_Impl)); + aLinkedCB.SetClickHdl(LINK(this, SvxBitmapPickTabPage, LinkBmpHdl_Impl)); + + // Grafiknamen ermitteln + + GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames); + pExamplesVS->SetHelpId(HID_VALUESET_NUMBMP ); + for(USHORT i = 0; i < aGrfNames.Count(); i++) + { + pExamplesVS->InsertItem( i + 1, i); + String* pGrfNm = (String*) aGrfNames.GetObject(i); + INetURLObject aObj(*pGrfNm); + if(aObj.GetProtocol() == INET_PROT_FILE) + *pGrfNm = aObj.PathToFileName(); + pExamplesVS->SetItemText( i + 1, *pGrfNm ); + } + if(!aGrfNames.Count()) + { + aErrorText.Show(); + } + else + { + pExamplesVS->Show(); + pExamplesVS->Format(); + } + +} + +/*-----------------12.02.97 07.46------------------- + +--------------------------------------------------*/ + + SvxBitmapPickTabPage::~SvxBitmapPickTabPage() +{ + String* pStr = (String*)aGrfNames.First(); + while( pStr ) + { + delete pStr; + pStr = (String*)aGrfNames.Next(); + } + delete pExamplesVS; + delete pActNum; + delete pSaveNum; +} + +/*-----------------12.02.97 07.46------------------- + +--------------------------------------------------*/ + +SfxTabPage* SvxBitmapPickTabPage::Create( Window* pParent, + const SfxItemSet& rAttrSet) +{ + return new SvxBitmapPickTabPage(pParent, rAttrSet); +} + +/*-----------------12.02.97 07.46------------------- + +--------------------------------------------------*/ + +void SvxBitmapPickTabPage::ActivatePage(const SfxItemSet& rSet) +{ + const SfxPoolItem* pItem; + bPreset = FALSE; + BOOL bIsPreset = FALSE; +// nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); + const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); + if(pExampleSet) + { + if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem)) + bIsPreset = ((const SfxBoolItem*)pItem)->GetValue(); + if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem)) + nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); + } + if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem)) + { + delete pSaveNum; + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + } + if(*pSaveNum != *pActNum) + { + *pActNum = *pSaveNum; + pExamplesVS->SetNoSelection(); + } + // ersten Eintrag vorselektieren + if(aGrfNames.Count() && + (pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset))) + { + pExamplesVS->SelectItem(1); + NumSelectHdl_Impl(pExamplesVS); + bPreset = TRUE; + } + bPreset |= bIsPreset; + bModified = FALSE; +} +/*-----------------12.02.97 07.46------------------- + +--------------------------------------------------*/ + +int SvxBitmapPickTabPage::DeactivatePage(SfxItemSet *_pSet) +{ + if(_pSet) + FillItemSet(*_pSet); + return TRUE; +} +/*-----------------12.02.97 07.46------------------- + +--------------------------------------------------*/ + +BOOL SvxBitmapPickTabPage::FillItemSet( SfxItemSet& rSet ) +{ + if ( !aGrfNames.Count() ) + { +// das ist im SfxItemSet leider nicht zulaessig #52134# +// rSet.DisableItem(SID_ATTR_NUMBERING_RULE); + return FALSE; + } + if(bPreset || bModified && pActNum) + { + *pSaveNum = *pActNum; + rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); + rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset)); + } + + return bModified; +} +/*-----------------12.02.97 07.46------------------- + +--------------------------------------------------*/ + +void SvxBitmapPickTabPage::Reset( const SfxItemSet& rSet ) +{ + const SfxPoolItem* pItem; + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); + delete pSaveNum; + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + + if(!pActNum) + pActNum = new SvxNumRule(*pSaveNum); + else if(*pSaveNum != *pActNum) + *pActNum = *pSaveNum; + if(!pActNum->IsFeatureSupported(NUM_ENABLE_LINKED_BMP)) + { + aLinkedCB.Check(FALSE); + aLinkedCB.Enable(FALSE); + } + else if(!pActNum->IsFeatureSupported(NUM_ENABLE_EMBEDDED_BMP)) + { + aLinkedCB.Check(TRUE); + aLinkedCB.Enable(FALSE); + } +} + +/*-----------------12.02.97 07.53------------------- + +--------------------------------------------------*/ + +IMPL_LINK(SvxBitmapPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG) +{ + if(pActNum) + { + bPreset = FALSE; + bModified = TRUE; + USHORT nIdx = pExamplesVS->GetSelectItemId() - 1; + + String* pGrfName = 0; + if(aGrfNames.Count() > nIdx) + pGrfName = (String*)aGrfNames.GetObject(nIdx); + + USHORT nMask = 1; + String aEmptyStr; + USHORT nSetNumberingType = SVX_NUM_BITMAP; + if(aLinkedCB.IsChecked()) + nSetNumberingType |= LINK_TOKEN; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aFmt(pActNum->GetLevel(i)); + aFmt.SetNumberingType(nSetNumberingType); + aFmt.SetPrefix( aEmptyStr ); + aFmt.SetSuffix( aEmptyStr ); + aFmt.SetCharFmtName( sNumCharFmtName ); + + Graphic aGraphic; + if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nIdx, &aGraphic)) + { + Size aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); + sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; + aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)eCoreUnit); + SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH ); + aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); + } + else if(pGrfName) + aFmt.SetGraphic( *pGrfName ); + pActNum->SetLevel(i, aFmt); + } + nMask <<= 1 ; + } + } + + return 0; +} + +/*-----------------06.06.97 11.17------------------- + +--------------------------------------------------*/ +IMPL_LINK(SvxBitmapPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG) +{ + NumSelectHdl_Impl(pExamplesVS); + OKButton& rOk = GetTabDialog()->GetOKButton(); + rOk.GetClickHdl().Call(&rOk); + return 0; +} +/* -----------------03.11.99 13:46------------------- + + --------------------------------------------------*/ +IMPL_LINK(SvxBitmapPickTabPage, LinkBmpHdl_Impl, CheckBox*, EMPTYARG ) +{ + if(!pExamplesVS->IsNoSelection()) + { + NumSelectHdl_Impl(pExamplesVS); + } + return 0; +} +/*-----------------13.02.97 09.40------------------- + +--------------------------------------------------*/ + +//CHINA001 SvxBmpNumValueSet::SvxBmpNumValueSet( Window* pParent, const ResId& rResId/*, const List& rStrNames*/ ) : +//CHINA001 +//CHINA001 SvxNumValueSet( pParent, rResId, NUM_PAGETYPE_BMP ), +//CHINA001 // rStrList ( rStrNames ), +//CHINA001 bGrfNotFound( FALSE ) +//CHINA001 +//CHINA001 { +//CHINA001 GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS); +//CHINA001 SetStyle( GetStyle() | WB_VSCROLL ); +//CHINA001 SetLineCount( 3 ); +//CHINA001 aFormatTimer.SetTimeout(300); +//CHINA001 aFormatTimer.SetTimeoutHdl(LINK(this, SvxBmpNumValueSet, FormatHdl_Impl)); +//CHINA001 } +//CHINA001 +//CHINA001 /*-----------------13.02.97 09.41------------------- +//CHINA001 +//CHINA001 --------------------------------------------------*/ +//CHINA001 +//CHINA001 SvxBmpNumValueSet::~SvxBmpNumValueSet() +//CHINA001 { +//CHINA001 GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS); +//CHINA001 aFormatTimer.Stop(); +//CHINA001 } +//CHINA001 /*-----------------13.02.97 09.41------------------- +//CHINA001 +//CHINA001 --------------------------------------------------*/ +//CHINA001 +//CHINA001 void SvxBmpNumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) +//CHINA001 { +//CHINA001 SvxNumValueSet::UserDraw(rUDEvt); +//CHINA001 +//CHINA001 Rectangle aRect = rUDEvt.GetRect(); +//CHINA001 OutputDevice* pDev = rUDEvt.GetDevice(); +//CHINA001 USHORT nItemId = rUDEvt.GetItemId(); +//CHINA001 Point aBLPos = aRect.TopLeft(); +//CHINA001 +//CHINA001 int nRectHeight = aRect.GetHeight(); +//CHINA001 Size aSize(nRectHeight/8, nRectHeight/8); +//CHINA001 +//CHINA001 Graphic aGraphic; +//CHINA001 if(!GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nItemId - 1, +//CHINA001 &aGraphic, NULL)) +//CHINA001 { +//CHINA001 bGrfNotFound = TRUE; +//CHINA001 } +//CHINA001 else +//CHINA001 { +//CHINA001 Point aPos(aBLPos.X() + 5, 0); +//CHINA001 for( USHORT i = 0; i < 3; i++ ) +//CHINA001 { +//CHINA001 USHORT nY = 11 + i * 33; +//CHINA001 aPos.Y() = aBLPos.Y() + nRectHeight * nY / 100; +//CHINA001 aGraphic.Draw( pDev, aPos, aSize ); +//CHINA001 } +//CHINA001 } +//CHINA001 } +//CHINA001 +//CHINA001 /*-----------------14.02.97 07.34------------------- +//CHINA001 +//CHINA001 --------------------------------------------------*/ +//CHINA001 +//CHINA001 IMPL_LINK(SvxBmpNumValueSet, FormatHdl_Impl, Timer*, EMPTYARG) +//CHINA001 { +//CHINA001 // nur, wenn eine Grafik nicht da war, muss formatiert werden +//CHINA001 if(bGrfNotFound) +//CHINA001 { +//CHINA001 bGrfNotFound = FALSE; +//CHINA001 Format(); +//CHINA001 } +//CHINA001 Invalidate(); +//CHINA001 return 0; +//CHINA001 } +/*-----------------01.12.97 16:15------------------- + Tabpage Numerierungsoptionen +--------------------------------------------------*/ +#define NUM_NO_GRAPHIC 1000 +SvxNumOptionsTabPage::SvxNumOptionsTabPage(Window* pParent, + const SfxItemSet& rSet) : + SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_NUM_OPTIONS ), rSet ), + + aFormatFL( this, SVX_RES(FL_FORMAT )), + aLevelFT( this, SVX_RES(FT_LEVEL )), + aLevelLB( this, SVX_RES(LB_LEVEL )), + aFmtFT( this, SVX_RES(FT_FMT )), + aFmtLB( this, SVX_RES(LB_FMT )), + aPrefixFT( this, SVX_RES(FT_PREFIX )), + aPrefixED( this, SVX_RES(ED_PREFIX )), + aSuffixFT( this, SVX_RES(FT_SUFFIX )), + aSuffixED( this, SVX_RES(ED_SUFFIX )), + aCharFmtFT( this, SVX_RES(FT_CHARFMT )), + aCharFmtLB( this, SVX_RES(LB_CHARFMT )), + aBulColorFT( this, SVX_RES(FT_BUL_COLOR)), + aBulColLB( this, SVX_RES(LB_BUL_COLOR)), + aBulRelSizeFT( this, SVX_RES(FT_BUL_REL_SIZE)), + aBulRelSizeMF( this, SVX_RES(MF_BUL_REL_SIZE)), + aAllLevelFT( this, SVX_RES(FT_ALL_LEVEL)), + aAllLevelNF( this, SVX_RES(NF_ALL_LEVEL)), + aStartFT( this, SVX_RES(FT_START )), + aStartED( this, SVX_RES(ED_START )), + aBulletPB( this, SVX_RES(PB_BULLET )), + aAlignFT( this, SVX_RES(FT_ALIGN )), + aAlignLB( this, SVX_RES(LB_ALIGN )), + aBitmapFT( this, SVX_RES(FT_BITMAP )), + aBitmapMB( this, SVX_RES(MB_BITMAP )), + aSizeFT( this, SVX_RES(FT_SIZE )), + aWidthMF( this, SVX_RES(MF_WIDTH )), + aMultFT( this, SVX_RES(FT_MULT )), + aHeightMF( this, SVX_RES(MF_HEIGHT )), + aRatioCB( this, SVX_RES(CB_RATIO )), + aOrientFT( this, SVX_RES(FT_ORIENT )), + aOrientLB( this, SVX_RES(LB_ORIENT )), + aSameLevelFL( this, SVX_RES(FL_SAME_LEVEL)), + aSameLevelCB( this, SVX_RES(CB_SAME_LEVEL)), + pPreviewWIN( new SvxNumberingPreview(this, SVX_RES(WIN_PREVIEW ))), + pActNum(0), + pSaveNum(0), + bLastWidthModified(FALSE), + bModified(FALSE), + bPreset(FALSE), + bAutomaticCharStyles(TRUE), + bHTMLMode(FALSE), + bMenuButtonInitialized(FALSE), + sBullet(SVX_RES(STR_BULLET)), + nBullet(0xff), + nActNumLvl(USHRT_MAX), + nNumItemId(SID_ATTR_NUMBERING_RULE) +{ + sStartWith = aStartFT.GetText(); + pPreviewWIN->SetBackground(Wallpaper(Color(COL_TRANSPARENT))); + SetExchangeSupport(); + aActBulletFont = lcl_GetDefaultBulletFont(); + + aBulletPB.SetClickHdl(LINK(this, SvxNumOptionsTabPage, BulletHdl_Impl)); + aFmtLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl)); + aBitmapMB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, GraphicHdl_Impl)); + aLevelLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, LevelHdl_Impl)); + aCharFmtLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, CharFmtHdl_Impl)); + aWidthMF.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, SizeHdl_Impl)); + aHeightMF.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, SizeHdl_Impl)); + aRatioCB.SetClickHdl(LINK(this, SvxNumOptionsTabPage, RatioHdl_Impl)); + aStartED.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl)); + aPrefixED.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl)); + aSuffixED.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl)); + aAllLevelNF.SetModifyHdl(LINK(this,SvxNumOptionsTabPage, AllLevelHdl_Impl)); + aOrientLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, OrientHdl_Impl)); + aSameLevelCB.SetClickHdl(LINK(this, SvxNumOptionsTabPage, SameLevelHdl_Impl)); + aBulRelSizeMF.SetModifyHdl(LINK(this,SvxNumOptionsTabPage, BulRelSizeHdl_Impl)); + aBulColLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, BulColorHdl_Impl)); + aInvalidateTimer.SetTimeoutHdl(LINK(this, SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl)); + aInvalidateTimer.SetTimeout(50); + + aBitmapMB.GetPopupMenu()->SetHighlightHdl(LINK(this, SvxNumOptionsTabPage, PopupActivateHdl_Impl)); + PopupMenu* pPopup = new PopupMenu; + aBitmapMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup ); + + pPopup->InsertItem( NUM_NO_GRAPHIC, String(SVX_RES(ST_POPUP_EMPTY_ENTRY)) ); + pPopup->EnableItem( NUM_NO_GRAPHIC, FALSE ); + + eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE)); + + FreeResource(); + + //get advanced numbering types from the component + Reference xDefNum = lcl_GetNumberingProvider(); + Reference xInfo(xDefNum, UNO_QUERY); + + // Extended numbering schemes present in the resource but not offered by + // the i18n framework per configuration must be removed from the listbox. + // Watch out for the ugly 0x88/*SVX_NUM_BITMAP|0x80*/ to not remove that. + const USHORT nDontRemove = 0xffff; + ::std::vector< USHORT> aRemove( aFmtLB.GetEntryCount(), nDontRemove); + for (size_t i=0; i(i)); + if (nEntryData > NumberingType::CHARS_LOWER_LETTER_N && + nEntryData != (SVX_NUM_BITMAP | 0x80)) + aRemove[i] = nEntryData; + } + if(xInfo.is()) + { + Sequence aTypes = xInfo->getSupportedNumberingTypes( ); + const sal_Int16* pTypes = aTypes.getConstArray(); + for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++) + { + sal_Int16 nCurrent = pTypes[nType]; + if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N) + { + sal_Bool bInsert = sal_True; + for(USHORT nEntry = 0; nEntry < aFmtLB.GetEntryCount(); nEntry++) + { + USHORT nEntryData = (USHORT)(ULONG)aFmtLB.GetEntryData(nEntry); + if(nEntryData == (USHORT) nCurrent) + { + bInsert = sal_False; + aRemove[nEntry] = nDontRemove; + break; + } + } + if(bInsert) + { + OUString aIdent = xInfo->getNumberingIdentifier( nCurrent ); + USHORT nPos = aFmtLB.InsertEntry(aIdent); + aFmtLB.SetEntryData(nPos,(void*)(ULONG)nCurrent); + } + } + } + } + for (size_t i=0; iGetPopupMenu( MN_GALLERY ); + String* pStr = (String*)aGrfNames.First(); + while( pStr ) + { + delete pStr; + pStr = (String*)aGrfNames.Next(); + } + delete pActNum; + delete pPreviewWIN; + delete pSaveNum; +} + +/*-----------------03.12.97 07:52------------------- + +--------------------------------------------------*/ +void SvxNumOptionsTabPage::SetMetric(FieldUnit eMetric) +{ + if(eMetric == FUNIT_MM) + { + aWidthMF .SetDecimalDigits(1); + aHeightMF .SetDecimalDigits(1); + } + aWidthMF .SetUnit( eMetric ); + aHeightMF .SetUnit( eMetric ); +} + +/*-----------------01.12.97 16:30------------------- + +--------------------------------------------------*/ +SfxTabPage* SvxNumOptionsTabPage::Create( Window* pParent, + const SfxItemSet& rAttrSet) +{ + return new SvxNumOptionsTabPage(pParent, rAttrSet); +}; +/*-----------------01.12.97 16:29------------------- + +--------------------------------------------------*/ +void SvxNumOptionsTabPage::ActivatePage(const SfxItemSet& rSet) +{ + const SfxPoolItem* pItem; + const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); + UINT16 nTmpNumLvl = USHRT_MAX; + if(pExampleSet) + { + if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem)) + bPreset = ((const SfxBoolItem*)pItem)->GetValue(); + if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem)) + nTmpNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); + } + if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem)) + { + delete pSaveNum; + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + } + // + bModified = (!pActNum->Get( 0 ) || bPreset); + if(*pActNum != *pSaveNum || + nActNumLvl != nTmpNumLvl) + { + nActNumLvl = nTmpNumLvl; + USHORT nMask = 1; + aLevelLB.SetUpdateMode(FALSE); + aLevelLB.SetNoSelection(); + aLevelLB.SelectEntryPos( pActNum->GetLevelCount(), nActNumLvl == USHRT_MAX); + if(nActNumLvl != USHRT_MAX) + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + aLevelLB.SelectEntryPos( i, TRUE); + nMask <<= 1 ; + } + aLevelLB.SetUpdateMode(TRUE); + *pActNum = *pSaveNum; + InitControls(); + } + +} +/*-----------------01.12.97 16:29------------------- + +--------------------------------------------------*/ +int SvxNumOptionsTabPage::DeactivatePage(SfxItemSet * _pSet) +{ + if(_pSet) + FillItemSet(*_pSet); + return TRUE; +} +/*-----------------01.12.97 16:29------------------- + +--------------------------------------------------*/ +BOOL SvxNumOptionsTabPage::FillItemSet( SfxItemSet& rSet ) +{ + rSet.Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl)); + if(bModified && pActNum) + { + *pSaveNum = *pActNum; + rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); + rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, FALSE)); + } + return bModified; +}; +/*-----------------01.12.97 16:29------------------- + +--------------------------------------------------*/ +void SvxNumOptionsTabPage::Reset( const SfxItemSet& rSet ) +{ + const SfxPoolItem* pItem; + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); + delete pSaveNum; + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + + // Ebenen einfuegen + if(!aLevelLB.GetEntryCount()) + { + for(USHORT i = 1; i <= pSaveNum->GetLevelCount(); i++) + aLevelLB.InsertEntry( UniString::CreateFromInt32(i)); + if(pSaveNum->GetLevelCount() > 1) + { + String sEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "1 - " ) ) ); + sEntry += UniString::CreateFromInt32( pSaveNum->GetLevelCount() ); + aLevelLB.InsertEntry(sEntry); + aLevelLB.SelectEntry(sEntry); + } + else + aLevelLB.SelectEntryPos(0); + } + else + aLevelLB.SelectEntryPos(aLevelLB.GetEntryCount() - 1); + +// nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); + USHORT nMask = 1; + aLevelLB.SetUpdateMode(FALSE); + aLevelLB.SetNoSelection(); + if(nActNumLvl == USHRT_MAX) + { + aLevelLB.SelectEntryPos( pSaveNum->GetLevelCount(), TRUE); + } + else + for(USHORT i = 0; i < pSaveNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + aLevelLB.SelectEntryPos( i, TRUE); + nMask <<= 1 ; + } + aLevelLB.SetUpdateMode(TRUE); + + if(!pActNum) + pActNum = new SvxNumRule(*pSaveNum); + else if(*pSaveNum != *pActNum) + *pActNum = *pSaveNum; + pPreviewWIN->SetNumRule(pActNum); + aSameLevelCB.Check(pActNum->IsContinuousNumbering()); + + //ColorListBox bei Bedarf fuellen + if ( pActNum->IsFeatureSupported( NUM_BULLET_COLOR ) ) + { + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + DBG_ASSERT( pDocSh, "DocShell not found!" ); + XColorTable* pColorTable = NULL; + FASTBOOL bKillTable = FALSE; + if ( pDocSh ) + { + pItem = pDocSh->GetItem( SID_COLOR_TABLE ); + if ( pItem ) + pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); + } + + if ( !pColorTable ) + { + pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); + bKillTable = TRUE; + } + + aBulColLB.InsertEntry( Color( COL_AUTO ), SVX_RESSTR( RID_SVXSTR_AUTOMATIC )); + + for ( long i = 0; i < pColorTable->Count(); i++ ) + { + XColorEntry* pEntry = pColorTable->GetColor(i); + aBulColLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + } + + if ( bKillTable ) + delete pColorTable; + } + + SfxObjectShell* pShell; + if ( SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, FALSE, &pItem ) + || ( 0 != ( pShell = SfxObjectShell::Current()) && + 0 != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) ) + { + USHORT nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue(); + bHTMLMode = 0 != (nHtmlMode&HTMLMODE_ON); + } + + BOOL bCharFmt = pActNum->IsFeatureSupported(NUM_CHAR_STYLE); + aCharFmtFT.Show(bCharFmt); + aCharFmtLB.Show(bCharFmt); + + BOOL bContinuous = pActNum->IsFeatureSupported(NUM_CONTINUOUS); + + BOOL bAllLevel = bContinuous && !bHTMLMode; + aAllLevelFT.Show(bAllLevel); + aAllLevelNF.Show(bAllLevel); + + aSameLevelFL.Show(bContinuous); + aSameLevelCB.Show(bContinuous); + //wieder Missbrauch: im Draw gibt es die Numerierung nur bis zum Bitmap + // without SVX_NUM_NUMBER_NONE + //remove types that are unsupported by Draw/Impress + if(!bContinuous) + { + USHORT nFmtCount = aFmtLB.GetEntryCount(); + for(USHORT i = nFmtCount; i; i--) + { + USHORT nEntryData = (USHORT)(ULONG)aFmtLB.GetEntryData(i - 1); + if(/*SVX_NUM_NUMBER_NONE == nEntryData ||*/ + ((SVX_NUM_BITMAP|LINK_TOKEN) == nEntryData)) + aFmtLB.RemoveEntry(i - 1); + } + } + //one must be enabled + if(!pActNum->IsFeatureSupported(NUM_ENABLE_LINKED_BMP)) + { + long nData = SVX_NUM_BITMAP|LINK_TOKEN; + USHORT nPos = aFmtLB.GetEntryPos((void*)nData); + if(LISTBOX_ENTRY_NOTFOUND != nPos) + aFmtLB.RemoveEntry(nPos); + } + else if(!pActNum->IsFeatureSupported(NUM_ENABLE_EMBEDDED_BMP)) + { + long nData = SVX_NUM_BITMAP; + USHORT nPos = aFmtLB.GetEntryPos((void*)nData); + if(LISTBOX_ENTRY_NOTFOUND != nPos) + aFmtLB.RemoveEntry(nPos); + } + if(pActNum->IsFeatureSupported(NUM_SYMBOL_ALIGNMENT)) + { + aAlignFT.Show(); + aAlignLB.Show(); + Size aSz(aFormatFL.GetSizePixel()); + aSz.Height() = aLevelFT.GetSizePixel().Height(); + aFormatFL.SetSizePixel(aSz); + aAlignLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl)); + } + + //MegaHack: Aufgrund eines nicht fixbaren 'designfehlers' im Impress + //Alle arten der numerischen Aufzaehlungen loeschen + if(pActNum->IsFeatureSupported(NUM_NO_NUMBERS)) + { + USHORT nFmtCount = aFmtLB.GetEntryCount(); + for(USHORT i = nFmtCount; i; i--) + { + USHORT nEntryData = (USHORT)(ULONG)aFmtLB.GetEntryData(i - 1); + if( /*nEntryData >= SVX_NUM_CHARS_UPPER_LETTER &&*/ nEntryData <= SVX_NUM_NUMBER_NONE) + aFmtLB.RemoveEntry(i - 1); + } + } + + InitControls(); + bModified = FALSE; + +} +/*-----------------02.12.97 13:47------------------- + +--------------------------------------------------*/ +void SvxNumOptionsTabPage::InitControls() +{ + BOOL bShowBullet = TRUE; + BOOL bShowBitmap = TRUE; + BOOL bSameType = TRUE; + BOOL bSameStart = TRUE; + BOOL bSamePrefix = TRUE; + BOOL bSameSuffix = TRUE; + BOOL bAllLevel = TRUE; + BOOL bSameCharFmt = TRUE; + BOOL bSameVOrient = TRUE; + BOOL bSameSize = TRUE; + BOOL bSameBulColor = TRUE; + BOOL bSameBulRelSize= TRUE; + BOOL bSameAdjust = TRUE; + + const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM]; + String sFirstCharFmt; + sal_Int16 eFirstOrient = text::VertOrientation::NONE; + Size aFirstSize(0,0); + USHORT nMask = 1; + USHORT nLvl = USHRT_MAX; + USHORT nHighestLevel = 0; + String aEmptyStr; + + BOOL bBullColor = pActNum->IsFeatureSupported(NUM_BULLET_COLOR); + BOOL bBullRelSize = pActNum->IsFeatureSupported(NUM_BULLET_REL_SIZE); + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + aNumFmtArr[i] = &pActNum->GetLevel(i); + bShowBullet &= aNumFmtArr[i]->GetNumberingType() == SVX_NUM_CHAR_SPECIAL; + bShowBitmap &= (aNumFmtArr[i]->GetNumberingType()&(~LINK_TOKEN)) == SVX_NUM_BITMAP; + if(USHRT_MAX == nLvl) + { + nLvl = i; + sFirstCharFmt = aNumFmtArr[i]->GetCharFmtName(); + eFirstOrient = aNumFmtArr[i]->GetVertOrient(); + if(bShowBitmap) + aFirstSize = aNumFmtArr[i]->GetGraphicSize(); + } + if( i > nLvl) + { + bSameType &= aNumFmtArr[i]->GetNumberingType() == aNumFmtArr[nLvl]->GetNumberingType(); + bSameStart = aNumFmtArr[i]->GetStart() == aNumFmtArr[nLvl]->GetStart(); + + bSamePrefix = aNumFmtArr[i]->GetPrefix() == aNumFmtArr[nLvl]->GetPrefix(); + bSameSuffix = aNumFmtArr[i]->GetSuffix() == aNumFmtArr[nLvl]->GetSuffix(); + bAllLevel &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[nLvl]->GetIncludeUpperLevels(); + bSameCharFmt &= sFirstCharFmt == aNumFmtArr[i]->GetCharFmtName(); + bSameVOrient &= eFirstOrient == aNumFmtArr[i]->GetVertOrient(); + if(bShowBitmap && bSameSize) + bSameSize &= aNumFmtArr[i]->GetGraphicSize() == aFirstSize; + bSameBulColor &= aNumFmtArr[i]->GetBulletColor() == aNumFmtArr[nLvl]->GetBulletColor(); + bSameBulRelSize &= aNumFmtArr[i]->GetBulletRelSize() == aNumFmtArr[nLvl]->GetBulletRelSize(); + bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust(); + } + nHighestLevel = i; + } + else + aNumFmtArr[i] = 0; + + nMask <<= 1 ; + + } + SwitchNumberType(bShowBullet ? 1 : bShowBitmap ? 2 : 0); + CheckForStartValue_Impl(aNumFmtArr[nLvl]->GetNumberingType()); + if(bShowBitmap) + { + if(!bSameVOrient || eFirstOrient == text::VertOrientation::NONE) + aOrientLB.SetNoSelection(); + else + aOrientLB.SelectEntryPos( + sal::static_int_cast< USHORT >(eFirstOrient - 1)); + // kein text::VertOrientation::NONE + + if(bSameSize) + { + SetMetricValue(aHeightMF, aFirstSize.Height(), eCoreUnit); + SetMetricValue(aWidthMF, aFirstSize.Width(), eCoreUnit); + } + else + { + aHeightMF.SetText(aEmptyStr); + aWidthMF.SetText(aEmptyStr); + } + } + + if(bSameType) + { + USHORT nLBData = (USHORT) aNumFmtArr[nLvl]->GetNumberingType(); + aFmtLB.SelectEntryPos(aFmtLB.GetEntryPos( (void*)sal::static_int_cast( nLBData ) )); + } + else + aFmtLB.SetNoSelection(); + + aAllLevelNF.Enable(nHighestLevel > 0 && !aSameLevelCB.IsChecked()); + aAllLevelNF.SetMax(nHighestLevel + 1); + if(bAllLevel) + { + aAllLevelNF.SetValue(aNumFmtArr[nLvl]->GetIncludeUpperLevels()); + } + else + { + aAllLevelNF.SetText(aEmptyStr); + } + if(bSameAdjust) + { + USHORT nPos = 1; // zentriert + if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT) + nPos = 0; + else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT) + nPos = 2; + aAlignLB.SelectEntryPos(nPos); + } + else + { + aAlignLB.SetNoSelection(); + } + + if(bBullRelSize) + { + if(bSameBulRelSize) + aBulRelSizeMF.SetValue(aNumFmtArr[nLvl]->GetBulletRelSize()); + else + aBulRelSizeMF.SetText(aEmptyStr); + } + if(bBullColor) + { + if(bSameBulColor) + aBulColLB.SelectEntry(aNumFmtArr[nLvl]->GetBulletColor()); + else + aBulColLB.SetNoSelection(); + } + switch(nBullet) + { + case SHOW_NUMBERING: + if(bSameStart) + { + aStartED.SetValue(aNumFmtArr[nLvl]->GetStart()); + } + else + aStartED.SetText(aEmptyStr); + break; + case SHOW_BULLET: + { +// const Font* pFnt = aNumFmtArr[Lvl]->GetBulletFont(); +// if(pFnt) +// ChgTxtFont(aBulletFT, *pFnt); +// aBulletFT.SetText(String((char)aNumFmtArr[nLvl]->GetBulletChar())); + } + break; + case SHOW_BITMAP: + break; + } + + if(bSamePrefix) + aPrefixED.SetText(aNumFmtArr[nLvl]->GetPrefix()); + else + aPrefixED.SetText(aEmptyStr); + if(bSameSuffix) + aSuffixED.SetText(aNumFmtArr[nLvl]->GetSuffix()); + else + aSuffixED.SetText(aEmptyStr); + + if(bSameCharFmt) + { + if(sFirstCharFmt.Len()) + aCharFmtLB.SelectEntry(sFirstCharFmt); + else + aCharFmtLB.SelectEntryPos( 0 ); + } + else + aCharFmtLB.SetNoSelection(); + + pPreviewWIN->SetLevel(nActNumLvl); + pPreviewWIN->Invalidate(); +} + +/*-----------------02.12.97 14:01------------------- + 0 - Nummer; 1 - Bullet; 2 - Bitmap +--------------------------------------------------*/ + +void SvxNumOptionsTabPage::SwitchNumberType( BYTE nType, BOOL ) +{ + if(nBullet == nType) + return; + nBullet = nType; + BOOL bBitmap = FALSE; + BOOL bBullet = FALSE; + BOOL bEnableBitmap = FALSE; + if(nType == SHOW_NUMBERING) + { + // Label umschalten, alten Text merken + aStartFT.SetText(sStartWith); + + } + else if(nType == SHOW_BULLET) + { + // Label umschalten, alten Text merken + aStartFT.SetText(sBullet); + bBullet = TRUE; + } + else + { + bBitmap = TRUE; + bEnableBitmap = TRUE; + } + BOOL bNumeric = !(bBitmap||bBullet); + aPrefixFT.Show(bNumeric); + aPrefixED.Show(bNumeric); + aSuffixFT.Show(bNumeric); + aSuffixED.Show(bNumeric); + + BOOL bCharFmt = pActNum->IsFeatureSupported(NUM_CHAR_STYLE); + aCharFmtFT.Show(!bBitmap && bCharFmt); + aCharFmtLB.Show(!bBitmap && bCharFmt); + + // das ist eigentlich Missbrauch, da fuer die vollst. Numerierung kein + // eigenes Flag existiert + BOOL bAllLevelFeature = pActNum->IsFeatureSupported(NUM_CONTINUOUS); + BOOL bAllLevel = bNumeric && bAllLevelFeature && !bHTMLMode; + aAllLevelFT.Show(bAllLevel); + aAllLevelNF.Show(bAllLevel); + + aStartFT.Show(!bBitmap); + aStartED.Show(!(bBullet||bBitmap)); + + aBulletPB.Show(bBullet); + BOOL bBullColor = pActNum->IsFeatureSupported(NUM_BULLET_COLOR); + aBulColorFT.Show( !bBitmap && bBullColor ); + aBulColLB.Show( !bBitmap && bBullColor ); + BOOL bBullResSize = pActNum->IsFeatureSupported(NUM_BULLET_REL_SIZE); + aBulRelSizeFT.Show( !bBitmap && bBullResSize ); + aBulRelSizeMF.Show( !bBitmap && bBullResSize ); + + aBitmapFT .Show(bBitmap); + aBitmapMB .Show(bBitmap); + + aSizeFT .Show(bBitmap); + aWidthMF .Show(bBitmap); + aMultFT .Show(bBitmap); + aHeightMF .Show(bBitmap); + aRatioCB .Show(bBitmap); + + aOrientFT .Show(bBitmap && bAllLevelFeature); + aOrientLB .Show(bBitmap && bAllLevelFeature); + + aSizeFT .Enable(bEnableBitmap); + aWidthMF .Enable(bEnableBitmap); + aMultFT .Enable(bEnableBitmap); + aHeightMF .Enable(bEnableBitmap); + aRatioCB .Enable(bEnableBitmap); + aOrientFT .Enable(bEnableBitmap); + aOrientLB .Enable(bEnableBitmap); + +} +/*-----------------02.12.97 13:51------------------- + +--------------------------------------------------*/ +IMPL_LINK( SvxNumOptionsTabPage, LevelHdl_Impl, ListBox *, pBox ) +{ + USHORT nSaveNumLvl = nActNumLvl; + nActNumLvl = 0; + if(pBox->IsEntryPosSelected( pActNum->GetLevelCount() ) && + (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff)) + { + nActNumLvl = 0xFFFF; + pBox->SetUpdateMode(FALSE); + for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ ) + pBox->SelectEntryPos( i, FALSE ); + pBox->SetUpdateMode(TRUE); + } + else if(pBox->GetSelectEntryCount()) + { + USHORT nMask = 1; + for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ ) + { + if(pBox->IsEntryPosSelected( i )) + nActNumLvl |= nMask; + nMask <<= 1; + } + pBox->SelectEntryPos( pActNum->GetLevelCount(), FALSE ); + } + else + { + nActNumLvl = nSaveNumLvl; + USHORT nMask = 1; + for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ ) + { + if(nActNumLvl & nMask) + { + pBox->SelectEntryPos(i); + break; + } + nMask <<=1; + } + } + InitControls(); + return 0; +} +/* -----------------------------05.04.2002 15:30------------------------------ + + ---------------------------------------------------------------------------*/ +IMPL_LINK( SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl, Timer*, EMPTYARG ) +{ + pPreviewWIN->Invalidate(); + return 0; +} +/*-----------------03.12.97 12:01------------------- + +--------------------------------------------------*/ +IMPL_LINK( SvxNumOptionsTabPage, AllLevelHdl_Impl, NumericField*, pBox ) +{ + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + USHORT nMask = 1; + for(USHORT e = 0; e < pActNum->GetLevelCount(); e++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aNumFmt(pActNum->GetLevel(e)); + aNumFmt.SetIncludeUpperLevels((BYTE) std::min(pBox->GetValue(), sal_Int64(e + 1)) ); + pActNum->SetLevel(e, aNumFmt); + } + nMask <<= 1; + } + } + SetModified(); + return 0; +} + +/*-----------------02.12.97 08:56------------------- + +--------------------------------------------------*/ +IMPL_LINK( SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, ListBox *, pBox ) +{ + String sSelectStyle; + sal_Int16 eOldType; + BOOL bShowOrient = FALSE; + BOOL bBmp = FALSE; + String aEmptyStr; + USHORT nMask = 1; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); + eOldType = aNumFmt.GetNumberingType(); + // PAGEDESC gibt es nicht + USHORT nNumType = (USHORT)(ULONG)pBox->GetEntryData(pBox->GetSelectEntryPos()); + aNumFmt.SetNumberingType((sal_Int16)nNumType); + sal_uInt16 nNumberingType = aNumFmt.GetNumberingType(); + if(SVX_NUM_BITMAP == (nNumberingType&(~LINK_TOKEN))) + { + bBmp |= 0 != aNumFmt.GetBrush(); + aNumFmt.SetIncludeUpperLevels( FALSE ); + aNumFmt.SetSuffix( aEmptyStr ); + aNumFmt.SetPrefix( aEmptyStr ); + if(!bBmp) + aNumFmt.SetGraphic(aEmptyStr); + pActNum->SetLevel(i, aNumFmt); + SwitchNumberType(SHOW_BITMAP, bBmp ); + bShowOrient = TRUE; + } + else if( SVX_NUM_CHAR_SPECIAL == nNumberingType ) + { + aNumFmt.SetIncludeUpperLevels( FALSE ); + aNumFmt.SetSuffix( aEmptyStr ); + aNumFmt.SetPrefix( aEmptyStr ); + if( !aNumFmt.GetBulletFont() ) + aNumFmt.SetBulletFont(&aActBulletFont); + if( !aNumFmt.GetBulletChar() ) + aNumFmt.SetBulletChar( SVX_DEF_BULLET ); + pActNum->SetLevel(i, aNumFmt); + SwitchNumberType(SHOW_BULLET); + //ChgTxtFont(aBulletFT, *aNumFmt.GetBulletFont()); + //aBulletFT.SetText( aNumFmt.GetBulletChar() ); + // Zuweisung der Zeichenvorlage automatisch + if(bAutomaticCharStyles) + { + sSelectStyle = sBulletCharFmtName; + } + } + else + { + aNumFmt.SetPrefix( aPrefixED.GetText() ); + aNumFmt.SetSuffix( aSuffixED.GetText() ); +// aNumFmt.SetBulletFont(0); + SwitchNumberType(SHOW_NUMBERING); + pActNum->SetLevel(i, aNumFmt); + CheckForStartValue_Impl(nNumberingType); + + // Zuweisung der Zeichenvorlage automatisch + if(bAutomaticCharStyles) + { + sSelectStyle = sNumCharFmtName; + } + } + } + nMask <<= 1; + } + BOOL bAllLevelFeature = pActNum->IsFeatureSupported(NUM_CONTINUOUS); + if(bShowOrient && bAllLevelFeature) + { + aOrientFT.Show(); + aOrientLB.Show(); + } + else + { + aOrientFT.Hide(); + aOrientLB.Hide(); + } + SetModified(); + if(sSelectStyle.Len()) + { + aCharFmtLB.SelectEntry(sSelectStyle); + CharFmtHdl_Impl(&aCharFmtLB); + // bAutomaticCharStyles wird im CharFmtHdl_Impl zurueckgesetzt + bAutomaticCharStyles = TRUE; + } + return 0; +} +/* -----------------06.11.2002 14:27----------------- + * + * --------------------------------------------------*/ +void SvxNumOptionsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType) +{ + BOOL bIsNull = aStartED.GetValue() == 0; + BOOL bNoZeroAllowed = nNumberingType < SVX_NUM_ARABIC || + SVX_NUM_CHARS_UPPER_LETTER_N == nNumberingType || + SVX_NUM_CHARS_LOWER_LETTER_N == nNumberingType; + aStartED.SetMin(bNoZeroAllowed ? 1 : 0); + if(bIsNull && bNoZeroAllowed) + aStartED.GetModifyHdl().Call(&aStartED); +} +/*-----------------03.12.97 16:43------------------- + +--------------------------------------------------*/ +IMPL_LINK( SvxNumOptionsTabPage, OrientHdl_Impl, ListBox *, pBox ) +{ + USHORT nPos = pBox->GetSelectEntryPos(); + nPos ++; // kein VERT_NONE + + USHORT nMask = 1; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); + if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN))) + { + const SvxBrushItem* pBrushItem = aNumFmt.GetBrush(); + const Size& rSize = aNumFmt.GetGraphicSize(); + sal_Int16 eOrient = (sal_Int16)nPos; + aNumFmt.SetGraphicBrush( pBrushItem, &rSize, &eOrient ); + pActNum->SetLevel(i, aNumFmt); + } + } + nMask <<= 1; + } + SetModified(FALSE); + return 0; + +} + +/*-----------------06.12.97 12:00------------------- + +--------------------------------------------------*/ +IMPL_LINK( SvxNumOptionsTabPage, SameLevelHdl_Impl, CheckBox *, pBox ) +{ + BOOL bSet = pBox->IsChecked(); + pActNum->SetContinuousNumbering(bSet); + BOOL bRepaint = FALSE; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); + if(aNumFmt.GetNumberingType() != SVX_NUM_NUMBER_NONE) + { + bRepaint = TRUE; + break; + } + } + SetModified(bRepaint); + InitControls(); + return 0; +} +/* -----------------16.11.98 14:20------------------- + * + * --------------------------------------------------*/ +IMPL_LINK( SvxNumOptionsTabPage, BulColorHdl_Impl, ColorListBox*, pBox ) +{ + Color nSetColor = pBox->GetSelectEntryColor(); + + USHORT nMask = 1; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); + aNumFmt.SetBulletColor(nSetColor); + pActNum->SetLevel(i, aNumFmt); + } + nMask <<= 1; + } + SetModified(); + return 0; +} +/* -----------------16.11.98 14:20------------------- + * + * --------------------------------------------------*/ +IMPL_LINK( SvxNumOptionsTabPage, BulRelSizeHdl_Impl, MetricField *, pField) +{ + USHORT nRelSize = (USHORT)pField->GetValue(); + + USHORT nMask = 1; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); + aNumFmt.SetBulletRelSize(nRelSize); + pActNum->SetLevel(i, aNumFmt); + } + nMask <<= 1; + } + SetModified(); + return 0; +} + +/*-----------------02.12.97 10:50------------------- + +--------------------------------------------------*/ +IMPL_LINK( SvxNumOptionsTabPage, GraphicHdl_Impl, MenuButton *, pButton ) +{ + USHORT nItemId = pButton->GetCurItemId(); + String aGrfName; + Size aSize; + sal_Bool bSucc(sal_False); + SvxOpenGraphicDialog aGrfDlg( SVX_RES(RID_STR_EDIT_GRAPHIC) ); +// aGrfDlg.SetDialogHelpId( HID_NUMBERINGOPT_SEL_GRF_FROM_FILE ); + + if(MN_GALLERY_ENTRY <= nItemId ) + { + aGrfName = *((String*)aGrfNames.GetObject( nItemId - MN_GALLERY_ENTRY)); + Graphic aGraphic; + if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nItemId - MN_GALLERY_ENTRY, &aGraphic)) + { + aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); + bSucc = sal_True; + } + } + else + { + aGrfDlg.EnableLink( sal_False ); + aGrfDlg.AsLink( sal_False ); + if ( !aGrfDlg.Execute() ) + { + // ausgewaehlten Filter merken + aGrfName = aGrfDlg.GetPath(); + + Graphic aGraphic; + if( !aGrfDlg.GetGraphic(aGraphic) ) + { + aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); + bSucc = sal_True; + } + } + } + if(bSucc) + { + aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)eCoreUnit); + + USHORT nMask = 1; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); + aNumFmt.SetCharFmtName(sNumCharFmtName); + aNumFmt.SetGraphic(aGrfName); + + // Size schon mal fuer spaeteren Groessenabgleich setzen + const SvxBrushItem* pBrushItem = aNumFmt.GetBrush(); + // initiate asynchronous loading + sal_Int16 eOrient = aNumFmt.GetVertOrient(); + aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient ); + aInitSize[i] = aNumFmt.GetGraphicSize(); + + pActNum->SetLevel(i, aNumFmt); + } + nMask <<= 1; + } + aRatioCB .Enable(); + aSizeFT .Enable(); + aMultFT.Enable(); + aWidthMF .Enable(); + aHeightMF.Enable(); + SetMetricValue(aWidthMF, aSize.Width(), eCoreUnit); + SetMetricValue(aHeightMF, aSize.Height(), eCoreUnit); + aOrientFT.Enable(); + aOrientLB.Enable(); + SetModified(); + //needed due to asynchronous loading of graphics in the SvxBrushItem + aInvalidateTimer.Start(); + } + return 0; +} +/* -----------------27.07.99 12:20------------------- + + --------------------------------------------------*/ +IMPL_LINK( SvxNumOptionsTabPage, PopupActivateHdl_Impl, Menu *, EMPTYARG ) +{ + if(!bMenuButtonInitialized) + { + bMenuButtonInitialized = TRUE; + EnterWait(); + PopupMenu* pPopup = aBitmapMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY ); + GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames); + if(aGrfNames.Count()) + { + pPopup->RemoveItem( pPopup->GetItemPos( NUM_NO_GRAPHIC )); + String aEmptyStr; + GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS); + + for(USHORT i = 0; i < aGrfNames.Count(); i++) + { + Graphic aGraphic; + String sGrfName = *(const String*)aGrfNames.GetObject(i); + INetURLObject aObj(sGrfName); + if(aObj.GetProtocol() == INET_PROT_FILE) + sGrfName = aObj.PathToFileName(); + if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, i, &aGraphic)) + { + Bitmap aBitmap(aGraphic.GetBitmap()); + Size aSize(aBitmap.GetSizePixel()); + if(aSize.Width() > MAX_BMP_WIDTH || + aSize.Height() > MAX_BMP_HEIGHT) + { + BOOL bWidth = aSize.Width() > aSize.Height(); + double nScale = bWidth ? + (double)MAX_BMP_WIDTH / (double)aSize.Width(): + (double)MAX_BMP_HEIGHT / (double)aSize.Height(); + aBitmap.Scale(nScale, nScale); + } + Image aImage(aBitmap); + + pPopup->InsertItem(MN_GALLERY_ENTRY + i, sGrfName, aImage ); + } + else + { + Image aImage; + pPopup->InsertItem( + MN_GALLERY_ENTRY + i, sGrfName, aImage ); + } + } + GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS); + } + LeaveWait(); + } + return 0; +} + +/*-----------------02.12.97 10:58------------------- + +--------------------------------------------------*/ +IMPL_LINK( SvxNumOptionsTabPage, BulletHdl_Impl, Button *, EMPTYARG ) +{ + SvxCharacterMap* pMap = new SvxCharacterMap( this, TRUE ); + + USHORT nMask = 1; + const Font* pFmtFont = 0; + BOOL bSameBullet = TRUE; + sal_Unicode cBullet = 0; + BOOL bFirst = TRUE; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + const SvxNumberFormat& rCurFmt = pActNum->GetLevel(i); + if(bFirst) + { + cBullet = rCurFmt.GetBulletChar(); + } + else if(rCurFmt.GetBulletChar() != cBullet ) + { + bSameBullet = FALSE; + break; + } + if(!pFmtFont) + pFmtFont = rCurFmt.GetBulletFont(); + bFirst = FALSE; + } + nMask <<= 1; + + } + + if(pFmtFont) + pMap->SetCharFont(*pFmtFont); + else + pMap->SetCharFont(aActBulletFont); + if(bSameBullet) + pMap->SetChar( cBullet ); + if(pMap->Execute() == RET_OK) + { + // Font Numrules umstellen + aActBulletFont = pMap->GetCharFont(); + + USHORT _nMask = 1; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & _nMask) + { + SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); + aNumFmt.SetBulletFont(&aActBulletFont); ; + aNumFmt.SetBulletChar( (sal_Unicode) pMap->GetChar() ); + pActNum->SetLevel(i, aNumFmt); + } + _nMask <<= 1; + } + + SetModified(); + } + delete pMap; + return 0; +} + +/*-----------------03.03.97 15:21------------------- + +--------------------------------------------------*/ + +IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, MetricField *, pField) +{ + BOOL bWidth = pField == &aWidthMF; + bLastWidthModified = bWidth; + BOOL bRatio = aRatioCB.IsChecked(); + long nWidthVal = static_cast(aWidthMF.Denormalize(aWidthMF.GetValue(FUNIT_100TH_MM))); + long nHeightVal = static_cast(aHeightMF.Denormalize(aHeightMF.GetValue(FUNIT_100TH_MM))); + nWidthVal = OutputDevice::LogicToLogic( nWidthVal , + MAP_100TH_MM, (MapUnit)eCoreUnit ); + nHeightVal = OutputDevice::LogicToLogic( nHeightVal, + MAP_100TH_MM, (MapUnit)eCoreUnit); + double fSizeRatio; + + BOOL bRepaint = FALSE; + USHORT nMask = 1; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); + if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN))) + { + Size aSize(aNumFmt.GetGraphicSize() ); + Size aSaveSize(aSize); + + if (aInitSize[i].Height()) + fSizeRatio = (double)aInitSize[i].Width() / (double)aInitSize[i].Height(); + else + fSizeRatio = (double)1; + + if(bWidth) + { + long nDelta = nWidthVal - aInitSize[i].Width(); + aSize.Width() = nWidthVal; + if (bRatio) + { + aSize.Height() = aInitSize[i].Height() + (long)((double)nDelta / fSizeRatio); + aHeightMF.SetUserValue(aHeightMF.Normalize( + OutputDevice::LogicToLogic( aSize.Height(), (MapUnit)eCoreUnit, MAP_100TH_MM )), + FUNIT_100TH_MM); + } + } + else + { + long nDelta = nHeightVal - aInitSize[i].Height(); + aSize.Height() = nHeightVal; + if (bRatio) + { + aSize.Width() = aInitSize[i].Width() + (long)((double)nDelta * fSizeRatio); + aWidthMF.SetUserValue(aWidthMF.Normalize( + OutputDevice::LogicToLogic( aSize.Width(), (MapUnit)eCoreUnit, MAP_100TH_MM )), + FUNIT_100TH_MM); + } + } + const SvxBrushItem* pBrushItem = aNumFmt.GetBrush(); + sal_Int16 eOrient = aNumFmt.GetVertOrient(); + if(aSize != aSaveSize) + bRepaint = TRUE; + aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient ); + pActNum->SetLevel(i, aNumFmt); + } + } + nMask <<= 1; + } + SetModified(bRepaint); + return 0; +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +IMPL_LINK( SvxNumOptionsTabPage, RatioHdl_Impl, CheckBox *, pBox ) +{ + if (pBox->IsChecked()) + { + if (bLastWidthModified) + SizeHdl_Impl(&aWidthMF); + else + SizeHdl_Impl(&aHeightMF); + } + return 0; +} + +/*-----------------02.12.97 16:07------------------- + +--------------------------------------------------*/ +IMPL_LINK( SvxNumOptionsTabPage, CharFmtHdl_Impl, ListBox *, EMPTYARG ) +{ + bAutomaticCharStyles = FALSE; + USHORT nEntryPos = aCharFmtLB.GetSelectEntryPos(); + String sEntry = aCharFmtLB.GetSelectEntry(); + USHORT nMask = 1; + String aEmptyStr; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); + if( 0 == nEntryPos ) + aNumFmt.SetCharFmtName(aEmptyStr); + else + { + if(SVX_NUM_BITMAP != (aNumFmt.GetNumberingType()&(~LINK_TOKEN))) + aNumFmt.SetCharFmtName(sEntry); + } + pActNum->SetLevel(i, aNumFmt); + } + nMask <<= 1; + } + SetModified(FALSE); + return 0; + +}; + +/*-----------------03.12.97 11:01------------------- + +--------------------------------------------------*/ +IMPL_LINK( SvxNumOptionsTabPage, EditModifyHdl_Impl, Edit *, pEdit ) +{ + BOOL bPrefix = pEdit == &aPrefixED; + BOOL bSuffix = pEdit == &aSuffixED; + BOOL bStart = pEdit == &aStartED; + USHORT nMask = 1; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); + if(bPrefix) + aNumFmt.SetPrefix( aPrefixED.GetText() ); + else if(bSuffix) + aNumFmt.SetSuffix( aSuffixED.GetText() ); + else if(bStart) + aNumFmt.SetStart( (USHORT)aStartED.GetValue() ); + else //align + { + USHORT nPos = aAlignLB.GetSelectEntryPos(); + SvxAdjust eAdjust = SVX_ADJUST_CENTER; + if(nPos == 0) + eAdjust = SVX_ADJUST_LEFT; + else if(nPos == 2) + eAdjust = SVX_ADJUST_RIGHT; + aNumFmt.SetNumAdjust( eAdjust ); + } + pActNum->SetLevel(i, aNumFmt); + } + nMask <<= 1; + } + SetModified(); + + return 0; +} + +/*-----------------09.12.97 11:49------------------- + +--------------------------------------------------*/ +USHORT lcl_DrawGraphic(VirtualDevice* pVDev, const SvxNumberFormat &rFmt, USHORT nXStart, + USHORT nYStart, USHORT nDivision) +{ + const SvxBrushItem* pBrushItem = rFmt.GetBrush(); + USHORT nRet = 0; + if(pBrushItem) + { + const Graphic* pGrf = pBrushItem->GetGraphic(); + if(pGrf) + { + Size aGSize( rFmt.GetGraphicSize() ); + aGSize.Width() /= nDivision; + nRet = (USHORT)aGSize.Width(); + aGSize.Height() /= nDivision; + pGrf->Draw( pVDev, Point(nXStart,nYStart), + pVDev->PixelToLogic( aGSize ) ); + } + } + return nRet; + +} + +/*-----------------09.12.97 11:54------------------- + +--------------------------------------------------*/ +USHORT lcl_DrawBullet(VirtualDevice* pVDev, + const SvxNumberFormat& rFmt, USHORT nXStart, + USHORT nYStart, const Size& rSize) +{ + Font aTmpFont(pVDev->GetFont()); + + //per Uno kann es sein, dass kein Font gesetzt ist! + Font aFont(rFmt.GetBulletFont() ? *rFmt.GetBulletFont() : aTmpFont); + Size aTmpSize(rSize); + aTmpSize.Width() *= rFmt.GetBulletRelSize(); + aTmpSize.Width() /= 100 ; + aTmpSize.Height() *= rFmt.GetBulletRelSize(); + aTmpSize.Height() /= 100 ; + // bei einer Hoehe von Null wird in Ursprungshoehe gezeichnet + if(!aTmpSize.Height()) + aTmpSize.Height() = 1; + aFont.SetSize(aTmpSize); + aFont.SetTransparent(TRUE); + Color aBulletColor = rFmt.GetBulletColor(); + if(aBulletColor.GetColor() == COL_AUTO) + aBulletColor = Color(pVDev->GetFillColor().IsDark() ? COL_WHITE : COL_BLACK); + else if(aBulletColor == pVDev->GetFillColor()) + aBulletColor.Invert(); + aFont.SetColor(aBulletColor); + pVDev->SetFont( aFont ); + String aText(sal_Unicode(rFmt.GetBulletChar())); + long nY = nYStart; + nY -= ((aTmpSize.Height() - rSize.Height())/ 2); + pVDev->DrawText( Point(nXStart, nY), aText ); + USHORT nRet = (USHORT)pVDev->GetTextWidth(aText); + + pVDev->SetFont(aTmpFont); + return nRet; +} +/*-----------------02.12.97 10:34------------------- + Vorschau der Numerierung painten +--------------------------------------------------*/ +void SvxNumberingPreview::Paint( const Rectangle& /*rRect*/ ) +{ + Size aSize(PixelToLogic(GetOutputSizePixel())); + Rectangle aRect(Point(0,0), aSize); + + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const Color aBackColor = rStyleSettings.GetFieldColor(); + const Color aTextColor = rStyleSettings.GetFieldTextColor(); + + VirtualDevice* pVDev = new VirtualDevice(*this); + pVDev->EnableRTL( IsRTLEnabled() ); + pVDev->SetMapMode(GetMapMode()); + pVDev->SetOutputSize( aSize ); + + Color aLineColor(COL_LIGHTGRAY); + if(aLineColor == aBackColor) + aLineColor.Invert(); + pVDev->SetLineColor(aLineColor); + pVDev->SetFillColor( aBackColor ); + pVDev->DrawRect(aRect); + + if(pActNum) + { + USHORT nWidthRelation; + if(nPageWidth) + { + nWidthRelation = USHORT (nPageWidth / aSize.Width()); + if(bPosition) + nWidthRelation = nWidthRelation * 2 / 3; + else + nWidthRelation = nWidthRelation / 4; + } + else + nWidthRelation = 30; // Kapiteldialog + + //Hoehe pro Ebene + USHORT nXStep = sal::static_int_cast< USHORT >(aSize.Width() / (3 * pActNum->GetLevelCount())); + if(pActNum->GetLevelCount() < 10) + nXStep /= 2; + USHORT nYStart = 4; + // fuer ein einziges Level darf nicht die gesamte Hoehe benutzt werden + USHORT nYStep = sal::static_int_cast< USHORT >((aSize.Height() - 6)/ (pActNum->GetLevelCount() > 1 ? pActNum->GetLevelCount() : 5)); + aStdFont = OutputDevice::GetDefaultFont( + DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE); + aStdFont.SetColor(aTextColor); + aStdFont.SetFillColor(aBackColor); + + // + USHORT nFontHeight = nYStep * 6 / 10; + if(bPosition) + nFontHeight = nYStep * 15 / 10; + aStdFont.SetSize(Size( 0, nFontHeight )); + + SvxNodeNum aNum( (BYTE)0 ); + USHORT nPreNum = pActNum->GetLevel(0).GetStart(); + + if(bPosition) + { + USHORT nLineHeight = nFontHeight * 8 / 7; + BYTE nStart = 0; + while( !(nActLevel & (1<GetLevelCount() ); + for( BYTE nLevel = nStart; nLevel < nEnd; ++nLevel ) + { + const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel); + aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart(); + + // --> OD 2008-01-16 #newlistlevelattrs# + USHORT nXStart( 0 ); + short nTextOffset( 0 ); + USHORT nNumberXPos( 0 ); + if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + nXStart = rFmt.GetAbsLSpace() / nWidthRelation; + nTextOffset = rFmt.GetCharTextDistance() / nWidthRelation; + nNumberXPos = nXStart; + USHORT nFirstLineOffset = (-rFmt.GetFirstLineOffset()) / nWidthRelation; + + if(nFirstLineOffset <= nNumberXPos) + nNumberXPos = nNumberXPos - nFirstLineOffset; + else + nNumberXPos = 0; + //im draw ist das zulaeesig + if(nTextOffset < 0) + nNumberXPos = nNumberXPos + nTextOffset; + } + else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) + { + const long nTmpNumberXPos( ( rFmt.GetIndentAt() + + rFmt.GetFirstLineIndent() ) / + nWidthRelation ); + if ( nTmpNumberXPos < 0 ) + { + nNumberXPos = 0; + } + else + { + nNumberXPos = static_cast( nTmpNumberXPos ); + } + } + // <-- + + USHORT nBulletWidth = 0; + if( SVX_NUM_BITMAP == (rFmt.GetNumberingType() &(~LINK_TOKEN))) + { + nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawGraphic(pVDev, rFmt, + nNumberXPos, + nYStart, nWidthRelation) : 0; + } + else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() ) + { + nBulletWidth = rFmt.IsShowSymbol() ? + lcl_DrawBullet(pVDev, rFmt, nNumberXPos, nYStart, aStdFont.GetSize()) : 0; + } + else + { + pVDev->SetFont(aStdFont); + aNum.SetLevel( nLevel ); + if(pActNum->IsContinuousNumbering()) + aNum.GetLevelVal()[nLevel] = nPreNum; + String aText(pActNum->MakeNumString( aNum )); + Font aSaveFont = pVDev->GetFont(); + Font aColorFont(aSaveFont); + Color aTmpBulletColor = rFmt.GetBulletColor(); + if(aTmpBulletColor.GetColor() == COL_AUTO) + aTmpBulletColor = Color(aBackColor.IsDark() ? COL_WHITE : COL_BLACK); + else if(aTmpBulletColor == aBackColor) + aTmpBulletColor.Invert(); + aColorFont.SetColor(aTmpBulletColor); + pVDev->SetFont(aColorFont); + pVDev->DrawText( Point(nNumberXPos, nYStart), aText ); + pVDev->SetFont(aSaveFont); + nBulletWidth = (USHORT)pVDev->GetTextWidth(aText); + nPreNum++; + } + // --> OD 2008-01-16 #newlistlevelattrs# + if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT && + rFmt.GetLabelFollowedBy() == SvxNumberFormat::SPACE ) + { + pVDev->SetFont(aStdFont); + String aText(' '); + pVDev->DrawText( Point(nNumberXPos, nYStart), aText ); + nBulletWidth = nBulletWidth + (USHORT)pVDev->GetTextWidth(aText); + } + + // --> OD 2008-01-16 #newlistlevelattrs# + USHORT nTextXPos( 0 ); + if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + nTextXPos = nXStart; + if(nTextOffset < 0) + nTextXPos = nTextXPos + nTextOffset; + if(nNumberXPos + nBulletWidth + nTextOffset > nTextXPos ) + nTextXPos = nNumberXPos + nBulletWidth + nTextOffset; + } + else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) + { + switch ( rFmt.GetLabelFollowedBy() ) + { + case SvxNumberFormat::LISTTAB: + { + nTextXPos = static_cast( + rFmt.GetListtabPos() / nWidthRelation ); + if ( nTextXPos < nNumberXPos + nBulletWidth ) + { + nTextXPos = nNumberXPos + nBulletWidth; + } + } + break; + case SvxNumberFormat::SPACE: + case SvxNumberFormat::NOTHING: + { + nTextXPos = nNumberXPos + nBulletWidth; + } + break; + } + + nXStart = static_cast( rFmt.GetIndentAt() / nWidthRelation ); + } + // <-- + + Rectangle aRect1(Point(nTextXPos, nYStart + nFontHeight / 2), Size(aSize.Width() / 2, 2)); + pVDev->SetFillColor( aBackColor ); + pVDev->DrawRect( aRect1 ); + + Rectangle aRect2(Point(nXStart, nYStart + nLineHeight + nFontHeight / 2 ), Size(aSize.Width() / 2, 2)); + pVDev->DrawRect( aRect2 ); + nYStart += 2 * nLineHeight; + } + } + else + { + //#i5153# painting gray or black rectangles as 'normal' numbering text + String sMsg( RTL_CONSTASCII_USTRINGPARAM( "Preview") ); + long nWidth = pVDev->GetTextWidth(sMsg); + long nTextHeight = pVDev->GetTextHeight(); + long nRectHeight = nTextHeight * 2 / 3; + long nTopOffset = nTextHeight - nRectHeight; + Color aBlackColor(COL_BLACK); + if(aBlackColor == aBackColor) + aBlackColor.Invert(); + + for( BYTE nLevel = 0; nLevel < pActNum->GetLevelCount(); + ++nLevel, nYStart = nYStart + nYStep ) + { + const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel); + aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart(); + // --> OD 2008-01-31 #newlistlevelattrs# + USHORT nXStart( 0 ); + if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + nXStart = rFmt.GetAbsLSpace() / nWidthRelation; + } + else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) + { + const long nTmpXStart( ( rFmt.GetIndentAt() + + rFmt.GetFirstLineIndent() ) / + nWidthRelation ); + if ( nTmpXStart < 0 ) + { + nXStart = 0; + } + else + { + nXStart = static_cast(nTmpXStart); + } + } + nXStart /= 2; + nXStart += 2; + // <-- + USHORT nTextOffset = 2 * nXStep; + if( SVX_NUM_BITMAP == (rFmt.GetNumberingType()&(~LINK_TOKEN)) ) + { + if(rFmt.IsShowSymbol()) + { + nTextOffset = lcl_DrawGraphic(pVDev, rFmt, nXStart, nYStart, nWidthRelation); + nTextOffset = nTextOffset + nXStep; + } + } + else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() ) + { + if(rFmt.IsShowSymbol()) + { + nTextOffset = lcl_DrawBullet(pVDev, rFmt, nXStart, nYStart, aStdFont.GetSize()); + nTextOffset = nTextOffset + nXStep; + } + } + else + { + Font aColorFont(aStdFont); + Color aTmpBulletColor = rFmt.GetBulletColor(); + if(aTmpBulletColor.GetColor() == COL_AUTO) + aTmpBulletColor = Color(aBackColor.IsDark() ? COL_WHITE : COL_BLACK); + else if(aTmpBulletColor == aBackColor) + aTmpBulletColor.Invert(); + aColorFont.SetColor(aTmpBulletColor); + pVDev->SetFont(aColorFont); + aNum.SetLevel( nLevel ); + if(pActNum->IsContinuousNumbering()) + aNum.GetLevelVal()[nLevel] = nPreNum; + String aText(pActNum->MakeNumString( aNum )); + pVDev->DrawText( Point(nXStart, nYStart), aText ); + pVDev->SetFont(aStdFont); + nTextOffset = (USHORT)pVDev->GetTextWidth(aText); + nTextOffset = nTextOffset + nXStep; + nPreNum++; + } + if(pOutlineNames) + { + //#i5153# outline numberings still use the style names as text + pVDev->SetFont(aStdFont); + sMsg = pOutlineNames[nLevel]; + pVDev->DrawText( Point(nXStart + nTextOffset, nYStart), sMsg ); + } + else + { + //#i5153# the selected rectangle(s) should be black + if( 0 != (nActLevel & (1<SetFillColor( aBlackColor ); + pVDev->SetLineColor( aBlackColor ); + } + else + { + //#i5153# unselected levels are gray + pVDev->SetFillColor( aLineColor ); + pVDev->SetLineColor( aLineColor ); + } + Rectangle aRect1(Point(nXStart + nTextOffset, nYStart + nTopOffset), Size(nWidth, nRectHeight)); + pVDev->DrawRect(aRect1); + } + } + } + } + DrawOutDev( Point(0,0), aSize, + Point(0,0), aSize, + *pVDev ); + delete pVDev; + +} + +/*-----------------03.12.97 10:02------------------- + +--------------------------------------------------*/ +SvxNumPositionTabPage::SvxNumPositionTabPage(Window* pParent, + const SfxItemSet& rSet) : + SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_NUM_POSITION ), rSet ), + aPositionFL( this, SVX_RES(FL_POSITION )), + aLevelFT( this, SVX_RES(FT_LEVEL )), + aLevelLB( this, SVX_RES(LB_LEVEL )), + aDistBorderFT( this, SVX_RES(FT_BORDERDIST )), + aDistBorderMF( this, SVX_RES(MF_BORDERDIST )), + aRelativeCB( this, SVX_RES(CB_RELATIVE )), + aIndentFT( this, SVX_RES(FT_INDENT )), + aIndentMF( this, SVX_RES(MF_INDENT )), + aDistNumFT( this, SVX_RES(FT_NUMDIST )), + aDistNumMF( this, SVX_RES(MF_NUMDIST )), + aAlignFT( this, SVX_RES(FT_ALIGN )), + aAlignLB( this, SVX_RES(LB_ALIGN )), + // --> OD 2008-01-10 #newlistlevelattrs# + aLabelFollowedByFT( this, SVX_RES(FT_LABEL_FOLLOWED_BY) ), + aLabelFollowedByLB( this, SVX_RES(LB_LABEL_FOLLOWED_BY) ), + aListtabFT( this, SVX_RES(FT_LISTTAB) ), + aListtabMF( this, SVX_RES(MF_LISTTAB) ), + aAlign2FT( this, SVX_RES(FT_ALIGN_2) ), + aAlign2LB( this, SVX_RES(LB_ALIGN_2) ), + aAlignedAtFT( this, SVX_RES(FT_ALIGNED_AT) ), + aAlignedAtMF( this, SVX_RES(MF_ALIGNED_AT) ), + aIndentAtFT( this, SVX_RES(FT_INDENT_AT) ), + aIndentAtMF( this, SVX_RES(MF_INDENT_AT) ), + // <-- + aStandardPB( this, SVX_RES(PB_STANDARD )), + pPreviewWIN( new SvxNumberingPreview(this, SVX_RES(WIN_PREVIEW ))), + pActNum(0), + pSaveNum(0), + nActNumLvl( USHRT_MAX ), + nNumItemId(SID_ATTR_NUMBERING_RULE), + bModified(false), + bPreset(false), + bInInintControl(FALSE), + // --> OD 2008-01-11 #newlistlevelattrs# + bLabelAlignmentPosAndSpaceModeActive( false ) + // <-- +{ + FreeResource(); + SetExchangeSupport(); + pPreviewWIN->SetBackground(Wallpaper(Color(COL_TRANSPARENT))); + + aRelativeCB.Check(); + aAlignLB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, EditModifyHdl_Impl)); + // --> OD 2008-01-10 #newlistlevelattrs# + aAlign2LB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, EditModifyHdl_Impl)); + for ( USHORT i = 0; i < aAlignLB.GetEntryCount(); ++i ) + { + aAlign2LB.InsertEntry( aAlignLB.GetEntry( i ) ); + } + aAlign2LB.SetDropDownLineCount( aAlign2LB.GetEntryCount() ); + aAlign2FT.SetText( aAlignFT.GetText() ); + // <-- + + Link aLk = LINK(this, SvxNumPositionTabPage, DistanceHdl_Impl); + + aDistBorderMF.SetUpHdl(aLk); + aDistBorderMF.SetDownHdl(aLk); + aDistBorderMF.SetLoseFocusHdl(aLk); + + aDistNumMF.SetUpHdl(aLk); + aDistNumMF.SetDownHdl(aLk); + aDistNumMF.SetLoseFocusHdl(aLk); + + aIndentMF.SetUpHdl(aLk); + aIndentMF.SetDownHdl(aLk); + aIndentMF.SetLoseFocusHdl(aLk); + + // --> OD 2008-01-10 #newlistlevelattrs# + aLabelFollowedByLB.SetDropDownLineCount( aLabelFollowedByLB.GetEntryCount() ); + aLabelFollowedByLB.SetSelectHdl( LINK(this, SvxNumPositionTabPage, LabelFollowedByHdl_Impl) ); + + aLk = LINK(this, SvxNumPositionTabPage, ListtabPosHdl_Impl); + aListtabMF.SetUpHdl(aLk); + aListtabMF.SetDownHdl(aLk); + aListtabMF.SetLoseFocusHdl(aLk); + + aLk = LINK(this, SvxNumPositionTabPage, AlignAtHdl_Impl); + aAlignedAtMF.SetUpHdl(aLk); + aAlignedAtMF.SetDownHdl(aLk); + aAlignedAtMF.SetLoseFocusHdl(aLk); + + aLk = LINK(this, SvxNumPositionTabPage, IndentAtHdl_Impl); + aIndentAtMF.SetUpHdl(aLk); + aIndentAtMF.SetDownHdl(aLk); + aIndentAtMF.SetLoseFocusHdl(aLk); + // <-- + + aLevelLB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, LevelHdl_Impl)); + aRelativeCB.SetClickHdl(LINK(this, SvxNumPositionTabPage, RelativeHdl_Impl)); + aStandardPB.SetClickHdl(LINK(this, SvxNumPositionTabPage, StandardHdl_Impl)); + + + aRelativeCB.Check(bLastRelative); + pPreviewWIN->SetPositionMode(); + eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE)); + + //HACK("der Wert sollte mal sinnvol gesetzt werden") + long nWidth = 10000; + nWidth = OutputDevice::LogicToLogic( nWidth, + (MapUnit)eCoreUnit, MAP_100TH_MM ); + + aDistBorderMF.SetMax(aDistBorderMF.Normalize( nWidth ), FUNIT_100TH_MM ); + aDistNumMF .SetMax(aDistNumMF .Normalize( nWidth ), FUNIT_100TH_MM ); + aIndentMF .SetMax(aIndentMF .Normalize( nWidth ), FUNIT_100TH_MM ); + // --> OD 2008-02-18 #newlistlevelattrs# + aListtabMF.SetMax(aListtabMF.Normalize( nWidth ), FUNIT_100TH_MM ); + aAlignedAtMF.SetMax(aAlignedAtMF.Normalize( nWidth ), FUNIT_100TH_MM ); + aIndentAtMF.SetMax(aIndentAtMF.Normalize( nWidth ), FUNIT_100TH_MM ); + // <-- + long nLast2 = nWidth /2; + aDistBorderMF.SetLast( aDistBorderMF.Normalize( nLast2 ), FUNIT_100TH_MM ); + aDistNumMF .SetLast( aDistNumMF .Normalize( nLast2 ), FUNIT_100TH_MM ); + aIndentMF .SetLast( aIndentMF .Normalize( nLast2 ), FUNIT_100TH_MM ); + // --> OD 2008-02-18 #newlistlevelattrs# + aListtabMF.SetLast(aListtabMF.Normalize( nLast2 ), FUNIT_100TH_MM ); + aAlignedAtMF.SetLast(aAlignedAtMF.Normalize( nLast2 ), FUNIT_100TH_MM ); + aIndentAtMF.SetLast(aIndentAtMF.Normalize( nLast2 ), FUNIT_100TH_MM ); + // <-- + +#if OSL_DEBUG_LEVEL > 1 + pDebugFixedText = new FixedText(this, 0); + pDebugFixedText->Show(); + Size aSize(200, 20); + Point aPos(250,0); + + pDebugFixedText->SetPosSizePixel(aPos, aSize); + pDebugFixedText->SetText( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "Das ist ein Debug-Text" ) ) ); +#endif +} +/*-----------------03.12.97 10:02------------------- + +--------------------------------------------------*/ +SvxNumPositionTabPage::~SvxNumPositionTabPage() +{ + delete pActNum; + delete pPreviewWIN; + delete pSaveNum; +#if OSL_DEBUG_LEVEL > 1 + delete pDebugFixedText; +#endif +} +/*-------------------------------------------------------*/ + +#if OSL_DEBUG_LEVEL > 1 +void lcl_PrintDebugOutput(FixedText& rFixed, const SvxNumberFormat& rNumFmt) +{ +#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) + + sal_Char const sHash[] = " # "; + if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + String sDebugText( UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetAbsLSpace() ) ) ); + sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) ); + sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetCharTextDistance() ) ); + sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) ); + sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetFirstLineOffset() ) ); + rFixed.SetText(sDebugText); + } + else if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) + { + String sDebugText( UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetListtabPos() ) ) ); + sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) ); + sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetFirstLineIndent() ) ); + sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) ); + sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetIndentAt() ) ); + rFixed.SetText(sDebugText); + } + +} +#endif + +/*-----------------03.12.97 10:06------------------- + +--------------------------------------------------*/ +void SvxNumPositionTabPage::InitControls() +{ + bInInintControl = TRUE; + // --> OD 2008-01-11 #newlistlevelattrs# + const bool bRelative = !bLabelAlignmentPosAndSpaceModeActive && + aRelativeCB.IsEnabled() && aRelativeCB.IsChecked(); + // <-- + const bool bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 && + USHRT_MAX != nActNumLvl; + + aDistBorderMF.Enable( !bLabelAlignmentPosAndSpaceModeActive && + ( bSingleSelection || bRelative ) ); + aDistBorderFT.Enable( !bLabelAlignmentPosAndSpaceModeActive && + ( bSingleSelection || bRelative ) ); + + bool bSetDistEmpty = false; + bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive; + bool bSameDist = !bLabelAlignmentPosAndSpaceModeActive; + bool bSameIndent = !bLabelAlignmentPosAndSpaceModeActive; + bool bSameAdjust = true; + + // --> OD 2008-01-11 #newlistlevelattrs# + bool bSameLabelFollowedBy = bLabelAlignmentPosAndSpaceModeActive; + bool bSameListtab = bLabelAlignmentPosAndSpaceModeActive; + bool bSameAlignAt = bLabelAlignmentPosAndSpaceModeActive; + bool bSameIndentAt = bLabelAlignmentPosAndSpaceModeActive; + // <-- + + const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM]; + USHORT nMask = 1; + USHORT nLvl = USHRT_MAX; + long nFirstBorderText = 0; + long nFirstBorderTextRelative = -1; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + aNumFmtArr[i] = &pActNum->GetLevel(i); + if(nActNumLvl & nMask) + { + if(USHRT_MAX == nLvl) + { + nLvl = i; + if ( !bLabelAlignmentPosAndSpaceModeActive ) + { + nFirstBorderText = nLvl > 0 ? + aNumFmtArr[nLvl]->GetAbsLSpace() + aNumFmtArr[nLvl]->GetFirstLineOffset() - + aNumFmtArr[nLvl - 1]->GetAbsLSpace() + aNumFmtArr[nLvl - 1]->GetFirstLineOffset(): + aNumFmtArr[nLvl]->GetAbsLSpace() + aNumFmtArr[nLvl]->GetFirstLineOffset(); + } + } + + if( i > nLvl) + { + // --> OD 2008-01-11 #newlistlevelattrs# + bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust(); + if ( !bLabelAlignmentPosAndSpaceModeActive ) + { + if(bRelative) + { + if(nFirstBorderTextRelative == -1) + nFirstBorderTextRelative = + (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() - + aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset()); + else + bSameDistBorderNum &= nFirstBorderTextRelative == + (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() - + aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset()); + } + else + bSameDistBorderNum &= + aNumFmtArr[i]->GetAbsLSpace() - aNumFmtArr[i]->GetFirstLineOffset() == + aNumFmtArr[i - 1]->GetAbsLSpace() - aNumFmtArr[i - 1]->GetFirstLineOffset(); + + bSameDist &= aNumFmtArr[i]->GetCharTextDistance() == aNumFmtArr[nLvl]->GetCharTextDistance(); + bSameIndent &= aNumFmtArr[i]->GetFirstLineOffset() == aNumFmtArr[nLvl]->GetFirstLineOffset(); + } + else + { + bSameLabelFollowedBy &= + aNumFmtArr[i]->GetLabelFollowedBy() == aNumFmtArr[nLvl]->GetLabelFollowedBy(); + bSameListtab &= + aNumFmtArr[i]->GetListtabPos() == aNumFmtArr[nLvl]->GetListtabPos(); + bSameAlignAt &= + ( ( aNumFmtArr[i]->GetIndentAt() + aNumFmtArr[i]->GetFirstLineIndent() ) + == ( aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent() ) ); + bSameIndentAt &= + aNumFmtArr[i]->GetIndentAt() == aNumFmtArr[nLvl]->GetIndentAt(); + } + // <-- + } + } + nMask <<= 1; + + } + if(bSameDistBorderNum) + { + long nDistBorderNum; + if(bRelative) + { + nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset(); + if(nLvl) + nDistBorderNum -= (long)aNumFmtArr[nLvl - 1]->GetAbsLSpace()+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset(); + } + else + { + nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset(); + } + SetMetricValue(aDistBorderMF, nDistBorderNum, eCoreUnit); + } + else + bSetDistEmpty = true; + +#if OSL_DEBUG_LEVEL > 1 + lcl_PrintDebugOutput(*pDebugFixedText, *aNumFmtArr[nLvl]); +#endif + + const String aEmptyStr; + if(bSameDist) + SetMetricValue(aDistNumMF, aNumFmtArr[nLvl]->GetCharTextDistance(), eCoreUnit); + else + aDistNumMF.SetText(aEmptyStr); + if(bSameIndent) + SetMetricValue(aIndentMF, - aNumFmtArr[nLvl]->GetFirstLineOffset(), eCoreUnit); + else + aIndentMF.SetText(aEmptyStr); + + if(bSameAdjust) + { + USHORT nPos = 1; // zentriert + if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT) + nPos = 0; + else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT) + nPos = 2; + aAlignLB.SelectEntryPos(nPos); + // --> OD 2008-01-11 #newlistlevelattrs# + aAlign2LB.SelectEntryPos( nPos ); + // <-- + } + else + { + aAlignLB.SetNoSelection(); + // --> OD 2008-01-11 #newlistlevelattrs# + aAlign2LB.SetNoSelection(); + // <-- + } + + // --> OD 2008-01-11 #newlistlevelattrs# + if ( bSameLabelFollowedBy ) + { + USHORT nPos = 0; // LISTTAB + if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::SPACE ) + { + nPos = 1; + } + else if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::NOTHING ) + { + nPos = 2; + } + aLabelFollowedByLB.SelectEntryPos( nPos ); + } + else + { + aLabelFollowedByLB.SetNoSelection(); + } + + if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::LISTTAB ) + { + aListtabFT.Enable( true ); + aListtabMF.Enable( true ); + if ( bSameListtab ) + { + SetMetricValue( aListtabMF, aNumFmtArr[nLvl]->GetListtabPos(), eCoreUnit ); + } + else + { + aListtabMF.SetText(aEmptyStr); + } + } + else + { + aListtabFT.Enable( false ); + aListtabMF.Enable( false ); + aListtabMF.SetText(aEmptyStr); + } + + if ( bSameAlignAt ) + { + SetMetricValue( aAlignedAtMF, + aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent(), + eCoreUnit ); + } + else + { + aAlignedAtMF.SetText(aEmptyStr); + } + + if ( bSameIndentAt ) + { + SetMetricValue( aIndentAtMF, aNumFmtArr[nLvl]->GetIndentAt(), eCoreUnit ); + } + else + { + aIndentAtMF.SetText(aEmptyStr); + } + // <-- + + if ( bSetDistEmpty ) + aDistBorderMF.SetText(aEmptyStr); + + bInInintControl = FALSE; +} + +/*-----------------03.12.97 10:02------------------- + +--------------------------------------------------*/ +void SvxNumPositionTabPage::ActivatePage(const SfxItemSet& rSet) +{ + const SfxPoolItem* pItem; + UINT16 nTmpNumLvl = USHRT_MAX; + const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); + if(pExampleSet) + { + if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem)) + bPreset = ((const SfxBoolItem*)pItem)->GetValue(); + if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem)) + nTmpNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); + } + // + if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem)) + { + delete pSaveNum; + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + } + bModified = (!pActNum->Get( 0 ) || bPreset); + if(*pSaveNum != *pActNum || + nActNumLvl != nTmpNumLvl ) + { + *pActNum = *pSaveNum; + nActNumLvl = nTmpNumLvl; + USHORT nMask = 1; + aLevelLB.SetUpdateMode(FALSE); + aLevelLB.SetNoSelection(); + aLevelLB.SelectEntryPos( pActNum->GetLevelCount(), nActNumLvl == USHRT_MAX); + if(nActNumLvl != USHRT_MAX) + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + aLevelLB.SelectEntryPos( i, TRUE); + nMask <<= 1 ; + } + aRelativeCB.Enable(nActNumLvl != 1); + aLevelLB.SetUpdateMode(TRUE); + + // --> OD 2008-01-11 #newlistlevelattrs# + InitPosAndSpaceMode(); + ShowControlsDependingOnPosAndSpaceMode(); + // <-- + + InitControls(); + } + pPreviewWIN->SetLevel(nActNumLvl); + pPreviewWIN->Invalidate(); +} + +/*-----------------03.12.97 10:02------------------- + +--------------------------------------------------*/ +int SvxNumPositionTabPage::DeactivatePage(SfxItemSet *_pSet) +{ + if(_pSet) + FillItemSet(*_pSet); + return TRUE; +} + +/*-----------------03.12.97 10:02------------------- + +--------------------------------------------------*/ +BOOL SvxNumPositionTabPage::FillItemSet( SfxItemSet& rSet ) +{ + rSet.Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl)); + + if(bModified && pActNum) + { + *pSaveNum = *pActNum; + rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); + rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, FALSE)); + } + return bModified; +} + +/*-----------------03.12.97 10:02------------------- + +--------------------------------------------------*/ +void SvxNumPositionTabPage::Reset( const SfxItemSet& rSet ) +{ + const SfxPoolItem* pItem; + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); + delete pSaveNum; + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + + // Ebenen einfuegen + if(!aLevelLB.GetEntryCount()) + { + for(USHORT i = 1; i <= pSaveNum->GetLevelCount(); i++) + aLevelLB.InsertEntry(UniString::CreateFromInt32(i)); + if(pSaveNum->GetLevelCount() > 1) + { + String sEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "1 - ") ) ); + sEntry.Append( UniString::CreateFromInt32( pSaveNum->GetLevelCount() ) ); + aLevelLB.InsertEntry(sEntry); + aLevelLB.SelectEntry(sEntry); + } + else + aLevelLB.SelectEntryPos(0); + } + else + aLevelLB.SelectEntryPos(aLevelLB.GetEntryCount() - 1); + USHORT nMask = 1; + aLevelLB.SetUpdateMode(FALSE); + aLevelLB.SetNoSelection(); + if(nActNumLvl == USHRT_MAX) + { + aLevelLB.SelectEntryPos( pSaveNum->GetLevelCount(), TRUE); + } + else + for(USHORT i = 0; i < pSaveNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + aLevelLB.SelectEntryPos( i, TRUE); + nMask <<= 1; + } + aLevelLB.SetUpdateMode(TRUE); + + if(!pActNum) + pActNum = new SvxNumRule(*pSaveNum); + else if(*pSaveNum != *pActNum) + *pActNum = *pSaveNum; + pPreviewWIN->SetNumRule(pActNum); + + // --> OD 2008-01-11 #newlistlevelattrs# + InitPosAndSpaceMode(); + ShowControlsDependingOnPosAndSpaceMode(); +// const BOOL bDraw = pActNum->IsFeatureSupported(NUM_CONTINUOUS); +// aDistNumFT.Show(bDraw); +// aDistNumMF.Show(bDraw); + // <-- + + InitControls(); + bModified = FALSE; +} + +// --> OD 2008-01-11 #newlistlevelattrs# +void SvxNumPositionTabPage::InitPosAndSpaceMode() +{ + if ( pActNum == 0 ) + { + DBG_ASSERT( false, + " - misusage of method -> has to be already set!" ); + return; + } + + SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode = + SvxNumberFormat::LABEL_ALIGNMENT; + USHORT nMask = 1; + for( USHORT i = 0; i < pActNum->GetLevelCount(); ++i ) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aNumFmt( pActNum->GetLevel(i) ); + ePosAndSpaceMode = aNumFmt.GetPositionAndSpaceMode(); + if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) + { + break; + } + } + nMask <<= 1; + } + + bLabelAlignmentPosAndSpaceModeActive = + ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT; +} + +void SvxNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode() +{ + aDistBorderFT.Show( !bLabelAlignmentPosAndSpaceModeActive ); + aDistBorderMF.Show( !bLabelAlignmentPosAndSpaceModeActive ); + aRelativeCB.Show( !bLabelAlignmentPosAndSpaceModeActive ); + aIndentFT.Show( !bLabelAlignmentPosAndSpaceModeActive ); + aIndentMF.Show( !bLabelAlignmentPosAndSpaceModeActive ); + aDistNumFT.Show( !bLabelAlignmentPosAndSpaceModeActive && + pActNum->IsFeatureSupported(NUM_CONTINUOUS) ); + aDistNumMF.Show( !bLabelAlignmentPosAndSpaceModeActive && + pActNum->IsFeatureSupported(NUM_CONTINUOUS)); + aAlignFT.Show( !bLabelAlignmentPosAndSpaceModeActive ); + aAlignLB.Show( !bLabelAlignmentPosAndSpaceModeActive ); + + aLabelFollowedByFT.Show( bLabelAlignmentPosAndSpaceModeActive ); + aLabelFollowedByLB.Show( bLabelAlignmentPosAndSpaceModeActive ); + aListtabFT.Show( bLabelAlignmentPosAndSpaceModeActive ); + aListtabMF.Show( bLabelAlignmentPosAndSpaceModeActive ); + aAlign2FT.Show( bLabelAlignmentPosAndSpaceModeActive ); + aAlign2LB.Show( bLabelAlignmentPosAndSpaceModeActive ); + aAlignedAtFT.Show( bLabelAlignmentPosAndSpaceModeActive ); + aAlignedAtMF.Show( bLabelAlignmentPosAndSpaceModeActive ); + aIndentAtFT.Show( bLabelAlignmentPosAndSpaceModeActive ); + aIndentAtMF.Show( bLabelAlignmentPosAndSpaceModeActive ); +} +// <-- + +/*-----------------03.12.97 10:02------------------- + +--------------------------------------------------*/ +SfxTabPage* SvxNumPositionTabPage::Create( Window* pParent, + const SfxItemSet& rAttrSet) +{ + return new SvxNumPositionTabPage(pParent, rAttrSet); +} + +/*-----------------04.12.97 12:51------------------- + +--------------------------------------------------*/ +void SvxNumPositionTabPage::SetMetric(FieldUnit eMetric) +{ + if(eMetric == FUNIT_MM) + { + aDistBorderMF .SetDecimalDigits(1); + aDistNumMF .SetDecimalDigits(1); + aIndentMF .SetDecimalDigits(1); + // --> OD 2008-02-18 #newlistlevelattrs# + aListtabMF.SetDecimalDigits(1); + aAlignedAtMF.SetDecimalDigits(1); + aIndentAtMF.SetDecimalDigits(1); + // <-- + } + aDistBorderMF .SetUnit( eMetric ); + aDistNumMF .SetUnit( eMetric ); + aIndentMF .SetUnit( eMetric ); + // --> OD 2008-02-18 #newlistlevelattrs# + aListtabMF.SetUnit( eMetric ); + aAlignedAtMF.SetUnit( eMetric ); + aIndentAtMF.SetUnit( eMetric ); + // <-- +} + +/*-----------------03.12.97 11:06------------------- + +--------------------------------------------------*/ +IMPL_LINK( SvxNumPositionTabPage, EditModifyHdl_Impl, Edit *, EMPTYARG ) +{ + USHORT nMask = 1; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); + + // --> OD 2008-01-11 #newlistlevelattrs# + const USHORT nPos = aAlignLB.IsVisible() + ? aAlignLB.GetSelectEntryPos() + : aAlign2LB.GetSelectEntryPos(); + // <-- + SvxAdjust eAdjust = SVX_ADJUST_CENTER; + if(nPos == 0) + eAdjust = SVX_ADJUST_LEFT; + else if(nPos == 2) + eAdjust = SVX_ADJUST_RIGHT; + aNumFmt.SetNumAdjust( eAdjust ); + pActNum->SetLevel(i, aNumFmt); + } + nMask <<= 1; + } + SetModified(); + return 0; +} +/*-----------------03.12.97 11:11------------------- + +--------------------------------------------------*/ +IMPL_LINK( SvxNumPositionTabPage, LevelHdl_Impl, ListBox *, pBox ) +{ + USHORT nSaveNumLvl = nActNumLvl; + nActNumLvl = 0; + if(pBox->IsEntryPosSelected( pActNum->GetLevelCount() ) && + (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff)) + { + nActNumLvl = 0xFFFF; + pBox->SetUpdateMode(FALSE); + for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ ) + pBox->SelectEntryPos( i, FALSE ); + pBox->SetUpdateMode(TRUE); + } + else if(pBox->GetSelectEntryCount()) + { + USHORT nMask = 1; + for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ ) + { + if(pBox->IsEntryPosSelected( i )) + nActNumLvl |= nMask; + nMask <<= 1; + } + pBox->SelectEntryPos( pActNum->GetLevelCount(), FALSE ); + } + else + { + nActNumLvl = nSaveNumLvl; + USHORT nMask = 1; + for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ ) + { + if(nActNumLvl & nMask) + { + pBox->SelectEntryPos(i); + break; + } + nMask <<=1; + } + } + aRelativeCB.Enable(nActNumLvl != 1); + SetModified(); + // --> OD 2008-01-15 #newlistlevelattrs# + InitPosAndSpaceMode(); + ShowControlsDependingOnPosAndSpaceMode(); + // <-- + InitControls(); + return 0; +} +/*-----------------03.12.97 12:24------------------- + +--------------------------------------------------*/ +IMPL_LINK( SvxNumPositionTabPage, DistanceHdl_Impl, MetricField *, pFld ) +{ + if(bInInintControl) + return 0; + long nValue = GetCoreValue(*pFld, eCoreUnit); + USHORT nMask = 1; +#if OSL_DEBUG_LEVEL > 1 + BOOL bFirst = TRUE; +#endif + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) ); + if(pFld == &aDistBorderMF) + { + + if(aRelativeCB.IsChecked()) + { + if(0 == i) + { + long nTmp = aNumFmt.GetFirstLineOffset(); + aNumFmt.SetAbsLSpace( USHORT(nValue - nTmp)); + } + else + { + long nTmp = pActNum->GetLevel( i - 1 ).GetAbsLSpace() + + pActNum->GetLevel( i - 1 ).GetFirstLineOffset() - + pActNum->GetLevel( i ).GetFirstLineOffset(); + + aNumFmt.SetAbsLSpace( USHORT(nValue + nTmp)); + } + } + else + { + aNumFmt.SetAbsLSpace( (short)nValue - aNumFmt.GetFirstLineOffset()); + } + } + else if(pFld == &aDistNumMF) + { + aNumFmt.SetCharTextDistance( (short)nValue ); + } + else if(pFld == &aIndentMF) + { + //jetzt muss mit dem FirstLineOffset auch der AbsLSpace veraendert werden + long nDiff = nValue + aNumFmt.GetFirstLineOffset(); + long nAbsLSpace = aNumFmt.GetAbsLSpace(); + aNumFmt.SetAbsLSpace(USHORT(nAbsLSpace + nDiff)); + aNumFmt.SetFirstLineOffset( -(short)nValue ); + } + +#if OSL_DEBUG_LEVEL > 1 + if(bFirst) + lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt); + bFirst = FALSE; +#endif + pActNum->SetLevel( i, aNumFmt ); + } + nMask <<= 1; + } + + SetModified(); + if(!aDistBorderMF.IsEnabled()) + { + String aEmptyStr; + aDistBorderMF.SetText(aEmptyStr); + } + + return 0; +} + +/*-----------------04.12.97 12:35------------------- + +--------------------------------------------------*/ +IMPL_LINK( SvxNumPositionTabPage, RelativeHdl_Impl, CheckBox *, pBox ) +{ + BOOL bOn = pBox->IsChecked(); + BOOL bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 && USHRT_MAX != nActNumLvl; + BOOL bSetValue = FALSE; + long nValue = 0; + if(bOn || bSingleSelection) + { + USHORT nMask = 1; + BOOL bFirst = TRUE; + bSetValue = TRUE; + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + const SvxNumberFormat &rNumFmt = pActNum->GetLevel(i); + if(bFirst) + { + nValue = rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset(); + if(bOn && i) + nValue -= (pActNum->GetLevel(i - 1).GetAbsLSpace() + pActNum->GetLevel(i - 1).GetFirstLineOffset()); + } + else + bSetValue = nValue == + (rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset()) - + (pActNum->GetLevel(i - 1).GetAbsLSpace() + pActNum->GetLevel(i - 1).GetFirstLineOffset()); + bFirst = FALSE; + } + nMask <<= 1; + } + + } + String aEmptyStr; + if(bSetValue) + SetMetricValue(aDistBorderMF, nValue, eCoreUnit); + else + aDistBorderMF.SetText(aEmptyStr); + aDistBorderMF.Enable(bOn || bSingleSelection); + aDistBorderFT.Enable(bOn || bSingleSelection); + bLastRelative = bOn; + return 0; +} + +// --> OD 2008-01-14 #newlistlevelattrs# +IMPL_LINK( SvxNumPositionTabPage, LabelFollowedByHdl_Impl, ListBox*, EMPTYARG ) +{ + // determine value to be set at the chosen list levels + SvxNumberFormat::SvxNumLabelFollowedBy eLabelFollowedBy = + SvxNumberFormat::LISTTAB; + { + const USHORT nPos = aLabelFollowedByLB.GetSelectEntryPos(); + if ( nPos == 1 ) + { + eLabelFollowedBy = SvxNumberFormat::SPACE; + } + else if ( nPos == 2 ) + { + eLabelFollowedBy = SvxNumberFormat::NOTHING; + } + } + + // set value at the chosen list levels + bool bSameListtabPos = true; + USHORT nFirstLvl = USHRT_MAX; + USHORT nMask = 1; + for( USHORT i = 0; i < pActNum->GetLevelCount(); ++i ) + { + if ( nActNumLvl & nMask ) + { + SvxNumberFormat aNumFmt( pActNum->GetLevel(i) ); + aNumFmt.SetLabelFollowedBy( eLabelFollowedBy ); + pActNum->SetLevel( i, aNumFmt ); + + if ( nFirstLvl == USHRT_MAX ) + { + nFirstLvl = i; + } + else + { + bSameListtabPos &= aNumFmt.GetListtabPos() == + pActNum->GetLevel( nFirstLvl ).GetListtabPos(); + } + } + nMask <<= 1; + } + + // enable/disable metric field for list tab stop position depending on + // selected item following the list label. + aListtabFT.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB ); + aListtabMF.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB ); + if ( bSameListtabPos && eLabelFollowedBy == SvxNumberFormat::LISTTAB ) + { + SetMetricValue( aListtabMF, pActNum->GetLevel( nFirstLvl ).GetListtabPos(), eCoreUnit ); + } + else + { + aListtabMF.SetText( String() ); + } + + SetModified(); + + return 0; +} +// <-- + +// --> OD 2008-01-14 #newlistlevelattrs# +IMPL_LINK( SvxNumPositionTabPage, ListtabPosHdl_Impl, MetricField*, pFld ) +{ + // determine value to be set at the chosen list levels + const long nValue = GetCoreValue( *pFld, eCoreUnit ); + + // set value at the chosen list levels + USHORT nMask = 1; + for( USHORT i = 0; i < pActNum->GetLevelCount(); ++i ) + { + if ( nActNumLvl & nMask ) + { + SvxNumberFormat aNumFmt( pActNum->GetLevel(i) ); + aNumFmt.SetListtabPos( nValue ); + pActNum->SetLevel( i, aNumFmt ); +#if OSL_DEBUG_LEVEL > 1 + lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt); +#endif + } + nMask <<= 1; + } + + SetModified(); + + return 0; +} +// <-- + +// --> OD 2008-01-14 #newlistlevelattrs# +IMPL_LINK( SvxNumPositionTabPage, AlignAtHdl_Impl, MetricField*, pFld ) +{ + // determine value to be set at the chosen list levels + const long nValue = GetCoreValue( *pFld, eCoreUnit ); + + // set value at the chosen list levels + USHORT nMask = 1; + for( USHORT i = 0; i < pActNum->GetLevelCount(); ++i ) + { + if ( nActNumLvl & nMask ) + { + SvxNumberFormat aNumFmt( pActNum->GetLevel(i) ); + const long nFirstLineIndent = nValue - aNumFmt.GetIndentAt(); + aNumFmt.SetFirstLineIndent( nFirstLineIndent ); + pActNum->SetLevel( i, aNumFmt ); +#if OSL_DEBUG_LEVEL > 1 + lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt); +#endif + } + nMask <<= 1; + } + + SetModified(); + + return 0; +} +// <-- + +// --> OD 2008-01-14 #newlistlevelattrs# +IMPL_LINK( SvxNumPositionTabPage, IndentAtHdl_Impl, MetricField*, pFld ) +{ + // determine value to be set at the chosen list levels + const long nValue = GetCoreValue( *pFld, eCoreUnit ); + + // set value at the chosen list levels + USHORT nMask = 1; + for( USHORT i = 0; i < pActNum->GetLevelCount(); ++i ) + { + if ( nActNumLvl & nMask ) + { + SvxNumberFormat aNumFmt( pActNum->GetLevel(i) ); + const long nAlignedAt = aNumFmt.GetIndentAt() + + aNumFmt.GetFirstLineIndent(); + aNumFmt.SetIndentAt( nValue ); + const long nNewFirstLineIndent = nAlignedAt - nValue; + aNumFmt.SetFirstLineIndent( nNewFirstLineIndent ); + pActNum->SetLevel( i, aNumFmt ); +#if OSL_DEBUG_LEVEL > 1 + lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt); +#endif + } + nMask <<= 1; + } + + SetModified(); + + return 0; +} +// <-- +/*-----------------05.12.97 15:33------------------- + +--------------------------------------------------*/ +IMPL_LINK( SvxNumPositionTabPage, StandardHdl_Impl, PushButton *, EMPTYARG ) +{ + USHORT nMask = 1; + // --> OD 2008-02-11 #newlistlevelattrs# + SvxNumRule aTmpNumRule( pActNum->GetFeatureFlags(), + pActNum->GetLevelCount(), + pActNum->IsContinuousNumbering(), + SVX_RULETYPE_NUMBERING, + pActNum->GetLevel( 0 ).GetPositionAndSpaceMode() ); + // <-- + for(USHORT i = 0; i < pActNum->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) ); + SvxNumberFormat aTempFmt(aTmpNumRule.GetLevel( i )); + // --> OD 2008-02-05 #newlistlevelattrs# + aNumFmt.SetPositionAndSpaceMode( aTempFmt.GetPositionAndSpaceMode() ); + if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + aNumFmt.SetAbsLSpace( aTempFmt.GetAbsLSpace() ); + aNumFmt.SetCharTextDistance( aTempFmt.GetCharTextDistance() ); + aNumFmt.SetFirstLineOffset( aTempFmt.GetFirstLineOffset() ); + } + else if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) + { + aNumFmt.SetNumAdjust( aTempFmt.GetNumAdjust() ); + aNumFmt.SetLabelFollowedBy( aTempFmt.GetLabelFollowedBy() ); + aNumFmt.SetListtabPos( aTempFmt.GetListtabPos() ); + aNumFmt.SetFirstLineIndent( aTempFmt.GetFirstLineIndent() ); + aNumFmt.SetIndentAt( aTempFmt.GetIndentAt() ); + } + // <-- + + pActNum->SetLevel( i, aNumFmt ); + } + nMask <<= 1; + } + + InitControls(); + SetModified(); + return 0; +} + +void SvxNumPositionTabPage::SetModified(BOOL bRepaint) +{ + bModified = TRUE; + if(bRepaint) + { + pPreviewWIN->SetLevel(nActNumLvl); + pPreviewWIN->Invalidate(); + } +} + +void SvxNumOptionsTabPage::SetModified(BOOL bRepaint) +{ + bModified = TRUE; + if(bRepaint) + { + pPreviewWIN->SetLevel(nActNumLvl); + pPreviewWIN->Invalidate(); + } +} + +//Add CHINA001 +void SvxNumOptionsTabPage::PageCreated(SfxAllItemSet aSet) +{ + SFX_ITEMSET_ARG (&aSet,pListItem,SfxStringListItem,SID_CHAR_FMT_LIST_BOX,sal_False); + SFX_ITEMSET_ARG (&aSet,pNumCharFmt,SfxStringItem,SID_NUM_CHAR_FMT,sal_False); + SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False); + SFX_ITEMSET_ARG (&aSet,pMetricItem,SfxAllEnumItem,SID_METRIC_ITEM,sal_False); + + if (pNumCharFmt &&pBulletCharFmt) + SetCharFmts( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue()); + + if (pListItem) + { + ListBox& myCharFmtLB = GetCharFmtListBox(); + const List *pList = (pListItem)->GetList(); + sal_uInt32 nCount = pList->Count();; + for(sal_uInt32 i = 0; i < nCount; i++) + { + myCharFmtLB.InsertEntry(*(const String*)(pList->GetObject(i)) ); + + } + } + if (pMetricItem) + SetMetric(static_cast(pMetricItem->GetValue())); +} + +//end of add CHINA001 + +//add CHINA001 begin + +void SvxNumPositionTabPage::PageCreated(SfxAllItemSet aSet) +{ + SFX_ITEMSET_ARG (&aSet,pMetricItem,SfxAllEnumItem,SID_METRIC_ITEM,sal_False); + + if (pMetricItem) + SetMetric(static_cast(pMetricItem->GetValue())); +} diff --git a/cui/source/tabpages/numpages.hrc b/cui/source/tabpages/numpages.hrc new file mode 100644 index 000000000000..59ea5d0e8a94 --- /dev/null +++ b/cui/source/tabpages/numpages.hrc @@ -0,0 +1,135 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: numpages.hrc,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define FT_ALIGN 50 +#define LB_ALIGN 51 +#define FT_DIST_BORDER 52 +#define MF_DIST_BORDER 53 +#define FT_DIST_NUM 54 +#define MF_DIST_NUM 55 +#define GB_POS 56 + +#define LB_FMT_CHAR 60 +#define FT_FMT_CHAR 61 + +#define FT_WIDTH 67 +#define FI_URL 68 +#define FT_HEIGHT 70 + + +#define MN_STD_NUMBER 120 +#define MD_DEL_NUMBER 121 +#define MN_STD_BULLET 122 +#define MN_DEL_BULLET 123 + +#define STR_BULLET 200 +//#define STR_NUMFMT_1 201 +//#define STR_NUMFMT_2 202 +//#define STR_NUMFMT_3 203 +//#define STR_NUMFMT_4 204 +//#define STR_NUMFMT_5 205 +//#define STR_NUMFMT_6 206 +//#define STR_NUMFMT_7 207 +//#define STR_NUMFMT_8 208 +//#define STR_NUMFMT_7_HTML 209 + +#define LB_FORM 210 +#define ED_FORM 211 +#define GB_FORM 212 + +#define BT_BULLET 213 + +#define FL_VALUES 220 +#define VS_VALUES 221 +#define ST_CUSTOMIZE 222 +#define FT_ERROR 223 +#define CB_LINKED 224 + +#define FT_LEVEL 151 +#define LB_LEVEL 152 +#define FL_FORMAT 153 +#define FL_POSITION 154 +#define FT_PREFIX 155 +#define ED_PREFIX 156 +#define FT_FMT 157 +#define LB_FMT 158 +#define FT_SUFFIX 159 +#define ED_SUFFIX 160 +#define FT_BORDERDIST 161 +#define MF_BORDERDIST 162 +#define FT_NUMDIST 163 +#define MF_NUMDIST 164 +#define FT_INDENT 165 +#define MF_INDENT 166 +#define FT_CHARFMT 167 +#define LB_CHARFMT 168 +#define NF_ALL_LEVEL 169 +#define FT_START 170 +#define ED_START 171 +#define FT_BULLET 172 +#define PB_BULLET 173 +#define WIN_PREVIEW 174 +#define FT_BITMAP 175 +#define PB_SEARCH 176 +#define CB_RATIO 177 +#define FT_SIZE 178 +#define MF_WIDTH 179 +#define FT_MULT 180 +#define MF_HEIGHT 181 +#define FT_ORIENT 182 +#define LB_ORIENT 183 +#define MB_BITMAP 184 +#define CB_RELATIVE 185 +#define FT_ALL_LEVEL 186 +#define PB_STANDARD 187 +#define CB_SAME_LEVEL 188 +#define FL_SAME_LEVEL 189 +#define FT_BUL_COLOR 190 +#define LB_BUL_COLOR 191 +#define FT_BUL_REL_SIZE 192 +#define MF_BUL_REL_SIZE 193 +// 194 removed +#define ST_POPUP_EMPTY_ENTRY 195 + +#define MN_GRAPHIC_DLG 1 +#define MN_GALLERY 2 +#define MN_GALLERY_ENTRY 100 + +#define FT_LABEL_FOLLOWED_BY 250 +#define LB_LABEL_FOLLOWED_BY 251 +#define FT_LISTTAB 252 +#define MF_LISTTAB 253 +#define FT_ALIGN_2 254 +#define LB_ALIGN_2 255 +#define FT_ALIGNED_AT 256 +#define MF_ALIGNED_AT 257 +#define FT_INDENT_AT 258 +#define MF_INDENT_AT 259 + diff --git a/cui/source/tabpages/numpages.src b/cui/source/tabpages/numpages.src new file mode 100644 index 000000000000..e202b2d13a84 --- /dev/null +++ b/cui/source/tabpages/numpages.src @@ -0,0 +1,910 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: numpages.src,v $ + * $Revision: 1.64.242.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include +#include +#include + +/**************************************************************************/ +/* */ +/* TabPage */ +/* */ +/**************************************************************************/ +TabPage RID_SVXPAGE_PICK_BULLET +{ + HelpID = HID_SVXPAGE_PICK_BULLET ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE; + FixedLine FL_VALUES + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Selection" ; + }; + Control VS_VALUES + { + Pos = MAP_APPFONT ( 9 , 14 ) ; + Size = MAP_APPFONT ( 242 , 167 ) ; + TabStop = TRUE ; + }; +}; +/**************************************************************************/ +/* */ +/* TabPage */ +/* */ +/**************************************************************************/ +TabPage RID_SVXPAGE_PICK_SINGLE_NUM +{ + HelpID = HID_SVXPAGE_PICK_SINGLE_NUM ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE; + FixedLine FL_VALUES + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Selection" ; + }; + Control VS_VALUES + { + Pos = MAP_APPFONT ( 9 , 14 ) ; + Size = MAP_APPFONT ( 242 , 167 ) ; + TabStop = TRUE ; + }; +}; +/**************************************************************************/ +/* */ +/* TabPage */ +/* */ +/**************************************************************************/ +TabPage RID_SVXPAGE_PICK_NUM +{ + HelpID = HID_SVXPAGE_PICK_NUM; + SVLook = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE; + FixedLine FL_VALUES + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Selection" ; + }; + Control VS_VALUES + { + Pos = MAP_APPFONT ( 9 , 14 ) ; + Size = MAP_APPFONT ( 242 , 167 ) ; + TabStop = TRUE ; + }; +}; +/**************************************************************************/ +/* */ +/* TabPage */ +/* */ +/**************************************************************************/ +TabPage RID_SVXPAGE_PICK_BMP +{ + HelpID = HID_SVXPAGE_PICK_BMP; + SVLook = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE; + FixedLine FL_VALUES + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Selection" ; + }; + Control VS_VALUES + { + Pos = MAP_APPFONT ( 9 , 14 ) ; + Size = MAP_APPFONT ( 242 , 152 ) ; + TabStop = TRUE ; + Hide = TRUE ; + }; + CheckBox CB_LINKED + { + Pos = MAP_APPFONT ( 9 , 169 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Link graphics"; + }; + FixedText FT_ERROR + { + Pos = MAP_APPFONT ( 9 , 14 ) ; + Size = MAP_APPFONT ( 242 , 30 ) ; + Text [ en-US ] = "The Gallery theme 'Bullets' is empty (no graphics)." ; + Hide = TRUE ; + WordBreak = TRUE ; + }; +}; +/**************************************************************************/ +/* */ +/* TabPage Numerierungsoptionen */ +/* */ +/**************************************************************************/ +TabPage RID_SVXPAGE_NUM_OPTIONS +{ + HelpID = HID_SVXPAGE_NUM_OPTIONS ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE; + FixedText FT_LEVEL + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "Level" ; + }; + MultiListBox LB_LEVEL + { + Pos = MAP_APPFONT ( 12 , 25 ) ; + Size = MAP_APPFONT ( 26 , 154 ) ; + TabStop = TRUE ; + DropDown = FALSE ; + Border = TRUE ; + SimpleMode = TRUE ; + }; + FixedLine FL_FORMAT + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Format" ; + }; + FixedText FT_FMT + { + Pos = MAP_APPFONT ( 50 , 27 ) ; + Size = MAP_APPFONT ( 50, 8 ) ; + Text [ en-US ] = "~Numbering" ; + }; + ListBox LB_FMT + { + Pos = MAP_APPFONT ( 103 , 25 ) ; + Size = MAP_APPFONT ( 67 , 72 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + CurPos = 0 ; + StringList [ en-US ] = + { + < "1, 2, 3, ... " ; 4/*SVX_NUM_ARABIC */; > ; + < "A, B, C, ... " ; 0/*SVX_NUM_CHARS_UPPER_LETTER */; > ; + < "a, b, c, ..." ; 1/*SVX_NUM_CHARS_LOWER_LETTER */; > ; + < "I, II, III, ... " ; 2/*SVX_NUM_ROMAN_UPPER */; > ; + < "i, ii, iii, ... " ; 3/*SVX_NUM_ROMAN_LOWER */; > ; + < "A, .., AA, .., AAA, ... " ; 9/*SVX_NUM_CHARS_UPPER_LETTER_N*/; > ; + < "a, .., aa, .., aaa, ..." ; 10/*SVX_NUM_CHARS_LOWER_LETTER_N*/; > ; + < "Bullet" ; 6/*SVX_NUM_CHAR_SPECIAL */; > ; + < "Graphics" ; 8/*SVX_NUM_BITMAP */; > ; + < "Linked graphics" ; 0x88/*SVX_NUM_BITMAP|0x80 */; > ; + < "None" ; 5/*SVX_NUM_NUMBER_NONE */; > ; + < "Native Numbering" ; 12 /*NATIVE_NUMBERING */; > ; + < "Ð, Б, .., Ðа, Ðб, ... (Bulgarian)" ; 38 /*CHARS_CYRILLIC_UPPER_LETTER_BG */; > ; + < "а, б, .., аа, аб, ... (Bulgarian)" ; 39 /*CHARS_CYRILLIC_LOWER_LETTER_BG */; > ; + < "Ð, Б, .., Ðа, Бб, ... (Bulgarian)" ; 40 /*CHARS_CYRILLIC_UPPER_LETTER_N_BG */; > ; + < "а, б, .., аа, бб, ... (Bulgarian)" ; 41 /*CHARS_CYRILLIC_LOWER_LETTER_N_BG */; > ; + < "Ð, Б, .., Ðа, Ðб, ... (Russian)" ; 42 /*CHARS_CYRILLIC_UPPER_LETTER_RU */; > ; + < "а, б, .., аа, аб, ... (Russian)" ; 43 /*CHARS_CYRILLIC_LOWER_LETTER_RU */; > ; + < "Ð, Б, .., Ðа, Бб, ... (Russian)" ; 44 /*CHARS_CYRILLIC_UPPER_LETTER_N_RU */; > ; + < "а, б, .., аа, бб, ... (Russian)" ; 45 /*CHARS_CYRILLIC_LOWER_LETTER_N_RU */; > ; + < "Ð, Б, .., Ðа, Ðб, ... (Serbian)" ; 48 /*CHARS_CYRILLIC_UPPER_LETTER_SR */; > ; + < "а, б, .., аа, аб, ... (Serbian)" ; 49 /*CHARS_CYRILLIC_LOWER_LETTER_SR */; > ; + < "Ð, Б, .., Ðа, Бб, ... (Serbian)" ; 50 /*CHARS_CYRILLIC_UPPER_LETTER_N_SR */; > ; + < "а, б, .., аа, бб, ... (Serbian)" ; 51 /*CHARS_CYRILLIC_LOWER_LETTER_N_SR */; > ; + + }; + }; + FixedText FT_PREFIX + { + Pos = MAP_APPFONT ( 50 , 43 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "Before" ; + Left = TRUE ; + }; + Edit ED_PREFIX + { + Border = TRUE ; + Pos = MAP_APPFONT ( 103 , 41 ) ; + Size = MAP_APPFONT ( 67 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + MaxTextLength = 50 ; + }; + FixedText FT_SUFFIX + { + Pos = MAP_APPFONT ( 50 , 59 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "After" ; + Left = TRUE ; + }; + Edit ED_SUFFIX + { + Border = TRUE ; + Pos = MAP_APPFONT ( 103 , 57 ) ; + Size = MAP_APPFONT ( 67 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + MaxTextLength = 50 ; + }; + FixedText FT_CHARFMT + { + Pos = MAP_APPFONT ( 50 , 75 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Character Style" ; + }; + ListBox LB_CHARFMT + { + TabStop = TRUE ; + DropDown = TRUE ; + Pos = MAP_APPFONT ( 103 , 73 ) ; + Size = MAP_APPFONT ( 67 , 72 ) ; + }; + FixedText FT_BUL_COLOR + { + Pos = MAP_APPFONT ( 50 , 75 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Hide = TRUE; + Text [ en-US ] = "Color"; + }; + ListBox LB_BUL_COLOR + { + TabStop = TRUE ; + DropDown = TRUE ; + Pos = MAP_APPFONT ( 103 , 73 ) ; + Size = MAP_APPFONT ( 67 , 100 ) ; + Hide = TRUE; + }; + FixedText FT_BUL_REL_SIZE + { + Pos = MAP_APPFONT ( 50 , 91 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Hide = TRUE; + Text [ en-US ] = "~Relative size"; + }; + MetricField MF_BUL_REL_SIZE + { + Pos = MAP_APPFONT ( 103 , 89 ) ; + Size = MAP_APPFONT ( 67 , 12 ) ; + Border = TRUE ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 1 ; + Minimum = 1; + Maximum = 250; + Hide = TRUE; + }; + FixedText FT_ALL_LEVEL + { + Pos = MAP_APPFONT ( 50 , 91 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "Show sublevels" ; + }; + NumericField NF_ALL_LEVEL + { + Border = TRUE ; + Pos = MAP_APPFONT ( 103 , 89 ) ; + Size = MAP_APPFONT ( 67 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 10 ; + Value = 1 ; + First = 1 ; + Last = 10 ; + }; + FixedText FT_START + { + Pos = MAP_APPFONT ( 50 , 107 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "Start at" ; + Left = TRUE ; + }; + NumericField ED_START + { + Border = TRUE ; + Pos = MAP_APPFONT ( 103 , 105 ) ; + Size = MAP_APPFONT ( 67 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 65535 ; + Value = 1 ; + First = 0 ; + Last = 65535 ; + }; + FixedText FT_ALIGN + { + Pos = MAP_APPFONT ( 50 , 135 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Alignment" ; + Hide = TRUE; + }; + ListBox LB_ALIGN + { + Pos = MAP_APPFONT ( 103 , 133 ) ; + Size = MAP_APPFONT ( 40 , 40 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + Hide = TRUE; + StringList [ en-US ] = + { + < "Left" ; > ; + < "Centered" ; > ; + < "Right" ; > ; + }; + }; + String STR_BULLET + { + Text [ en-US ] = "Character" ; + }; + PushButton PB_BULLET + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 103 , 105 ) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + Text = "..." ; + TabStop = TRUE ; + }; + FixedText FT_BITMAP + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 50 , 43 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "Graphics" ; + }; + MenuButton MB_BITMAP + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 103 , 41 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + ButtonMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = MN_GRAPHIC_DLG ; + // HelpID = HID_NUM_NAMED_NUMS ; + Text [ en-US ] = "From file..." ; + }; + MenuItem + { + Identifier = MN_GALLERY ; + Text [ en-US ] = "Gallery"; + }; + }; + }; + Text [ en-US ] = "Select..." ; + }; + FixedText FT_SIZE + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 50 , 61 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "Width" ; + }; + MetricField MF_WIDTH + { + Pos = MAP_APPFONT ( 103 , 59 ) ; + Size = MAP_APPFONT ( 67 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 1999 ; + DecimalDigits = 2 ; + Value = 0 ; + Unit = FUNIT_CM ; + First = 0 ; + Last = 1999 ; + SpinSize = 5 ; + Hide = TRUE ; + }; + FixedText FT_MULT + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 50 , 77 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "Height" ; + }; + MetricField MF_HEIGHT + { + Pos = MAP_APPFONT ( 103 , 75 ) ; + Size = MAP_APPFONT ( 67 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 1999 ; + DecimalDigits = 2 ; + Value = 0 ; + Unit = FUNIT_CM ; + First = 0 ; + Last = 1999 ; + SpinSize = 5 ; + Hide = TRUE ; + }; + CheckBox CB_RATIO + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 50 , 91 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + Text [ en-US ] = "Keep ratio" ; + }; + FixedText FT_ORIENT + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 50 , 105 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "Alignment" ; + }; + ListBox LB_ORIENT + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 103 , 103 ) ; + Size = MAP_APPFONT ( 67 , 72 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + CurPos = 0 ; + StringList [ en-US ] = + { + < "Top of baseline" ; > ; + < "Center of baseline" ; > ; + < "Bottom of baseline" ; > ; + < "Top of character" ; > ; + < "Center of character" ; > ; + < "Bottom of character" ; > ; + < "Top of line" ; > ; + < "Center of line" ; > ; + < "Bottom of line" ; > ; + }; + }; + FixedLine FL_SAME_LEVEL + { + Pos = MAP_APPFONT ( 47 , 156 ) ; + Size = MAP_APPFONT ( 126 , 8 ) ; + Text [ en-US ] = "All levels" ; + }; + CheckBox CB_SAME_LEVEL + { + Pos = MAP_APPFONT ( 53 , 167 ) ; + Size = MAP_APPFONT ( 114 , 10 ) ; + Text [ en-US ] = "~Consecutive numbering" ; + }; + Window WIN_PREVIEW + { + Pos = MAP_APPFONT ( 179 , 25 ) ; + Size = MAP_APPFONT ( 69 , 154 ) ; + Border = TRUE ; + }; + String ST_POPUP_EMPTY_ENTRY + { + Text [ en-US ] = "There are no graphics in the 'Bullets' Gallery theme."; + }; + +}; +/**************************************************************************/ +/* */ +/* TabPage Positionen */ +/* */ +/**************************************************************************/ +TabPage RID_SVXPAGE_NUM_POSITION +{ + HelpID = HID_SVXPAGE_NUM_POSITION ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE; + FixedText FT_LEVEL + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 50, 8 ) ; + Text [ en-US ] = "Level" ; + }; + MultiListBox LB_LEVEL + { + Pos = MAP_APPFONT ( 12 , 25 ) ; + Size = MAP_APPFONT ( 26 , 154 ) ; + TabStop = TRUE ; + DropDown = FALSE ; + Border = TRUE ; + SimpleMode = TRUE ; + }; + FixedLine FL_POSITION + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Group = TRUE ; + Text [ en-US ] = "Position and spacing" ; + }; + FixedText FT_BORDERDIST + { + Pos = MAP_APPFONT ( 50 , 27 ) ; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Indent" ; + }; + MetricField MF_BORDERDIST + { + Pos = MAP_APPFONT ( 198 , 25 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -1999 ; + Maximum = 1999 ; + DecimalDigits = 2 ; + Value = 0 ; + Unit = FUNIT_CM ; + First = 0 ; + Last = 1999 ; + SpinSize = 5 ; + }; + CheckBox CB_RELATIVE + { + Pos = MAP_APPFONT ( 198 , 41 ) ; + Size = MAP_APPFONT ( 52 , 10 ) ; + Text [ en-US ] = "Relati~ve" ; + }; + FixedText FT_INDENT + { + Pos = MAP_APPFONT ( 50 , 59 ) ; + Size = MAP_APPFONT ( 105 , 8 ) ; + Text [ en-US ] = "Width of numbering" ; + }; + MetricField MF_INDENT + { + Pos = MAP_APPFONT ( 198 , 57 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 1999 ; + DecimalDigits = 2 ; + Value = 0 ; + Unit = FUNIT_CM ; + First = 0 ; + Last = 1999 ; + SpinSize = 5 ; + }; + FixedText FT_NUMDIST + { + Pos = MAP_APPFONT ( 50 , 75 ) ; + Size = MAP_APPFONT ( 105 , 8 ) ; + Text [ en-US ] = "Minimum space numbering <-> text" ; + }; + MetricField MF_NUMDIST + { + Pos = MAP_APPFONT ( 198 , 73 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 1999 ; + DecimalDigits = 2 ; + Value = 0 ; + Unit = FUNIT_CM ; + First = 0 ; + Last = 1999 ; + SpinSize = 5 ; + Border = TRUE ; + TabStop = TRUE ; + }; + FixedText FT_ALIGN + { + Pos = MAP_APPFONT ( 50 , 91 ) ; + Size = MAP_APPFONT ( 105 , 8 ) ; + Text [ en-US ] = "N~umbering alignment" ; + }; + ListBox LB_ALIGN + { + Pos = MAP_APPFONT ( 198 , 89 ) ; + Size = MAP_APPFONT ( 40 , 40 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Left" ; > ; + < "Centered" ; > ; + < "Right" ; > ; + }; + }; + FixedText FT_LABEL_FOLLOWED_BY + { + Pos = MAP_APPFONT ( 50 , 27 ) ; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Numbering followed by" ; + }; + ListBox LB_LABEL_FOLLOWED_BY + { + Pos = MAP_APPFONT ( 198 , 25 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Tab stop" ; > ; + < "Space" ; > ; + < "Nothing" ; > ; + }; + }; + FixedText FT_LISTTAB + { + Pos = MAP_APPFONT ( 50 , 43 ) ; + Size = MAP_APPFONT ( 143 , 10 ) ; + Right = TRUE ; + Text [ en-US ] = "at" ; + }; + MetricField MF_LISTTAB + { + Pos = MAP_APPFONT ( 198 , 41 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 1999 ; + DecimalDigits = 2 ; + Value = 0 ; + Unit = FUNIT_CM ; + First = 0 ; + Last = 1999 ; + SpinSize = 5 ; + }; + FixedText FT_ALIGN_2 + { + Pos = MAP_APPFONT ( 50 , 59 ) ; + Size = MAP_APPFONT ( 105 , 8 ) ; + }; + ListBox LB_ALIGN_2 + { + Pos = MAP_APPFONT ( 198 , 57 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_ALIGNED_AT + { + Pos = MAP_APPFONT ( 50 , 75 ) ; + Size = MAP_APPFONT ( 105 , 8 ) ; + Text [ en-US ] = "Aligned at" ; + }; + MetricField MF_ALIGNED_AT + { + Pos = MAP_APPFONT ( 198 , 73 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -1999 ; + Maximum = 1999 ; + DecimalDigits = 2 ; + Value = 0 ; + Unit = FUNIT_CM ; + First = 0 ; + Last = 1999 ; + SpinSize = 5 ; + Border = TRUE ; + TabStop = TRUE ; + }; + FixedText FT_INDENT_AT + { + Pos = MAP_APPFONT ( 50 , 91 ) ; + Size = MAP_APPFONT ( 105 , 8 ) ; + Text [ en-US ] = "Indent at" ; + }; + MetricField MF_INDENT_AT + { + Pos = MAP_APPFONT ( 198 , 89 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -1999 ; + Maximum = 1999 ; + DecimalDigits = 2 ; + Value = 0 ; + Unit = FUNIT_CM ; + First = 0 ; + Last = 1999 ; + SpinSize = 5 ; + Border = TRUE ; + TabStop = TRUE ; + }; + PushButton PB_STANDARD + { + Pos = MAP_APPFONT ( 198 , 165 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "Default" ; + }; + Window WIN_PREVIEW + { + Pos = MAP_APPFONT ( 50 , 113 ) ; + Size = MAP_APPFONT ( 143 , 67 ) ; + Border = TRUE ; + }; +}; + +String RID_STR_EDIT_GRAPHIC +{ + Text [ en-US ] = "Link" ; +}; +String RID_STR_FULLNUMS_1 { Text = "1.|1.1|a)|61589|61589" ; }; +String RID_STR_FULLNUMS_2 { Text = "1.|a)|61589|61589|61589" ; }; +String RID_STR_FULLNUMS_3 { Text = "1.|(a)|i.|A.|61589" ; }; +String RID_STR_FULLNUMS_4 { Text = "1.|1.|1.|1.|1." ; }; +String RID_STR_FULLNUMS_5 { Text = "I.|A.|i.|a)|61589" ; }; +String RID_STR_FULLNUMS_6 { Text = "A.|I.|a.|i.|61589" ; }; +String RID_STR_FULLNUMS_7 { Text = "1|1.1|1.1.1|1.1.1.1|1.1.1.1.1" ; }; +String RID_STR_FULLNUMS_8 { Text = "61487|61488|61485|61589|61589" ; }; +String RID_STR_FULLNUMS_7_HTML { Text = "I.|I.|I|I.|I." ; }; + +String RID_SVXSTR_BULLET_DESCRIPTION_0 +{ + Text [en-US] = "Solid small circular bullets"; +}; +String RID_SVXSTR_BULLET_DESCRIPTION_1 +{ + Text [en-US] = "Solid large circular bullets"; +}; +String RID_SVXSTR_BULLET_DESCRIPTION_2 +{ + Text [en-US] = "Solid diamond bullets"; +}; +String RID_SVXSTR_BULLET_DESCRIPTION_3 +{ + Text [en-US] = "Solid large square bullets"; +}; +String RID_SVXSTR_BULLET_DESCRIPTION_4 +{ + Text [en-US] = "Right pointing arrow bullets filled out"; +}; +String RID_SVXSTR_BULLET_DESCRIPTION_5 +{ + Text [en-US] = "Right pointing arrow bullets"; +}; +String RID_SVXSTR_BULLET_DESCRIPTION_6 +{ + Text [en-US] = "Check mark bullets"; +}; +String RID_SVXSTR_BULLET_DESCRIPTION_7 +{ + Text [en-US] = "Tick mark bullets"; +}; +String RID_SVXSTR_SINGLENUM_DESCRIPTION_0 +{ + Text [en-US] = "Number 1) 2) 3)"; +}; +String RID_SVXSTR_SINGLENUM_DESCRIPTION_1 +{ + Text [en-US] = "Number 1. 2. 3."; +}; +String RID_SVXSTR_SINGLENUM_DESCRIPTION_2 +{ + Text [en-US] = "Number (1) (2) (3)"; +}; +String RID_SVXSTR_SINGLENUM_DESCRIPTION_3 +{ + Text [en-US] = "Uppercase Roman number I. II. III."; +}; +String RID_SVXSTR_SINGLENUM_DESCRIPTION_4 +{ + Text [en-US] = "Uppercase letter A) B) C)"; +}; +String RID_SVXSTR_SINGLENUM_DESCRIPTION_5 +{ + Text [en-US] = "Lowercase letter a) b) c)"; +}; +String RID_SVXSTR_SINGLENUM_DESCRIPTION_6 +{ + Text [en-US] = "Lowercase letter (a) (b) (c)"; +}; +String RID_SVXSTR_SINGLENUM_DESCRIPTION_7 +{ + Text [en-US] = "Lowercase Roman number i. ii. iii."; +}; + +String RID_SVXSTR_OUTLINENUM_DESCRIPTION_0 +{ + Text [en-US] = "Numeric, numeric, lowercase letters, solid small circular bullet"; +}; +String RID_SVXSTR_OUTLINENUM_DESCRIPTION_1 +{ + Text [en-US] = "Numeric, lowercase letters, solid small circular bullet"; +}; +String RID_SVXSTR_OUTLINENUM_DESCRIPTION_2 +{ + Text [en-US] = "Numeric, lowercase letters, lowercase Roman, uppercase letters, solid small circular bullet"; +}; +String RID_SVXSTR_OUTLINENUM_DESCRIPTION_3 +{ + Text [en-US] = "Numeric"; +}; +String RID_SVXSTR_OUTLINENUM_DESCRIPTION_4 +{ + Text [en-US] = "Uppercase Roman, uppercase letters, lowercase Roman, lowercase letters, solid small circular bullet"; +}; +String RID_SVXSTR_OUTLINENUM_DESCRIPTION_5 +{ + Text [en-US] = "Uppercase letters, uppercase Roman, lowercase letters, lowercase Roman, solid small circular bullet"; +}; +String RID_SVXSTR_OUTLINENUM_DESCRIPTION_6 +{ + Text [en-US] = "Numeric with all sublevels"; +}; +String RID_SVXSTR_OUTLINENUM_DESCRIPTION_7 +{ + Text [en-US] = "Right pointing bullet, right pointing arrow bullet, solid diamond bullet, solid small circular bullet"; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx new file mode 100644 index 000000000000..082363ebed23 --- /dev/null +++ b/cui/source/tabpages/page.cxx @@ -0,0 +1,1771 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: page.cxx,v $ + * $Revision: 1.42 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "svx/htmlmode.hxx" + +#define _SVX_PAGE_CXX + +#include +#include "page.hrc" +#include "helpid.hrc" +#include "page.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "svx/dlgutil.hxx" +#include +#include +#include +#include +#include +#include //CHINA001 + +// #i4219# +#include +#include //CHINA001 +#include //CHINA001 +#include //CHINA001 +// configuration helper ======================================================= + +/** Helper to get a configuration setting. + @descr This is a HACK to get a configuration item directly. Normally the + OfaHtmlOptions class from 'offmgr' project would do the job, but we cannot + use it here. On the other hand, the OfaHtmlOptions cannot be moved to + 'svtools', because it uses 'svx' itself... + The correct way would be to move OfaHtmlOptions to 'svtools' anyway, and to + remove the dependency from 'svx' (a call to the static function + SvxTextEncodingBox::GetBestMimeEncoding(), which contains low level + operations that can be moved to lower projects, i.e. 'rtl'). Then this + class can be removed, and the OfaHtmlOptions can be used instead. */ +class SvxHtmlExportModeConfigItem_Impl : public utl::ConfigItem +{ +public: + explicit SvxHtmlExportModeConfigItem_Impl(); + + /** Returns the HTML export mode, as read from the configuration. */ + inline sal_Int32 GetExportMode() const { return mnExpMode; } + + /** Returns true, if the current HTML export mode is set to HTML 3.2. */ + inline bool IsExportModeHTML32() const { return mnExpMode == 0; } // 0 == HTML_CFG_HTML32, see offmgr/htmlcfg.hxx + + virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames); + +private: + sal_Int32 mnExpMode; +}; + +SvxHtmlExportModeConfigItem_Impl::SvxHtmlExportModeConfigItem_Impl() : + utl::ConfigItem( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/HTML/Export" ) ) ), + mnExpMode( 3 ) // default to 3 == HTML_CFG_NS40, see offmgr/htmlcfg.hxx +{ + using com::sun::star::uno::Sequence; + using com::sun::star::uno::Any; + + Sequence< rtl::OUString > aPropNames( 1 ); + aPropNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Browser" ) ); + Sequence< Any > aPropValues( GetProperties( aPropNames ) ); + if( aPropValues.getLength() == 1 ) + aPropValues[ 0 ] >>= mnExpMode; +} + +void SvxHtmlExportModeConfigItem_Impl::Commit() +{ +} + +void SvxHtmlExportModeConfigItem_Impl::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& ) +{ +} + +// static ---------------------------------------------------------------- + +static const long MINBODY = 284; // 0,5cm in twips aufgerundet +//static const long PRINT_OFFSET = 17; // 0,03cm in twips abgerundet +static const long PRINT_OFFSET = 0; // why was this ever set to 17 ? it led to wrong right and bottom margins. + +static USHORT pRanges[] = +{ + SID_ATTR_BORDER_OUTER, + SID_ATTR_BORDER_SHADOW, + SID_ATTR_LRSPACE, + SID_ATTR_PAGE_SHARED, + SID_SWREGISTER_COLLECTION, + SID_SWREGISTER_MODE, + 0 +}; + +// ------- Mapping Seitenlayout ------------------------------------------ + +USHORT aArr[] = +{ + SVX_PAGE_ALL, + SVX_PAGE_MIRROR, + SVX_PAGE_RIGHT, + SVX_PAGE_LEFT +}; + +// ----------------------------------------------------------------------- + +USHORT PageUsageToPos_Impl( USHORT nUsage ) +{ + const USHORT nCount = sizeof(aArr) / sizeof(USHORT); + + for ( USHORT i = 0; i < nCount; ++i ) + if ( aArr[i] == ( nUsage & 0x000f ) ) + return i; + return SVX_PAGE_ALL; +} + +// ----------------------------------------------------------------------- + +USHORT PosToPageUsage_Impl( USHORT nPos ) +{ + const USHORT nCount = sizeof(aArr) / sizeof(USHORT); + + if ( nPos >= nCount ) + return 0; + return aArr[nPos]; +} + +// ----------------------------------------------------------------------- + +Size GetMinBorderSpace_Impl( const SvxShadowItem& rShadow, const SvxBoxItem& rBox ) +{ + Size aSz; + aSz.Height() = rShadow.CalcShadowSpace( SHADOW_BOTTOM ) + rBox.CalcLineSpace( BOX_LINE_BOTTOM ); + aSz.Height() += rShadow.CalcShadowSpace( SHADOW_TOP ) + rBox.CalcLineSpace( BOX_LINE_TOP ); + aSz.Width() = rShadow.CalcShadowSpace( SHADOW_LEFT ) + rBox.CalcLineSpace( BOX_LINE_LEFT ); + aSz.Width() += rShadow.CalcShadowSpace( SHADOW_RIGHT ) + rBox.CalcLineSpace( BOX_LINE_RIGHT ); + return aSz; +} + +// ----------------------------------------------------------------------- + +long ConvertLong_Impl( const long nIn, SfxMapUnit eUnit ) +{ + return OutputDevice::LogicToLogic( nIn, (MapUnit)eUnit, MAP_TWIP ); +} + +BOOL IsEqualSize_Impl( const SvxSizeItem* pSize, const Size& rSize ) +{ + if ( pSize ) + { + Size aSize = pSize->GetSize(); + long nDiffW = Abs( rSize.Width () - aSize.Width () ); + long nDiffH = Abs( rSize.Height() - aSize.Height() ); + return ( nDiffW < 10 && nDiffH < 10 ); + } + else + return FALSE; +} + +// ----------------------------------------------------------------------- + +#define MARGIN_LEFT ( (MarginPosition)0x0001 ) +#define MARGIN_RIGHT ( (MarginPosition)0x0002 ) +#define MARGIN_TOP ( (MarginPosition)0x0004 ) +#define MARGIN_BOTTOM ( (MarginPosition)0x0008 ) + +struct SvxPage_Impl +{ + MarginPosition m_nPos; + Printer* mpDefPrinter; + bool mbDelPrinter; + + SvxPage_Impl() : + m_nPos( 0 ), + mpDefPrinter( 0 ), + mbDelPrinter( false ) {} + + ~SvxPage_Impl() { if ( mbDelPrinter ) delete mpDefPrinter; } +}; + +// class SvxPageDescPage -------------------------------------------------- + +// gibt den Bereich der Which-Werte zur"uck + +USHORT* SvxPageDescPage::GetRanges() +{ + return pRanges; +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxPageDescPage::Create( Window* pParent, const SfxItemSet& rSet ) +{ + return new SvxPageDescPage( pParent, rSet ); +} + +// ----------------------------------------------------------------------- + +SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr ) : + + SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_PAGE ), rAttr ), + + aPaperSizeFl ( this, SVX_RES( FL_PAPER_SIZE ) ), + aPaperFormatText ( this, SVX_RES( FT_PAPER_FORMAT ) ), + aPaperSizeBox ( this, SVX_RES( LB_PAPER_SIZE ) ), + aPaperWidthText ( this, SVX_RES( FT_PAPER_WIDTH ) ), + aPaperWidthEdit ( this, SVX_RES( ED_PAPER_WIDTH ) ), + aPaperHeightText ( this, SVX_RES( FT_PAPER_HEIGHT ) ), + aPaperHeightEdit ( this, SVX_RES( ED_PAPER_HEIGHT ) ), + aOrientationFT ( this, SVX_RES( FT_ORIENTATION ) ), + aPortraitBtn ( this, SVX_RES( RB_PORTRAIT ) ), + aLandscapeBtn ( this, SVX_RES( RB_LANDSCAPE ) ), + aBspWin ( this, SVX_RES( WN_BSP ) ), + aTextFlowLbl ( this, SVX_RES( FT_TEXT_FLOW ) ), + aTextFlowBox ( this, SVX_RES( LB_TEXT_FLOW ) ), + aPaperTrayLbl ( this, SVX_RES( FT_PAPER_TRAY ) ), + aPaperTrayBox ( this, SVX_RES( LB_PAPER_TRAY ) ), + aMarginFl ( this, SVX_RES( FL_MARGIN ) ), + aLeftMarginLbl ( this, SVX_RES( FT_LEFT_MARGIN ) ), + aLeftMarginEdit ( this, SVX_RES( ED_LEFT_MARGIN ) ), + aRightMarginLbl ( this, SVX_RES( FT_RIGHT_MARGIN ) ), + aRightMarginEdit ( this, SVX_RES( ED_RIGHT_MARGIN ) ), + aTopMarginLbl ( this, SVX_RES( FT_TOP_MARGIN ) ), + aTopMarginEdit ( this, SVX_RES( ED_TOP_MARGIN ) ), + aBottomMarginLbl ( this, SVX_RES( FT_BOTTOM_MARGIN ) ), + aBottomMarginEdit ( this, SVX_RES( ED_BOTTOM_MARGIN ) ), + + aLayoutFL ( this, SVX_RES( FL_LAYOUT ) ), + aPageText ( this, SVX_RES( FT_PAGELAYOUT ) ), + aLayoutBox ( this, SVX_RES( LB_LAYOUT ) ), + aNumberFormatText ( this, SVX_RES( FT_NUMBER_FORMAT ) ), + aNumberFormatBox ( this, SVX_RES( LB_NUMBER_FORMAT ) ), + aBottomSeparatorFl ( this, SVX_RES( FL_BOTTOM_SEP ) ), + aTblAlignFT ( this, SVX_RES( FT_TBL_ALIGN ) ), + aHorzBox ( this, SVX_RES( CB_HORZ ) ), + aVertBox ( this, SVX_RES( CB_VERT ) ), + aAdaptBox ( this, SVX_RES( CB_ADAPT ) ), + aRegisterCB ( this, SVX_RES( CB_REGISTER ) ), + aRegisterFT ( this, SVX_RES( FT_REGISTER ) ), + aRegisterLB ( this, SVX_RES( LB_REGISTER ) ), + + aInsideText ( SVX_RES( STR_INSIDE ) ), + aOutsideText ( SVX_RES( STR_OUTSIDE ) ), + aPrintRangeQueryText( SVX_RES( STR_QUERY_PRINTRANGE ) ), + + bLandscape ( FALSE ), + eMode ( SVX_PAGE_MODE_STANDARD ), + ePaperStart ( PAPER_A3 ), + ePaperEnd ( PAPER_ENV_DL ), + pImpl ( new SvxPage_Impl ) + +{ + bBorderModified = FALSE; + FreeResource(); + aBspWin.EnableRTL( FALSE ); + + // diese Page braucht ExchangeSupport + SetExchangeSupport(); + + SvtLanguageOptions aLangOptions; + sal_Bool bCJK = aLangOptions.IsAsianTypographyEnabled(); + sal_Bool bCTL = aLangOptions.IsCTLFontEnabled(); + sal_Bool bWeb = sal_False; + const SfxPoolItem* pItem; + + SfxObjectShell* pShell; + if(SFX_ITEM_SET == rAttr.GetItemState(SID_HTML_MODE, FALSE, &pItem) || + ( 0 != (pShell = SfxObjectShell::Current()) && + 0 != (pItem = pShell->GetItem(SID_HTML_MODE)))) + bWeb = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON); + + // #109989# get the HTML export setting from configuration. + // !! This is a hack, see comments in SvxHtmlExportModeConfigItem_Impl class above. + bool bHTML32 = SvxHtmlExportModeConfigItem_Impl().IsExportModeHTML32(); + + // fill text flow listbox with valid entries + aTextFlowBox.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_PAGEDIR_LTR_HORI ), FRMDIR_HORI_LEFT_TOP ); + if( bCTL ) + aTextFlowBox.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_PAGEDIR_RTL_HORI ), FRMDIR_HORI_RIGHT_TOP ); + // #109989# do not show vertical directions in Writer/Web + if( !bWeb ) + { + if( bCJK ) + aTextFlowBox.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_PAGEDIR_RTL_VERT ), FRMDIR_VERT_TOP_RIGHT ); +// if( ... ) +// aTextFlowBox.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_PAGEDIR_LTR_VERT ), FRMDIR_VERT_TOP_LEFT ); + } + + // #109989# show the text direction box in Writer/Web too, but only, if HTML export mode is not HTML3.2. + if( !(bWeb && bHTML32) && (bCJK || bCTL) && + SFX_ITEM_UNKNOWN < rAttr.GetItemState(GetWhich( SID_ATTR_FRAMEDIRECTION ))) + { + aTextFlowLbl.Show(); + aTextFlowBox.Show(); + aTextFlowBox.SetSelectHdl(LINK(this, SvxPageDescPage, FrameDirectionModify_Impl )); + + aBspWin.EnableFrameDirection(sal_True); + } + Init_Impl(); + + FieldUnit eFUnit = GetModuleFieldUnit( &rAttr ); + SetFieldUnit( aLeftMarginEdit, eFUnit ); + SetFieldUnit( aRightMarginEdit, eFUnit ); + SetFieldUnit( aTopMarginEdit, eFUnit ); + SetFieldUnit( aBottomMarginEdit, eFUnit ); + SetFieldUnit( aPaperWidthEdit, eFUnit ); + SetFieldUnit( aPaperHeightEdit, eFUnit ); + + if ( SfxViewShell::Current() && SfxViewShell::Current()->GetPrinter() ) + pImpl->mpDefPrinter = (Printer*)SfxViewShell::Current()->GetPrinter(); + else + { + pImpl->mpDefPrinter = new Printer; + pImpl->mbDelPrinter = true; + } + + MapMode aOldMode = pImpl->mpDefPrinter->GetMapMode(); + pImpl->mpDefPrinter->SetMapMode( MAP_TWIP ); + + // First- und Last-Werte f"ur die R"ander setzen + Size aPaperSize = pImpl->mpDefPrinter->GetPaperSize(); + Size aPrintSize = pImpl->mpDefPrinter->GetOutputSize(); + /* + * einen Punkt ( 0,0 ) in logische Koordinaten zu konvertieren, + * sieht aus wie Unsinn; ist aber sinnvoll, wenn der Ursprung des + * Koordinatensystems verschoben ist. + */ + Point aPrintOffset = pImpl->mpDefPrinter->GetPageOffset() - + pImpl->mpDefPrinter->PixelToLogic( Point() ); + pImpl->mpDefPrinter->SetMapMode( aOldMode ); + + long nOffset = !aPrintOffset.X() && !aPrintOffset.Y() ? 0 : PRINT_OFFSET; + aLeftMarginEdit.SetFirst( aLeftMarginEdit.Normalize( aPrintOffset.X() ), FUNIT_TWIP ); + nFirstLeftMargin = static_cast(aLeftMarginEdit.GetFirst()); + aRightMarginEdit.SetFirst( aRightMarginEdit.Normalize( + aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X() + nOffset ), FUNIT_TWIP); + nFirstRightMargin = static_cast(aRightMarginEdit.GetFirst()); + aTopMarginEdit.SetFirst( aTopMarginEdit.Normalize( aPrintOffset.Y() ), FUNIT_TWIP ); + nFirstTopMargin = static_cast(aTopMarginEdit.GetFirst()); + aBottomMarginEdit.SetFirst( aBottomMarginEdit.Normalize( + aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y() + nOffset ), FUNIT_TWIP ); + nFirstBottomMargin = static_cast(aBottomMarginEdit.GetFirst()); + aLeftMarginEdit.SetLast( aLeftMarginEdit.Normalize( + aPrintOffset.X() + aPrintSize.Width() ), FUNIT_TWIP ); + nLastLeftMargin = static_cast(aLeftMarginEdit.GetLast()); + aRightMarginEdit.SetLast( aRightMarginEdit.Normalize( + aPrintOffset.X() + aPrintSize.Width() ), FUNIT_TWIP ); + nLastRightMargin = static_cast(aRightMarginEdit.GetLast()); + aTopMarginEdit.SetLast( aTopMarginEdit.Normalize( + aPrintOffset.Y() + aPrintSize.Height() ), FUNIT_TWIP ); + nLastTopMargin = static_cast(aTopMarginEdit.GetLast()); + aBottomMarginEdit.SetLast( aBottomMarginEdit.Normalize( + aPrintOffset.Y() + aPrintSize.Height() ), FUNIT_TWIP ); + nLastBottomMargin = static_cast(aBottomMarginEdit.GetLast()); + + // #i4219# get DrawingLayer options + const SvtOptionsDrawinglayer aDrawinglayerOpt; + + // #i4219# take Maximum now from configuration (1/100th cm) + // was: 11900 -> 119 cm ;new value 3 meters -> 300 cm -> 30000 + aPaperWidthEdit.SetMax(aPaperWidthEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperWidth()), FUNIT_CM); + aPaperWidthEdit.SetLast(aPaperWidthEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperWidth()), FUNIT_CM); + aPaperHeightEdit.SetMax(aPaperHeightEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperHeight()), FUNIT_CM); + aPaperHeightEdit.SetLast(aPaperHeightEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperHeight()), FUNIT_CM); + + // #i4219# also for margins (1/100th cm). Was: 9999, keeping. + aLeftMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperLeftMargin()); + aLeftMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperLeftMargin()); + aRightMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperRightMargin()); + aRightMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperRightMargin()); + aTopMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperTopMargin()); + aTopMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperTopMargin()); + aBottomMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperBottomMargin()); + aBottomMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperBottomMargin()); +} + +// ----------------------------------------------------------------------- + +SvxPageDescPage::~SvxPageDescPage() +{ + delete pImpl; +} + +// ----------------------------------------------------------------------- + +void SvxPageDescPage::Init_Impl() +{ + aLeftText = aLeftMarginLbl.GetText(); + aRightText = aRightMarginLbl.GetText(); + + // Handler einstellen + aLayoutBox.SetSelectHdl( LINK( this, SvxPageDescPage, LayoutHdl_Impl ) ); + aPaperSizeBox.SetDropDownLineCount(10); + + aPaperTrayBox.SetGetFocusHdl( + LINK( this, SvxPageDescPage, PaperBinHdl_Impl ) ); + aPaperSizeBox.SetSelectHdl( + LINK( this, SvxPageDescPage, PaperSizeSelect_Impl ) ); + aPaperWidthEdit.SetModifyHdl( + LINK( this, SvxPageDescPage, PaperSizeModify_Impl ) ); + aPaperHeightEdit.SetModifyHdl( + LINK( this, SvxPageDescPage, PaperSizeModify_Impl ) ); + aLandscapeBtn.SetClickHdl( + LINK( this, SvxPageDescPage, SwapOrientation_Impl ) ); + aPortraitBtn.SetClickHdl( + LINK( this, SvxPageDescPage, SwapOrientation_Impl ) ); + + Link aLink = LINK( this, SvxPageDescPage, BorderModify_Impl ); + aLeftMarginEdit.SetModifyHdl( aLink ); + aRightMarginEdit.SetModifyHdl( aLink ); + aTopMarginEdit.SetModifyHdl( aLink ); + aBottomMarginEdit.SetModifyHdl( aLink ); + + aLink = LINK( this, SvxPageDescPage, RangeHdl_Impl ); + aPaperWidthEdit.SetLoseFocusHdl( aLink ); + aPaperHeightEdit.SetLoseFocusHdl( aLink ); + aLeftMarginEdit.SetLoseFocusHdl( aLink ); + aRightMarginEdit.SetLoseFocusHdl( aLink ); + aTopMarginEdit.SetLoseFocusHdl( aLink ); + aBottomMarginEdit.SetLoseFocusHdl( aLink ); + + aHorzBox.SetClickHdl( LINK( this, SvxPageDescPage, CenterHdl_Impl ) ); + aVertBox.SetClickHdl( LINK( this, SvxPageDescPage, CenterHdl_Impl ) ); + +} + +// ----------------------------------------------------------------------- + +void SvxPageDescPage::Reset( const SfxItemSet& rSet ) +{ + SfxItemPool* pPool = rSet.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + SfxMapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ); + + // R"ander (Links/Rechts) einstellen + const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_LRSPACE ); + + if ( pItem ) + { + const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)*pItem; + SetMetricValue( aLeftMarginEdit, rLRSpace.GetLeft(), eUnit ); + aBspWin.SetLeft( + (USHORT)ConvertLong_Impl( (long)rLRSpace.GetLeft(), eUnit ) ); + SetMetricValue( aRightMarginEdit, rLRSpace.GetRight(), eUnit ); + aBspWin.SetRight( + (USHORT)ConvertLong_Impl( (long)rLRSpace.GetRight(), eUnit ) ); + } + + // R"ander (Oben/Unten) einstellen + pItem = GetItem( rSet, SID_ATTR_ULSPACE ); + + if ( pItem ) + { + const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)*pItem; + SetMetricValue( aTopMarginEdit, rULSpace.GetUpper(), eUnit ); + aBspWin.SetTop( + (USHORT)ConvertLong_Impl( (long)rULSpace.GetUpper(), eUnit ) ); + SetMetricValue( aBottomMarginEdit, rULSpace.GetLower(), eUnit ); + aBspWin.SetBottom( + (USHORT)ConvertLong_Impl( (long)rULSpace.GetLower(), eUnit ) ); + } + + // allgemeine Seitendaten + SvxNumType eNumType = SVX_ARABIC; + bLandscape = ( pImpl->mpDefPrinter->GetOrientation() == ORIENTATION_LANDSCAPE ); + USHORT nUse = (USHORT)SVX_PAGE_ALL; + pItem = GetItem( rSet, SID_ATTR_PAGE ); + + if ( pItem ) + { + const SvxPageItem& rItem = (const SvxPageItem&)*pItem; + eNumType = rItem.GetNumType(); + nUse = rItem.GetPageUsage(); + bLandscape = rItem.IsLandscape(); + } + + // Ausrichtung + aLayoutBox.SelectEntryPos( ::PageUsageToPos_Impl( nUse ) ); + aBspWin.SetUsage( nUse ); + LayoutHdl_Impl( 0 ); + + // Numerierungsart der Seitenvorlage einstellen + aNumberFormatBox.SelectEntryPos( sal::static_int_cast< USHORT >(eNumType) ); + + // Aktueller Papierschacht + aPaperTrayBox.Clear(); + BYTE nPaperBin = PAPERBIN_PRINTER_SETTINGS; + pItem = GetItem( rSet, SID_ATTR_PAGE_PAPERBIN ); + + if ( pItem ) + { + nPaperBin = ( (const SvxPaperBinItem*)pItem )->GetValue(); + + if ( nPaperBin >= pImpl->mpDefPrinter->GetPaperBinCount() ) + nPaperBin = PAPERBIN_PRINTER_SETTINGS; + } + + String aBinName; + + if ( PAPERBIN_PRINTER_SETTINGS == nPaperBin ) + aBinName = SVX_RESSTR( RID_SVXSTR_PAPERBIN_SETTINGS ); + else + aBinName = pImpl->mpDefPrinter->GetPaperBinName( (USHORT)nPaperBin ); + + USHORT nEntryPos = aPaperTrayBox.InsertEntry( aBinName ); + aPaperTrayBox.SetEntryData( nEntryPos, (void*)(ULONG)nPaperBin ); + aPaperTrayBox.SelectEntry( aBinName ); + + // Size rausholen + Size aPaperSize = SvxPaperInfo::GetPaperSize( pImpl->mpDefPrinter ); + pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE ); + + if ( pItem ) + aPaperSize = ( (const SvxSizeItem*)pItem )->GetSize(); + + FASTBOOL bOrientationSupport = + pImpl->mpDefPrinter->HasSupport( SUPPORT_SET_ORIENTATION ); +#ifdef OS2 + // unter OS/2 wird bei HasSupport() immer TRUE returned + // aber nur als Dummy, deshalb FALSE + bOrientationSupport = FALSE; +#endif + + if ( !bOrientationSupport && + aPaperSize.Width() > aPaperSize.Height() ) + bLandscape = TRUE; + + aLandscapeBtn.Check( bLandscape ); + aPortraitBtn.Check( !bLandscape ); + + aBspWin.SetSize( Size( ConvertLong_Impl( aPaperSize.Width(), eUnit ), + ConvertLong_Impl( aPaperSize.Height(), eUnit ) ) ); + + aPaperSize = OutputDevice::LogicToLogic(aPaperSize, (MapUnit)eUnit, MAP_100TH_MM); + if ( bLandscape ) + Swap( aPaperSize ); + + // Actual Paper Format + Paper ePaper = SvxPaperInfo::GetSvxPaper( aPaperSize, MAP_100TH_MM, TRUE ); + + if ( PAPER_USER != ePaper ) + aPaperSize = SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM ); + + if ( bLandscape ) + Swap( aPaperSize ); + + // Werte in die Edits eintragen + SetMetricValue( aPaperHeightEdit, aPaperSize.Height(), SFX_MAPUNIT_100TH_MM ); + SetMetricValue( aPaperWidthEdit, aPaperSize.Width(), SFX_MAPUNIT_100TH_MM ); + aPaperSizeBox.Clear(); + + USHORT nActPos = LISTBOX_ENTRY_NOTFOUND; + USHORT nAryId = RID_SVXSTRARY_PAPERSIZE_STD; + + if ( ePaperStart != PAPER_A3 ) + nAryId = RID_SVXSTRARY_PAPERSIZE_DRAW; + ResStringArray aPaperAry( SVX_RES( nAryId ) ); + sal_uInt32 nCnt = aPaperAry.Count(); + + for ( sal_uInt32 i = 0; i < nCnt; ++i ) + { + String aStr = aPaperAry.GetString(i); + Paper eSize = (Paper)aPaperAry.GetValue(i); + USHORT nPos = aPaperSizeBox.InsertEntry( aStr ); + aPaperSizeBox.SetEntryData( nPos, (void*)(ULONG)eSize ); + + if ( eSize == ePaper ) + nActPos = nPos; + } + // aktuelles Papierformat selektieren + aPaperSizeBox.SelectEntryPos( nActPos ); + + // Applikationsspezifisch + + switch ( eMode ) + { + case SVX_PAGE_MODE_CENTER: + { + aTblAlignFT.Show(); + aHorzBox.Show(); + aVertBox.Show(); + DisableVerticalPageDir(); + + // Horizontale Ausrichtung + pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 ); + aHorzBox.Check( pItem ? ( (const SfxBoolItem*)pItem )->GetValue() + : FALSE ); + + // Vertikale Ausrichtung + pItem = GetItem( rSet, SID_ATTR_PAGE_EXT2 ); + aVertBox.Check( pItem ? ( (const SfxBoolItem*)pItem )->GetValue() + : FALSE ); + + // Beispiel-Fenster auf Tabelle setzen + aBspWin.SetTable( TRUE ); + aBspWin.SetHorz( aHorzBox.IsChecked() ); + aBspWin.SetVert( aVertBox.IsChecked() ); + + break; + } + + case SVX_PAGE_MODE_PRESENTATION: + { + DisableVerticalPageDir(); + aAdaptBox.Show(); + pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 ); + aAdaptBox.Check( pItem ? + ( (const SfxBoolItem*)pItem )->GetValue() : FALSE ); + + //!!! hidden, weil von StarDraw nicht implementiert + aLayoutBox.Hide(); + aPageText.Hide(); + + break; + } + default: ;//prevent warning + } + + + // im Beispiel Hintergrund und Umrandung anzeigen + ResetBackground_Impl( rSet ); +//! UpdateExample_Impl(); + RangeHdl_Impl( 0 ); + + // Header Footer anzeigen + InitHeadFoot_Impl( rSet ); + + // R"ander auf Hoch/Quer updaten, dann Beispiel updaten + bBorderModified = FALSE; + SwapFirstValues_Impl( FALSE ); + UpdateExample_Impl(); + + // Alte Werte sichern + aLeftMarginEdit.SaveValue(); + aRightMarginEdit.SaveValue(); + aTopMarginEdit.SaveValue(); + aBottomMarginEdit.SaveValue(); + aLayoutBox.SaveValue(); + aNumberFormatBox.SaveValue(); + aPaperSizeBox.SaveValue(); + aPaperWidthEdit.SaveValue(); + aPaperHeightEdit.SaveValue(); + aPortraitBtn.SaveValue(); + aLandscapeBtn.SaveValue(); + aPaperTrayBox.SaveValue(); + aVertBox.SaveValue(); + aHorzBox.SaveValue(); + aAdaptBox.SaveValue(); + + CheckMarginEdits( true ); + + // Registerhaltigkeit + if(SFX_ITEM_SET == rSet.GetItemState(SID_SWREGISTER_MODE)) + { + aRegisterCB.Check(((const SfxBoolItem&)rSet.Get( + SID_SWREGISTER_MODE)).GetValue()); + aRegisterCB.SaveValue(); + RegisterModify(&aRegisterCB); + } + if(SFX_ITEM_SET == rSet.GetItemState(SID_SWREGISTER_COLLECTION)) + { + aRegisterLB.SelectEntry( + ((const SfxStringItem&)rSet.Get(SID_SWREGISTER_COLLECTION)).GetValue()); + aRegisterLB.SaveValue(); + } + + SfxItemState eState = rSet.GetItemState( GetWhich( SID_ATTR_FRAMEDIRECTION ), + TRUE, &pItem ); + if( SFX_ITEM_UNKNOWN != eState ) + { + sal_uInt32 nVal = SFX_ITEM_SET == eState + ? ((SvxFrameDirectionItem*)pItem)->GetValue() + : 0; + aTextFlowBox.SelectEntryValue( static_cast< SvxFrameDirection >( nVal ) ); + aTextFlowBox.SaveValue(); + aBspWin.SetFrameDirection(nVal); + } +} + +// ----------------------------------------------------------------------- + +void SvxPageDescPage::FillUserData() +{ + if ( SVX_PAGE_MODE_PRESENTATION == eMode ) + SetUserData( UniString::CreateFromInt32( (sal_Int32)aAdaptBox.IsChecked() ) ); +} + +// ----------------------------------------------------------------------- + +BOOL SvxPageDescPage::FillItemSet( SfxItemSet& rSet ) +{ + BOOL bModified = FALSE; + const SfxItemSet& rOldSet = GetItemSet(); + SfxItemPool* pPool = rOldSet.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + USHORT nWhich = GetWhich( SID_ATTR_LRSPACE ); + SfxMapUnit eUnit = pPool->GetMetric( nWhich ); + const SfxPoolItem* pOld = 0; + + // alten linken und rechten Rand kopieren + SvxLRSpaceItem aMargin( (const SvxLRSpaceItem&)rOldSet.Get( nWhich ) ); + + // alten oberen und unteren Rand kopieren + nWhich = GetWhich( SID_ATTR_ULSPACE ); + SvxULSpaceItem aTopMargin( (const SvxULSpaceItem&)rOldSet.Get( nWhich ) ); + + if ( aLeftMarginEdit.GetText() != aLeftMarginEdit.GetSavedValue() ) + { + aMargin.SetLeft( (USHORT)GetCoreValue( aLeftMarginEdit, eUnit ) ); + bModified |= TRUE; + } + + if ( aRightMarginEdit.GetText() != aRightMarginEdit.GetSavedValue() ) + { + aMargin.SetRight( (USHORT)GetCoreValue( aRightMarginEdit, eUnit ) ); + bModified |= TRUE; + } + + // Linken und rechten Rand setzen + if ( bModified ) + { + pOld = GetOldItem( rSet, SID_ATTR_LRSPACE ); + + if ( !pOld || !( *(const SvxLRSpaceItem*)pOld == aMargin ) ) + rSet.Put( aMargin ); + else + bModified = FALSE; + } + + BOOL bMod = FALSE; + + if ( aTopMarginEdit.GetText() != aTopMarginEdit.GetSavedValue() ) + { + aTopMargin.SetUpper( (USHORT)GetCoreValue( aTopMarginEdit, eUnit ) ); + bMod |= TRUE; + } + + if ( aBottomMarginEdit.GetText() != aBottomMarginEdit.GetSavedValue() ) + { + aTopMargin.SetLower( (USHORT)GetCoreValue( aBottomMarginEdit, eUnit ) ); + bMod |= TRUE; + } + + // unteren oberen Rand setzen + // + if ( bMod ) + { + pOld = GetOldItem( rSet, SID_ATTR_ULSPACE ); + + if ( !pOld || !( *(const SvxULSpaceItem*)pOld == aTopMargin ) ) + { + bModified |= TRUE; + rSet.Put( aTopMargin ); + } + } + + // Druckerschacht + nWhich = GetWhich( SID_ATTR_PAGE_PAPERBIN ); + USHORT nPos = aPaperTrayBox.GetSelectEntryPos(); + USHORT nBin = (USHORT)(ULONG)aPaperTrayBox.GetEntryData( nPos ); + pOld = GetOldItem( rSet, SID_ATTR_PAGE_PAPERBIN ); + + if ( !pOld || ( (const SvxPaperBinItem*)pOld )->GetValue() != nBin ) + { + rSet.Put( SvxPaperBinItem( nWhich, (BYTE)nBin ) ); + bModified |= TRUE; + } + + nPos = aPaperSizeBox.GetSelectEntryPos(); + Paper ePaper = (Paper)(ULONG)aPaperSizeBox.GetEntryData( nPos ); + const USHORT nOld = aPaperSizeBox.GetSavedValue(); + BOOL bChecked = aLandscapeBtn.IsChecked(); + + if ( PAPER_USER == ePaper ) + { + if ( nOld != nPos || + aPaperWidthEdit.IsValueModified() || + aPaperHeightEdit.IsValueModified() || + bChecked != aLandscapeBtn.GetSavedValue() ) + { + Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ), + GetCoreValue( aPaperHeightEdit, eUnit ) ); + pOld = GetOldItem( rSet, SID_ATTR_PAGE_SIZE ); + + if ( !pOld || ( (const SvxSizeItem*)pOld )->GetSize() != aSize ) + { + rSet.Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE), aSize ) ); + bModified |= TRUE; + } + } + } + else + { + if ( nOld != nPos || bChecked != aLandscapeBtn.GetSavedValue() ) + { + Size aSize( SvxPaperInfo::GetPaperSize( ePaper, (MapUnit)eUnit ) ); + + if ( bChecked ) + Swap( aSize ); + + pOld = GetOldItem( rSet, SID_ATTR_PAGE_SIZE ); + + if ( !pOld || ( (const SvxSizeItem*)pOld )->GetSize() != aSize ) + { + rSet.Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE), aSize ) ); + bModified |= TRUE; + } + } + } + + // sonstiges Zeug der Page + nWhich = GetWhich( SID_ATTR_PAGE ); + SvxPageItem aPage( (const SvxPageItem&)rOldSet.Get( nWhich ) ); + bMod = aLayoutBox.GetSelectEntryPos() != aLayoutBox.GetSavedValue(); + + if ( bMod ) + aPage.SetPageUsage( + ::PosToPageUsage_Impl( aLayoutBox.GetSelectEntryPos() ) ); + + if ( bChecked != aLandscapeBtn.GetSavedValue() ) + { + aPage.SetLandscape(bChecked); + bMod |= TRUE; + } + + // Einstellen der Numerierungsart der Seite + nPos = aNumberFormatBox.GetSelectEntryPos(); + + if ( nPos != aNumberFormatBox.GetSavedValue() ) + { + aPage.SetNumType( (SvxNumType)nPos ); + bMod |= TRUE; + } + + if ( bMod ) + { + pOld = GetOldItem( rSet, SID_ATTR_PAGE ); + + if ( !pOld || !( *(const SvxPageItem*)pOld == aPage ) ) + { + rSet.Put( aPage ); + bModified |= TRUE; + } + } + else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich ) ) + rSet.ClearItem( nWhich ); + else + rSet.Put( rOldSet.Get( nWhich ) ); + + // Modispezifische Controls auswerten + + switch ( eMode ) + { + case SVX_PAGE_MODE_CENTER: + { + if ( aHorzBox.IsChecked() != aHorzBox.GetSavedValue() ) + { + SfxBoolItem aHorz( GetWhich( SID_ATTR_PAGE_EXT1 ), + aHorzBox.IsChecked() ); + rSet.Put( aHorz ); + bModified |= TRUE; + } + + if ( aVertBox.IsChecked() != aVertBox.GetSavedValue() ) + { + SfxBoolItem aVert( GetWhich( SID_ATTR_PAGE_EXT2 ), + aVertBox.IsChecked() ); + rSet.Put( aVert ); + bModified |= TRUE; + } + break; + } + + case SVX_PAGE_MODE_PRESENTATION: + { + // immer putten, damit Draw das auswerten kann + rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_PAGE_EXT1 ), + aAdaptBox.IsChecked() ) ); + bModified |= TRUE; + break; + } + default: ;//prevent warning + + } + + if(aRegisterCB.IsVisible() && + (aRegisterCB.IsChecked() || aRegisterCB.GetSavedValue() != aRegisterCB.IsChecked())) + { + const SfxBoolItem& rRegItem = (const SfxBoolItem&)rOldSet.Get(SID_SWREGISTER_MODE); + SfxBoolItem* pRegItem = (SfxBoolItem*)rRegItem.Clone(); + BOOL bCheck = aRegisterCB.IsChecked(); + pRegItem->SetValue(bCheck); + rSet.Put(*pRegItem); + bModified |= TRUE; + if(bCheck) + { + bModified |= TRUE; + rSet.Put(SfxStringItem(SID_SWREGISTER_COLLECTION, + aRegisterLB.GetSelectEntry())); + } + delete pRegItem; + } + + SvxFrameDirection eDirection = aTextFlowBox.GetSelectEntryValue(); + if( aTextFlowBox.IsVisible() && (eDirection != aTextFlowBox.GetSavedValue()) ) + { + rSet.Put( SvxFrameDirectionItem( eDirection, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) ); + bModified = TRUE; + } + + return bModified; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxPageDescPage, LayoutHdl_Impl, ListBox *, EMPTYARG ) +{ + // innen au\sen umschalten + const USHORT nPos = PosToPageUsage_Impl( aLayoutBox.GetSelectEntryPos() ); + + if ( nPos == SVX_PAGE_MIRROR ) + { + if ( aLeftMarginLbl.GetText() != aInsideText ) + aLeftMarginLbl.SetText( aInsideText ); + + if ( aRightMarginLbl.GetText() != aOutsideText ) + aRightMarginLbl.SetText( aOutsideText ); + } + else + { + if ( aLeftMarginLbl.GetText() != aLeftText ) + aLeftMarginLbl.SetText( aLeftText ); + + if ( aRightMarginLbl.GetText() != aRightText ) + aRightMarginLbl.SetText( aRightText ); + } + UpdateExample_Impl( true ); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxPageDescPage, PaperBinHdl_Impl, ListBox *, EMPTYARG ) +{ + if ( aPaperTrayBox.GetEntryCount() > 1 ) + // schon gef"ullt + return 0; + + // Schacht-Box initialisieren + String aOldName = aPaperTrayBox.GetSelectEntry(); + aPaperTrayBox.SetUpdateMode( FALSE ); + aPaperTrayBox.Clear(); + USHORT nEntryPos = aPaperTrayBox.InsertEntry( + SVX_RESSTR( RID_SVXSTR_PAPERBIN_SETTINGS ) ); + aPaperTrayBox.SetEntryData( nEntryPos, + (void*)(ULONG)PAPERBIN_PRINTER_SETTINGS ); + String aPaperBin( SVX_RES( RID_SVXSTR_PAPERBIN ) ); + USHORT nBinCount = pImpl->mpDefPrinter->GetPaperBinCount(); + + for ( USHORT i = 0; i < nBinCount; ++i ) + { + String aName = pImpl->mpDefPrinter->GetPaperBinName(i); + + if ( !aName.Len() ) + { + aName = aPaperBin; + aName.Append( sal_Unicode(' ') ); + aName.Append( UniString::CreateFromInt32( i+1 ) ); + } + nEntryPos = aPaperTrayBox.InsertEntry( aName ); + aPaperTrayBox.SetEntryData( nEntryPos, (void*)(ULONG)i ); + } + aPaperTrayBox.SelectEntry( aOldName ); + aPaperTrayBox.SetUpdateMode( TRUE ); + + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxPageDescPage, PaperSizeSelect_Impl, ListBox *, pBox ) +{ + const USHORT nPos = pBox->GetSelectEntryPos(); + Paper ePaper = (Paper)(ULONG)aPaperSizeBox.GetEntryData( nPos ); + + if ( ePaper != PAPER_USER ) + { + Size aSize( SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM ) ); + + if ( aLandscapeBtn.IsChecked() ) + Swap( aSize ); + + if ( aSize.Height() < aPaperHeightEdit.GetMin( FUNIT_100TH_MM ) ) + aPaperHeightEdit.SetMin( + aPaperHeightEdit.Normalize( aSize.Height() ), FUNIT_100TH_MM ); + if ( aSize.Width() < aPaperWidthEdit.GetMin( FUNIT_100TH_MM ) ) + aPaperWidthEdit.SetMin( + aPaperWidthEdit.Normalize( aSize.Width() ), FUNIT_100TH_MM ); + SetMetricValue( aPaperHeightEdit, aSize.Height(), SFX_MAPUNIT_100TH_MM ); + SetMetricValue( aPaperWidthEdit, aSize.Width(), SFX_MAPUNIT_100TH_MM ); + + // R"ander ggf. neu berechnen + CalcMargin_Impl(); + + RangeHdl_Impl( 0 ); + UpdateExample_Impl( true ); + + if ( eMode == SVX_PAGE_MODE_PRESENTATION ) + { + // Draw: bei Papierformat soll der Rand 1cm betragen + long nTmp = 0; + BOOL bScreen = ( PAPER_SCREEN == ePaper ); + + if ( !bScreen ) + // bei Bildschirm keinen Rand + nTmp = 1; // entspr. 1cm + + // Abfragen, ob fuer Raender 0 gesetzt ist: + if ( bScreen || aRightMarginEdit.GetValue() == 0 ) + { + SetMetricValue( aRightMarginEdit, nTmp, SFX_MAPUNIT_CM ); + if ( !bScreen && + aRightMarginEdit.GetFirst() > aRightMarginEdit.GetValue() ) + aRightMarginEdit.SetValue( aRightMarginEdit.GetFirst() ); + } + if ( bScreen || aLeftMarginEdit.GetValue() == 0 ) + { + SetMetricValue( aLeftMarginEdit, nTmp, SFX_MAPUNIT_CM ); + if ( !bScreen && + aLeftMarginEdit.GetFirst() > aLeftMarginEdit.GetValue() ) + aLeftMarginEdit.SetValue( aLeftMarginEdit.GetFirst() ); + } + if ( bScreen || aBottomMarginEdit.GetValue() == 0 ) + { + SetMetricValue( aBottomMarginEdit, nTmp, SFX_MAPUNIT_CM ); + if ( !bScreen && + aBottomMarginEdit.GetFirst() > aBottomMarginEdit.GetValue() ) + aBottomMarginEdit.SetValue( aBottomMarginEdit.GetFirst() ); + } + if ( bScreen || aTopMarginEdit.GetValue() == 0 ) + { + SetMetricValue( aTopMarginEdit, nTmp, SFX_MAPUNIT_CM ); + if ( !bScreen && + aTopMarginEdit.GetFirst() > aTopMarginEdit.GetValue() ) + aTopMarginEdit.SetValue( aTopMarginEdit.GetFirst() ); + } + UpdateExample_Impl( true ); + } + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxPageDescPage, PaperSizeModify_Impl, Edit *, EMPTYARG ) +{ + USHORT nWhich = GetWhich( SID_ATTR_LRSPACE ); + SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWhich ); + Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ), + GetCoreValue( aPaperHeightEdit, eUnit ) ); + Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, (MapUnit)eUnit, TRUE ); + USHORT nEntryCount = aPaperSizeBox.GetEntryCount(); + + for ( USHORT i = 0; i < nEntryCount; ++i ) + { + Paper eTmp = (Paper)(ULONG)aPaperSizeBox.GetEntryData(i); + + if ( eTmp == ePaper ) + { + aPaperSizeBox.SelectEntryPos(i); + break; + } + } + UpdateExample_Impl( true ); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxPageDescPage, SwapOrientation_Impl, RadioButton *, pBtn ) +{ + if ( + (!bLandscape && pBtn == &aLandscapeBtn) || + (bLandscape && pBtn == &aPortraitBtn) + ) + { + bLandscape = aLandscapeBtn.IsChecked(); + + const long lWidth = GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_100TH_MM ); + const long lHeight = GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_100TH_MM ); + + // swap with and height + SetMetricValue( aPaperWidthEdit, lHeight, SFX_MAPUNIT_100TH_MM ); + SetMetricValue( aPaperHeightEdit, lWidth, SFX_MAPUNIT_100TH_MM ); + + // recalculate margins if necessary + CalcMargin_Impl(); + + PaperSizeSelect_Impl( &aPaperSizeBox ); + RangeHdl_Impl( 0 ); + SwapFirstValues_Impl( bBorderModified ); + UpdateExample_Impl( true ); + } + return 0; +} + +// ----------------------------------------------------------------------- + +void SvxPageDescPage::SwapFirstValues_Impl( FASTBOOL bSet ) +{ + MapMode aOldMode = pImpl->mpDefPrinter->GetMapMode(); + Orientation eOri = ORIENTATION_PORTRAIT; + + if ( bLandscape ) + eOri = ORIENTATION_LANDSCAPE; + Orientation eOldOri = pImpl->mpDefPrinter->GetOrientation(); + pImpl->mpDefPrinter->SetOrientation( eOri ); + pImpl->mpDefPrinter->SetMapMode( MAP_TWIP ); + + // First- und Last-Werte f"ur die R"ander setzen + Size aPaperSize = pImpl->mpDefPrinter->GetPaperSize(); + Size aPrintSize = pImpl->mpDefPrinter->GetOutputSize(); + /* + * einen Punkt ( 0,0 ) in logische Koordinaten zu konvertieren, + * sieht aus wie Unsinn; ist aber sinnvoll, wenn der Ursprung des + * Koordinatensystems verschoben ist. + */ + Point aPrintOffset = pImpl->mpDefPrinter->GetPageOffset() - + pImpl->mpDefPrinter->PixelToLogic( Point() ); + pImpl->mpDefPrinter->SetMapMode( aOldMode ); + pImpl->mpDefPrinter->SetOrientation( eOldOri ); + + sal_Int64 nSetL = aLeftMarginEdit.Denormalize( + aLeftMarginEdit.GetValue( FUNIT_TWIP ) ); + sal_Int64 nSetR = aRightMarginEdit.Denormalize( + aRightMarginEdit.GetValue( FUNIT_TWIP ) ); + sal_Int64 nSetT = aTopMarginEdit.Denormalize( + aTopMarginEdit.GetValue( FUNIT_TWIP ) ); + sal_Int64 nSetB = aBottomMarginEdit.Denormalize( + aBottomMarginEdit.GetValue( FUNIT_TWIP ) ); + + long nOffset = !aPrintOffset.X() && !aPrintOffset.Y() ? 0 : PRINT_OFFSET; + long nNewL = aPrintOffset.X(); + long nNewR = + aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X() + nOffset; + long nNewT = aPrintOffset.Y(); + long nNewB = + aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y() + nOffset; + + aLeftMarginEdit.SetFirst( aLeftMarginEdit.Normalize( nNewL ), FUNIT_TWIP ); + nFirstLeftMargin = static_cast(aLeftMarginEdit.GetFirst()); + aRightMarginEdit.SetFirst( aRightMarginEdit.Normalize( nNewR ), FUNIT_TWIP ); + nFirstRightMargin = static_cast(aRightMarginEdit.GetFirst()); + aTopMarginEdit.SetFirst( aTopMarginEdit.Normalize( nNewT ), FUNIT_TWIP ); + nFirstTopMargin = static_cast(aTopMarginEdit.GetFirst()); + aBottomMarginEdit.SetFirst( aBottomMarginEdit.Normalize( nNewB ), FUNIT_TWIP ); + nFirstBottomMargin = static_cast(aBottomMarginEdit.GetFirst()); + + if ( bSet ) + { + // ggf. auch die Werte umsetzen, + if ( nSetL < nNewL ) + aLeftMarginEdit.SetValue( aLeftMarginEdit.Normalize( nNewL ), + FUNIT_TWIP ); + if ( nSetR < nNewR ) + aRightMarginEdit.SetValue( aRightMarginEdit.Normalize( nNewR ), + FUNIT_TWIP ); + if ( nSetT < nNewT ) + aTopMarginEdit.SetValue( aTopMarginEdit.Normalize( nNewT ), + FUNIT_TWIP ); + if ( nSetB < nNewB ) + aBottomMarginEdit.SetValue( aBottomMarginEdit.Normalize( nNewB ), + FUNIT_TWIP ); + } +} + +// ----------------------------------------------------------------------- + +IMPL_LINK_INLINE_START( SvxPageDescPage, BorderModify_Impl, MetricField *, EMPTYARG ) +{ + if ( !bBorderModified ) + bBorderModified = TRUE; + UpdateExample_Impl(); + return 0; +} +IMPL_LINK_INLINE_END( SvxPageDescPage, BorderModify_Impl, MetricField *, EMPTYARG ) + +// ----------------------------------------------------------------------- + +void SvxPageDescPage::UpdateExample_Impl( bool bResetbackground ) +{ + // Size + Size aSize( GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_TWIP ), + GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_TWIP ) ); + + aBspWin.SetSize( aSize ); + + // R"ander + aBspWin.SetTop( GetCoreValue( aTopMarginEdit, SFX_MAPUNIT_TWIP ) ); + aBspWin.SetBottom( GetCoreValue( aBottomMarginEdit, SFX_MAPUNIT_TWIP ) ); + aBspWin.SetLeft( GetCoreValue( aLeftMarginEdit, SFX_MAPUNIT_TWIP ) ); + aBspWin.SetRight( GetCoreValue( aRightMarginEdit, SFX_MAPUNIT_TWIP ) ); + + // Layout + aBspWin.SetUsage( PosToPageUsage_Impl( aLayoutBox.GetSelectEntryPos() ) ); + if ( bResetbackground ) + aBspWin.ResetBackground(); + aBspWin.Invalidate(); +} + +// ----------------------------------------------------------------------- + +void SvxPageDescPage::ResetBackground_Impl( const SfxItemSet& rSet ) +{ + USHORT nWhich = GetWhich( SID_ATTR_PAGE_HEADERSET ); + + if ( rSet.GetItemState( nWhich, FALSE ) == SFX_ITEM_SET ) + { + const SvxSetItem& rSetItem = + (const SvxSetItem&)rSet.Get( nWhich, FALSE ); + 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 ); + aBspWin.SetHdColor( rItem.GetColor() ); + } + nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); + + if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) + { + const SvxBoxItem& rItem = + (const SvxBoxItem&)rTmpSet.Get( nWhich ); + aBspWin.SetHdBorder( rItem ); + } + } + } + + nWhich = GetWhich( SID_ATTR_PAGE_FOOTERSET ); + + if ( rSet.GetItemState( nWhich, FALSE ) == SFX_ITEM_SET ) + { + const SvxSetItem& rSetItem = + (const SvxSetItem&)rSet.Get( nWhich, FALSE ); + 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 ); + aBspWin.SetFtColor( rItem.GetColor() ); + } + nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); + + if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) + { + const SvxBoxItem& rItem = + (const SvxBoxItem&)rTmpSet.Get( nWhich ); + aBspWin.SetFtBorder( rItem ); + } + } + } + + const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_BRUSH ); + + if ( pItem ) + { + aBspWin.SetColor( ( (const SvxBrushItem*)pItem )->GetColor() ); + const Graphic* pGrf = ( (const SvxBrushItem*)pItem )->GetGraphic(); + + if ( pGrf ) + { + Bitmap aBitmap = pGrf->GetBitmap(); + aBspWin.SetBitmap( &aBitmap ); + } + else + aBspWin.SetBitmap( NULL ); + } + + pItem = GetItem( rSet, SID_ATTR_BORDER_OUTER ); + + if ( pItem ) + aBspWin.SetBorder( (SvxBoxItem&)*pItem ); +} + +// ----------------------------------------------------------------------- + +void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet ) +{ + bLandscape = aLandscapeBtn.IsChecked(); + const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE ); + + if ( pItem ) + aBspWin.SetSize( ( (const SvxSizeItem*)pItem )->GetSize() ); + + const SvxSetItem* pSetItem = 0; + + // Kopfzeilen-Attribute auswerten + + if ( SFX_ITEM_SET == + rSet.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET ), + FALSE, (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 ) ); + long nDist = rUL.GetLower(); + aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist ); + aBspWin.SetHdDist( nDist ); + const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&) + rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) ); + aBspWin.SetHdLeft( rLR.GetLeft() ); + aBspWin.SetHdRight( rLR.GetRight() ); + aBspWin.SetHeader( TRUE ); + } + else + aBspWin.SetHeader( FALSE ); + + // im Beispiel Hintergrund und Umrandung anzeigen + USHORT nWhich = GetWhich( SID_ATTR_BRUSH ); + + if ( rHeaderSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) + { + const SvxBrushItem& rItem = + (const SvxBrushItem&)rHeaderSet.Get( nWhich ); + aBspWin.SetHdColor( rItem.GetColor() ); + } + nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); + + if ( rHeaderSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) + { + const SvxBoxItem& rItem = + (const SvxBoxItem&)rHeaderSet.Get( nWhich ); + aBspWin.SetHdBorder( rItem ); + } + } + + // Fusszeilen-Attribute auswerten + + if ( SFX_ITEM_SET == + rSet.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET ), + FALSE, (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 ) ); + long nDist = rUL.GetUpper(); + aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist ); + aBspWin.SetFtDist( nDist ); + const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&) + rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) ); + aBspWin.SetFtLeft( rLR.GetLeft() ); + aBspWin.SetFtRight( rLR.GetRight() ); + aBspWin.SetFooter( TRUE ); + } + else + aBspWin.SetFooter( FALSE ); + + // im Beispiel Hintergrund und Umrandung anzeigen + USHORT nWhich = GetWhich( SID_ATTR_BRUSH ); + + if ( rFooterSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) + { + const SvxBrushItem& rItem = + (const SvxBrushItem&)rFooterSet.Get( nWhich ); + aBspWin.SetFtColor( rItem.GetColor() ); + } + nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); + + if ( rFooterSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) + { + const SvxBoxItem& rItem = + (const SvxBoxItem&)rFooterSet.Get( nWhich ); + aBspWin.SetFtBorder( rItem ); + } + } +} + +// ----------------------------------------------------------------------- + +void SvxPageDescPage::ActivatePage( const SfxItemSet& rSet ) +{ + InitHeadFoot_Impl( rSet ); + ResetBackground_Impl( rSet ); + RangeHdl_Impl( 0 ); +} + +// ----------------------------------------------------------------------- + +int SvxPageDescPage::DeactivatePage( SfxItemSet* _pSet ) +{ + // Abfrage, ob die Seitenr"ander ausserhalb des Druckbereichs liegen + // Wenn nicht, dann den Anwender fragen, ob sie "ubernommen werden sollen. + // Wenn nicht, dann auf der TabPage bleiben. + USHORT nPos = aPaperSizeBox.GetSelectEntryPos(); + Paper ePaper = (Paper)(ULONG)aPaperSizeBox.GetEntryData( nPos ); + + if ( ePaper != PAPER_SCREEN && IsMarginOutOfRange() ) + { + if ( QueryBox( this, WB_YES_NO | WB_DEF_NO, aPrintRangeQueryText ).Execute() == RET_NO ) + { + MetricField* pField = NULL; + if ( IsPrinterRangeOverflow( aLeftMarginEdit, nFirstLeftMargin, nLastLeftMargin, MARGIN_LEFT ) ) + pField = &aLeftMarginEdit; + if ( IsPrinterRangeOverflow( aRightMarginEdit, nFirstRightMargin, nLastRightMargin, MARGIN_RIGHT ) + && !pField ) + pField = &aRightMarginEdit; + if ( IsPrinterRangeOverflow( aTopMarginEdit, nFirstTopMargin, nLastTopMargin, MARGIN_TOP ) + && !pField ) + pField = &aTopMarginEdit; + if ( IsPrinterRangeOverflow( aBottomMarginEdit, nFirstBottomMargin, nLastBottomMargin, MARGIN_BOTTOM ) + && !pField ) + pField = &aBottomMarginEdit; + if ( pField ) + pField->GrabFocus(); + UpdateExample_Impl(); + return KEEP_PAGE; + } + else + CheckMarginEdits( false ); + } + + if ( _pSet ) + { + FillItemSet( *_pSet ); + + // ggf. hoch/quer putten + USHORT nWh = GetWhich( SID_ATTR_PAGE_SIZE ); + SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWh ); + Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ), + GetCoreValue( aPaperHeightEdit, eUnit ) ); + + // putten, wenn aktuelle Gr"o/se unterschiedlich zum Wert in _pSet + const SvxSizeItem* pSize = (const SvxSizeItem*)GetItem( *_pSet, SID_ATTR_PAGE_SIZE ); + if ( aSize.Width() && ( !pSize || !IsEqualSize_Impl( pSize, aSize ) ) ) + _pSet->Put( SvxSizeItem( nWh, aSize ) ); + } + + return LEAVE_PAGE; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxPageDescPage, RangeHdl_Impl, Edit *, EMPTYARG ) +{ + // Aktuelle Header-Breite/H"ohe aus dem Bsp + long nHHeight = aBspWin.GetHdHeight(); + long nHDist = aBspWin.GetHdDist(); + + // Aktuelle Footer-Breite/H"ohe aus dem Bsp + long nFHeight = aBspWin.GetFtHeight(); + long nFDist = aBspWin.GetFtDist(); + + // Aktuelle Header/Footer-R"ander aus dem Bsp + long nHFLeft = Max( aBspWin.GetHdLeft(), aBspWin.GetFtLeft() ); + long nHFRight = Max( aBspWin.GetHdRight(), aBspWin.GetFtRight() ); + + // Aktuelle Werte der Seitenr"ander + long nBT = static_cast(aTopMarginEdit.Denormalize(aTopMarginEdit.GetValue(FUNIT_TWIP))); + long nBB = static_cast(aBottomMarginEdit.Denormalize(aBottomMarginEdit.GetValue(FUNIT_TWIP))); + long nBL = static_cast(aLeftMarginEdit.Denormalize(aLeftMarginEdit.GetValue(FUNIT_TWIP))); + long nBR = static_cast(aRightMarginEdit.Denormalize(aRightMarginEdit.GetValue(FUNIT_TWIP))); + + // Breite Umrandung der Seite berechnen + const SfxItemSet* _pSet = &GetItemSet(); + Size aBorder; + + if ( _pSet->GetItemState( GetWhich(SID_ATTR_BORDER_SHADOW) ) >= + SFX_ITEM_AVAILABLE && + _pSet->GetItemState( GetWhich(SID_ATTR_BORDER_OUTER) ) >= + SFX_ITEM_AVAILABLE ) + { + aBorder = ( GetMinBorderSpace_Impl( + (const SvxShadowItem&)_pSet->Get(GetWhich(SID_ATTR_BORDER_SHADOW)), + (const SvxBoxItem&)_pSet->Get(GetWhich(SID_ATTR_BORDER_OUTER)))); + } + + long nH = static_cast(aPaperHeightEdit.Denormalize(aPaperHeightEdit.GetValue(FUNIT_TWIP))); + long nW = static_cast(aPaperWidthEdit.Denormalize(aPaperWidthEdit.GetValue(FUNIT_TWIP))); + + // Grenzen Papier + // Maximum liegt bei 54cm + // + long nMin = nHHeight + nHDist + nFDist + nFHeight + nBT + nBB + + MINBODY + aBorder.Height(); + aPaperHeightEdit.SetMin(aPaperHeightEdit.Normalize(nMin), FUNIT_TWIP); + + nMin = MINBODY + nBL + nBR + aBorder.Width(); + aPaperWidthEdit.SetMin(aPaperWidthEdit.Normalize(nMin), FUNIT_TWIP); + + // Falls sich die Papiergr"o\se ge"adert hat + nH = static_cast(aPaperHeightEdit.Denormalize(aPaperHeightEdit.GetValue(FUNIT_TWIP))); + nW = static_cast(aPaperWidthEdit.Denormalize(aPaperWidthEdit.GetValue(FUNIT_TWIP))); + + // Top + long nMax = nH - nBB - aBorder.Height() - MINBODY - + nFDist - nFHeight - nHDist - nHHeight; + + aTopMarginEdit.SetMax(aTopMarginEdit.Normalize(nMax), FUNIT_TWIP); + + // Bottom + nMax = nH - nBT - aBorder.Height() - MINBODY - + nFDist - nFHeight - nHDist - nHHeight; + + aBottomMarginEdit.SetMax(aTopMarginEdit.Normalize(nMax), FUNIT_TWIP); + + // Left + nMax = nW - nBR - MINBODY - aBorder.Width() - nHFLeft - nHFRight; + aLeftMarginEdit.SetMax(aLeftMarginEdit.Normalize(nMax), FUNIT_TWIP); + + // Right + nMax = nW - nBL - MINBODY - aBorder.Width() - nHFLeft - nHFRight; + aRightMarginEdit.SetMax(aRightMarginEdit.Normalize(nMax), FUNIT_TWIP); + return 0; +} + +// ----------------------------------------------------------------------- + +void SvxPageDescPage::CalcMargin_Impl() +{ + // Aktuelle Werte der Seitenr"ander + long nBT = GetCoreValue( aTopMarginEdit, SFX_MAPUNIT_TWIP ); + long nBB = GetCoreValue( aBottomMarginEdit, SFX_MAPUNIT_TWIP ); + + long nBL = GetCoreValue( aLeftMarginEdit, SFX_MAPUNIT_TWIP ); + long nBR = GetCoreValue( aRightMarginEdit, SFX_MAPUNIT_TWIP ); + + long nH = GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_TWIP ); + long nW = GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_TWIP ); + + long nWidth = nBL + nBR + MINBODY; + long nHeight = nBT + nBB + MINBODY; + + if ( nWidth > nW || nHeight > nH ) + { + if ( nWidth > nW ) + { + long nTmp = nBL <= nBR ? nBR : nBL; + nTmp -= nWidth - nW; + + if ( nBL <= nBR ) + SetMetricValue( aRightMarginEdit, nTmp, SFX_MAPUNIT_TWIP ); + else + SetMetricValue( aLeftMarginEdit, nTmp, SFX_MAPUNIT_TWIP ); + } + + if ( nHeight > nH ) + { + long nTmp = nBT <= nBB ? nBB : nBT; + nTmp -= nHeight - nH; + + if ( nBT <= nBB ) + SetMetricValue( aBottomMarginEdit, nTmp, SFX_MAPUNIT_TWIP ); + else + SetMetricValue( aTopMarginEdit, nTmp, SFX_MAPUNIT_TWIP ); + } + } +} + +// ----------------------------------------------------------------------- + +IMPL_LINK_INLINE_START( SvxPageDescPage, CenterHdl_Impl, CheckBox *, EMPTYARG ) +{ + aBspWin.SetHorz( aHorzBox.IsChecked() ); + aBspWin.SetVert( aVertBox.IsChecked() ); + UpdateExample_Impl(); + return 0; +} +IMPL_LINK_INLINE_END( SvxPageDescPage, CenterHdl_Impl, CheckBox *, EMPTYARG ) + +// ----------------------------------------------------------------------- + +void SvxPageDescPage::SetCollectionList(const List* pList) +{ + sStandardRegister = *(String*)pList->GetObject(0); + for( USHORT i = 1; i < pList->Count(); i++ ) + { + aRegisterLB.InsertEntry(*(String*)pList->GetObject(i)); + } + + aRegisterCB .Show(); + aRegisterFT .Show(); + aRegisterLB.Show(); + aRegisterCB.SetClickHdl(LINK(this, SvxPageDescPage, RegisterModify)); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxPageDescPage, RegisterModify, CheckBox*, pBox ) +{ + BOOL bEnable = FALSE; + if(pBox->IsChecked()) + { + bEnable = TRUE; + if(USHRT_MAX == aRegisterLB.GetSelectEntryPos()) + aRegisterLB.SelectEntry(sStandardRegister); + } + aRegisterFT.Enable( bEnable ); + aRegisterLB.Enable( bEnable ); + return 0; +} + +// ---------------------------------------------------------------------------- + +void SvxPageDescPage::DisableVerticalPageDir() +{ + aTextFlowBox.RemoveEntryValue( FRMDIR_VERT_TOP_RIGHT ); + aTextFlowBox.RemoveEntryValue( FRMDIR_VERT_TOP_LEFT ); + if( aTextFlowBox.GetEntryCount() < 2 ) + { + aTextFlowLbl.Hide(); + aTextFlowBox.Hide(); + aBspWin.EnableFrameDirection( sal_False ); + } +} + +IMPL_LINK( SvxPageDescPage, FrameDirectionModify_Impl, ListBox*, EMPTYARG) +{ + aBspWin.SetFrameDirection( (sal_uInt32) aTextFlowBox.GetSelectEntryValue() ); + aBspWin.Invalidate(); + return 0; +} + +bool SvxPageDescPage::IsPrinterRangeOverflow( + MetricField& rField, long nFirstMargin, long nLastMargin, MarginPosition nPos ) +{ + bool bRet = false; + bool bCheck = ( ( pImpl->m_nPos & nPos ) == 0 ); + long nValue = static_cast(rField.GetValue()); + if ( bCheck && + ( nValue < nFirstMargin || nValue > nLastMargin ) && + rField.GetText() != rField.GetSavedValue() ) + { + rField.SetValue( nValue < nFirstMargin ? nFirstMargin : nLastMargin ); + bRet = true; + } + + return bRet; +} + +/** Check if a value of a margin edit is outside the printer paper margins + and save this information. +*/ +void SvxPageDescPage::CheckMarginEdits( bool _bClear ) +{ + if ( _bClear ) + pImpl->m_nPos = 0; + + sal_Int64 nValue = aLeftMarginEdit.GetValue(); + if ( nValue < nFirstLeftMargin || nValue > nLastLeftMargin ) + pImpl->m_nPos |= MARGIN_LEFT; + nValue = aRightMarginEdit.GetValue(); + if ( nValue < nFirstRightMargin || nValue > nLastRightMargin ) + pImpl->m_nPos |= MARGIN_RIGHT; + nValue = aTopMarginEdit.GetValue(); + if ( nValue < nFirstTopMargin || nValue > nLastTopMargin ) + pImpl->m_nPos |= MARGIN_TOP; + nValue = aBottomMarginEdit.GetValue(); + if ( nValue < nFirstBottomMargin || nValue > nLastBottomMargin ) + pImpl->m_nPos |= MARGIN_BOTTOM; +} + +bool SvxPageDescPage::IsMarginOutOfRange() +{ + bool bRet = ( ( ( !( pImpl->m_nPos & MARGIN_LEFT ) && + ( aLeftMarginEdit.GetText() != aLeftMarginEdit.GetSavedValue() ) ) && + ( aLeftMarginEdit.GetValue() < nFirstLeftMargin || + aLeftMarginEdit.GetValue() > nLastLeftMargin ) ) || + ( ( !( pImpl->m_nPos & MARGIN_RIGHT ) && + ( aRightMarginEdit.GetText() != aRightMarginEdit.GetSavedValue() ) ) && + ( aRightMarginEdit.GetValue() < nFirstRightMargin || + aRightMarginEdit.GetValue() > nLastRightMargin ) ) || + ( ( !( pImpl->m_nPos & MARGIN_TOP ) && + ( aTopMarginEdit.GetText() != aTopMarginEdit.GetSavedValue() ) ) && + ( aTopMarginEdit.GetValue() < nFirstTopMargin || + aTopMarginEdit.GetValue() > nLastTopMargin ) ) || + ( ( !( pImpl->m_nPos & MARGIN_BOTTOM ) && + ( aBottomMarginEdit.GetText() != aBottomMarginEdit.GetSavedValue() ) ) && + ( aBottomMarginEdit.GetValue() < nFirstBottomMargin || + aBottomMarginEdit.GetValue() > nLastBottomMargin ) ) ); + return bRet; +} + +void SvxPageDescPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 +{ + SFX_ITEMSET_ARG (&aSet,pModeItem,SfxAllEnumItem,SID_ENUM_PAGE_MODE,sal_False); + SFX_ITEMSET_ARG (&aSet,pPaperStartItem,SfxAllEnumItem,SID_PAPER_START,sal_False); + SFX_ITEMSET_ARG (&aSet,pPaperEndItem,SfxAllEnumItem,SID_PAPER_END,sal_False); + SFX_ITEMSET_ARG (&aSet,pCollectListItem,SfxStringListItem,SID_COLLECT_LIST,sal_False); + if (pModeItem) + SetMode((SvxModeType)pModeItem->GetEnumValue()); + if (pPaperStartItem && pPaperEndItem) + SetPaperFormatRanges( (Paper)pPaperStartItem->GetEnumValue(), (Paper)pPaperEndItem->GetEnumValue() ); + if (pCollectListItem) + SetCollectionList(pCollectListItem->GetList()); +} diff --git a/cui/source/tabpages/page.h b/cui/source/tabpages/page.h new file mode 100644 index 000000000000..98aefdc79cc4 --- /dev/null +++ b/cui/source/tabpages/page.h @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: page.h,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_PAGE_H +#define _SVX_PAGE_H + +// define ---------------------------------------------------------------- + +#define PAPERSIZE_A0 0 +#define PAPERSIZE_A1 1 +#define PAPERSIZE_A2 2 +#define PAPERSIZE_A3 3 +#define PAPERSIZE_A4 4 +#define PAPERSIZE_A5 5 +#define PAPERSIZE_B4_ISO 6 +#define PAPERSIZE_B5_ISO 7 +#define PAPERSIZE_LETTER 8 +#define PAPERSIZE_LEGAL 9 +#define PAPERSIZE_TABLOID 10 +#define PAPERSIZE_USER 11 +#define PAPERSIZE_B6_ISO 12 +#define PAPERSIZE_C4 13 +#define PAPERSIZE_C5 14 +#define PAPERSIZE_C6 15 +#define PAPERSIZE_C65 16 +#define PAPERSIZE_DL 17 +#define PAPERSIZE_DIA 18 +#define PAPERSIZE_SCREEN 19 +#define PAPERSIZE_C 20 +#define PAPERSIZE_D 21 +#define PAPERSIZE_E 22 +#define PAPERSIZE_EXECUTIVE 23 +#define PAPERSIZE_LEGAL2 24 +#define PAPERSIZE_MONARCH 25 +#define PAPERSIZE_COM675 26 +#define PAPERSIZE_COM9 27 +#define PAPERSIZE_COM10 28 +#define PAPERSIZE_COM11 29 +#define PAPERSIZE_COM12 30 +#define PAPERSIZE_KAI16 31 +#define PAPERSIZE_KAI32 32 +#define PAPERSIZE_KAI32BIG 33 +#define PAPERSIZE_B4_JIS 34 +#define PAPERSIZE_B5_JIS 35 +#define PAPERSIZE_B6_JIS 36 + +#endif + diff --git a/cui/source/tabpages/page.hrc b/cui/source/tabpages/page.hrc new file mode 100644 index 000000000000..bd2810a39061 --- /dev/null +++ b/cui/source/tabpages/page.hrc @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: page.hrc,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_PAGE_HRC +#define _SVX_PAGE_HRC + +// defines --------------------------------------------------------------- + +#define FT_LEFT_MARGIN 10 +#define ED_LEFT_MARGIN 11 +#define FT_RIGHT_MARGIN 12 +#define ED_RIGHT_MARGIN 13 +#define FT_TOP_MARGIN 14 +#define ED_TOP_MARGIN 15 +#define FT_BOTTOM_MARGIN 16 +#define ED_BOTTOM_MARGIN 17 +#define FL_MARGIN 18 + +#define LB_LAYOUT 20 +#define FT_PAGELAYOUT 21 + +#define LB_NUMBER_FORMAT 30 +#define FL_LAYOUT 31 +#define FT_NUMBER_FORMAT 32 + +#define FT_TEXT_FLOW 35 +#define LB_TEXT_FLOW 36 + +#define WN_BSP 40 + +#define FT_ORIENTATION 48 +#define FT_PAPER_FORMAT 49 +#define LB_PAPER_SIZE 50 +#define RB_PORTRAIT 51 +#define RB_LANDSCAPE 52 +#define FT_PAPER_WIDTH 53 +#define ED_PAPER_WIDTH 54 +#define FT_PAPER_HEIGHT 55 +#define ED_PAPER_HEIGHT 56 +#define FT_PAPER_TRAY 57 +#define LB_PAPER_TRAY 58 +#define FL_PAPER_SIZE 59 + +#define CB_REGISTER 60 +#define FT_REGISTER 61 +#define LB_REGISTER 62 +#define FL_BOTTOM_SEP 64 + +#define CB_HORZ 70 +#define CB_VERT 71 +#define CB_ADAPT 72 +#define FT_TBL_ALIGN 73 + +#define PB_BACK 80 + +#define STR_INSIDE 90 +#define STR_OUTSIDE 91 +#define STR_QUERY_PRINTRANGE 92 + +#endif + diff --git a/cui/source/tabpages/page.src b/cui/source/tabpages/page.src new file mode 100644 index 000000000000..6a44e41729a7 --- /dev/null +++ b/cui/source/tabpages/page.src @@ -0,0 +1,668 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: page.src,v $ + * $Revision: 1.71 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + // include --------------------------------------------------------------- + +#include +#include "helpid.hrc" +#include "page.hrc" +#include "page.h" + + // RID_SVXPAGE_PAGE ------------------------------------------------------ + +TabPage RID_SVXPAGE_PAGE +{ + HelpId = HID_FORMAT_PAGE ; + Hide = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedLine FL_PAPER_SIZE + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 164 , 8 ) ; + Text [ en-US ] = "Paper format" ; + }; + FixedText FT_PAPER_FORMAT + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 35 , 8 ) ; + Text [ en-US ] = "~Format"; + }; + ListBox LB_PAPER_SIZE + { + Pos = MAP_APPFONT ( 50 , 14 ) ; + Size = MAP_APPFONT ( 50 , 64 ) ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + FixedText FT_PAPER_WIDTH + { + Pos = MAP_APPFONT ( 12 , 32 ) ; + Size = MAP_APPFONT ( 35 , 8 ) ; + Text [ en-US ] = "~Width" ; + Left = TRUE ; + }; + MetricField ED_PAPER_WIDTH + { + Border = TRUE ; + Pos = MAP_APPFONT ( 50, 30 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + // #i4219# taken from congiguration now Maximum = 11900 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + // #i4219# Last = 11900 ; + SpinSize = 10 ; + }; + FixedText FT_PAPER_HEIGHT + { + Pos = MAP_APPFONT ( 12 , 48 ) ; + Size = MAP_APPFONT ( 35 , 8 ) ; + Text [ en-US ] = "~Height" ; + Left = TRUE ; + }; + MetricField ED_PAPER_HEIGHT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 50 , 46 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + // #i4219# taken from congiguration now Maximum = 11900 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + // #i4219# Last = 11900 ; + SpinSize = 10 ; + }; + FixedText FT_ORIENTATION + { + Pos = MAP_APPFONT ( 12 , 62 ) ; + Size = MAP_APPFONT ( 35 , 8 ) ; + Text [ en-US ] = "Orientation"; + }; + RadioButton RB_PORTRAIT + { + Pos = MAP_APPFONT ( 50 , 62 ) ; + Size = MAP_APPFONT ( 53 , 10 ) ; + Check = TRUE ; + Text [ en-US ] = "~Portrait" ; + }; + RadioButton RB_LANDSCAPE + { + Pos = MAP_APPFONT ( 50 , 74 ) ; + Size = MAP_APPFONT ( 53 , 10 ) ; + Text [ en-US ] = "L~andscape"; + }; + Window WN_BSP + { + Pos = MAP_APPFONT ( 176 , 6 ) ; + Size = MAP_APPFONT ( 75 , 46 ) ; + }; + + FixedText FT_TEXT_FLOW + { + Pos = MAP_APPFONT ( 113 , 60 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Left = TRUE ; + Hide = TRUE ; + Text [ en-US ] = "~Text direction"; + }; + ListBox LB_TEXT_FLOW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 165 , 58 ) ; + Size = MAP_APPFONT ( 83 , 50 ) ; + DropDown = TRUE ; + Hide = TRUE ; + }; + + FixedText FT_PAPER_TRAY + { + Pos = MAP_APPFONT ( 113 , 74 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "Paper ~tray"; + }; + ListBox LB_PAPER_TRAY + { + Pos = MAP_APPFONT ( 165 , 72 ) ; + Size = MAP_APPFONT ( 83 , 50 ) ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + FixedLine FL_MARGIN + { + Pos = MAP_APPFONT ( 6 , 90 ) ; + Size = MAP_APPFONT ( 95 , 8 ) ; + Text [ en-US ] = "Margins"; + }; + FixedText FT_LEFT_MARGIN + { + Pos = MAP_APPFONT ( 12 , 103 ) ; + Size = MAP_APPFONT ( 40 , 8 ) ; + Text [ en-US ] = "~Left" ; + Left = TRUE ; + }; + MetricField ED_LEFT_MARGIN + { + Border = TRUE ; + Pos = MAP_APPFONT ( 55 , 101 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + // #i4219# taken from congiguration now Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + // #i4219# Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_RIGHT_MARGIN + { + Pos = MAP_APPFONT ( 12 , 119 ) ; + Size = MAP_APPFONT ( 40 , 8 ) ; + Text [ en-US ] = "~Right" ; + Left = TRUE ; + }; + MetricField ED_RIGHT_MARGIN + { + Border = TRUE ; + Pos = MAP_APPFONT ( 55 , 117 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + // #i4219# taken from congiguration now Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + // #i4219# Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_TOP_MARGIN + { + Pos = MAP_APPFONT ( 12 , 135 ) ; + Size = MAP_APPFONT ( 40 , 8 ) ; + Text [ en-US ] = "~Top" ; + Left = TRUE ; + }; + MetricField ED_TOP_MARGIN + { + Border = TRUE ; + Pos = MAP_APPFONT ( 55 , 133 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + // #i4219# taken from congiguration now Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + // #i4219# Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_BOTTOM_MARGIN + { + Pos = MAP_APPFONT ( 12 , 151 ) ; + Size = MAP_APPFONT ( 40 , 8 ) ; + Text [ en-US ] = "~Bottom" ; + Left = TRUE ; + }; + MetricField ED_BOTTOM_MARGIN + { + Border = TRUE ; + Pos = MAP_APPFONT ( 55 , 149 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + // #i4219# taken from congiguration now Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + // #i4219# Last = 9999 ; + SpinSize = 10 ; + }; + FixedLine FL_BOTTOM_SEP + { + Pos = MAP_APPFONT ( 102 , 101 ) ; + Size = MAP_APPFONT ( 4 , 68 ) ; + Vert = TRUE; + }; + FixedLine FL_LAYOUT + { + Pos = MAP_APPFONT ( 107, 90 ) ; + Size = MAP_APPFONT ( 147 , 8 ) ; + Text [ en-US ] = "Layout settings"; + }; + FixedText FT_PAGELAYOUT + { + Pos = MAP_APPFONT ( 113 , 103 ) ; + Size = MAP_APPFONT ( 54 , 8 ) ; + Text [ en-US ] = "Page layout" ; + }; + ListBox LB_LAYOUT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 170, 101 ) ; + Size = MAP_APPFONT ( 78 , 44 ) ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Right and left" ; Default ; > ; + < "Mirrored" ; Default ; > ; + < "Only right" ; Default ; > ; + < "Only left" ; Default ; > ; + }; + }; + FixedText FT_NUMBER_FORMAT + { + Pos = MAP_APPFONT ( 113 , 119 ) ; + Size = MAP_APPFONT ( 54 , 8 ) ; + Text [ en-US ] = "For~mat"; + }; + ListBox LB_NUMBER_FORMAT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 170 , 117 ) ; + Size = MAP_APPFONT ( 78 , 64 ) ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "A, B, C, ..." ; Default ; > ; + < "a, b, c, ..." ; Default ; > ; + < "I, II, III, ..." ; Default ; > ; + < "i, ii, iii, ..." ; Default ; > ; + < "1, 2, 3, ..." ; Default ; > ; + < "None" ; Default ; > ; + }; + }; + FixedText FT_TBL_ALIGN + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 113 , 133 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "Table alignment"; + }; + CheckBox CB_HORZ + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 175 , 133 ) ; + Size = MAP_APPFONT ( 73 , 10 ) ; + Text [ en-US ] = "Hori~zontal" ; + }; + CheckBox CB_VERT + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 175 , 147 ) ; + Size = MAP_APPFONT ( 73 , 10 ) ; + Text [ en-US ] = "~Vertical" ; + }; + CheckBox CB_ADAPT + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 113 , 133 ) ; + Size = MAP_APPFONT ( 135 , 10 ) ; + Text [ en-US ] = "~Fit object to paper format"; + }; + /* Registerhaltigkeit (fuer SW) */ + CheckBox CB_REGISTER + { + Pos = MAP_APPFONT ( 113 , 133 ) ; + Size = MAP_APPFONT ( 135 , 10 ) ; + Hide = TRUE ; + Text [ en-US ] = "Register-true" ; + }; + FixedText FT_REGISTER + { + Pos = MAP_APPFONT ( 122 , 147 ) ; + Size = MAP_APPFONT ( 126 , 8 ) ; + Text [ en-US ] = "Reference ~Style" ; + Hide = TRUE ; + }; + ListBox LB_REGISTER + { + Pos = MAP_APPFONT ( 122 , 157 ) ; + Size = MAP_APPFONT ( 126 , 50 ) ; + DropDown = TRUE ; + Hide = TRUE ; + Sort = TRUE ; + HScroll = TRUE ; + DDExtraWidth = TRUE ; + }; + String STR_INSIDE + { + Text [ en-US ] = "I~nner" ; + }; + String STR_OUTSIDE + { + Text [ en-US ] = "O~uter" ; + }; + String STR_QUERY_PRINTRANGE + { + Text [ en-US ] = "The margin settings are out of print range.\n\nDo you still want to apply these settings?"; + }; +}; + // App-spezifische Res +String RID_SVXSTR_WRITER_PAGE +{ + Text [ en-US ] = "Continuation page" ; +}; + // Papierformate +String RID_SVXSTR_PAPER_A0 +{ + Text = "A0" ; +}; +String RID_SVXSTR_PAPER_A1 +{ + Text = "A1" ; +}; +String RID_SVXSTR_PAPER_A2 +{ + Text = "A2" ; +}; +String RID_SVXSTR_PAPER_A3 +{ + Text = "A3" ; +}; +String RID_SVXSTR_PAPER_A4 +{ + Text = "A4" ; +}; +String RID_SVXSTR_PAPER_A5 +{ + Text = "A5" ; +}; +String RID_SVXSTR_PAPER_B4_ISO +{ + Text = "B4 (ISO)" ; +}; +String RID_SVXSTR_PAPER_B5_ISO +{ + Text = "B5 (ISO)" ; +}; +String RID_SVXSTR_PAPER_LETTER +{ + Text = "Letter" ; +}; +String RID_SVXSTR_PAPER_LEGAL +{ + Text = "Legal" ; +}; +String RID_SVXSTR_PAPER_TABLOID +{ + Text = "Tabloid" ; +}; +String RID_SVXSTR_PAPER_USER +{ + Text [ en-US ] = "User Defined" ; +}; +String RID_SVXSTR_PAPER_B6_ISO +{ + Text = "B6 (ISO)" ; +}; +String RID_SVXSTR_PAPER_C4 +{ + Text = "C4 Envelope" ; +}; +String RID_SVXSTR_PAPER_C5 +{ + Text = "C5 Envelope" ; +}; +String RID_SVXSTR_PAPER_C6 +{ + Text = "C6 Envelope" ; +}; +String RID_SVXSTR_PAPER_C65 +{ + Text = "C6/5 Envelope" ; +}; +String RID_SVXSTR_PAPER_DL +{ + Text = "DL Envelope" ; +}; +String RID_SVXSTR_PAPER_DIA +{ + Text = "Dia Slide" ; +}; +String RID_SVXSTR_PAPER_SCREEN +{ + Text [ en-US ] = "Screen" ; +}; +String RID_SVXSTR_PAPER_C +{ + Text = "C" ; +}; +String RID_SVXSTR_PAPER_D +{ + Text = "D" ; +}; +String RID_SVXSTR_PAPER_E +{ + Text = "E" ; +}; +String RID_SVXSTR_PAPER_EXECUTIVE +{ + Text = "Executive" ; +}; +String RID_SVXSTR_PAPER_LEGAL2 +{ + Text = "Long Bond" ; +}; +String RID_SVXSTR_PAPER_MONARCH +{ + Text = "#8 (Monarch) Envelope" ; +}; +String RID_SVXSTR_PAPER_COM675 +{ + Text = "#6 3/4 (Personal) Envelope" ; +}; +String RID_SVXSTR_PAPER_COM9 +{ + Text = "#9 Envelope" ; +}; +String RID_SVXSTR_PAPER_COM10 +{ + Text = "#10 Envelope" ; +}; +String RID_SVXSTR_PAPER_COM11 +{ + Text = "#11 Envelope" ; +}; +String RID_SVXSTR_PAPER_COM12 +{ + Text = "#12 Envelope" ; +}; +String RID_SVXSTR_PAPER_KAI16 +{ + Text = "16 Kai" ; +}; +String RID_SVXSTR_PAPER_KAI32 +{ + Text = "32 Kai" ; +}; +String RID_SVXSTR_PAPER_KAI32BIG +{ + Text = "Big 32 Kai" ; +}; +String RID_SVXSTR_PAPER_B4_JIS +{ + Text = "B4 (JIS)" ; +}; +String RID_SVXSTR_PAPER_B5_JIS +{ + Text = "B5 (JIS)" ; +}; +String RID_SVXSTR_PAPER_B6_JIS +{ + Text = "B6 (JIS)" ; +}; +StringArray RID_SVXSTRARY_PAPERSIZE_STD +{ + ItemList [ en-US ] = + { + < "A5" ; PAPERSIZE_A5 ; > ; + < "A4" ; PAPERSIZE_A4 ; > ; + < "A3" ; PAPERSIZE_A3 ; > ; + < "B6 (ISO)" ; PAPERSIZE_B6_ISO ; > ; + < "B5 (ISO)" ; PAPERSIZE_B5_ISO ; > ; + < "B4 (ISO)" ; PAPERSIZE_B4_ISO ; > ; + < "Letter" ; PAPERSIZE_LETTER ; > ; + < "Legal" ; PAPERSIZE_LEGAL ; > ; + < "Long Bond" ; PAPERSIZE_LEGAL2 ; > ; + < "Tabloid" ; PAPERSIZE_TABLOID ; > ; + < "B6 (JIS)" ; PAPERSIZE_B6_JIS ; > ; + < "B5 (JIS)" ; PAPERSIZE_B5_JIS ; > ; + < "B4 (JIS)" ; PAPERSIZE_B4_JIS ; > ; + < "16 Kai" ; PAPERSIZE_KAI16; > ; + < "32 Kai" ; PAPERSIZE_KAI32; > ; + < "Big 32 Kai" ; PAPERSIZE_KAI32BIG; > ; + < "User" ; PAPERSIZE_USER ; > ; + < "DL Envelope" ; PAPERSIZE_DL ; > ; + < "C6 Envelope" ; PAPERSIZE_C6 ; > ; + < "C6/5 Envelope" ; PAPERSIZE_C65 ; > ; + < "C5 Envelope" ; PAPERSIZE_C5 ; > ; + < "C4 Envelope" ; PAPERSIZE_C4 ; > ; + < "#6 3/4 (Personal) Envelope" ; PAPERSIZE_COM675; > ; + < "#8 (Monarch) Envelope" ; PAPERSIZE_MONARCH; > ; + < "#9 Envelope" ; PAPERSIZE_COM9; > ; + < "#10 Envelope" ; PAPERSIZE_COM10; > ; + < "#11 Envelope" ; PAPERSIZE_COM11; > ; + < "#12 Envelope" ; PAPERSIZE_COM12; > ; + }; +}; +StringArray RID_SVXSTRARY_PAPERSIZE_DRAW +{ + ItemList [ en-US ] = + { + < "A5" ; PAPERSIZE_A5 ; > ; + < "A4" ; PAPERSIZE_A4 ; > ; + < "A3" ; PAPERSIZE_A3 ; > ; + < "A2" ; PAPERSIZE_A2 ; > ; + < "A1" ; PAPERSIZE_A1 ; > ; + < "A0" ; PAPERSIZE_A0 ; > ; + < "B6 (ISO)" ; PAPERSIZE_B6_ISO ; > ; + < "B5 (ISO)" ; PAPERSIZE_B5_ISO ; > ; + < "B4 (ISO)" ; PAPERSIZE_B4_ISO ; > ; + < "Letter" ; PAPERSIZE_LETTER ; > ; + < "Legal" ; PAPERSIZE_LEGAL ; > ; + < "Long Bond" ; PAPERSIZE_LEGAL2 ; > ; + < "Tabloid" ; PAPERSIZE_TABLOID ; > ; + < "B6 (JIS)" ; PAPERSIZE_B6_JIS ; > ; + < "B5 (JIS)" ; PAPERSIZE_B5_JIS ; > ; + < "B4 (JIS)" ; PAPERSIZE_B4_JIS ; > ; + < "16 Kai" ; PAPERSIZE_KAI16; > ; + < "32 Kai" ; PAPERSIZE_KAI32; > ; + < "Big 32 Kai" ; PAPERSIZE_KAI32BIG; > ; + < "User" ; PAPERSIZE_USER ; > ; + < "DL Envelope" ; PAPERSIZE_DL ; > ; + < "C6 Envelope" ; PAPERSIZE_C6 ; > ; + < "C6/5 Envelope" ; PAPERSIZE_C65 ; > ; + < "C5 Envelope" ; PAPERSIZE_C5 ; > ; + < "C4 Envelope" ; PAPERSIZE_C4 ; > ; + < "Dia Slide" ; PAPERSIZE_DIA ; > ; + < "Screen" ; PAPERSIZE_SCREEN ; > ; + }; +}; +String RID_SVXSTR_PAPERBIN +{ + Text [ en-US ] = "Paper tray" ; +}; +String RID_SVXSTR_PAPERBIN_SETTINGS +{ + Text [ en-US ] = "[From printer settings]" ; +}; + // ********************************************************************** EOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx new file mode 100644 index 000000000000..40920fa38c97 --- /dev/null +++ b/cui/source/tabpages/paragrph.cxx @@ -0,0 +1,2374 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: paragrph.cxx,v $ + * $Revision: 1.54 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +#include +#include +#include +#include +#include + +#define _SVX_PARAGRPH_CXX 0 + +#include +#include +#include +#include "paragrph.hrc" +#include "paragrph.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "svx/dlgutil.hxx" +#include +#include "svx/htmlmode.hxx" +#include +#include //add CHINA001 +#include //add CHINA001 +#include //add CHINA001 + +// static ---------------------------------------------------------------- + +static USHORT pStdRanges[] = +{ + SID_ATTR_PARA_LINESPACE, // 10033 + SID_ATTR_PARA_LINESPACE, + SID_ATTR_LRSPACE, // 10048 - + SID_ATTR_ULSPACE, // 10049 + SID_ATTR_PARA_REGISTER, // 10413 + SID_ATTR_PARA_REGISTER, + 0 +}; + +static USHORT pAlignRanges[] = +{ + SID_ATTR_PARA_ADJUST, // 10027 + SID_ATTR_PARA_ADJUST, + 0 +}; + +static USHORT pExtRanges[] = +{ + SID_ATTR_PARA_PAGEBREAK, // 10037 - + SID_ATTR_PARA_WIDOWS, // 10041 + SID_ATTR_PARA_MODEL, // 10065 - + SID_ATTR_PARA_KEEP, // 10066 + 0 +}; + +// define ---------------------------------------------------------------- + +#define MAX_DURCH 5670 // 10 cm ist sinnvoll als maximaler Durchschuss + // laut BP +#define FIX_DIST_DEF 283 // Standard-Fix-Abstand 0,5cm + +// enum ------------------------------------------------------------------ + +enum LineSpaceList +{ + LLINESPACE_1 = 0, + LLINESPACE_15 = 1, + LLINESPACE_2 = 2, + LLINESPACE_PROP = 3, + LLINESPACE_MIN = 4, + LLINESPACE_DURCH= 5, + LLINESPACE_FIX = 6, + LLINESPACE_END +}; + +// C-Funktion ------------------------------------------------------------ + +void SetLineSpace_Impl( SvxLineSpacingItem&, int, long lValue = 0 ); + +void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace, + int eSpace, long lValue ) +{ + switch ( eSpace ) + { + case LLINESPACE_1: + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; + rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; + break; + + case LLINESPACE_15: + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; + rLineSpace.SetPropLineSpace( 150 ); + break; + + case LLINESPACE_2: + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; + rLineSpace.SetPropLineSpace( 200 ); + break; + + case LLINESPACE_PROP: + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; + rLineSpace.SetPropLineSpace( (BYTE)lValue ); + break; + + case LLINESPACE_MIN: + rLineSpace.SetLineHeight( (USHORT)lValue ); + rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; + break; + + case LLINESPACE_DURCH: + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; + rLineSpace.SetInterLineSpace( (USHORT)lValue ); + break; + + case LLINESPACE_FIX: + rLineSpace.SetLineHeight((USHORT)lValue); + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_FIX; + rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; + break; + } +} + + +USHORT GetHtmlMode_Impl(const SfxItemSet& rSet) +{ + USHORT nHtmlMode = 0; + const SfxPoolItem* pItem = 0; + SfxObjectShell* pShell; + if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem) || + ( 0 != (pShell = SfxObjectShell::Current()) && + 0 != (pItem = pShell->GetItem(SID_HTML_MODE)))) + { + nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue(); + } + return nHtmlMode; + +} + +// class SvxStdParagraphTabPage ------------------------------------------ + +IMPL_LINK( SvxStdParagraphTabPage, ELRLoseFocusHdl, Edit *, EMPTYARG ) +{ +//! if ( aLeftIndent.IsRelativeMode() ) +//! return 0; //!!! + + SfxItemPool* pPool = GetItemSet().GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + FieldUnit eUnit = + MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) ); + + sal_Int64 nL = aLeftIndent.Denormalize( aLeftIndent.GetValue( eUnit ) ); + sal_Int64 nR = aRightIndent.Denormalize( aRightIndent.GetValue( eUnit ) ); + String aTmp = aFLineIndent.GetText(); + + // Erstzeilen Einzug + if( aLeftIndent.GetMin() < 0 ) + aFLineIndent.SetMin( -99999, FUNIT_MM ); + else + aFLineIndent.SetMin( aFLineIndent.Normalize( -nL ), eUnit ); + + // Check nur fuer konkrete Breite (Shell) + sal_Int64 nTmp = nWidth - nL - nR - MM50; + aFLineIndent.SetMax( aFLineIndent.Normalize( nTmp ), eUnit ); + + if ( !aTmp.Len() ) + aFLineIndent.SetEmptyFieldValue(); + // Maximum Links Rechts + aTmp = aLeftIndent.GetText(); + nTmp = nWidth - nR - MM50; + aLeftIndent.SetMax( aLeftIndent.Normalize( nTmp ), eUnit ); + + if ( !aTmp.Len() ) + aLeftIndent.SetEmptyFieldValue(); + aTmp = aRightIndent.GetText(); + nTmp = nWidth - nL - MM50; + aRightIndent.SetMax( aRightIndent.Normalize( nTmp ), eUnit ); + + if ( !aTmp.Len() ) + aRightIndent.SetEmptyFieldValue(); + return 0; +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxStdParagraphTabPage::Create( Window* pParent, + const SfxItemSet& rSet) +{ + return new SvxStdParagraphTabPage( pParent, rSet ); +} + +// ----------------------------------------------------------------------- + +BOOL SvxStdParagraphTabPage::FillItemSet( SfxItemSet& rOutSet ) +{ + SfxItemState eState = SFX_ITEM_UNKNOWN; + const SfxPoolItem* pOld = 0; + SfxItemPool* pPool = rOutSet.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + + BOOL bModified = FALSE; + USHORT nWhich; + USHORT nPos = aLineDist.GetSelectEntryPos(); + + if ( LISTBOX_ENTRY_NOTFOUND != nPos && + ( nPos != aLineDist.GetSavedValue() || + aLineDistAtPercentBox.IsValueModified() || + aLineDistAtMetricBox.IsValueModified() ) ) + { + nWhich = GetWhich( SID_ATTR_PARA_LINESPACE ); + SfxMapUnit eUnit = pPool->GetMetric( nWhich ); + SvxLineSpacingItem aSpacing( + (const SvxLineSpacingItem&)GetItemSet().Get( nWhich ) ); + + switch ( nPos ) + { + case LLINESPACE_1: + case LLINESPACE_15: + case LLINESPACE_2: + SetLineSpace_Impl( aSpacing, nPos ); + break; + + case LLINESPACE_PROP: + SetLineSpace_Impl( aSpacing, nPos, + static_cast(aLineDistAtPercentBox.Denormalize( + aLineDistAtPercentBox.GetValue() )) ); + break; + + case LLINESPACE_MIN: + case LLINESPACE_DURCH: + case LLINESPACE_FIX: + SetLineSpace_Impl( aSpacing, nPos, + GetCoreValue( aLineDistAtMetricBox, eUnit ) ); + break; + + default: + DBG_ERROR( "unbekannter Type fuer Zeilenabstand." ); + break; + } + eState = GetItemSet().GetItemState( nWhich ); + pOld = GetOldItem( rOutSet, SID_ATTR_PARA_LINESPACE ); + + if ( !pOld || !( *(const SvxLineSpacingItem*)pOld == aSpacing ) || + SFX_ITEM_DONTCARE == eState ) + { + rOutSet.Put( aSpacing ); + bModified |= TRUE; + } + } + + if ( aTopDist.IsValueModified() || aBottomDist.IsValueModified() ) + { + nWhich = GetWhich( SID_ATTR_ULSPACE ); + SfxMapUnit eUnit = pPool->GetMetric( nWhich ); + pOld = GetOldItem( rOutSet, SID_ATTR_ULSPACE ); + SvxULSpaceItem aMargin( nWhich ); + + if ( bRelativeMode ) + { + DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" ); + + const SvxULSpaceItem& rOldItem = + (const SvxULSpaceItem&)GetItemSet().GetParent()->Get( nWhich ); + + if ( aTopDist.IsRelative() ) + aMargin.SetUpper( rOldItem.GetUpper(), + (USHORT)aTopDist.GetValue() ); + else + aMargin.SetUpper( (USHORT)GetCoreValue( aTopDist, eUnit ) ); + + if ( aBottomDist.IsRelative() ) + aMargin.SetLower( rOldItem.GetLower(), + (USHORT)aBottomDist.GetValue() ); + else + aMargin.SetLower( (USHORT)GetCoreValue( aBottomDist, eUnit ) ); + + } + else + { + aMargin.SetUpper( (USHORT)GetCoreValue( aTopDist, eUnit ) ); + aMargin.SetLower( (USHORT)GetCoreValue( aBottomDist, eUnit ) ); + } + eState = GetItemSet().GetItemState( nWhich ); + + if ( !pOld || !( *(const SvxULSpaceItem*)pOld == aMargin ) || + SFX_ITEM_DONTCARE == eState ) + { + rOutSet.Put( aMargin ); + bModified |= TRUE; + } + } + FASTBOOL bNullTab = FALSE; + + if ( aLeftIndent.IsValueModified() || + aFLineIndent.IsValueModified() || + aRightIndent.IsValueModified() + || aAutoCB.GetSavedValue() != aAutoCB.IsChecked() ) + { + nWhich = GetWhich( SID_ATTR_LRSPACE ); + SfxMapUnit eUnit = pPool->GetMetric( nWhich ); + SvxLRSpaceItem aMargin( nWhich ); + pOld = GetOldItem( rOutSet, SID_ATTR_LRSPACE ); + + if ( bRelativeMode ) + { + DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" ); + + const SvxLRSpaceItem& rOldItem = + (const SvxLRSpaceItem&)GetItemSet().GetParent()->Get( nWhich ); + + if ( aLeftIndent.IsRelative() ) + aMargin.SetTxtLeft( rOldItem.GetTxtLeft(), + (USHORT)aLeftIndent.GetValue() ); + else + aMargin.SetTxtLeft( GetCoreValue( aLeftIndent, eUnit ) ); + + if ( aRightIndent.IsRelative() ) + aMargin.SetRight( rOldItem.GetRight(), + (USHORT)aRightIndent.GetValue() ); + else + aMargin.SetRight( GetCoreValue( aRightIndent, eUnit ) ); + + if ( aFLineIndent.IsRelative() ) + aMargin.SetTxtFirstLineOfst( rOldItem.GetTxtFirstLineOfst(), + (USHORT)aFLineIndent.GetValue() ); + else + aMargin.SetTxtFirstLineOfst( + (USHORT)GetCoreValue( aFLineIndent, eUnit ) ); + } + else + { + aMargin.SetTxtLeft( GetCoreValue( aLeftIndent, eUnit ) ); + aMargin.SetRight( GetCoreValue( aRightIndent, eUnit ) ); + aMargin.SetTxtFirstLineOfst( + (USHORT)GetCoreValue( aFLineIndent, eUnit ) ); + } + aMargin.SetAutoFirst(aAutoCB.IsChecked()); + if ( aMargin.GetTxtFirstLineOfst() < 0 ) + bNullTab = TRUE; + eState = GetItemSet().GetItemState( nWhich ); + + if ( !pOld || !( *(const SvxLRSpaceItem*)pOld == aMargin ) || + SFX_ITEM_DONTCARE == eState ) + { + rOutSet.Put( aMargin ); + bModified |= TRUE; + } + } + + if ( bNullTab ) + { + MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) ); + if ( MAP_100TH_MM != eUnit ) + { + + // negativer Erstzeileneinzug -> ggf. Null Default-Tabstop setzen + USHORT _nWhich = GetWhich( SID_ATTR_TABSTOP ); + const SfxItemSet& rInSet = GetItemSet(); + + if ( rInSet.GetItemState( _nWhich ) >= SFX_ITEM_AVAILABLE ) + { + const SvxTabStopItem& rTabItem = + (const SvxTabStopItem&)rInSet.Get( _nWhich ); + SvxTabStopItem aNullTab( rTabItem ); + SvxTabStop aNull( 0, SVX_TAB_ADJUST_DEFAULT ); + aNullTab.Insert( aNull ); + rOutSet.Put( aNullTab ); + } + } + } + if( aRegisterCB.IsVisible()) + { + const SfxBoolItem* pBoolItem = (SfxBoolItem*)GetOldItem( + rOutSet, SID_ATTR_PARA_REGISTER); + SfxBoolItem* pRegItem = (SfxBoolItem*)pBoolItem->Clone(); + USHORT _nWhich = GetWhich( SID_ATTR_PARA_REGISTER ); + BOOL bSet = pRegItem->GetValue(); + + if(aRegisterCB.IsChecked() != bSet ) + { + pRegItem->SetValue(!bSet); + rOutSet.Put(*pRegItem); + bModified |= TRUE; + } + else if ( SFX_ITEM_DEFAULT == GetItemSet().GetItemState( _nWhich, FALSE ) ) + rOutSet.ClearItem(_nWhich); + delete pRegItem; + } + + return bModified; +} + +// ----------------------------------------------------------------------- + +void SvxStdParagraphTabPage::Reset( const SfxItemSet& rSet ) +{ + SfxItemPool* pPool = rSet.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool?" ); + String aEmpty; + + // Metrik einstellen + FieldUnit eFUnit = GetModuleFieldUnit( &rSet ); + SetFieldUnit( aLeftIndent, eFUnit ); + SetFieldUnit( aRightIndent, eFUnit ); + SetFieldUnit( aFLineIndent, eFUnit ); + SetFieldUnit( aTopDist, eFUnit ); + SetFieldUnit( aBottomDist, eFUnit ); + SetFieldUnit( aLineDistAtMetricBox, eFUnit ); + + USHORT _nWhich = GetWhich( SID_ATTR_LRSPACE ); + SfxItemState eItemState = rSet.GetItemState( _nWhich ); + + if ( eItemState >= SFX_ITEM_AVAILABLE ) + { + SfxMapUnit eUnit = pPool->GetMetric( _nWhich ); + + if ( bRelativeMode ) + { + const SvxLRSpaceItem& rOldItem = + (const SvxLRSpaceItem&)rSet.Get( _nWhich ); + + if ( rOldItem.GetPropLeft() != 100 ) + { + aLeftIndent.SetRelative( TRUE ); + aLeftIndent.SetValue( rOldItem.GetPropLeft() ); + } + else + { + aLeftIndent.SetRelative(); + SetFieldUnit( aLeftIndent, eFUnit ); + SetMetricValue( aLeftIndent, rOldItem.GetTxtLeft(), eUnit ); + } + + if ( rOldItem.GetPropRight() != 100 ) + { + aRightIndent.SetRelative( TRUE ); + aRightIndent.SetValue( rOldItem.GetPropRight() ); + } + else + { + aRightIndent.SetRelative(); + SetFieldUnit( aRightIndent, eFUnit ); + SetMetricValue( aRightIndent, rOldItem.GetRight(), eUnit ); + } + + if ( rOldItem.GetPropTxtFirstLineOfst() != 100 ) + { + aFLineIndent.SetRelative( TRUE ); + aFLineIndent.SetValue( rOldItem.GetPropTxtFirstLineOfst() ); + } + else + { + aFLineIndent.SetRelative(); + aFLineIndent.SetMin(-9999); + SetFieldUnit( aFLineIndent, eFUnit ); + SetMetricValue( aFLineIndent, rOldItem.GetTxtFirstLineOfst(), + eUnit ); + } + aAutoCB.Check(rOldItem.IsAutoFirst()); + } + else + { + const SvxLRSpaceItem& rSpace = + (const SvxLRSpaceItem&)rSet.Get( _nWhich ); + + SetMetricValue( aLeftIndent, rSpace.GetTxtLeft(), eUnit ); + SetMetricValue( aRightIndent, rSpace.GetRight(), eUnit ); + SetMetricValue( aFLineIndent, rSpace.GetTxtFirstLineOfst(), eUnit ); + aAutoCB.Check(rSpace.IsAutoFirst()); + } + AutoHdl_Impl(&aAutoCB); + } + else + { + aLeftIndent.SetEmptyFieldValue(); + aRightIndent.SetEmptyFieldValue(); + aFLineIndent.SetEmptyFieldValue(); + } + + _nWhich = GetWhich( SID_ATTR_ULSPACE ); + eItemState = rSet.GetItemState( _nWhich ); + + if ( eItemState >= SFX_ITEM_AVAILABLE ) + { + SfxMapUnit eUnit = pPool->GetMetric( _nWhich ); + + if ( bRelativeMode ) + { + const SvxULSpaceItem& rOldItem = + (const SvxULSpaceItem&)rSet.Get( _nWhich ); + + if ( rOldItem.GetPropUpper() != 100 ) + { + aTopDist.SetRelative( TRUE ); + aTopDist.SetValue( rOldItem.GetPropUpper() ); + } + else + { + aTopDist.SetRelative(); + SetFieldUnit( aTopDist, eFUnit ); + SetMetricValue( aTopDist, rOldItem.GetUpper(), eUnit ); + } + + if ( rOldItem.GetPropLower() != 100 ) + { + aBottomDist.SetRelative( TRUE ); + aBottomDist.SetValue( rOldItem.GetPropLower() ); + } + else + { + aBottomDist.SetRelative(); + SetFieldUnit( aBottomDist, eFUnit ); + SetMetricValue( aBottomDist, rOldItem.GetLower(), eUnit ); + } + } + else + { + const SvxULSpaceItem& rTopMargin = + (const SvxULSpaceItem&)rSet.Get( _nWhich ); + SetMetricValue( aTopDist, rTopMargin.GetUpper(), eUnit ); + SetMetricValue( aBottomDist, rTopMargin.GetLower(), eUnit ); + } + } + else + { + aTopDist.SetEmptyFieldValue(); + aBottomDist.SetEmptyFieldValue(); + } + + _nWhich = GetWhich( SID_ATTR_PARA_LINESPACE ); + eItemState = rSet.GetItemState( _nWhich ); + + if ( eItemState >= SFX_ITEM_AVAILABLE ) + SetLineSpacing_Impl( (const SvxLineSpacingItem &)rSet.Get( _nWhich ) ); + else + aLineDist.SetNoSelection(); + + + _nWhich = GetWhich( SID_ATTR_PARA_REGISTER ); + eItemState = rSet.GetItemState( _nWhich ); + + if ( eItemState >= SFX_ITEM_AVAILABLE ) + aRegisterCB.Check( ((const SfxBoolItem &)rSet.Get( _nWhich )).GetValue()); + aRegisterCB.SaveValue(); + USHORT nHtmlMode = GetHtmlMode_Impl(rSet); + if(nHtmlMode & HTMLMODE_ON) + { + aRegisterCB.Hide(); + aRegisterFL.Hide(); + aAutoCB.Hide(); + if(!(nHtmlMode & HTMLMODE_SOME_STYLES)) // IE oder SW + { + aRightLabel.Disable(); + aRightIndent.Disable(); + aTopDist.Disable(); //HTML3.2 und NS 3.0 + aBottomDist.Disable(); + if(!(nHtmlMode & HTMLMODE_FIRSTLINE)) //NS 3.0 + { + aFLineIndent.Disable(); + aFLineLabel.Disable(); + } + } + } + + ELRLoseFocusHdl( NULL ); + aAutoCB.SaveValue(); + aLineDist.SaveValue(); +} + +// ----------------------------------------------------------------------- + +void SvxStdParagraphTabPage::EnableRelativeMode() +{ + DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" ); + + aLeftIndent.EnableRelativeMode( 0, 999 ); + aFLineIndent.EnableRelativeMode( 0, 999 ); + aRightIndent.EnableRelativeMode( 0, 999 ); + aTopDist.EnableRelativeMode( 0, 999 ); + aBottomDist.EnableRelativeMode( 0, 999 ); + bRelativeMode = TRUE; +} + +// ----------------------------------------------------------------------- + +int SvxStdParagraphTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + ELRLoseFocusHdl( NULL ); + + if ( _pSet ) + FillItemSet( *_pSet ); + return LEAVE_PAGE; +} + +// ----------------------------------------------------------------------- + +SvxStdParagraphTabPage::SvxStdParagraphTabPage( Window* pParent, + const SfxItemSet& rAttr ) : + + SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_STD_PARAGRAPH ), rAttr ), + + aLeftLabel ( this, SVX_RES( FT_LEFTINDENT ) ), + aLeftIndent ( this, SVX_RES( ED_LEFTINDENT ) ), + aRightLabel ( this, SVX_RES( FT_RIGHTINDENT ) ), + aRightIndent ( this, SVX_RES( ED_RIGHTINDENT ) ), + + aFLineLabel ( this, SVX_RES( FT_FLINEINDENT ) ), + aFLineIndent ( this, SVX_RES( ED_FLINEINDENT ) ), + aAutoCB ( this, SVX_RES( CB_AUTO ) ), + aIndentFrm ( this, SVX_RES( FL_INDENT ) ), + aTopLabel ( this, SVX_RES( FT_TOPDIST ) ), + aTopDist ( this, SVX_RES( ED_TOPDIST ) ), + aBottomLabel ( this, SVX_RES( FT_BOTTOMDIST ) ), + aBottomDist ( this, SVX_RES( ED_BOTTOMDIST ) ), + aDistFrm ( this, SVX_RES( FL_DIST ) ), + aLineDist ( this, SVX_RES( LB_LINEDIST ) ), + aLineDistAtLabel ( this, SVX_RES( FT_LINEDIST ) ), + aLineDistAtPercentBox ( this, SVX_RES( ED_LINEDISTPERCENT ) ), + aLineDistAtMetricBox ( this, SVX_RES( ED_LINEDISTMETRIC ) ), + aLineDistFrm ( this, SVX_RES( FL_LINEDIST ) ), + sAbsDist ( SVX_RES(ST_LINEDIST_ABS) ), + aExampleWin ( this, SVX_RES( WN_EXAMPLE ) ), + aRegisterCB ( this, SVX_RES( CB_REGISTER ) ), + aRegisterFL ( this, SVX_RES( FL_REGISTER ) ), + pActLineDistFld ( &aLineDistAtPercentBox ), + nAbst ( MAX_DURCH ), + nWidth ( 11905 /*567 * 50*/ ), + nMinFixDist(0L), + + bRelativeMode ( FALSE ), + bNegativeIndents(FALSE) + +{ + // diese Page braucht ExchangeSupport + SetExchangeSupport(); + + aLineDistAtMetricBox.Hide(); + FreeResource(); + Init_Impl(); + aFLineIndent.SetMin(-9999); // wird default auf 0 gesetzt +} + + +// ----------------------------------------------------------------------- + +void SvxStdParagraphTabPage::EnableNegativeMode() +{ + aLeftIndent.SetMin(-9999); + aRightIndent.SetMin(-9999); + aRightIndent.EnableNegativeMode(); + aLeftIndent.EnableNegativeMode(); + bNegativeIndents = TRUE; +} + +// ----------------------------------------------------------------------- + +USHORT* SvxStdParagraphTabPage::GetRanges() +{ + return pStdRanges; +} + +// ----------------------------------------------------------------------- + +void SvxStdParagraphTabPage::SetLineSpacing_Impl +( + const SvxLineSpacingItem &rAttr +) +{ + SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( rAttr.Which() ); + + switch( rAttr.GetLineSpaceRule() ) + { + case SVX_LINE_SPACE_AUTO: + { + SvxInterLineSpace eInter = rAttr.GetInterLineSpaceRule(); + + switch( eInter ) + { + // Default einzeilig + case SVX_INTER_LINE_SPACE_OFF: + aLineDist.SelectEntryPos( LLINESPACE_1 ); + break; + + // Default einzeilig + case SVX_INTER_LINE_SPACE_PROP: + if ( 100 == rAttr.GetPropLineSpace() ) + { + aLineDist.SelectEntryPos( LLINESPACE_1 ); + break; + } + // 1.5zeilig + if ( 150 == rAttr.GetPropLineSpace() ) + { + aLineDist.SelectEntryPos( LLINESPACE_15 ); + break; + } + // 2zeilig + if ( 200 == rAttr.GetPropLineSpace() ) + { + aLineDist.SelectEntryPos( LLINESPACE_2 ); + break; + } + // eingestellter Prozentwert + aLineDistAtPercentBox. + SetValue( aLineDistAtPercentBox.Normalize( + rAttr.GetPropLineSpace() ) ); + aLineDist.SelectEntryPos( LLINESPACE_PROP ); + break; + + case SVX_INTER_LINE_SPACE_FIX: + SetMetricValue( aLineDistAtMetricBox, + rAttr.GetInterLineSpace(), eUnit ); + aLineDist.SelectEntryPos( LLINESPACE_DURCH ); + break; + default: ;//prevent warning + } + } + break; + case SVX_LINE_SPACE_FIX: + SetMetricValue(aLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit); + aLineDist.SelectEntryPos( LLINESPACE_FIX ); + break; + + case SVX_LINE_SPACE_MIN: + SetMetricValue(aLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit); + aLineDist.SelectEntryPos( LLINESPACE_MIN ); + break; + default: ;//prevent warning + } + LineDistHdl_Impl( &aLineDist ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxStdParagraphTabPage, LineDistHdl_Impl, ListBox *, pBox ) +{ + switch( pBox->GetSelectEntryPos() ) + { + case LLINESPACE_1: + case LLINESPACE_15: + case LLINESPACE_2: + aLineDistAtLabel.Enable(FALSE); + pActLineDistFld->Enable(FALSE); + pActLineDistFld->SetText( String() ); + break; + + case LLINESPACE_DURCH: + // Setzen eines sinnvollen Defaults? + // MS Begrenzen min(10, aPageSize) + aLineDistAtPercentBox.Hide(); + pActLineDistFld = &aLineDistAtMetricBox; + aLineDistAtMetricBox.SetMin(0); + + + if ( !aLineDistAtMetricBox.GetText().Len() ) + aLineDistAtMetricBox.SetValue( + aLineDistAtMetricBox.Normalize( 1 ) ); + aLineDistAtPercentBox.Hide(); + pActLineDistFld->Show(); + pActLineDistFld->Enable(); + aLineDistAtLabel.Enable(); + break; + + case LLINESPACE_MIN: + aLineDistAtPercentBox.Hide(); + pActLineDistFld = &aLineDistAtMetricBox; + aLineDistAtMetricBox.SetMin(0); + + if ( !aLineDistAtMetricBox.GetText().Len() ) + aLineDistAtMetricBox.SetValue( + aLineDistAtMetricBox.Normalize( 10 ), FUNIT_TWIP ); + aLineDistAtPercentBox.Hide(); + pActLineDistFld->Show(); + pActLineDistFld->Enable(); + aLineDistAtLabel.Enable(); + break; + + case LLINESPACE_PROP: + aLineDistAtMetricBox.Hide(); + pActLineDistFld = &aLineDistAtPercentBox; + + if ( !aLineDistAtPercentBox.GetText().Len() ) + aLineDistAtPercentBox.SetValue( + aLineDistAtPercentBox.Normalize( 100 ), FUNIT_TWIP ); + aLineDistAtMetricBox.Hide(); + pActLineDistFld->Show(); + pActLineDistFld->Enable(); + aLineDistAtLabel.Enable(); + break; + case LLINESPACE_FIX: + { + aLineDistAtPercentBox.Hide(); + pActLineDistFld = &aLineDistAtMetricBox; + sal_Int64 nTemp = aLineDistAtMetricBox.GetValue(); + aLineDistAtMetricBox.SetMin(aLineDistAtMetricBox.Normalize(nMinFixDist), FUNIT_TWIP); + + // wurde der Wert beim SetMin veraendert, dann ist es Zeit + // fuer den default + if ( aLineDistAtMetricBox.GetValue() != nTemp ) + SetMetricValue( aLineDistAtMetricBox, + FIX_DIST_DEF, SFX_MAPUNIT_TWIP ); // fix gibt's nur im Writer + aLineDistAtPercentBox.Hide(); + pActLineDistFld->Show(); + pActLineDistFld->Enable(); + aLineDistAtLabel.Enable(); + } + break; + } + UpdateExample_Impl( TRUE ); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK_INLINE_START( SvxStdParagraphTabPage, ModifyHdl_Impl, SvxRelativeField *, EMPTYARG ) +{ + UpdateExample_Impl(); + return 0; +} +IMPL_LINK_INLINE_END( SvxStdParagraphTabPage, ModifyHdl_Impl, SvxRelativeField *, EMPTYARG ) + +// ----------------------------------------------------------------------- + +void SvxStdParagraphTabPage::Init_Impl() +{ + aLineDist.SetSelectHdl( + LINK( this, SvxStdParagraphTabPage, LineDistHdl_Impl ) ); + + Link aLink = LINK( this, SvxStdParagraphTabPage, ELRLoseFocusHdl ); + aFLineIndent.SetLoseFocusHdl( aLink ); + aLeftIndent.SetLoseFocusHdl( aLink ); + aRightIndent.SetLoseFocusHdl( aLink ); + + aLink = LINK( this, SvxStdParagraphTabPage, ModifyHdl_Impl ); + aFLineIndent.SetModifyHdl( aLink ); + aLeftIndent.SetModifyHdl( aLink ); + aRightIndent.SetModifyHdl( aLink ); + aTopDist.SetModifyHdl( aLink ); + aBottomDist.SetModifyHdl( aLink ); + + aAutoCB.SetClickHdl( LINK( this, SvxStdParagraphTabPage, AutoHdl_Impl )); + SfxItemPool* pPool = GetItemSet().GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + FieldUnit eUnit = + MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) ); + + aTopDist.SetMax( aTopDist.Normalize( nAbst ), eUnit ); + aBottomDist.SetMax( aBottomDist.Normalize( nAbst ), eUnit ); + aLineDistAtMetricBox.SetMax( + aLineDistAtMetricBox.Normalize( nAbst ), eUnit ); +} + +// ----------------------------------------------------------------------- + +void SvxStdParagraphTabPage::UpdateExample_Impl( BOOL bAll ) +{ + aExampleWin.SetFirstLineOfst( + (short)aFLineIndent.Denormalize( aFLineIndent.GetValue( FUNIT_TWIP ) ) ); + aExampleWin.SetLeftMargin( + static_cast(aLeftIndent.Denormalize( aLeftIndent.GetValue( FUNIT_TWIP ) ) ) ); + aExampleWin.SetRightMargin( + static_cast(aRightIndent.Denormalize( aRightIndent.GetValue( FUNIT_TWIP ) ) ) ); + aExampleWin.SetUpper( + (USHORT)aTopDist.Denormalize( aTopDist.GetValue( FUNIT_TWIP ) ) ); + aExampleWin.SetLower( + (USHORT)aBottomDist.Denormalize( aBottomDist.GetValue( FUNIT_TWIP ) ) ); + + + + USHORT nPos = aLineDist.GetSelectEntryPos(); + + switch ( nPos ) + { + case LLINESPACE_1: + case LLINESPACE_15: + case LLINESPACE_2: + aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos ); + break; + + case LLINESPACE_PROP: + aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos, + (USHORT)aLineDistAtPercentBox.Denormalize( + aLineDistAtPercentBox.GetValue() ) ); + break; + + case LLINESPACE_MIN: + case LLINESPACE_DURCH: + case LLINESPACE_FIX: + aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos, + (USHORT)GetCoreValue( aLineDistAtMetricBox, SFX_MAPUNIT_TWIP ) ); + break; + } + aExampleWin.Draw( bAll ); +} + +// ----------------------------------------------------------------------- + +void SvxStdParagraphTabPage::EnableRegisterMode() +{ + aRegisterCB.Show(); + aRegisterFL.Show(); +} + +/*-----------------16.01.97 19.54------------------- + +--------------------------------------------------*/ +IMPL_LINK( SvxStdParagraphTabPage, AutoHdl_Impl, CheckBox*, pBox ) +{ + BOOL bEnable = !pBox->IsChecked(); + aFLineLabel .Enable(bEnable); + aFLineIndent.Enable(bEnable); + return 0; +} + +/*-----------------16.01.97 18.00------------------- + +--------------------------------------------------*/ +void SvxStdParagraphTabPage::SetPageWidth( USHORT nPageWidth ) +{ + nWidth = nPageWidth; +} +/*-----------------16.01.97 18.01------------------- + +--------------------------------------------------*/ +void SvxStdParagraphTabPage::SetMaxDistance( USHORT nMaxDist ) +{ + nAbst = nMaxDist; +} + +/*-----------------17.01.97 08.11------------------- + +--------------------------------------------------*/ +void SvxStdParagraphTabPage::EnableAutoFirstLine() +{ + aAutoCB.Show(); +} + +/*-----------------11.06.97 11.48------------------- + absoluter Zeilenabstand +--------------------------------------------------*/ +void SvxStdParagraphTabPage::EnableAbsLineDist(long nMinTwip) +{ + aLineDist.InsertEntry(sAbsDist); + nMinFixDist = nMinTwip; +} + +//addd CHINA001 begin +void SvxStdParagraphTabPage::PageCreated(SfxAllItemSet aSet) +{ + +/* CHINA001 different bit represent call to different method of SvxStdParagraphTabPage + 0x0001 --->EnableRelativeMode() + 0x0002 --->EnableRegisterMode() + 0x0004 --->EnableAutoFirstLine() + 0x0008 --->EnableNegativeMode() + + + */ + SFX_ITEMSET_ARG (&aSet,pPageWidthItem,SfxUInt16Item,SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,sal_False); + SFX_ITEMSET_ARG (&aSet,pFlagSetItem,SfxUInt32Item,SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,sal_False); + SFX_ITEMSET_ARG (&aSet,pLineDistItem,SfxUInt32Item,SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,sal_False); + + if (pPageWidthItem) + SetPageWidth(pPageWidthItem->GetValue()); + + if (pFlagSetItem ) + if (( 0x0001 & pFlagSetItem->GetValue())== 0x0001 ) + EnableRelativeMode(); + + if (pFlagSetItem) + if (( 0x0002 & pFlagSetItem->GetValue())== 0x0002 ) + EnableRegisterMode(); + + if (pFlagSetItem) + if ( ( 0x0004 & pFlagSetItem->GetValue())== 0x0004 ) + EnableAutoFirstLine(); + + if(pLineDistItem) + EnableAbsLineDist(pLineDistItem->GetValue()); + + if (pFlagSetItem) + if (( 0x0008 & pFlagSetItem->GetValue()) == 0x0008 ) + EnableNegativeMode(); + +} +//end of CHINA001 + +#define LASTLINEPOS_DEFAULT 0 +#define LASTLINEPOS_LEFT 1 + +#define LASTLINECOUNT_OLD 3 +#define LASTLINECOUNT_NEW 4 + +// class SvxParaAlignTabPage ------------------------------------------------ + +/*-----------------16.01.97 19.34------------------- + +--------------------------------------------------*/ +SvxParaAlignTabPage::SvxParaAlignTabPage( Window* pParent, const SfxItemSet& rSet ) + : SfxTabPage(pParent, SVX_RES( RID_SVXPAGE_ALIGN_PARAGRAPH ),rSet), + aAlignFrm ( this, SVX_RES( FL_ALIGN ) ), + aLeft ( this, SVX_RES( BTN_LEFTALIGN ) ), + aRight ( this, SVX_RES( BTN_RIGHTALIGN ) ), + aCenter ( this, SVX_RES( BTN_CENTERALIGN ) ), + aJustify ( this, SVX_RES( BTN_JUSTIFYALIGN ) ), + aLastLineFT ( this, SVX_RES( FT_LASTLINE ) ), + aLastLineLB ( this, SVX_RES( LB_LASTLINE ) ), + aExpandCB ( this, SVX_RES( CB_EXPAND ) ), + aSnapToGridCB ( this, SVX_RES( CB_SNAP ) ), + aExampleWin ( this, SVX_RES( WN_EXAMPLE ) ), + + aVertAlignFL ( this, SVX_RES( FL_VERTALIGN ) ), + aVertAlignFT ( this, SVX_RES( FT_VERTALIGN ) ), + aVertAlignLB ( this, SVX_RES( LB_VERTALIGN ) ), + + aPropertiesFL ( this, SVX_RES( FL_PROPERTIES )), + aTextDirectionFT ( this, SVX_RES( FT_TEXTDIRECTION )), + aTextDirectionLB ( this, SVX_RES( LB_TEXTDIRECTION )) +{ + SvtLanguageOptions aLangOptions; + USHORT nLastLinePos = LASTLINEPOS_DEFAULT; + + if ( aLangOptions.IsAsianTypographyEnabled() ) + { + String sLeft(SVX_RES(ST_LEFTALIGN_ASIAN)); + aLeft.SetText(sLeft); + aRight.SetText(String(SVX_RES(ST_RIGHTALIGN_ASIAN))); + sLeft = MnemonicGenerator::EraseAllMnemonicChars( sLeft ); + + if ( aLastLineLB.GetEntryCount() == LASTLINECOUNT_OLD ) + { + aLastLineLB.RemoveEntry( 0 ); + aLastLineLB.InsertEntry( sLeft, 0 ); + } + else + nLastLinePos = LASTLINEPOS_LEFT; + } + // remove "Default" or "Left" entry, depends on CJKOptions + if ( aLastLineLB.GetEntryCount() == LASTLINECOUNT_NEW ) + aLastLineLB.RemoveEntry( nLastLinePos ); + + FreeResource(); + Link aLink = LINK( this, SvxParaAlignTabPage, AlignHdl_Impl ); + aLeft.SetClickHdl( aLink ); + aRight.SetClickHdl( aLink ); + aCenter.SetClickHdl( aLink ); + aJustify.SetClickHdl( aLink ); + aLastLineLB.SetSelectHdl( LINK( this, SvxParaAlignTabPage, LastLineHdl_Impl ) ); + aTextDirectionLB.SetSelectHdl( LINK( this, SvxParaAlignTabPage, TextDirectionHdl_Impl ) ); + + USHORT nHtmlMode = GetHtmlMode_Impl(rSet); + if(!(nHtmlMode & HTMLMODE_ON) || (0 != (nHtmlMode & HTMLMODE_SOME_STYLES)) ) + { + if( aLangOptions.IsCTLFontEnabled() ) + { + aTextDirectionLB.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_LTR ), FRMDIR_HORI_LEFT_TOP ); + aTextDirectionLB.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_RTL ), FRMDIR_HORI_RIGHT_TOP ); + aTextDirectionLB.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER ), FRMDIR_ENVIRONMENT ); + + aPropertiesFL.Show(); + aTextDirectionFT.Show(); + aTextDirectionLB.Show(); + } + } +} + +/*-----------------16.01.97 19.33------------------- + +--------------------------------------------------*/ +SvxParaAlignTabPage::~SvxParaAlignTabPage() +{ +} + +/*-----------------16.01.97 19.33------------------- + +--------------------------------------------------*/ +int SvxParaAlignTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if ( _pSet ) + FillItemSet( *_pSet ); + return LEAVE_PAGE; +} + +/*-----------------16.01.97 19.33------------------- + +--------------------------------------------------*/ +SfxTabPage* SvxParaAlignTabPage::Create( Window* pParent, const SfxItemSet& rSet ) +{ + return new SvxParaAlignTabPage(pParent, rSet); +} + +/*-----------------16.01.97 19.33------------------- + +--------------------------------------------------*/ +USHORT* SvxParaAlignTabPage::GetRanges() +{ + return pAlignRanges; + +} + +/*-----------------16.01.97 19.33------------------- + +--------------------------------------------------*/ +BOOL SvxParaAlignTabPage::FillItemSet( SfxItemSet& rOutSet ) +{ + BOOL bModified = FALSE; + + FASTBOOL bAdj = FALSE, bChecked = FALSE; + SvxAdjust eAdjust = SVX_ADJUST_LEFT; + + if ( aLeft.IsChecked() ) + { + eAdjust = SVX_ADJUST_LEFT; + bAdj = !aLeft.GetSavedValue(); + bChecked = TRUE; + } + else if ( aRight.IsChecked() ) + { + eAdjust = SVX_ADJUST_RIGHT; + bAdj = !aRight.GetSavedValue(); + bChecked = TRUE; + } + else if ( aCenter.IsChecked() ) + { + eAdjust = SVX_ADJUST_CENTER; + bAdj = !aCenter.GetSavedValue(); + bChecked = TRUE; + } + else if ( aJustify.IsChecked() ) + { + eAdjust = SVX_ADJUST_BLOCK; + bAdj = !aJustify.GetSavedValue() || + aExpandCB.IsChecked() != aExpandCB.GetSavedValue() || + aLastLineLB.GetSelectEntryPos() != aLastLineLB.GetSavedValue(); + bChecked = TRUE; + } + USHORT _nWhich = GetWhich( SID_ATTR_PARA_ADJUST ); + + if ( bAdj ) + { + const SvxAdjustItem* pOld = + (const SvxAdjustItem*)GetOldItem( rOutSet, SID_ATTR_PARA_ADJUST ); + SvxAdjust eOneWord = aExpandCB.IsChecked() ? SVX_ADJUST_BLOCK + : SVX_ADJUST_LEFT; + USHORT nLBPos = aLastLineLB.GetSelectEntryPos(); + SvxAdjust eLastBlock = SVX_ADJUST_LEFT; + + if ( 1 == nLBPos ) + eLastBlock = SVX_ADJUST_CENTER; + else if ( 2 == nLBPos ) + eLastBlock = SVX_ADJUST_BLOCK; + + FASTBOOL bNothingWasChecked = + !aLeft.GetSavedValue() && !aRight.GetSavedValue() && + !aCenter.GetSavedValue() && !aJustify.GetSavedValue(); + + if ( !pOld || pOld->GetAdjust() != eAdjust || + pOld->GetOneWord() != eOneWord || + pOld->GetLastBlock() != eLastBlock || + ( bChecked && bNothingWasChecked ) ) + { + bModified |= TRUE; + SvxAdjustItem aAdj( + (const SvxAdjustItem&)GetItemSet().Get( _nWhich ) ); + aAdj.SetAdjust( eAdjust ); + aAdj.SetOneWord( eOneWord ); + aAdj.SetLastBlock( eLastBlock ); + rOutSet.Put( aAdj ); + } + } + if(aSnapToGridCB.IsChecked() != aSnapToGridCB.GetSavedValue()) + { + rOutSet.Put(SvxParaGridItem(aSnapToGridCB.IsChecked(), GetWhich( SID_ATTR_PARA_SNAPTOGRID ))); + bModified = TRUE; + } + if(aVertAlignLB.GetSavedValue() != aVertAlignLB.GetSelectEntryPos()) + { + rOutSet.Put(SvxParaVertAlignItem(aVertAlignLB.GetSelectEntryPos(), GetWhich( SID_PARA_VERTALIGN ))); + bModified = TRUE; + } + + if( aTextDirectionLB.IsVisible() ) + { + SvxFrameDirection eDir = aTextDirectionLB.GetSelectEntryValue(); + if( eDir != aTextDirectionLB.GetSavedValue() ) + { + rOutSet.Put( SvxFrameDirectionItem( eDir, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) ); + bModified = TRUE; + } + } + + return bModified; +} + +/*-----------------16.01.97 19.33------------------- + +--------------------------------------------------*/ +void SvxParaAlignTabPage::Reset( const SfxItemSet& rSet ) +{ + USHORT _nWhich = GetWhich( SID_ATTR_PARA_ADJUST ); + SfxItemState eItemState = rSet.GetItemState( _nWhich ); + + USHORT nLBSelect = 0; + if ( eItemState >= SFX_ITEM_AVAILABLE ) + { + const SvxAdjustItem& rAdj = (const SvxAdjustItem&)rSet.Get( _nWhich ); + + switch ( rAdj.GetAdjust() /*!!! VB fragen rAdj.GetLastBlock()*/ ) + { + case SVX_ADJUST_LEFT: aLeft.Check(); break; + + case SVX_ADJUST_RIGHT: aRight.Check(); break; + + case SVX_ADJUST_CENTER: aCenter.Check(); break; + + case SVX_ADJUST_BLOCK: aJustify.Check(); break; + default: ; //prevent warning + } + BOOL bEnable = aJustify.IsChecked(); + aLastLineFT.Enable(bEnable); + aLastLineLB.Enable(bEnable); + aExpandCB .Enable(bEnable); + + aExpandCB.Check(SVX_ADJUST_BLOCK == rAdj.GetOneWord()); + switch(rAdj.GetLastBlock()) + { + case SVX_ADJUST_LEFT: nLBSelect = 0; break; + + case SVX_ADJUST_CENTER: nLBSelect = 1; break; + + case SVX_ADJUST_BLOCK: nLBSelect = 2; break; + default: ; //prevent warning + } + } + else + { + aLeft.Check( FALSE ); + aRight.Check( FALSE ); + aCenter.Check( FALSE ); + aJustify.Check( FALSE ); + } + aLastLineLB.SelectEntryPos(nLBSelect); + + USHORT nHtmlMode = GetHtmlMode_Impl(rSet); + if(nHtmlMode & HTMLMODE_ON) + { + aLastLineLB.Hide(); + aLastLineFT.Hide(); + aExpandCB.Hide(); + if(!(nHtmlMode & HTMLMODE_FULL_STYLES|HTMLMODE_FIRSTLINE) ) + aJustify.Disable(); + aSnapToGridCB.Show(FALSE); + } + _nWhich = GetWhich(SID_ATTR_PARA_SNAPTOGRID); + eItemState = rSet.GetItemState( _nWhich ); + if ( eItemState >= SFX_ITEM_AVAILABLE ) + { + const SvxParaGridItem& rSnap = (const SvxParaGridItem&)rSet.Get( _nWhich ); + aSnapToGridCB.Check(rSnap.GetValue()); + } + + _nWhich = GetWhich( SID_PARA_VERTALIGN ); + eItemState = rSet.GetItemState( _nWhich ); + + if ( eItemState >= SFX_ITEM_AVAILABLE ) + { + aVertAlignLB.Show(); + aVertAlignFL.Show(); + aVertAlignFT.Show(); + + const SvxParaVertAlignItem& rAlign = (const SvxParaVertAlignItem&)rSet.Get( _nWhich ); + aVertAlignLB.SelectEntryPos(rAlign.GetValue()); + } + + _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION ); + //text direction + if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( _nWhich ) ) + { + const SvxFrameDirectionItem& rFrameDirItem = ( const SvxFrameDirectionItem& ) rSet.Get( _nWhich ); + aTextDirectionLB.SelectEntryValue( (SvxFrameDirection)rFrameDirItem.GetValue() ); + aTextDirectionLB.SaveValue(); + } + + aSnapToGridCB.SaveValue(); + aVertAlignLB.SaveValue(); + aLeft.SaveValue(); + aRight.SaveValue(); + aCenter.SaveValue(); + aJustify.SaveValue(); + aLastLineLB.SaveValue(); + aExpandCB.SaveValue(); + + UpdateExample_Impl(TRUE); +} + +/*-----------------17.01.97 08.06------------------- + +--------------------------------------------------*/ +IMPL_LINK( SvxParaAlignTabPage, AlignHdl_Impl, RadioButton*, EMPTYARG ) +{ + BOOL bJustify = aJustify.IsChecked(); + aLastLineFT.Enable(bJustify); + aLastLineLB.Enable(bJustify); + aExpandCB.Enable(bJustify); + UpdateExample_Impl(FALSE); + return 0; +} + +IMPL_LINK( SvxParaAlignTabPage, LastLineHdl_Impl, ListBox*, EMPTYARG ) +{ + UpdateExample_Impl(FALSE); + return 0; +} + +IMPL_LINK( SvxParaAlignTabPage, TextDirectionHdl_Impl, ListBox*, EMPTYARG ) +{ + SvxFrameDirection eDir = aTextDirectionLB.GetSelectEntryValue(); + switch ( eDir ) + { + // check the default alignment for this text direction + case FRMDIR_HORI_LEFT_TOP : aLeft.Check( TRUE ); break; + case FRMDIR_HORI_RIGHT_TOP : aRight.Check( TRUE ); break; + case FRMDIR_ENVIRONMENT : /* do nothing */ break; + default: + { + DBG_ERRORFILE( "SvxParaAlignTabPage::TextDirectionHdl_Impl(): other directions not supported" ); + } + } + + return 0; +} + +/*-----------------16.01.97 19.34------------------- + +--------------------------------------------------*/ +void SvxParaAlignTabPage::UpdateExample_Impl( BOOL bAll ) +{ + if ( aLeft.IsChecked() ) + aExampleWin.SetAdjust( SVX_ADJUST_LEFT ); + else if ( aRight.IsChecked() ) + aExampleWin.SetAdjust( SVX_ADJUST_RIGHT ); + else if ( aCenter.IsChecked() ) + aExampleWin.SetAdjust( SVX_ADJUST_CENTER ); + else if ( aJustify.IsChecked() ) + { + aExampleWin.SetAdjust( SVX_ADJUST_BLOCK ); + SvxAdjust eLastBlock = SVX_ADJUST_LEFT; + USHORT nLBPos = aLastLineLB.GetSelectEntryPos(); + if(nLBPos == 1) + eLastBlock = SVX_ADJUST_CENTER; + else if(nLBPos == 2) + eLastBlock = SVX_ADJUST_BLOCK; + aExampleWin.SetLastLine( eLastBlock ); + } + + aExampleWin.Draw( bAll ); +} +/*-----------------17.01.97 08.04------------------- + Erweiterungen fuer den Blocksatz einschalten +--------------------------------------------------*/ +void SvxParaAlignTabPage::EnableJustifyExt() +{ + aLastLineFT.Show(); + aLastLineLB.Show(); + aExpandCB .Show(); + SvtLanguageOptions aCJKOptions; + if(aCJKOptions.IsAsianTypographyEnabled()) + aSnapToGridCB.Show(); + +} +//add CHINA001 begin +void SvxParaAlignTabPage::PageCreated (SfxAllItemSet aSet) +{ + SFX_ITEMSET_ARG (&aSet,pBoolItem,SfxBoolItem,SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_False); + if (pBoolItem) + if(pBoolItem->GetValue()) + EnableJustifyExt(); +} +//end of CHINA001 +// class SvxExtParagraphTabPage ------------------------------------------ + +SfxTabPage* SvxExtParagraphTabPage::Create( Window* pParent, + const SfxItemSet& rSet ) +{ + return new SvxExtParagraphTabPage( pParent, rSet ); +} + +// ----------------------------------------------------------------------- + +BOOL SvxExtParagraphTabPage::FillItemSet( SfxItemSet& rOutSet ) +{ + BOOL bModified = FALSE; + USHORT _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE ); + const TriState eHyphenState = aHyphenBox.GetState(); + const SfxPoolItem* pOld = GetOldItem( rOutSet, SID_ATTR_PARA_HYPHENZONE ); + + if ( eHyphenState != aHyphenBox.GetSavedValue() || + aExtHyphenBeforeBox.IsValueModified() || + aExtHyphenAfterBox.IsValueModified() || + aMaxHyphenEdit.IsValueModified() ) + { + SvxHyphenZoneItem aHyphen( + (const SvxHyphenZoneItem&)GetItemSet().Get( _nWhich ) ); + aHyphen.SetHyphen( eHyphenState == STATE_CHECK ); + + if ( eHyphenState == STATE_CHECK ) + { + aHyphen.GetMinLead() = (BYTE)aExtHyphenBeforeBox.GetValue(); + aHyphen.GetMinTrail() = (BYTE)aExtHyphenAfterBox.GetValue(); + } + aHyphen.GetMaxHyphens() = (BYTE)aMaxHyphenEdit.GetValue(); + + if ( !pOld || + !( *(SvxHyphenZoneItem*)pOld == aHyphen ) || + eHyphenState != aHyphenBox.GetSavedValue()) + { + rOutSet.Put( aHyphen ); + bModified |= TRUE; + } + } + + if (aPagenumEdit.IsEnabled() && aPagenumEdit.IsValueModified()) + { + SfxUInt16Item aPageNum( SID_ATTR_PARA_PAGENUM, + (USHORT)aPagenumEdit.GetValue() ); + + pOld = GetOldItem( rOutSet, SID_ATTR_PARA_PAGENUM ); + + if ( !pOld || ( (const SfxUInt16Item*)pOld )->GetValue() != aPageNum.GetValue() ) + { + rOutSet.Put( aPageNum ); + bModified |= TRUE; + } + } + + // Seitenumbruch + + TriState eState = aApplyCollBtn.GetState(); + FASTBOOL bIsPageModel = FALSE; + + _nWhich = GetWhich( SID_ATTR_PARA_MODEL ); + String sPage; + if ( eState != aApplyCollBtn.GetSavedValue() || + ( STATE_CHECK == eState && + aApplyCollBox.GetSelectEntryPos() != aApplyCollBox.GetSavedValue() ) ) + { + if ( eState == STATE_CHECK ) + { + sPage = aApplyCollBox.GetSelectEntry(); + bIsPageModel = 0 != sPage.Len(); + } + pOld = GetOldItem( rOutSet, SID_ATTR_PARA_MODEL ); + + if ( !pOld || ( (const SvxPageModelItem*)pOld )->GetValue() != sPage ) + { + rOutSet.Put( SvxPageModelItem( sPage, FALSE, _nWhich ) ); + bModified |= TRUE; + } + else + bIsPageModel = FALSE; + } + else if(STATE_CHECK == eState && aApplyCollBtn.IsEnabled()) + bIsPageModel = TRUE; + else + rOutSet.Put( SvxPageModelItem( sPage, FALSE, _nWhich ) ); + + _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK ); + + if ( bIsPageModel ) + // wird PageModel eingeschaltet, dann immer PageBreak ausschalten + rOutSet.Put( SvxFmtBreakItem( SVX_BREAK_NONE, _nWhich ) ); + else + { + eState = aPageBreakBox.GetState(); + SfxItemState eModelState = GetItemSet().GetItemState(SID_ATTR_PARA_MODEL, FALSE); + + if ( (eModelState == SFX_ITEM_SET && STATE_CHECK == aPageBreakBox.GetState()) || + eState != aPageBreakBox.GetSavedValue() || + aBreakTypeLB.GetSelectEntryPos() != aBreakTypeLB.GetSavedValue() || + aBreakPositionLB.GetSelectEntryPos() != aBreakPositionLB.GetSavedValue() ) + { + const SvxFmtBreakItem rOldBreak( + (const SvxFmtBreakItem&)GetItemSet().Get( _nWhich )); + SvxFmtBreakItem aBreak(rOldBreak.GetBreak(), rOldBreak.Which()); + + switch ( eState ) + { + case STATE_CHECK: + { + BOOL bBefore = aBreakPositionLB.GetSelectEntryPos() == 0; + + if ( aBreakTypeLB.GetSelectEntryPos() == 0 ) + { + if ( bBefore ) + aBreak.SetValue( SVX_BREAK_PAGE_BEFORE ); + else + aBreak.SetValue( SVX_BREAK_PAGE_AFTER ); + } + else + { + if ( bBefore ) + aBreak.SetValue( SVX_BREAK_COLUMN_BEFORE ); + else + aBreak.SetValue( SVX_BREAK_COLUMN_AFTER ); + } + break; + } + + case STATE_NOCHECK: + aBreak.SetValue( SVX_BREAK_NONE ); + break; + default: ; //prevent warning + } + pOld = GetOldItem( rOutSet, SID_ATTR_PARA_PAGEBREAK ); + + if ( eState != aPageBreakBox.GetSavedValue() || + !pOld || !( *(const SvxFmtBreakItem*)pOld == aBreak ) ) + { + bModified |= TRUE; + rOutSet.Put( aBreak ); + } + } + } + + + // Absatztrennung + _nWhich = GetWhich( SID_ATTR_PARA_SPLIT ); + eState = aKeepTogetherBox.GetState(); + + if ( eState != aKeepTogetherBox.GetSavedValue() ) + { + pOld = GetOldItem( rOutSet, SID_ATTR_PARA_SPLIT ); + + if ( !pOld || ( (const SvxFmtSplitItem*)pOld )->GetValue() != + ( eState == STATE_NOCHECK ) ) + { + rOutSet.Put( SvxFmtSplitItem( eState == STATE_NOCHECK, _nWhich ) ); + bModified |= TRUE; + } + } + + // Absaetze zusammenhalten + _nWhich = GetWhich( SID_ATTR_PARA_KEEP ); + eState = aKeepParaBox.GetState(); + + if ( eState != aKeepParaBox.GetSavedValue() ) + { + pOld = GetOldItem( rOutSet, SID_ATTR_PARA_KEEP ); + + // hat sich der Status geaendert, muss immer geputtet werden + rOutSet.Put( SvxFmtKeepItem( eState == STATE_CHECK, _nWhich ) ); + bModified |= TRUE; + } + + // Witwen und Waisen + _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS ); + eState = aWidowBox.GetState(); + + if ( eState != aWidowBox.GetSavedValue() || + aWidowRowNo.IsValueModified() ) + { + SvxWidowsItem rItem( eState == STATE_CHECK ? + (BYTE)aWidowRowNo.GetValue() : 0, _nWhich ); + pOld = GetOldItem( rOutSet, SID_ATTR_PARA_WIDOWS ); + + if ( eState != aWidowBox.GetSavedValue() || !pOld || !( *(const SvxWidowsItem*)pOld == rItem ) ) + { + rOutSet.Put( rItem ); + bModified |= TRUE; + } + } + + _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS ); + eState = aOrphanBox.GetState(); + + if ( eState != aOrphanBox.GetSavedValue() || + aOrphanRowNo.IsValueModified() ) + { + SvxOrphansItem rItem( eState == STATE_CHECK ? + (BYTE)aOrphanRowNo.GetValue() : 0, _nWhich ); + pOld = GetOldItem( rOutSet, SID_ATTR_PARA_ORPHANS ); + + if ( eState != aOrphanBox.GetSavedValue() || + !pOld || + !( *(const SvxOrphansItem*)pOld == rItem ) ) + { + rOutSet.Put( rItem ); + bModified |= TRUE; + } + } + + return bModified; +} + +// ----------------------------------------------------------------------- + +void SvxExtParagraphTabPage::Reset( const SfxItemSet& rSet ) +{ + USHORT _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE ); + SfxItemState eItemState = rSet.GetItemState( _nWhich ); + + BOOL bItemAvailable = eItemState >= SFX_ITEM_AVAILABLE; + BOOL bIsHyphen = FALSE; + if( !bHtmlMode && bItemAvailable ) + { + const SvxHyphenZoneItem& rHyphen = + (const SvxHyphenZoneItem&)rSet.Get( _nWhich ); + aHyphenBox.EnableTriState( FALSE ); + + bIsHyphen = rHyphen.IsHyphen(); + aHyphenBox.SetState( bIsHyphen ? STATE_CHECK : STATE_NOCHECK ); + + aExtHyphenBeforeBox.SetValue( rHyphen.GetMinLead() ); + aExtHyphenAfterBox.SetValue( rHyphen.GetMinTrail() ); + aMaxHyphenEdit.SetValue( rHyphen.GetMaxHyphens() ); + } + else + { + aHyphenBox.SetState( STATE_DONTKNOW ); + } + BOOL bEnable = bItemAvailable && bIsHyphen; + aExtHyphenBeforeBox.Enable(bEnable); + aExtHyphenAfterBox.Enable(bEnable); + aBeforeText.Enable(bEnable); + aAfterText.Enable(bEnable); + aMaxHyphenLabel.Enable(bEnable); + aMaxHyphenEdit.Enable(bEnable); + + _nWhich = GetWhich( SID_ATTR_PARA_PAGENUM ); + + if ( rSet.GetItemState(_nWhich) >= SFX_ITEM_AVAILABLE ) + { + const USHORT nPageNum = + ( (const SfxUInt16Item&)rSet.Get( _nWhich ) ).GetValue(); + aPagenumEdit.SetValue( nPageNum ); + } + + if ( bPageBreak ) + { + // zuerst PageModel behandeln + _nWhich = GetWhich( SID_ATTR_PARA_MODEL ); + BOOL bIsPageModel = FALSE; + eItemState = rSet.GetItemState( _nWhich ); + + if ( eItemState >= SFX_ITEM_SET ) + { + aApplyCollBtn.EnableTriState( FALSE ); + + const SvxPageModelItem& rModel = + (const SvxPageModelItem&)rSet.Get( _nWhich ); + String aStr( rModel.GetValue() ); + + if ( aStr.Len() && + aApplyCollBox.GetEntryPos( aStr ) != LISTBOX_ENTRY_NOTFOUND ) + { + aApplyCollBox.SelectEntry( aStr ); + aApplyCollBtn.SetState( STATE_CHECK ); + bIsPageModel = TRUE; + + aPageBreakBox.Enable(); + aPageBreakBox.EnableTriState( FALSE ); + aBreakTypeFT.Enable(); + aBreakTypeLB.Enable(); + aBreakPositionFT.Enable(); + aBreakPositionLB.Enable(); + aApplyCollBtn.Enable(); + aPageBreakBox.SetState( STATE_CHECK ); + + //select page break + aBreakTypeLB.SelectEntryPos(0); + //select break before + aBreakPositionLB.SelectEntryPos(0); + } + else + { + aApplyCollBox.SetNoSelection(); + aApplyCollBtn.SetState( STATE_NOCHECK ); + } + } + else if ( SFX_ITEM_DONTCARE == eItemState ) + { + aApplyCollBtn.EnableTriState( TRUE ); + aApplyCollBtn.SetState( STATE_DONTKNOW ); + aApplyCollBox.SetNoSelection(); + } + else + { + aApplyCollBtn.Enable(FALSE); + aApplyCollBox.Enable(FALSE); + aPagenumEdit.Enable(FALSE); + aPagenumText.Enable(FALSE); + } +//!!! ApplyCollClickHdl_Impl( &aApplyCollBtn ); + + if ( !bIsPageModel ) + { + _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK ); + eItemState = rSet.GetItemState( _nWhich ); + + if ( eItemState >= SFX_ITEM_AVAILABLE ) + { + const SvxFmtBreakItem& rPageBreak = + (const SvxFmtBreakItem&)rSet.Get( _nWhich ); + + SvxBreak eBreak = (SvxBreak)rPageBreak.GetValue(); + + // PageBreak nicht ueber CTRL-RETURN, + // dann kann CheckBox frei gegeben werden + aPageBreakBox.Enable(); + aPageBreakBox.EnableTriState( FALSE ); + aBreakTypeFT.Enable(); + aBreakTypeLB.Enable(); + aBreakPositionFT.Enable(); + aBreakPositionLB.Enable(); + + aPageBreakBox.SetState( STATE_CHECK ); + + BOOL _bEnable = eBreak != SVX_BREAK_NONE && + eBreak != SVX_BREAK_COLUMN_BEFORE && + eBreak != SVX_BREAK_COLUMN_AFTER; + aApplyCollBtn.Enable(_bEnable); + if(!_bEnable) + { + aApplyCollBox.Enable(_bEnable); + aPagenumEdit.Enable(_bEnable); + } + + if ( eBreak == SVX_BREAK_NONE ) + aPageBreakBox.SetState( STATE_NOCHECK ); + + USHORT nType = 0; // selection position in break type ListBox : Page + USHORT nPosition = 0; // selection position in break position ListBox : Before + switch ( eBreak ) + { + case SVX_BREAK_PAGE_BEFORE: + break; + case SVX_BREAK_PAGE_AFTER: + nPosition = 1; + break; + case SVX_BREAK_COLUMN_BEFORE: + nType = 1; + break; + case SVX_BREAK_COLUMN_AFTER: + nType = 1; + nPosition = 1; + break; + default: ;//prevent warning + } + aBreakTypeLB.SelectEntryPos(nType); + aBreakPositionLB.SelectEntryPos(nPosition); + } + else if ( SFX_ITEM_DONTCARE == eItemState ) + aPageBreakBox.SetState( STATE_DONTKNOW ); + else + { + aPageBreakBox.Enable(FALSE); + aBreakTypeFT.Enable(FALSE); + aBreakTypeLB.Enable(FALSE); + aBreakPositionFT.Enable(FALSE); + aBreakPositionLB.Enable(FALSE); + } + } + + PageBreakPosHdl_Impl( &aBreakPositionLB ); + PageBreakHdl_Impl( &aPageBreakBox ); + } + + _nWhich = GetWhich( SID_ATTR_PARA_KEEP ); + eItemState = rSet.GetItemState( _nWhich ); + + if ( eItemState >= SFX_ITEM_AVAILABLE ) + { + aKeepParaBox.EnableTriState( FALSE ); + const SvxFmtKeepItem& rKeep = + (const SvxFmtKeepItem&)rSet.Get( _nWhich ); + + if ( rKeep.GetValue() ) + aKeepParaBox.SetState( STATE_CHECK ); + else + aKeepParaBox.SetState( STATE_NOCHECK ); + } + else if ( SFX_ITEM_DONTCARE == eItemState ) + aKeepParaBox.SetState( STATE_DONTKNOW ); + else + aKeepParaBox.Enable(FALSE); + + _nWhich = GetWhich( SID_ATTR_PARA_SPLIT ); + eItemState = rSet.GetItemState( _nWhich ); + + if ( eItemState >= SFX_ITEM_AVAILABLE ) + { + const SvxFmtSplitItem& rSplit = + (const SvxFmtSplitItem&)rSet.Get( _nWhich ); + aKeepTogetherBox.EnableTriState( FALSE ); + + if ( !rSplit.GetValue() ) + aKeepTogetherBox.SetState( STATE_CHECK ); + else + { + aKeepTogetherBox.SetState( STATE_NOCHECK ); + + // Witwen und Waisen + aWidowBox.Enable(); + _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS ); + SfxItemState eTmpState = rSet.GetItemState( _nWhich ); + + if ( eTmpState >= SFX_ITEM_AVAILABLE ) + { + const SvxWidowsItem& rWidow = + (const SvxWidowsItem&)rSet.Get( _nWhich ); + aWidowBox.EnableTriState( FALSE ); + const USHORT nLines = rWidow.GetValue(); + + BOOL _bEnable = nLines > 0; + aWidowRowNo.SetValue( aWidowRowNo.Normalize( nLines ) ); + aWidowBox.SetState( _bEnable ? STATE_CHECK : STATE_NOCHECK); + aWidowRowNo.Enable(_bEnable); + aWidowRowLabel.Enable(_bEnable); + + } + else if ( SFX_ITEM_DONTCARE == eTmpState ) + aWidowBox.SetState( STATE_DONTKNOW ); + else + aWidowBox.Enable(FALSE); + + aOrphanBox.Enable(); + _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS ); + eTmpState = rSet.GetItemState( _nWhich ); + + if ( eTmpState >= SFX_ITEM_AVAILABLE ) + { + const SvxOrphansItem& rOrphan = + (const SvxOrphansItem&)rSet.Get( _nWhich ); + const USHORT nLines = rOrphan.GetValue(); + aOrphanBox.EnableTriState( FALSE ); + + BOOL _bEnable = nLines > 0; + aOrphanBox.SetState( _bEnable ? STATE_CHECK : STATE_NOCHECK); + aOrphanRowNo.SetValue( aOrphanRowNo.Normalize( nLines ) ); + aOrphanRowNo.Enable(_bEnable); + aOrphanRowLabel.Enable(_bEnable); + + } + else if ( SFX_ITEM_DONTCARE == eTmpState ) + aOrphanBox.SetState( STATE_DONTKNOW ); + else + aOrphanBox.Enable(FALSE); + } + } + else if ( SFX_ITEM_DONTCARE == eItemState ) + aKeepTogetherBox.SetState( STATE_DONTKNOW ); + else + aKeepTogetherBox.Enable(FALSE); + + // damit alles richt enabled wird + KeepTogetherHdl_Impl( 0 ); + WidowHdl_Impl( 0 ); + OrphanHdl_Impl( 0 ); + + aHyphenBox.SaveValue(); + aExtHyphenBeforeBox.SaveValue(); + aExtHyphenAfterBox.SaveValue(); + aMaxHyphenEdit.SaveValue(); + aPageBreakBox.SaveValue(); + aBreakPositionLB.SaveValue(); + aBreakTypeLB.SaveValue(); + aApplyCollBtn.SaveValue(); + aApplyCollBox.SaveValue(); + aPagenumEdit.SaveValue(); + aKeepTogetherBox.SaveValue(); + aKeepParaBox.SaveValue(); + aWidowBox.SaveValue(); + aOrphanBox.SaveValue(); +} + +// ----------------------------------------------------------------------- + +int SvxExtParagraphTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if ( _pSet ) + FillItemSet( *_pSet ); + return LEAVE_PAGE; +} + +// ----------------------------------------------------------------------- + +void SvxExtParagraphTabPage::DisablePageBreak() +{ + bPageBreak = FALSE; + aPageBreakBox.Enable(FALSE); + aBreakTypeLB.RemoveEntry(0); + aBreakPositionFT.Enable(FALSE); + aBreakPositionLB.Enable(FALSE); + aApplyCollBtn.Enable(FALSE); + aApplyCollBox.Enable(FALSE); + aPagenumEdit.Enable(FALSE); +} + +// ----------------------------------------------------------------------- + +SvxExtParagraphTabPage::SvxExtParagraphTabPage( Window* pParent, const SfxItemSet& rAttr ) : + + SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_EXT_PARAGRAPH ), rAttr ), + + aHyphenBox ( this, SVX_RES( BTN_HYPHEN ) ), + aBeforeText ( this, SVX_RES( FT_HYPHENBEFORE ) ), + aExtHyphenBeforeBox ( this, SVX_RES( ED_HYPHENBEFORE ) ), + aAfterText ( this, SVX_RES( FT_HYPHENAFTER ) ), + aExtHyphenAfterBox ( this, SVX_RES( ED_HYPHENAFTER ) ), + aMaxHyphenLabel ( this, SVX_RES( FT_MAXHYPH ) ), + aMaxHyphenEdit ( this, SVX_RES( ED_MAXHYPH ) ), + aExtFL ( this, SVX_RES( FL_HYPHEN ) ), + aBreaksFL ( this, SVX_RES( FL_BREAKS ) ), + aPageBreakBox ( this, SVX_RES( BTN_PAGEBREAK ) ), + aBreakTypeFT ( this, SVX_RES( FT_BREAKTYPE )), + aBreakTypeLB ( this, SVX_RES( LB_BREAKTYPE )), + aBreakPositionFT ( this, SVX_RES( FT_BREAKPOSITION )), + aBreakPositionLB ( this, SVX_RES( LB_BREAKPOSITION )), +// aPageBox ( this, SVX_RES( BTN_BREAKPAGE ) ), +// aColumnBox ( this, SVX_RES( BTN_BREAKCOLUMN ) ), +// aBeforeBox ( this, SVX_RES( BTN_PAGEBREAKBEFORE ) ), +// aAfterBox ( this, SVX_RES( BTN_PAGEBREAKAFTER ) ), + aApplyCollBtn ( this, SVX_RES( BTN_PAGECOLL ) ), + aApplyCollBox ( this, SVX_RES( LB_PAGECOLL ) ), + aPagenumText ( this, SVX_RES( FT_PAGENUM ) ), + aPagenumEdit ( this, SVX_RES( ED_PAGENUM ) ), + aExtendFL ( this, SVX_RES( FL_OPTIONS ) ), + aKeepTogetherBox ( this, SVX_RES( BTN_KEEPTOGETHER ) ), + aKeepParaBox ( this, SVX_RES( CB_KEEPTOGETHER ) ), + aOrphanBox ( this, SVX_RES( BTN_ORPHANS ) ), + aOrphanRowNo ( this, SVX_RES( ED_ORPHANS ) ), + aOrphanRowLabel ( this, SVX_RES( FT_ORPHANS ) ), + aWidowBox ( this, SVX_RES( BTN_WIDOWS ) ), + aWidowRowNo ( this, SVX_RES( ED_WIDOWS ) ), + aWidowRowLabel ( this, SVX_RES( FT_WIDOWS ) ), + bPageBreak ( TRUE ), + bHtmlMode ( FALSE ), + nStdPos ( 0 ) +{ + FreeResource(); + + // diese Page braucht ExchangeSupport + SetExchangeSupport(); + + aHyphenBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, HyphenClickHdl_Impl ) ); + aPageBreakBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, PageBreakHdl_Impl ) ); + aKeepTogetherBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, KeepTogetherHdl_Impl ) ); + aWidowBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, WidowHdl_Impl ) ); + aOrphanBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, OrphanHdl_Impl ) ); + aApplyCollBtn.SetClickHdl( LINK( this, SvxExtParagraphTabPage, ApplyCollClickHdl_Impl ) ); + aBreakTypeLB.SetSelectHdl( LINK( this, SvxExtParagraphTabPage, PageBreakTypeHdl_Impl ) ); + aBreakPositionLB.SetSelectHdl( LINK( this, SvxExtParagraphTabPage, PageBreakPosHdl_Impl ) ); + + SfxObjectShell* pSh = SfxObjectShell::Current(); + if ( pSh ) + { + SfxStyleSheetBasePool* pPool = pSh->GetStyleSheetPool(); + pPool->SetSearchMask( SFX_STYLE_FAMILY_PAGE ); + SfxStyleSheetBase* pStyle = pPool->First(); + String aStdName; + + while( pStyle ) + { + if ( aStdName.Len() == 0 ) + // first style == standard style + aStdName = pStyle->GetName(); + aApplyCollBox.InsertEntry( pStyle->GetName() ); + pStyle = pPool->Next(); + } + nStdPos = aApplyCollBox.GetEntryPos( aStdName ); + } + + USHORT nHtmlMode = GetHtmlMode_Impl( rAttr ); + if ( nHtmlMode & HTMLMODE_ON ) + { + bHtmlMode = TRUE; + aHyphenBox .Enable(FALSE); + aBeforeText .Enable(FALSE); + aExtHyphenBeforeBox .Enable(FALSE); + aAfterText .Enable(FALSE); + aExtHyphenAfterBox .Enable(FALSE); + aMaxHyphenLabel .Enable(FALSE); + aMaxHyphenEdit .Enable(FALSE); + aExtFL .Enable(FALSE); + aPagenumText .Enable(FALSE); + aPagenumEdit .Enable(FALSE); + // no column break in HTML + aBreakTypeLB.RemoveEntry(1); + } +} + +// ----------------------------------------------------------------------- + +__EXPORT SvxExtParagraphTabPage::~SvxExtParagraphTabPage() +{ +} + +// ----------------------------------------------------------------------- + +USHORT* SvxExtParagraphTabPage::GetRanges() +{ + return pExtRanges; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxExtParagraphTabPage, PageBreakHdl_Impl, TriStateBox *, EMPTYARG ) +{ + switch ( aPageBreakBox.GetState() ) + { + case STATE_CHECK: + aBreakTypeFT.Enable(); + aBreakTypeLB.Enable(); + aBreakPositionFT.Enable(); + aBreakPositionLB.Enable(); + + if ( 0 == aBreakTypeLB.GetSelectEntryPos()&& + 0 == aBreakPositionLB.GetSelectEntryPos() ) + { + aApplyCollBtn.Enable(); + + BOOL bEnable = STATE_CHECK == aApplyCollBtn.GetState() && + aApplyCollBox.GetEntryCount(); + aApplyCollBox.Enable(bEnable); + if(!bHtmlMode) + { + aPagenumText.Enable(bEnable); + aPagenumEdit.Enable(bEnable); + } + } + break; + + case STATE_NOCHECK: + case STATE_DONTKNOW: + aApplyCollBtn.SetState( STATE_NOCHECK ); + aApplyCollBtn.Enable(FALSE); + aApplyCollBox.Enable(FALSE); + aPagenumText.Enable(FALSE); + aPagenumEdit.Enable(FALSE); + aBreakTypeFT.Enable(FALSE); + aBreakTypeLB.Enable(FALSE); + aBreakPositionFT.Enable(FALSE); + aBreakPositionLB.Enable(FALSE); + break; + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxExtParagraphTabPage, KeepTogetherHdl_Impl, TriStateBox *, EMPTYARG ) +{ + BOOL bEnable = aKeepTogetherBox.GetState() == STATE_NOCHECK; + aWidowBox.Enable(bEnable); + aOrphanBox.Enable(bEnable); + + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxExtParagraphTabPage, WidowHdl_Impl, TriStateBox *, EMPTYARG ) +{ + switch ( aWidowBox.GetState() ) + { + case STATE_CHECK: + aWidowRowNo.Enable(); + aWidowRowLabel.Enable(); + aKeepTogetherBox.Enable(FALSE); + break; + + case STATE_NOCHECK: + if ( aOrphanBox.GetState() == STATE_NOCHECK ) + aKeepTogetherBox.Enable(); + + // kein break + case STATE_DONTKNOW: + aWidowRowNo.Enable(FALSE); + aWidowRowLabel.Enable(FALSE); + break; + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxExtParagraphTabPage, OrphanHdl_Impl, TriStateBox *, EMPTYARG ) +{ + switch( aOrphanBox.GetState() ) + { + case STATE_CHECK: + aOrphanRowNo.Enable(); + aOrphanRowLabel.Enable(); + aKeepTogetherBox.Enable(FALSE); + break; + + case STATE_NOCHECK: + if ( aWidowBox.GetState() == STATE_NOCHECK ) + aKeepTogetherBox.Enable(); + + // kein break + case STATE_DONTKNOW: + aOrphanRowNo.Enable(FALSE); + aOrphanRowLabel.Enable(FALSE); + break; + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxExtParagraphTabPage, HyphenClickHdl_Impl, TriStateBox *, EMPTYARG ) +{ + + BOOL bEnable = aHyphenBox.GetState() == STATE_CHECK; + aBeforeText.Enable(bEnable); + aExtHyphenBeforeBox.Enable(bEnable); + aAfterText.Enable(bEnable); + aExtHyphenAfterBox.Enable(bEnable); + aMaxHyphenLabel.Enable(bEnable); + aMaxHyphenEdit.Enable(bEnable); + aHyphenBox.SetState( bEnable ? STATE_CHECK : STATE_NOCHECK); + + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxExtParagraphTabPage, ApplyCollClickHdl_Impl, TriStateBox *, EMPTYARG ) +{ + BOOL bEnable = FALSE; + if ( aApplyCollBtn.GetState() == STATE_CHECK && + aApplyCollBox.GetEntryCount() ) + { + bEnable = TRUE; + aApplyCollBox.SelectEntryPos( nStdPos ); + } + else + { + aApplyCollBox.SetNoSelection(); + } + aApplyCollBox.Enable(bEnable); + if(!bHtmlMode) + { + aPagenumText.Enable(bEnable); + aPagenumEdit.Enable(bEnable); + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxExtParagraphTabPage, PageBreakPosHdl_Impl, ListBox *, pListBox ) +{ + if ( 0 == pListBox->GetSelectEntryPos() ) + { + aApplyCollBtn.Enable(); + + BOOL bEnable = aApplyCollBtn.GetState() == STATE_CHECK && + aApplyCollBox.GetEntryCount(); + + aApplyCollBox.Enable(bEnable); + if(!bHtmlMode) + { + aPagenumText.Enable(bEnable); + aPagenumEdit.Enable(bEnable); + } + } + else if ( 1 == pListBox->GetSelectEntryPos() ) + { + aApplyCollBtn.SetState( STATE_NOCHECK ); + aApplyCollBtn.Enable(FALSE); + aApplyCollBox.Enable(FALSE); + aPagenumText.Enable(FALSE); + aPagenumEdit.Enable(FALSE); + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxExtParagraphTabPage, PageBreakTypeHdl_Impl, ListBox *, pListBox ) +{ + //column break or break break after + USHORT nBreakPos = aBreakPositionLB.GetSelectEntryPos(); + if ( pListBox->GetSelectEntryPos() == 1 || 1 == nBreakPos) + { + aApplyCollBtn.SetState( STATE_NOCHECK ); + aApplyCollBtn.Enable(FALSE); + aApplyCollBox.Enable(FALSE); + aPagenumText.Enable(FALSE); + aPagenumEdit.Enable(FALSE); + } + else + PageBreakPosHdl_Impl( &aBreakPositionLB ); + return 0; +} +//Add CHINA001 begin +void SvxExtParagraphTabPage::PageCreated(SfxAllItemSet aSet) +{ + + + SFX_ITEMSET_ARG (&aSet,pDisablePageBreakItem,SfxBoolItem,SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,sal_False); + + if (pDisablePageBreakItem) + if ( pDisablePageBreakItem->GetValue()) + DisablePageBreak(); + + +} +//end of Add CHINA001 +/*-- 29.11.00 11:36:24--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SvxAsianTabPage::SvxAsianTabPage( Window* pParent, const SfxItemSet& rSet ) : + SfxTabPage(pParent, SVX_RES( RID_SVXPAGE_PARA_ASIAN ), rSet), + aOptionsFL( this, SVX_RES(FL_AS_OPTIONS )), + aForbiddenRulesCB( this, SVX_RES(CB_AS_FORBIDDEN )), + aHangingPunctCB( this, SVX_RES(CB_AS_HANG_PUNC )), + aScriptSpaceCB( this, SVX_RES(CB_AS_SCRIPT_SPACE ))//, + +{ + FreeResource(); + + Link aLink = LINK( this, SvxAsianTabPage, ClickHdl_Impl ); + aHangingPunctCB.SetClickHdl( aLink ); + aScriptSpaceCB.SetClickHdl( aLink ); + aForbiddenRulesCB.SetClickHdl( aLink ); + +} +/*-- 29.11.00 11:36:24--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SvxAsianTabPage::~SvxAsianTabPage() +{ +} +/*-- 29.11.00 11:36:24--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SfxTabPage* SvxAsianTabPage::Create( Window* pParent, const SfxItemSet& rSet ) +{ + return new SvxAsianTabPage(pParent, rSet); +} +/*-- 29.11.00 11:36:24--------------------------------------------------- + + -----------------------------------------------------------------------*/ +USHORT* SvxAsianTabPage::GetRanges() +{ + static USHORT pRanges[] = + { + SID_ATTR_PARA_SCRIPTSPACE, SID_ATTR_PARA_FORBIDDEN_RULES, + 0 + }; + return pRanges; +} +/*-- 29.11.00 11:36:24--------------------------------------------------- + + -----------------------------------------------------------------------*/ +BOOL SvxAsianTabPage::FillItemSet( SfxItemSet& rSet ) +{ + BOOL bRet = FALSE; + SfxItemPool* pPool = rSet.GetPool(); + if(aScriptSpaceCB.IsChecked() != aScriptSpaceCB.GetSavedValue()) + { + SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get( + pPool->GetWhich(SID_ATTR_PARA_SCRIPTSPACE)).Clone(); + pNewItem->SetValue(aScriptSpaceCB.IsChecked()); + rSet.Put(*pNewItem); + delete pNewItem; + bRet = TRUE; + } + if(aHangingPunctCB.IsChecked() != aHangingPunctCB.GetSavedValue()) + { + SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get( + pPool->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION)).Clone(); + pNewItem->SetValue(aHangingPunctCB.IsChecked()); + rSet.Put(*pNewItem); + delete pNewItem; + bRet = TRUE; + } + if(aForbiddenRulesCB.IsChecked() != aForbiddenRulesCB.GetSavedValue()) + { + SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get( + pPool->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone(); + pNewItem->SetValue(aForbiddenRulesCB.IsChecked()); + rSet.Put(*pNewItem); + delete pNewItem; + bRet = TRUE; + } + return bRet; +} +/*-- 29.11.00 11:36:25--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void lcl_SetBox(const SfxItemSet& rSet, USHORT nSlotId, TriStateBox& rBox) +{ + USHORT _nWhich = rSet.GetPool()->GetWhich(nSlotId); + SfxItemState eState = rSet.GetItemState(_nWhich, TRUE); + if(!eState || eState == SFX_ITEM_DISABLED ) + rBox.Enable(FALSE); + else if(eState >= SFX_ITEM_AVAILABLE) + { + rBox.EnableTriState( FALSE ); + rBox.Check(((const SfxBoolItem&)rSet.Get(_nWhich)).GetValue()); + } + else + rBox.SetState( STATE_DONTKNOW ); + rBox.SaveValue(); +} + + +void SvxAsianTabPage::Reset( const SfxItemSet& rSet ) +{ + lcl_SetBox(rSet, SID_ATTR_PARA_FORBIDDEN_RULES, aForbiddenRulesCB ); +// lcl_SetBox(rSet, , aAllowWordBreakCB ); + lcl_SetBox(rSet, SID_ATTR_PARA_HANGPUNCTUATION, aHangingPunctCB ); + + + //character distance not yet available +// lcl_SetBox(rSet, , aPuntuationCB ); + lcl_SetBox(rSet, SID_ATTR_PARA_SCRIPTSPACE, aScriptSpaceCB ); +// lcl_SetBox(rSet, , aAdjustNumbersCB ); +// aAllowWordBreakCB .Enable(FALSE); +// aPuntuationCB .Enable(FALSE); +// aAdjustNumbersCB .Enable(FALSE); +} +/* -----------------------------19.12.00 12:59-------------------------------- + + ---------------------------------------------------------------------------*/ +IMPL_LINK( SvxAsianTabPage, ClickHdl_Impl, TriStateBox*, pBox ) +{ + pBox->EnableTriState( FALSE ); + return 0; +} diff --git a/cui/source/tabpages/paragrph.hrc b/cui/source/tabpages/paragrph.hrc new file mode 100644 index 000000000000..6b0b835b07e3 --- /dev/null +++ b/cui/source/tabpages/paragrph.hrc @@ -0,0 +1,124 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: paragrph.hrc,v $ + * $Revision: 1.19 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_PARAGRPH_HRC +#define _SVX_PARAGRPH_HRC + +// StandardTabPage ---------------------------------------------------------- + +#define FT_LEFTINDENT 10 +#define ED_LEFTINDENT 11 +#define FT_FLINEINDENT 12 +#define ED_FLINEINDENT 13 +#define FT_RIGHTINDENT 14 +#define ED_RIGHTINDENT 15 +#define FL_INDENT 16 + +#define FT_TOPDIST 20 +#define ED_TOPDIST 21 +#define FT_BOTTOMDIST 22 +#define ED_BOTTOMDIST 23 +#define FL_DIST 24 + +#define BTN_LEFTALIGN 30 +#define BTN_RIGHTALIGN 31 +#define BTN_CENTERALIGN 32 +#define BTN_JUSTIFYALIGN 33 +#define FL_ALIGN 34 +#define FL_VERTALIGN 35 +#define LB_VERTALIGN 36 +#define FL_VERTEX 37 +#define CB_SNAP 38 +#define FT_VERTALIGN 39 + + +#define LB_LINEDIST 40 +#define FT_LINEDIST 41 +#define ED_LINEDISTPERCENT 42 +#define ED_LINEDISTMETRIC 43 +#define FL_LINEDIST 44 +#define WN_EXAMPLE 46 + +#define CB_AUTO 48 +#define FT_LASTLINE 49 +#define LB_LASTLINE 50 +#define CB_EXPAND 51 +#define ST_LINEDIST_ABS 52 +#define ST_LEFTALIGN_ASIAN 53 +#define ST_RIGHTALIGN_ASIAN 54 + +// ExtendedTabPage ---------------------------------------------------------- + +#define BTN_HYPHEN 50 +#define ED_HYPHENBEFORE 52 +#define FT_HYPHENBEFORE 53 +#define ED_HYPHENAFTER 55 +#define FT_HYPHENAFTER 56 +#define FL_HYPHEN 57 + +#define BTN_PAGEBREAK 60 +#define FT_BREAKTYPE 61 +#define LB_BREAKTYPE 62 +#define FT_BREAKPOSITION 63 +#define LB_BREAKPOSITION 64 +#define BTN_PAGECOLL 65 +#define LB_PAGECOLL 66 +#define BTN_KEEPTOGETHER 67 +#define BTN_WIDOWS 68 +#define ED_WIDOWS 69 +#define FT_WIDOWS 70 +#define BTN_ORPHANS 71 +#define ED_ORPHANS 72 +#define FT_ORPHANS 73 +#define FL_OPTIONS 74 +#define FT_PAGENUM 75 +#define ED_PAGENUM 76 +#define FL_BREAKS 77 + +#define CB_KEEPTOGETHER 80 +#define FT_MAXHYPH 81 +#define ED_MAXHYPH 83 + +#define CB_REGISTER 84 +#define FL_REGISTER 85 +#define FL_PROPERTIES 90 +#define FT_TEXTDIRECTION 91 +#define LB_TEXTDIRECTION 92 + + +//asian typography +#define FL_AS_OPTIONS 1 +#define CB_AS_HANG_PUNC 2 + +#define CB_AS_FORBIDDEN 4 + +#define CB_AS_SCRIPT_SPACE 7 + +#endif + diff --git a/cui/source/tabpages/paragrph.src b/cui/source/tabpages/paragrph.src new file mode 100644 index 000000000000..996242dccbda --- /dev/null +++ b/cui/source/tabpages/paragrph.src @@ -0,0 +1,734 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: paragrph.src,v $ + * $Revision: 1.85 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include +#include "helpid.hrc" +#include "paragrph.hrc" + + // RID_SVXPAGE_STD_PARAGRAPH --------------------------------------------- +TabPage RID_SVXPAGE_STD_PARAGRAPH +{ + HelpId = HID_FORMAT_PARAGRAPH_STD ; + Hide = TRUE ; + Text [ en-US ] = "Indents and Spacing" ; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedText FT_LEFTINDENT + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 120 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "Before text" ; + }; + MetricField ED_LEFTINDENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 135 , 14 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_RIGHTINDENT + { + Pos = MAP_APPFONT ( 12 , 32 ) ; + Size = MAP_APPFONT ( 120 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "After text" ; + }; + MetricField ED_RIGHTINDENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 135 , 30 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_FLINEINDENT + { + Pos = MAP_APPFONT ( 12 , 48 ) ; + Size = MAP_APPFONT ( 120 , 8 ) ; + Text [ en-US ] = "~First line" ; + Left = TRUE ; + }; + MetricField ED_FLINEINDENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 135 , 46 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -9999 ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = -9999 ; + Last = 9999 ; + SpinSize = 10 ; + }; + CheckBox CB_AUTO + { + Pos = MAP_APPFONT ( 12 , 61 ) ; + Size = MAP_APPFONT ( 120 , 10 ) ; + Hide = TRUE ; + Text [ en-US ] = "~Automatic" ; + }; + FixedLine FL_INDENT + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 173 , 8 ) ; + Text [ en-US ] = "Indent" ; + }; + FixedText FT_TOPDIST + { + Pos = MAP_APPFONT ( 12 , 90 ) ; + Size = MAP_APPFONT ( 120 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "Ab~ove paragraph" ; + }; + MetricField ED_TOPDIST + { + Border = TRUE ; + Pos = MAP_APPFONT ( 135 , 88 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_BOTTOMDIST + { + Pos = MAP_APPFONT ( 12 , 104 ) ; + Size = MAP_APPFONT ( 120 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "Below paragraph" ; + }; + MetricField ED_BOTTOMDIST + { + Border = TRUE ; + Pos = MAP_APPFONT ( 135 , 104 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedLine FL_DIST + { + Pos = MAP_APPFONT ( 6 , 77 ) ; + Size = MAP_APPFONT ( 173 , 8 ) ; + Text [ en-US ] = "Spacing" ; + }; + ListBox LB_LINEDIST + { + Pos = MAP_APPFONT ( 12 , 133 ) ; + Size = MAP_APPFONT ( 55 , 72 ) ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Single" ; Default ; > ; + < "1.5 lines" ; Default ; > ; + < "Double" ; Default ; > ; + < "Proportional" ; Default ; > ; + < "At least" ; Default ; > ; + < "Leading" ; Default ; > ; + }; + }; + String ST_LINEDIST_ABS + { + Text [ en-US ] = "Fixed" ; + }; + FixedText FT_LINEDIST + { + Disable = TRUE ; + Pos = MAP_APPFONT ( 70 , 135 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "of" ; + Left = TRUE ; + }; + MetricField ED_LINEDISTPERCENT + { + Disable = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 135 , 133 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 50 ; + Maximum = 200 ; + Value = 100 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + First = 50 ; + Last = 200 ; + SpinSize = 1 ; + }; + MetricField ED_LINEDISTMETRIC + { + Disable = TRUE ; + Border = TRUE ; + Hide = TRUE ; + Pos = MAP_APPFONT ( 135 , 133 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedLine FL_LINEDIST + { + Pos = MAP_APPFONT ( 6 , 122 ) ; + Size = MAP_APPFONT ( 173 , 8 ) ; + Text [ en-US ] = "Line spacing" ; + }; + Window WN_EXAMPLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 185 , 7 ) ; + Size = MAP_APPFONT ( 68 , 112 ) ; + }; + CheckBox CB_REGISTER + { + Pos = MAP_APPFONT ( 12 , 162 ) ; + Size = MAP_APPFONT ( 120 , 10 ) ; + Hide = TRUE ; + Text [ en-US ] = "A~ctivate" ; + }; + FixedLine FL_REGISTER + { + Pos = MAP_APPFONT ( 6 , 151 ) ; + Size = MAP_APPFONT ( 173 , 8 ) ; + Hide = TRUE ; + Text [ en-US ] = "Register-true" ; + }; + +}; + // RID_SVXPAGE_ALIGN_PARAGRAPH --------------------------------------------- +TabPage RID_SVXPAGE_ALIGN_PARAGRAPH +{ + HelpId = HID_FORMAT_PARAGRAPH_ALIGN ; + Hide = TRUE ; + Text [ en-US ] = "Alignment" ; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedLine FL_ALIGN + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 173 , 8 ) ; + Text [ en-US ] = "Options" ; + Group = TRUE ; + }; + RadioButton BTN_LEFTALIGN + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 161 , 10 ) ; + Text [ en-US ] = "~Left" ; + Group = TRUE ; + }; + RadioButton BTN_RIGHTALIGN + { + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 161 , 10 ) ; + Text [ en-US ] = "Righ~t" ; + }; + RadioButton BTN_CENTERALIGN + { + Pos = MAP_APPFONT ( 12 , 42 ) ; + Size = MAP_APPFONT ( 161 , 10 ) ; + Text [ en-US ] = "~Center" ; + }; + RadioButton BTN_JUSTIFYALIGN + { + Pos = MAP_APPFONT ( 12 , 56 ) ; + Size = MAP_APPFONT ( 161 , 10 ) ; + Text [ en-US ] = "Justified" ; + }; + String ST_LEFTALIGN_ASIAN + { + Text [ en-US ] = "~Left/Top" ; + }; + String ST_RIGHTALIGN_ASIAN + { + Text [ en-US ] = "Righ~t/Bottom" ; + }; + FixedText FT_LASTLINE + { + Pos = MAP_APPFONT ( 20 , 72 ) ; + Size = MAP_APPFONT ( 80 , 8 ) ; + Hide = TRUE ; + Text [ en-US ] = "~Last line" ; + }; + ListBox LB_LASTLINE + { + Pos = MAP_APPFONT ( 105 , 70 ) ; + Size = MAP_APPFONT ( 70 , 50 ) ; + DropDown = TRUE ; + Hide = TRUE ; + StringList [ en-US ] = + { + < "Default" ; Default ; > ; + < "Left" ; Default ; > ; + < "Centered" ; Default ; > ; + < "Justified"; Default; > ; + }; + }; + CheckBox CB_EXPAND + { + Pos = MAP_APPFONT ( 20 , 86 ) ; + Size = MAP_APPFONT ( 153 , 10 ) ; + Hide = TRUE ; + Text [ en-US ] = "~Expand single word" ; + }; + CheckBox CB_SNAP + { + Pos = MAP_APPFONT ( 20 , 100 ) ; + Size = MAP_APPFONT ( 153 , 10 ) ; + Hide = TRUE ; + Text [ en-US ] = "Snap to text grid (if active)"; + }; + Window WN_EXAMPLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 185 , 7 ) ; + Size = MAP_APPFONT ( 68 , 112 ) ; + }; + FixedLine FL_VERTALIGN + { + Pos = MAP_APPFONT ( 6 , 122 ) ; + Size = MAP_APPFONT ( 173 , 8 ) ; + Hide = TRUE; + Text [ en-US ] = "Text-to-text"; + }; + FixedText FT_VERTALIGN + { + Pos = MAP_APPFONT ( 12 , 135 ) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Hide = TRUE; + Text [ en-US ] = "~Alignment"; + }; + ListBox LB_VERTALIGN + { + Pos = MAP_APPFONT ( 105 , 133 ) ; + Size = MAP_APPFONT ( 70 , 50 ) ; + DropDown = TRUE ; + Hide = TRUE ; + StringList [ en-US ] = + { + < "Automatic" ; > ; + < "Base line" ; > ; + < "Top" ; > ; + < "Middle" ; > ; + < "Bottom" ; > ; + }; + }; + FixedLine FL_PROPERTIES + { + Pos = MAP_APPFONT ( 6 , 154 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Hide = TRUE ; + Text [ en-US ] = "Properties"; + }; + FixedText FT_TEXTDIRECTION + { + Pos = MAP_APPFONT ( 12 , 167 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Hide = TRUE ; + Text [ en-US ] = "Text ~direction"; + }; + ListBox LB_TEXTDIRECTION + { + Border = TRUE ; + Pos = MAP_APPFONT ( 105 , 165 ) ; + Size = MAP_APPFONT ( 146 , 50 ) ; + DropDown = TRUE ; + Hide = TRUE ; + }; +}; + // RID_SVXPAGE_EXT_PARAGRAPH --------------------------------------------- +TabPage RID_SVXPAGE_EXT_PARAGRAPH +{ + HelpId = HID_FORMAT_PARAGRAPH_EXT ; + Hide = TRUE ; + Text [ en-US ] = "Text Flow" ; + Size = MAP_APPFONT ( 260 , 185 ) ; + TriStateBox BTN_HYPHEN + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 236 , 10 ) ; + Text [ en-US ] = "A~utomatically" ; + }; + NumericField ED_HYPHENBEFORE + { + Disable = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 21 , 26 ) ; + Size = MAP_APPFONT ( 24 , 12 ) ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 2 ; + Maximum = 9 ; + Value = 2 ; + First = 2 ; + Last = 9 ; + }; + FixedText FT_HYPHENBEFORE + { + Disable = TRUE ; + Pos = MAP_APPFONT ( 48 , 29 ) ; + Size = MAP_APPFONT ( 200 , 8 ) ; + Text [ en-US ] = "C~haracters at line end" ; + Left = TRUE ; + }; + NumericField ED_HYPHENAFTER + { + Disable = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 21 , 41 ) ; + Size = MAP_APPFONT ( 24 , 12 ) ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 2 ; + Maximum = 9 ; + Value = 2 ; + First = 2 ; + Last = 9 ; + }; + FixedText FT_HYPHENAFTER + { + Disable = TRUE ; + Pos = MAP_APPFONT ( 48 , 43 ) ; + Size = MAP_APPFONT ( 200 , 8 ) ; + Text [ en-US ] = "Cha~racters at line begin" ; + Left = TRUE ; + }; + FixedText FT_MAXHYPH + { + Pos = MAP_APPFONT ( 48 , 57 ) ; + Size = MAP_APPFONT ( 200 , 8 ) ; + WordBreak = TRUE ; + Text [ en-US ] = "~Maximum number of consecutive hyphens" ; + }; + NumericField ED_MAXHYPH + { + Border = TRUE ; + Pos = MAP_APPFONT ( 21 , 55 ) ; + Size = MAP_APPFONT ( 24 , 12 ) ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 99 ; + Last = 99 ; + }; + FixedLine FL_HYPHEN + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Hyphenation" ; + }; + FixedLine FL_OPTIONS + { // is moved one section deeper to not raise unnecessary translations + Pos = MAP_APPFONT ( 6 , 116 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Options" ; + Group = TRUE ; + }; + FixedLine FL_BREAKS + { + Pos = MAP_APPFONT ( 6 , 73 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Breaks" ; + Group = TRUE ; + }; + TriStateBox BTN_PAGEBREAK + { + // Disable = TRUE; + Pos = MAP_APPFONT ( 12 , 86 ) ; + Size = MAP_APPFONT ( 61 , 10 ) ; + Text [ en-US ] = "Insert" ; + Group = TRUE ; + }; + FixedText FT_BREAKTYPE + { + Pos = MAP_APPFONT ( 75 , 86 ) ; + Size = MAP_APPFONT ( 21 , 10 ) ; + Text [ en-US ] = "~Type"; + }; + ListBox LB_BREAKTYPE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 98 , 84 ) ; + Size = MAP_APPFONT ( 61 , 50 ) ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Page" ; 0; > ; + < "Column" ; 1; > ; + }; + }; + FixedText FT_BREAKPOSITION + { + Pos = MAP_APPFONT ( 163 , 86 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + Right = TRUE; + Text [ en-US ] = "Position"; + }; + ListBox LB_BREAKPOSITION + { + Border = TRUE ; + Pos = MAP_APPFONT ( 211 , 84 ) ; + Size = MAP_APPFONT ( 40 , 50 ) ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Before" ; 0; > ; + < "After" ; 1; > ; + }; + }; + TriStateBox BTN_PAGECOLL + { + // Disable = TRUE; + Pos = MAP_APPFONT (21 , 100 ) ; + Size = MAP_APPFONT ( 75 , 10 ) ; + Text [ en-US ] = "With Page St~yle" ; + Group = TRUE ; + }; + ListBox LB_PAGECOLL + { + // Disable = TRUE; + Pos = MAP_APPFONT ( 98 , 98 ) ; + Size = MAP_APPFONT ( 61 , 50 ) ; + DropDown = TRUE ; + Sort = TRUE; + }; + FixedText FT_PAGENUM + { + Pos = MAP_APPFONT ( 163 , 100 ) ; + Size = MAP_APPFONT ( 45 , 8 ) ; + Right = TRUE ; + Text [ en-US ] = "Page ~number" ; + }; + NumericField ED_PAGENUM + { + Border = TRUE ; + Pos = MAP_APPFONT ( 211 , 98 ) ; + Size = MAP_APPFONT ( 26 , 12 ) ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 9999 ; + Value = 0 ; + First = 0 ; + Last = 9999 ; + }; + TriStateBox BTN_KEEPTOGETHER + { + Pos = MAP_APPFONT ( 12 , 127 ) ; + Size = MAP_APPFONT ( 236 , 10 ) ; + Text [ en-US ] = "~Do not split paragraph" ; + Group = TRUE ; + }; + TriStateBox CB_KEEPTOGETHER + { + Pos = MAP_APPFONT ( 12, 141 ) ; + Size = MAP_APPFONT ( 236 , 10 ) ; + Text [ en-US ] = "~Keep with next paragraph" ; + }; + TriStateBox BTN_ORPHANS + { + Disable = TRUE ; + Pos = MAP_APPFONT ( 12 , 155 ) ; + Size = MAP_APPFONT ( 120 , 10 ) ; + Group = TRUE ; + Text [ en-US ] = "~Orphan control"; + }; + NumericField ED_ORPHANS + { + Disable = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 134 , 153 ) ; + Size = MAP_APPFONT ( 24 , 12 ) ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 2 ; + Maximum = 9 ; + Value = 2 ; + First = 2 ; + Last = 9 ; + }; + FixedText FT_ORPHANS + { + Disable = TRUE ; + Pos = MAP_APPFONT ( 161 , 155 ) ; + Size = MAP_APPFONT ( 86 , 8 ) ; + Text [ en-US ] = "Lines" ; + Left = TRUE ; + }; + TriStateBox BTN_WIDOWS + { + Disable = TRUE ; + Pos = MAP_APPFONT ( 12 , 169 ) ; + Size = MAP_APPFONT ( 120 , 10 ) ; + Group = TRUE ; + Text [ en-US ] = "~Widow control"; + }; + NumericField ED_WIDOWS + { + Disable = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 134 , 167 ) ; + Size = MAP_APPFONT ( 24 , 12 ) ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 2 ; + Maximum = 9 ; + Value = 2 ; + First = 2 ; + Last = 9 ; + }; + FixedText FT_WIDOWS + { + Disable = TRUE ; + Pos = MAP_APPFONT ( 161 , 169 ) ; + Size = MAP_APPFONT ( 86 , 8 ) ; + Text [ en-US ] = "Lines" ; + Left = TRUE ; + }; +}; +/*-- 29.11.00 11:36:24--------------------------------------------------- + Asian typography + -----------------------------------------------------------------------*/ +TabPage RID_SVXPAGE_PARA_ASIAN +{ + HelpId = HID_SVXPAGE_PARA_ASIAN ; + Hide = TRUE ; + Text [ en-US ] = "Asian Typography"; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedLine FL_AS_OPTIONS + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Line change"; + }; + TriStateBox CB_AS_FORBIDDEN + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + Text [ en-US ] = "Apply list of forbidden characters to the beginning and end of lines"; + }; + TriStateBox CB_AS_HANG_PUNC + { + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + Text [ en-US ] = "Allow hanging punctuation"; + }; + TriStateBox CB_AS_SCRIPT_SPACE + { + Pos = MAP_APPFONT ( 12 , 42 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + Text [ en-US ] = "Apply spacing between Asian, Latin and Complex text"; + }; +}; + +// ********************************************************************** EOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx new file mode 100644 index 000000000000..09168fc9a16e --- /dev/null +++ b/cui/source/tabpages/swpossizetabpage.cxx @@ -0,0 +1,1973 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: swpossizetabpage.cxx,v $ + * $Revision: 1.17 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace ::com::sun::star::text; +#define SwFPos SvxSwFramePosString + +struct FrmMap +{ + SvxSwFramePosString::StringId eStrId; + SvxSwFramePosString::StringId eMirrorStrId; + short nAlign; + ULONG nLBRelations; +}; + +struct RelationMap +{ + SvxSwFramePosString::StringId eStrId; + SvxSwFramePosString::StringId eMirrorStrId; + ULONG nLBRelation; + short nRelation; +}; +struct StringIdPair_Impl +{ + SvxSwFramePosString::StringId eHori; + SvxSwFramePosString::StringId eVert; +}; + +#define LB_FRAME 0x00000001L // paragraph text area +#define LB_PRTAREA 0x00000002L // paragraph text area + indents +#define LB_VERT_FRAME 0x00000004L // vertical paragraph text area +#define LB_VERT_PRTAREA 0x00000008L // vertical paragraph text area + indents +#define LB_REL_FRM_LEFT 0x00000010L // left paragraph margin +#define LB_REL_FRM_RIGHT 0x00000020L // right paragraph margin + +#define LB_REL_PG_LEFT 0x00000040L // left page margin +#define LB_REL_PG_RIGHT 0x00000080L // right page margin +#define LB_REL_PG_FRAME 0x00000100L // complete page +#define LB_REL_PG_PRTAREA 0x00000200L // text area of page + +#define LB_FLY_REL_PG_LEFT 0x00000400L // left frame margin +#define LB_FLY_REL_PG_RIGHT 0x00000800L // right frame margin +#define LB_FLY_REL_PG_FRAME 0x00001000L // complete frame +#define LB_FLY_REL_PG_PRTAREA 0x00002000L // frame interior + +#define LB_REL_BASE 0x00010000L // as char, relative to baseline +#define LB_REL_CHAR 0x00020000L // as char, relative to character +#define LB_REL_ROW 0x00040000L // as char, relative to line + +// OD 10.11.2003 #i22305# +#define LB_FLY_VERT_FRAME 0x00100000L // vertical entire frame +#define LB_FLY_VERT_PRTAREA 0x00200000L // vertical frame text area + +// OD 11.11.2003 #i22341# +#define LB_VERT_LINE 0x00400000L // vertical text line + +static RelationMap __FAR_DATA aRelationMap[] = +{ + {SwFPos::FRAME, SwFPos::FRAME, LB_FRAME, RelOrientation::FRAME}, + {SwFPos::PRTAREA, SwFPos::PRTAREA, LB_PRTAREA, RelOrientation::PRINT_AREA}, + {SwFPos::REL_PG_LEFT, SwFPos::MIR_REL_PG_LEFT, LB_REL_PG_LEFT, RelOrientation::PAGE_LEFT}, + {SwFPos::REL_PG_RIGHT, SwFPos::MIR_REL_PG_RIGHT, LB_REL_PG_RIGHT, RelOrientation::PAGE_RIGHT}, + {SwFPos::REL_FRM_LEFT, SwFPos::MIR_REL_FRM_LEFT, LB_REL_FRM_LEFT, RelOrientation::FRAME_LEFT}, + {SwFPos::REL_FRM_RIGHT, SwFPos::MIR_REL_FRM_RIGHT, LB_REL_FRM_RIGHT, RelOrientation::FRAME_RIGHT}, + {SwFPos::REL_PG_FRAME, SwFPos::REL_PG_FRAME, LB_REL_PG_FRAME, RelOrientation::PAGE_FRAME}, + {SwFPos::REL_PG_PRTAREA,SwFPos::REL_PG_PRTAREA, LB_REL_PG_PRTAREA, RelOrientation::PAGE_PRINT_AREA}, + {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB_REL_CHAR, RelOrientation::CHAR}, + + {SwFPos::FLY_REL_PG_LEFT, SwFPos::FLY_MIR_REL_PG_LEFT, LB_FLY_REL_PG_LEFT, RelOrientation::PAGE_LEFT}, + {SwFPos::FLY_REL_PG_RIGHT, SwFPos::FLY_MIR_REL_PG_RIGHT, LB_FLY_REL_PG_RIGHT, RelOrientation::PAGE_RIGHT}, + {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB_FLY_REL_PG_FRAME, RelOrientation::PAGE_FRAME}, + {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB_FLY_REL_PG_PRTAREA, RelOrientation::PAGE_PRINT_AREA}, + + {SwFPos::REL_BORDER, SwFPos::REL_BORDER, LB_VERT_FRAME, RelOrientation::FRAME}, + {SwFPos::REL_PRTAREA, SwFPos::REL_PRTAREA, LB_VERT_PRTAREA, RelOrientation::PRINT_AREA}, + + // OD 10.11.2003 #i22305# + {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB_FLY_VERT_FRAME, RelOrientation::FRAME}, + {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB_FLY_VERT_PRTAREA, RelOrientation::PRINT_AREA}, + + // OD 11.11.2003 #i22341# + {SwFPos::REL_LINE, SwFPos::REL_LINE, LB_VERT_LINE, RelOrientation::TEXT_LINE} +}; + +static RelationMap __FAR_DATA aAsCharRelationMap[] = +{ + {SwFPos::REL_BASE, SwFPos::REL_BASE, LB_REL_BASE, RelOrientation::FRAME}, + {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB_REL_CHAR, RelOrientation::FRAME}, + {SwFPos::REL_ROW, SwFPos::REL_ROW, LB_REL_ROW, RelOrientation::FRAME} +}; + +/*-------------------------------------------------------------------- + Anchored at page + --------------------------------------------------------------------*/ + +#define HORI_PAGE_REL (LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_PG_LEFT| \ + LB_REL_PG_RIGHT) + +static FrmMap __FAR_DATA aHPageMap[] = +{ + {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, HORI_PAGE_REL}, + {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HORI_PAGE_REL}, + {SwFPos::CENTER_HORI,SwFPos::CENTER_HORI, HoriOrientation::CENTER, HORI_PAGE_REL}, + {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, HORI_PAGE_REL} +}; + +static FrmMap __FAR_DATA aHPageHtmlMap[] = +{ + {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, LB_REL_PG_FRAME} +}; + +#define VERT_PAGE_REL (LB_REL_PG_FRAME|LB_REL_PG_PRTAREA) + +static FrmMap __FAR_DATA aVPageMap[] = +{ + {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, VERT_PAGE_REL}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, VERT_PAGE_REL}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, VERT_PAGE_REL}, + {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, VERT_PAGE_REL} +}; + +static FrmMap __FAR_DATA aVPageHtmlMap[] = +{ + {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, LB_REL_PG_FRAME} +}; + +/*-------------------------------------------------------------------- + Anchored at frame + --------------------------------------------------------------------*/ + +#define HORI_FRAME_REL (LB_FLY_REL_PG_FRAME|LB_FLY_REL_PG_PRTAREA| \ + LB_FLY_REL_PG_LEFT|LB_FLY_REL_PG_RIGHT) + +static FrmMap __FAR_DATA aHFrameMap[] = +{ + {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, HORI_FRAME_REL}, + {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HORI_FRAME_REL}, + {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, HoriOrientation::CENTER, HORI_FRAME_REL}, + {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, HORI_FRAME_REL} +}; + +static FrmMap __FAR_DATA aHFlyHtmlMap[] = +{ + {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, LB_FLY_REL_PG_FRAME}, + {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, LB_FLY_REL_PG_FRAME} +}; + +// OD 19.09.2003 #i18732# - own vertical alignment map for to frame anchored objects +// OD 10.11.2003 #i22305# +#define VERT_FRAME_REL (LB_VERT_FRAME|LB_FLY_VERT_PRTAREA) + +static FrmMap __FAR_DATA aVFrameMap[] = +{ + {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, VERT_FRAME_REL}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, VERT_FRAME_REL}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, VERT_FRAME_REL}, + {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, VERT_FRAME_REL} +}; + +static FrmMap __FAR_DATA aVFlyHtmlMap[] = +{ + {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_FLY_VERT_FRAME}, + {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, LB_FLY_VERT_FRAME} +}; + +static FrmMap __FAR_DATA aVMultiSelectionMap[] = +{ + {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, 0} +}; +static FrmMap __FAR_DATA aHMultiSelectionMap[] = +{ + {SwFPos::FROMLEFT, SwFPos::FROMLEFT, HoriOrientation::NONE, 0} +}; + +/*-------------------------------------------------------------------- + Anchored at paragraph + --------------------------------------------------------------------*/ + +#define HORI_PARA_REL (LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \ + LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \ + LB_REL_FRM_RIGHT) + +static FrmMap __FAR_DATA aHParaMap[] = +{ + {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, HORI_PARA_REL}, + {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HORI_PARA_REL}, + {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, HoriOrientation::CENTER, HORI_PARA_REL}, + {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, HORI_PARA_REL} +}; + +#define HTML_HORI_PARA_REL (LB_FRAME|LB_PRTAREA) + +static FrmMap __FAR_DATA aHParaHtmlMap[] = +{ + {SwFPos::LEFT, SwFPos::LEFT, HoriOrientation::LEFT, HTML_HORI_PARA_REL}, + {SwFPos::RIGHT, SwFPos::RIGHT, HoriOrientation::RIGHT, HTML_HORI_PARA_REL} +}; + +static FrmMap __FAR_DATA aHParaHtmlAbsMap[] = +{ + {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, HTML_HORI_PARA_REL}, + {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HTML_HORI_PARA_REL} +}; + + +#define VERT_PARA_REL (LB_VERT_FRAME|LB_VERT_PRTAREA| \ + LB_REL_PG_FRAME|LB_REL_PG_PRTAREA) + +static FrmMap __FAR_DATA aVParaMap[] = +{ + {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, VERT_PARA_REL}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, VERT_PARA_REL}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, VERT_PARA_REL}, + {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, VERT_PARA_REL} +}; + +static FrmMap __FAR_DATA aVParaHtmlMap[] = +{ + {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_VERT_PRTAREA} +}; + +/*-------------------------------------------------------------------- + Anchored at character + --------------------------------------------------------------------*/ + +#define HORI_CHAR_REL (LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \ + LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \ + LB_REL_FRM_RIGHT|LB_REL_CHAR) + +static FrmMap __FAR_DATA aHCharMap[] = +{ + {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, HORI_CHAR_REL}, + {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HORI_CHAR_REL}, + {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, HoriOrientation::CENTER, HORI_CHAR_REL}, + {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, HORI_CHAR_REL} +}; + +#define HTML_HORI_CHAR_REL (LB_FRAME|LB_PRTAREA|LB_REL_CHAR) + +static FrmMap __FAR_DATA aHCharHtmlMap[] = +{ + {SwFPos::LEFT, SwFPos::LEFT, HoriOrientation::LEFT, HTML_HORI_CHAR_REL}, + {SwFPos::RIGHT, SwFPos::RIGHT, HoriOrientation::RIGHT, HTML_HORI_CHAR_REL} +}; + +static FrmMap __FAR_DATA aHCharHtmlAbsMap[] = +{ + {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, LB_PRTAREA|LB_REL_CHAR}, + {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, LB_PRTAREA}, + {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, LB_REL_PG_FRAME} +}; + +// OD 19.09.2003 #i18732# - allow vertical alignment at page areas +// OD 12.11.2003 #i22341# - handle on its own +#define VERT_CHAR_REL (LB_VERT_FRAME|LB_VERT_PRTAREA| \ + LB_REL_PG_FRAME|LB_REL_PG_PRTAREA) + +static FrmMap __FAR_DATA aVCharMap[] = +{ + // OD 11.11.2003 #i22341# + // introduce mappings for new vertical alignment at top of line + // and correct mapping for vertical alignment at character for position + // Note: Because of these adjustments the map becomes ambigous in its values + // / and . These ambiguities are considered + // in the methods , + // and + {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, VERT_CHAR_REL|LB_REL_CHAR}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, VERT_CHAR_REL|LB_REL_CHAR}, + {SwFPos::BELOW, SwFPos::BELOW, VertOrientation::CHAR_BOTTOM, LB_REL_CHAR}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, VERT_CHAR_REL|LB_REL_CHAR}, + {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, VERT_CHAR_REL}, + {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, VertOrientation::NONE, LB_REL_CHAR|LB_VERT_LINE}, + {SwFPos::TOP, SwFPos::TOP, VertOrientation::LINE_TOP, LB_VERT_LINE}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::LINE_BOTTOM, LB_VERT_LINE}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::LINE_CENTER, LB_VERT_LINE} +}; + + +static FrmMap __FAR_DATA aVCharHtmlMap[] = +{ + {SwFPos::BELOW, SwFPos::BELOW, VertOrientation::CHAR_BOTTOM, LB_REL_CHAR} +}; + +static FrmMap __FAR_DATA aVCharHtmlAbsMap[] = +{ + {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_REL_CHAR}, + {SwFPos::BELOW, SwFPos::BELOW, VertOrientation::CHAR_BOTTOM, LB_REL_CHAR} +}; +/*-------------------------------------------------------------------- + anchored as character + --------------------------------------------------------------------*/ + +static FrmMap __FAR_DATA aVAsCharMap[] = +{ + {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_REL_BASE}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, LB_REL_BASE}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, LB_REL_BASE}, + + {SwFPos::TOP, SwFPos::TOP, VertOrientation::CHAR_TOP, LB_REL_CHAR}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::CHAR_BOTTOM, LB_REL_CHAR}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CHAR_CENTER, LB_REL_CHAR}, + + {SwFPos::TOP, SwFPos::TOP, VertOrientation::LINE_TOP, LB_REL_ROW}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::LINE_BOTTOM, LB_REL_ROW}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::LINE_CENTER, LB_REL_ROW}, + + {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, VertOrientation::NONE, LB_REL_BASE} +}; + +static FrmMap __FAR_DATA aVAsCharHtmlMap[] = +{ + {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_REL_BASE}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, LB_REL_BASE}, + + {SwFPos::TOP, SwFPos::TOP, VertOrientation::CHAR_TOP, LB_REL_CHAR}, + + {SwFPos::TOP, SwFPos::TOP, VertOrientation::LINE_TOP, LB_REL_ROW}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::LINE_BOTTOM, LB_REL_ROW}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::LINE_CENTER, LB_REL_ROW} +}; +/*-- 05.03.2004 15:52:56--------------------------------------------------- + + -----------------------------------------------------------------------*/ +std::size_t lcl_GetFrmMapCount(const FrmMap* pMap) +{ + if ( pMap ) + { + std::size_t aSizeOf = sizeof(FrmMap); + if( pMap == aVParaHtmlMap) + return sizeof(aVParaHtmlMap) / aSizeOf; + if( pMap == aVAsCharHtmlMap) + return sizeof(aVAsCharHtmlMap) / aSizeOf; + if( pMap == aHParaHtmlMap) + return sizeof(aHParaHtmlMap) / aSizeOf; + if( pMap == aHParaHtmlAbsMap) + return sizeof(aHParaHtmlAbsMap) / aSizeOf; + if ( pMap == aVPageMap ) + return sizeof(aVPageMap) / aSizeOf; + if ( pMap == aVPageHtmlMap ) + return sizeof(aVPageHtmlMap) / aSizeOf; + if ( pMap == aVAsCharMap ) + return sizeof(aVAsCharMap) / aSizeOf; + if ( pMap == aVParaMap ) + return sizeof(aVParaMap) / aSizeOf; + if ( pMap == aHParaMap ) + return sizeof(aHParaMap) / aSizeOf; + if ( pMap == aHFrameMap ) + return sizeof(aHFrameMap) / aSizeOf; + // OD 19.09.2003 #i18732# - own vertical alignment map for to frame anchored objects + if ( pMap == aVFrameMap ) + return sizeof(aVFrameMap) / aSizeOf; + if ( pMap == aHCharMap ) + return sizeof(aHCharMap) / aSizeOf; + if ( pMap == aHCharHtmlMap ) + return sizeof(aHCharHtmlMap) / aSizeOf; + if ( pMap == aHCharHtmlAbsMap ) + return sizeof(aHCharHtmlAbsMap) / aSizeOf; + if ( pMap == aVCharMap ) + return sizeof(aVCharMap) / aSizeOf; + if ( pMap == aVCharHtmlMap ) + return sizeof(aVCharHtmlMap) / aSizeOf; + if ( pMap == aVCharHtmlAbsMap ) + return sizeof(aVCharHtmlAbsMap) / aSizeOf; + if ( pMap == aHPageHtmlMap ) + return sizeof(aHPageHtmlMap) / aSizeOf; + if ( pMap == aHFlyHtmlMap ) + return sizeof(aHFlyHtmlMap) / aSizeOf; + if ( pMap == aVFlyHtmlMap ) + return sizeof(aVFlyHtmlMap) / aSizeOf; + if( pMap == aVMultiSelectionMap) + return sizeof(aVMultiSelectionMap) / aSizeOf; + if( pMap == aHMultiSelectionMap) + return sizeof(aHMultiSelectionMap) / aSizeOf; + return sizeof(aHPageMap) / aSizeOf; + } + return 0; +} +/*-- 03.03.2004 12:21:33--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL( + SvxSwFramePosString::StringId eStringId, BOOL bVertical, BOOL bRTL) +{ + //special handling of STR_FROMLEFT + if(SwFPos::FROMLEFT == eStringId) + { + eStringId = bVertical ? + bRTL ? SwFPos::FROMBOTTOM : SwFPos::FROMTOP : + bRTL ? SwFPos::FROMRIGHT : SwFPos::FROMLEFT; + return eStringId; + } + if(bVertical) + { + //exchange horizontal strings with vertical strings and vice versa + static const StringIdPair_Impl aHoriIds[] = + { + {SwFPos::LEFT, SwFPos::TOP}, + {SwFPos::RIGHT, SwFPos::BOTTOM}, + {SwFPos::CENTER_HORI, SwFPos::CENTER_VERT}, + {SwFPos::FROMTOP, SwFPos::FROMRIGHT}, + {SwFPos::REL_PG_LEFT, SwFPos::REL_PG_TOP}, + {SwFPos::REL_PG_RIGHT, SwFPos::REL_PG_BOTTOM} , + {SwFPos::REL_FRM_LEFT, SwFPos::REL_FRM_TOP}, + {SwFPos::REL_FRM_RIGHT, SwFPos::REL_FRM_BOTTOM} + }; + static const StringIdPair_Impl aVertIds[] = + { + {SwFPos::TOP, SwFPos::RIGHT}, + {SwFPos::BOTTOM, SwFPos::LEFT }, + {SwFPos::CENTER_VERT, SwFPos::CENTER_HORI}, + {SwFPos::FROMTOP, SwFPos::FROMRIGHT }, + {SwFPos::REL_PG_TOP, SwFPos::REL_PG_LEFT }, + {SwFPos::REL_PG_BOTTOM, SwFPos::REL_PG_RIGHT } , + {SwFPos::REL_FRM_TOP, SwFPos::REL_FRM_LEFT }, + {SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT } + }; + USHORT nIndex; + for(nIndex = 0; nIndex < sizeof(aHoriIds) / sizeof(StringIdPair_Impl); ++nIndex) + { + if(aHoriIds[nIndex].eHori == eStringId) + { + eStringId = aHoriIds[nIndex].eVert; + return eStringId; + } + } + nIndex = 0; + for(nIndex = 0; nIndex < sizeof(aVertIds) / sizeof(StringIdPair_Impl); ++nIndex) + { + if(aVertIds[nIndex].eHori == eStringId) + { + eStringId = aVertIds[nIndex].eVert; + break; + } + } + } + return eStringId; +} +// OD 12.11.2003 #i22341# - helper method in order to determine all possible +// listbox relations in a relation map for a given relation +ULONG lcl_GetLBRelationsForRelations( const USHORT _nRel ) +{ + ULONG nLBRelations = 0L; + + sal_uInt16 nRelMapSize = sizeof(aRelationMap) / sizeof(RelationMap); + for ( sal_uInt16 nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos ) + { + if ( aRelationMap[nRelMapPos].nRelation == _nRel ) + { + nLBRelations |= aRelationMap[nRelMapPos].nLBRelation; + } + } + + return nLBRelations; +} + +// OD 14.11.2003 #i22341# - helper method on order to determine all possible +// listbox relations in a relation map for a given string ID +ULONG lcl_GetLBRelationsForStrID( const FrmMap* _pMap, + const SvxSwFramePosString::StringId _eStrId, + const bool _bUseMirrorStr ) +{ + ULONG nLBRelations = 0L; + + std::size_t nRelMapSize = lcl_GetFrmMapCount( _pMap ); + for ( std::size_t nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos ) + { + if ( ( !_bUseMirrorStr && _pMap[nRelMapPos].eStrId == _eStrId ) || + ( _bUseMirrorStr && _pMap[nRelMapPos].eMirrorStrId == _eStrId ) ) + { + nLBRelations |= _pMap[nRelMapPos].nLBRelations; + } + } + + return nLBRelations; +} +/*-- 03.03.2004 12:21:33--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SvxSwPosSizeTabPage::SvxSwPosSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : + SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_SWPOSSIZE ), rInAttrs ), +#ifdef _MSC_VER +#pragma warning (disable : 4355) +#endif + m_aSizeFL( this, SVX_RES( FL_SIZE ) ), + m_aWidthFT( this, SVX_RES( FT_WIDTH ) ), + m_aWidthMF( this, SVX_RES( MF_WIDTH ) ), + m_aHeightFT( this, SVX_RES( FT_HEIGHT ) ), + m_aHeightMF( this, SVX_RES( MF_HEIGHT ) ), + m_aKeepRatioCB(this,SVX_RES( CB_KEEPRATIO) ), + m_aSeparatorFL(this,SVX_RES( FL_SEPARATOR) ), + + m_aAnchorFL( this, SVX_RES( FL_ANCHOR ) ), + m_aToPageRB( this, SVX_RES( RB_TOPAGE ) ), + m_aToParaRB( this, SVX_RES( RB_TOPARA ) ), + m_aToCharRB( this, SVX_RES( RB_TOCHAR ) ), + m_aAsCharRB( this, SVX_RES( RB_ASCHAR ) ), + m_aToFrameRB( this, SVX_RES( RB_TOFRAME) ), + + m_aProtectionFL( this, SVX_RES( FL_PROTECTION ) ), + m_aPositionCB( this, SVX_RES( CB_POSITION ) ), + m_aSizeCB( this, SVX_RES( CB_SIZE ) ), + + m_aPositionFL( this, SVX_RES( FL_POSITION ) ), + m_aHoriFT( this, SVX_RES( FT_HORI ) ), + m_aHoriLB( this, SVX_RES( LB_HORI ) ), + m_aHoriByFT( this, SVX_RES( FT_HORIBY ) ), + m_aHoriByMF( this, SVX_RES( MF_HORIBY ) ), + m_aHoriToFT( this, SVX_RES( FT_HORITO ) ), + m_aHoriToLB( this, SVX_RES( LB_HORITO ) ), + + m_aHoriMirrorCB( this, SVX_RES( CB_HORIMIRROR ) ), + + m_aVertFT( this, SVX_RES( FT_VERT ) ), + m_aVertLB( this, SVX_RES( LB_VERT ) ), + m_aVertByFT( this, SVX_RES( FT_VERTBY ) ), + m_aVertByMF( this, SVX_RES( MF_VERTBY ) ), + m_aVertToFT( this, SVX_RES( FT_VERTTO ) ), + m_aVertToLB( this, SVX_RES( LB_VERTTO ) ), + + m_aFollowCB( this, SVX_RES( CB_FOLLOW ) ), + m_aExampleWN( this, SVX_RES( WN_EXAMPLE ) ), +#ifdef _MSC_VER +#pragma warning (default : 4355) +#endif + m_pVMap( 0 ), + m_pHMap( 0 ), + m_pSdrView( 0 ), + m_nOldH(HoriOrientation::CENTER), + m_nOldHRel(RelOrientation::FRAME), + m_nOldV(VertOrientation::TOP), + m_nOldVRel(RelOrientation::PRINT_AREA), + m_fWidthHeightRatio(1.0), + m_nHtmlMode(0), + m_bHtmlMode(false), + m_bAtHoriPosModified(false), + m_bAtVertPosModified(false), + m_bIsVerticalFrame(false), + m_bPositioningDisabled(false), + m_bIsMultiSelection(false), + m_bIsInRightToLeft(false) +{ + FreeResource(); + FieldUnit eDlgUnit = GetModuleFieldUnit( &rInAttrs ); + SetFieldUnit( m_aHoriByMF, eDlgUnit, TRUE ); + SetFieldUnit( m_aVertByMF, eDlgUnit, TRUE ); + SetFieldUnit( m_aWidthMF , eDlgUnit, TRUE ); + SetFieldUnit( m_aHeightMF, eDlgUnit, TRUE ); + + SetExchangeSupport(); + + Link aLk = LINK(this, SvxSwPosSizeTabPage, RangeModifyHdl); + m_aWidthMF. SetLoseFocusHdl( aLk ); + m_aHeightMF. SetLoseFocusHdl( aLk ); + m_aHoriByMF.SetLoseFocusHdl( aLk ); + m_aVertByMF.SetLoseFocusHdl( aLk ); + m_aFollowCB.SetClickHdl( aLk ); + + aLk = LINK(this, SvxSwPosSizeTabPage, ModifyHdl); + m_aWidthMF. SetModifyHdl( aLk ); + m_aHeightMF. SetModifyHdl( aLk ); + m_aHoriByMF.SetModifyHdl( aLk ); + m_aVertByMF.SetModifyHdl( aLk ); + + aLk = LINK(this, SvxSwPosSizeTabPage, AnchorTypeHdl); + m_aToPageRB.SetClickHdl( aLk ); + m_aToParaRB.SetClickHdl( aLk ); + m_aToCharRB.SetClickHdl( aLk ); + m_aAsCharRB.SetClickHdl( aLk ); + m_aToFrameRB.SetClickHdl( aLk ); + + m_aHoriLB.SetSelectHdl(LINK(this, SvxSwPosSizeTabPage, PosHdl)); + m_aVertLB. SetSelectHdl(LINK(this, SvxSwPosSizeTabPage, PosHdl)); + + m_aHoriToLB.SetSelectHdl(LINK(this, SvxSwPosSizeTabPage, RelHdl)); + m_aVertToLB.SetSelectHdl(LINK(this, SvxSwPosSizeTabPage, RelHdl)); + + m_aHoriMirrorCB.SetClickHdl(LINK(this, SvxSwPosSizeTabPage, MirrorHdl)); + m_aPositionCB.SetClickHdl(LINK(this, SvxSwPosSizeTabPage, ProtectHdl)); +} +/*-- 03.03.2004 12:21:33--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SvxSwPosSizeTabPage::~SvxSwPosSizeTabPage() +{ +} +/*-- 03.03.2004 12:21:33--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SfxTabPage* SvxSwPosSizeTabPage::Create( Window* pParent, const SfxItemSet& rSet) +{ + return new SvxSwPosSizeTabPage(pParent, rSet); +} +/*-- 05.03.2004 17:27:42--------------------------------------------------- + + -----------------------------------------------------------------------*/ +USHORT* SvxSwPosSizeTabPage::GetRanges() +{ + static USHORT pSwPosRanges[] = + { + SID_ATTR_TRANSFORM_POS_X, + SID_ATTR_TRANSFORM_POS_Y, + SID_ATTR_TRANSFORM_PROTECT_POS, + SID_ATTR_TRANSFORM_PROTECT_POS, + SID_ATTR_TRANSFORM_INTERN, + SID_ATTR_TRANSFORM_INTERN, + SID_ATTR_TRANSFORM_ANCHOR, + SID_ATTR_TRANSFORM_VERT_ORIENT, + SID_ATTR_TRANSFORM_WIDTH, + SID_ATTR_TRANSFORM_SIZE_POINT, + SID_ATTR_TRANSFORM_PROTECT_POS, + SID_ATTR_TRANSFORM_INTERN, + SID_ATTR_TRANSFORM_AUTOWIDTH, + SID_ATTR_TRANSFORM_VERT_ORIENT, + SID_HTML_MODE, + SID_HTML_MODE, + SID_SW_FOLLOW_TEXT_FLOW, + SID_SW_FOLLOW_TEXT_FLOW, + SID_ATTR_TRANSFORM_HORI_POSITION, + SID_ATTR_TRANSFORM_VERT_POSITION, + 0 + }; + return pSwPosRanges; +} +/*-- 03.03.2004 12:21:34--------------------------------------------------- + + -----------------------------------------------------------------------*/ +BOOL SvxSwPosSizeTabPage::FillItemSet( SfxItemSet& rSet) +{ + bool bAnchorChanged = false; + short nAnchor = GetAnchorType(&bAnchorChanged); + BOOL bModified = FALSE; + if(bAnchorChanged) + { + rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_ANCHOR, nAnchor)); + bModified |= TRUE; + } + if ( m_aPositionCB.GetState() != m_aPositionCB.GetSavedValue() ) + { + if( m_aPositionCB.GetState() == STATE_DONTKNOW ) + rSet.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_POS ); + else + rSet.Put( + SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_POS ), + m_aPositionCB.GetState() == STATE_CHECK ? TRUE : FALSE ) ); + bModified |= TRUE; + } + + if ( m_aSizeCB.GetState() != m_aSizeCB.GetSavedValue() ) + { + if ( m_aSizeCB.GetState() == STATE_DONTKNOW ) + rSet.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_SIZE ); + else + rSet.Put( + SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_SIZE ), + m_aSizeCB.GetState() == STATE_CHECK ? TRUE : FALSE ) ); + bModified |= TRUE; + } + + const SfxItemSet& rOldSet = GetItemSet(); + + if(!m_bPositioningDisabled) + { + //on multiple selections the positioning is set via SdrView + if(m_bIsMultiSelection) + { + if( m_aHoriByMF.IsValueModified() || m_aVertByMF.IsValueModified() ) + { + long nHoriByPos = + static_cast(m_aHoriByMF.Denormalize(m_aHoriByMF.GetValue(FUNIT_TWIP))); + long nVertByPos = + static_cast(m_aVertByMF.Denormalize(m_aVertByMF.GetValue(FUNIT_TWIP))); + + // Altes Rechteck mit CoreUnit + m_aRect = m_pSdrView->GetAllMarkedRect(); + m_pSdrView->GetSdrPageView()->LogicToPagePos( m_aRect ); + + nHoriByPos += m_aAnchorPos.X(); + nVertByPos += m_aAnchorPos.Y(); + + rSet.Put( SfxInt32Item( GetWhich( SID_ATTR_TRANSFORM_POS_X ), nHoriByPos ) ); + rSet.Put( SfxInt32Item( GetWhich( SID_ATTR_TRANSFORM_POS_Y ), nVertByPos ) ); + + bModified |= TRUE; + } + } + else + { + if ( m_pHMap ) + { + const SfxInt16Item& rHoriOrient = + static_cast(rOldSet.Get( SID_ATTR_TRANSFORM_HORI_ORIENT)); + const SfxInt16Item& rHoriRelation = + static_cast(rOldSet.Get( SID_ATTR_TRANSFORM_HORI_RELATION)); + const SfxInt32Item& rHoriPosition = + static_cast(rOldSet.Get( SID_ATTR_TRANSFORM_HORI_POSITION)) ; + + USHORT nMapPos = GetMapPos(m_pHMap, m_aHoriLB); + short nAlign = GetAlignment(m_pHMap, nMapPos, m_aHoriLB, m_aHoriToLB); + short nRel = GetRelation(m_pHMap, m_aHoriToLB); + const long nHoriByPos = + static_cast(m_aHoriByMF.Denormalize(m_aHoriByMF.GetValue(FUNIT_TWIP))); + if ( + nAlign != rHoriOrient.GetValue() || + nRel != rHoriRelation.GetValue() || + (m_aHoriByMF.IsEnabled() && nHoriByPos != rHoriPosition.GetValue()) + ) + { + rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_ORIENT, nAlign)); + rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_RELATION, nRel)); + if(m_aHoriByMF.IsEnabled()) + rSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_HORI_POSITION, nHoriByPos)); + bModified |= TRUE; + } + } + if(m_aHoriMirrorCB.IsEnabled() && m_aHoriMirrorCB.IsChecked() != m_aHoriMirrorCB.GetSavedValue()) + bModified |= 0 != rSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_HORI_MIRROR, m_aHoriMirrorCB.IsChecked())); + + if ( m_pVMap ) + { + const SfxInt16Item& rVertOrient = + static_cast(rOldSet.Get( SID_ATTR_TRANSFORM_VERT_ORIENT)); + const SfxInt16Item& rVertRelation = + static_cast(rOldSet.Get( SID_ATTR_TRANSFORM_VERT_RELATION)); + const SfxInt32Item& rVertPosition = + static_cast(rOldSet.Get( SID_ATTR_TRANSFORM_VERT_POSITION)); + + USHORT nMapPos = GetMapPos(m_pVMap, m_aVertLB); + short nAlign = GetAlignment(m_pVMap, nMapPos, m_aVertLB, m_aVertToLB); + short nRel = GetRelation(m_pVMap, m_aVertToLB); + // --> OD 2004-10-21 #i34055# - convert vertical position for + // as-character anchored objects + long nVertByPos = + static_cast(m_aVertByMF.Denormalize(m_aVertByMF.GetValue(FUNIT_TWIP))); + if ( GetAnchorType() == TextContentAnchorType_AS_CHARACTER ) + { + nVertByPos *= -1; + } + // <-- + if ( nAlign != rVertOrient.GetValue() || + nRel != rVertRelation.GetValue() || + ( m_aVertByMF.IsEnabled() && + nVertByPos != rVertPosition.GetValue() ) ) + { + rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_ORIENT, nAlign)); + rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_RELATION, nRel)); + if(m_aVertByMF.IsEnabled()) + rSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_VERT_POSITION, nVertByPos)); + bModified |= TRUE; + } + } + + // OD 19.09.2003 #i18732# + if(m_aFollowCB.IsChecked() != m_aFollowCB.GetSavedValue()) + { + //Writer internal type - based on SfxBoolItem + const SfxPoolItem* pItem = GetItem( rOldSet, SID_SW_FOLLOW_TEXT_FLOW); + if(pItem) + { + SfxBoolItem* pFollow = static_cast(pItem->Clone()); + pFollow->SetValue(m_aFollowCB.IsChecked()); + bModified |= 0 != rSet.Put(*pFollow); + delete pFollow; + } + } + } + } + if ( m_aWidthMF.IsValueModified() || m_aHeightMF.IsValueModified() ) + { + sal_uInt32 nWidth = static_cast(m_aWidthMF.Denormalize(m_aWidthMF.GetValue(FUNIT_TWIP))); + sal_uInt32 nHeight = static_cast(m_aHeightMF.Denormalize(m_aHeightMF.GetValue(FUNIT_TWIP))); + rSet.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_WIDTH ), + (UINT32) nWidth ) ); + rSet.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_HEIGHT ), + (UINT32) nHeight ) ); + //this item is required by SdrEditView::SetGeoAttrToMarked() + rSet.Put( SfxAllEnumItem( GetWhich( SID_ATTR_TRANSFORM_SIZE_POINT ), RP_LT ) ); + + bModified |= TRUE; + } + + return bModified; +} +/*-- 03.03.2004 12:21:34--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvxSwPosSizeTabPage::Reset( const SfxItemSet& rSet) +{ + const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_TRANSFORM_ANCHOR ); + bool bInvalidateAnchor = false; + short nAnchorType = TextContentAnchorType_AT_PARAGRAPH; + if(pItem) + { + nAnchorType = static_cast(pItem)->GetValue(); + switch(nAnchorType) + { + case TextContentAnchorType_AT_PAGE: m_aToPageRB.Check(); break; + case TextContentAnchorType_AT_PARAGRAPH: m_aToParaRB.Check(); break; + case TextContentAnchorType_AT_CHARACTER: m_aToCharRB.Check(); break; + case TextContentAnchorType_AS_CHARACTER: m_aAsCharRB.Check(); break; + case TextContentAnchorType_AT_FRAME: m_aToFrameRB.Check(); break; + default : bInvalidateAnchor = true; + } + m_aToPageRB.SaveValue(); + m_aToParaRB.SaveValue(); + m_aToCharRB.SaveValue(); + m_aAsCharRB.SaveValue(); + m_aToFrameRB.SaveValue(); + } + if(bInvalidateAnchor) + { + m_aToPageRB.Enable( FALSE ); + m_aToParaRB.Enable( FALSE ); + m_aToCharRB.Enable( FALSE ); + m_aAsCharRB.Enable( FALSE ); + m_aToFrameRB.Enable( FALSE ); + } + + pItem = GetItem( rSet, SID_ATTR_TRANSFORM_PROTECT_POS ); + if ( pItem ) + { + sal_Bool bProtected = ( ( const SfxBoolItem* )pItem )->GetValue(); + m_aPositionCB.SetState( bProtected ? STATE_CHECK : STATE_NOCHECK ); + m_aPositionCB.EnableTriState( FALSE ); + m_aSizeCB.Enable( !bProtected ); + } + else + { + m_aPositionCB.SetState( STATE_DONTKNOW ); + } + + m_aPositionCB.SaveValue(); + + pItem = GetItem( rSet, SID_ATTR_TRANSFORM_PROTECT_SIZE ); + + if ( pItem ) + { + m_aSizeCB.SetState( ( (const SfxBoolItem*)pItem )->GetValue() + ? STATE_CHECK : STATE_NOCHECK ); + m_aSizeCB.EnableTriState( FALSE ); + } + else + m_aSizeCB.SetState( STATE_DONTKNOW ); + m_aSizeCB.SaveValue(); + + pItem = GetItem( rSet, SID_HTML_MODE ); + if(pItem) + m_nHtmlMode = static_cast(pItem)->GetValue(); + m_bHtmlMode = 0 != (m_bHtmlMode & HTMLMODE_ON); + + pItem = GetItem( rSet, SID_ATTR_TRANSFORM_IN_VERTICAL_TEXT ); + if(pItem && static_cast(pItem)->GetValue()) + { + String sHLabel = m_aHoriFT.GetText(); + m_aHoriFT.SetText(m_aVertFT.GetText()); + m_aVertFT.SetText(sHLabel); + m_bIsVerticalFrame = true; + } + pItem = GetItem( rSet, SID_ATTR_TRANSFORM_IN_RTL_TEXT); + if(pItem) + m_bIsInRightToLeft = static_cast(pItem)->GetValue(); + + pItem = GetItem( rSet, SID_SW_FOLLOW_TEXT_FLOW); + if(pItem) + { + const bool bFollowTextFlow = + static_cast(pItem)->GetValue(); + m_aFollowCB.Check( bFollowTextFlow ); + } + m_aFollowCB.SaveValue(); + + if(m_bHtmlMode) + { + if( 0 == (m_nHtmlMode & HTMLMODE_FULL_ABS_POS)) + { + m_aHeightFT .Enable( FALSE ); + m_aHeightMF .Enable( FALSE ); + } + if( 0 == (m_nHtmlMode & HTMLMODE_SOME_ABS_POS)) + { + if(GetAnchorType() == TextContentAnchorType_AT_PAGE) + { + m_aToParaRB.Check(); + } + m_aToPageRB.Enable(FALSE); + } + m_aHoriMirrorCB.Show(FALSE); + m_aKeepRatioCB.Enable(FALSE); + // OD 19.09.2003 #i18732# - hide checkbox in HTML mode + m_aFollowCB.Show(FALSE); + } + else + { + // OD 06.11.2003 #i18732# correct enable/disable of check box 'Mirror on..' + m_aHoriMirrorCB.Enable(!m_aAsCharRB.IsChecked() && !m_bIsMultiSelection); + + // OD 06.11.2003 #i18732# - enable/disable check box 'Follow text flow'. + m_aFollowCB.Enable( m_aToParaRB.IsChecked() || + m_aToCharRB.IsChecked() ); + } + + pItem = GetItem( rSet, SID_ATTR_TRANSFORM_WIDTH ); + sal_Int32 nWidth = Max( pItem ? ( static_cast(pItem)->GetValue()) : 0, (UINT32)1 ); + + m_aWidthMF.SetValue(m_aWidthMF.Normalize(nWidth), FUNIT_TWIP); + + pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HEIGHT ); + sal_Int32 nHeight = Max( pItem ? ( static_cast(pItem)->GetValue()) : 0, (UINT32)1 ); + m_aHeightMF.SetValue(m_aHeightMF.Normalize(nHeight), FUNIT_TWIP); + m_fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0; + + if(!m_bPositioningDisabled) + { + pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HORI_ORIENT); + if(pItem) + { + short nHoriOrientation = static_cast< const SfxInt16Item*>(pItem)->GetValue(); + m_nOldH = nHoriOrientation; + } + pItem = GetItem( rSet, SID_ATTR_TRANSFORM_VERT_ORIENT); + if(pItem) + { + short nVertOrientation = static_cast< const SfxInt16Item*>(pItem)->GetValue(); + m_nOldV = nVertOrientation; + } + pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HORI_RELATION); + if(pItem) + { + m_nOldHRel = static_cast< const SfxInt16Item*>(pItem)->GetValue(); + } + + pItem = GetItem( rSet, SID_ATTR_TRANSFORM_VERT_RELATION); + if(pItem) + { + m_nOldVRel = static_cast< const SfxInt16Item*>(pItem)->GetValue(); + } + pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HORI_MIRROR); + if(pItem) + m_aHoriMirrorCB.Check(static_cast(pItem)->GetValue()); + m_aHoriMirrorCB.SaveValue(); + + sal_Int32 nHoriPos = 0; + sal_Int32 nVertPos = 0; + pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HORI_POSITION); + if(pItem) + nHoriPos = static_cast(pItem)->GetValue(); + pItem = GetItem( rSet, SID_ATTR_TRANSFORM_VERT_POSITION); + if(pItem) + nVertPos = static_cast(pItem)->GetValue(); + + InitPos(nAnchorType, m_nOldH, m_nOldHRel, m_nOldV, m_nOldVRel, nHoriPos, nVertPos); + + m_aVertByMF.SaveValue(); + m_aHoriByMF.SaveValue(); + // OD 19.09.2003 #i18732# + m_aFollowCB.SaveValue(); + + RangeModifyHdl(&m_aWidthMF); // initially set maximum values + } +} +/*-- 03.03.2004 12:21:35--------------------------------------------------- + + -----------------------------------------------------------------------*/ +int SvxSwPosSizeTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if( _pSet ) + FillItemSet( *_pSet ); + return( LEAVE_PAGE ); +} +/*-- 04.03.2004 09:14:41--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvxSwPosSizeTabPage::EnableAnchorTypes(USHORT nAnchorEnable) +{ + if((nAnchorEnable & SVX_OBJ_AT_FLY)) + m_aToFrameRB.Show(); + if(!(nAnchorEnable & SVX_OBJ_PAGE)) + m_aToPageRB.Enable(FALSE); +} +/*-- 04.03.2004 09:33:33--------------------------------------------------- + + -----------------------------------------------------------------------*/ +short SvxSwPosSizeTabPage::GetAnchorType(bool* pbHasChanged) +{ + short nRet = -1; + RadioButton* pCheckedButton = 0; + if(m_aToParaRB.IsEnabled()) + { + if(m_aToPageRB.IsChecked()) + { + nRet = TextContentAnchorType_AT_PAGE; + pCheckedButton = &m_aToPageRB; + } + else if(m_aToParaRB.IsChecked()) + { + nRet = TextContentAnchorType_AT_PARAGRAPH; + pCheckedButton = &m_aToParaRB; + } + else if(m_aToCharRB.IsChecked()) + { + nRet = TextContentAnchorType_AT_CHARACTER; + pCheckedButton = &m_aToCharRB; + } + else if(m_aAsCharRB.IsChecked()) + { + nRet = TextContentAnchorType_AS_CHARACTER; + pCheckedButton = &m_aAsCharRB; + } + else if(m_aToFrameRB.IsChecked()) + { + nRet = TextContentAnchorType_AT_FRAME; + pCheckedButton = &m_aToFrameRB; + } + } + if(pbHasChanged) + { + if(pCheckedButton) + *pbHasChanged = pCheckedButton->IsChecked() != pCheckedButton->GetSavedValue(); + else + *pbHasChanged = false; + } + return nRet; +} +/*-- 05.03.2004 10:43:32--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK( SvxSwPosSizeTabPage, RangeModifyHdl, Edit *, EMPTYARG ) +{ + if(m_bPositioningDisabled) + return 0; + SvxSwFrameValidation aVal; + + aVal.nAnchorType = GetAnchorType(); + aVal.bAutoHeight = false; + aVal.bAutoWidth = false; + aVal.bMirror = m_aHoriMirrorCB.IsChecked(); + // OD 18.09.2003 #i18732# + aVal.bFollowTextFlow = m_aFollowCB.IsChecked(); + + if ( m_pHMap ) + { + // Ausrichtung Horizontal + USHORT nMapPos = GetMapPos(m_pHMap, m_aHoriToLB); + USHORT nAlign = GetAlignment(m_pHMap, nMapPos, m_aHoriLB, m_aHoriToLB); + USHORT nRel = GetRelation(m_pHMap, m_aHoriToLB); + + aVal.nHoriOrient = (short)nAlign; + aVal.nHRelOrient = (short)nRel; + } + else + aVal.nHoriOrient = HoriOrientation::NONE; + + if ( m_pVMap ) + { + // Ausrichtung Vertikal + USHORT nMapPos = GetMapPos(m_pVMap, m_aVertLB); + USHORT nAlign = GetAlignment(m_pVMap, nMapPos, m_aVertLB, m_aVertToLB); + USHORT nRel = GetRelation(m_pVMap, m_aVertToLB); + + aVal.nVertOrient = (short)nAlign; + aVal.nVRelOrient = (short)nRel; + } + else + aVal.nVertOrient = VertOrientation::NONE; + + const long nAtHorzPosVal = + static_cast(m_aHoriByMF.Denormalize(m_aHoriByMF.GetValue(FUNIT_TWIP))); + const long nAtVertPosVal = + static_cast(m_aVertByMF.Denormalize(m_aVertByMF.GetValue(FUNIT_TWIP))); + + aVal.nHPos = nAtHorzPosVal; + aVal.nVPos = nAtVertPosVal; + + sal_Int32 nWidth = static_cast(m_aWidthMF. Denormalize(m_aWidthMF.GetValue(FUNIT_TWIP))); + sal_Int32 nHeight = static_cast(m_aHeightMF.Denormalize(m_aHeightMF.GetValue(FUNIT_TWIP))); + aVal.nWidth = nWidth; + aVal.nHeight = nHeight; + + if(m_aValidateLink.IsSet()) + m_aValidateLink.Call(&aVal); + + nWidth = aVal.nWidth; + nHeight = aVal.nHeight; + + // Mindestbreite auch fuer Vorlage + m_aHeightMF.SetMin(m_aHeightMF.Normalize(aVal.nMinHeight), FUNIT_TWIP); + m_aWidthMF. SetMin(m_aWidthMF.Normalize(aVal.nMinWidth), FUNIT_TWIP); + + sal_Int32 nMaxWidth(aVal.nMaxWidth); + sal_Int32 nMaxHeight(aVal.nMaxHeight); + + sal_Int64 nTmp = m_aHeightMF.Normalize(nMaxHeight); + m_aHeightMF.SetMax(nTmp, FUNIT_TWIP); + + nTmp = m_aWidthMF.Normalize(nMaxWidth); + m_aWidthMF.SetMax(nTmp, FUNIT_TWIP); + + m_aHoriByMF.SetMin(m_aHoriByMF.Normalize(aVal.nMinHPos), FUNIT_TWIP); + m_aHoriByMF.SetMax(m_aHoriByMF.Normalize(aVal.nMaxHPos), FUNIT_TWIP); + if ( aVal.nHPos != nAtHorzPosVal ) + m_aHoriByMF.SetValue(m_aHoriByMF.Normalize(aVal.nHPos), FUNIT_TWIP); + + m_aVertByMF.SetMin(m_aVertByMF.Normalize(aVal.nMinVPos ), FUNIT_TWIP); + m_aVertByMF.SetMax(m_aVertByMF.Normalize(aVal.nMaxVPos), FUNIT_TWIP); + if ( aVal.nVPos != nAtVertPosVal ) + m_aVertByMF.SetValue(m_aVertByMF.Normalize(aVal.nVPos), FUNIT_TWIP); + + return 0; +} +/*-- 05.03.2004 11:12:56--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK( SvxSwPosSizeTabPage, AnchorTypeHdl, RadioButton *, EMPTYARG ) +{ + m_aHoriMirrorCB.Enable(!m_aAsCharRB.IsChecked() && !m_bIsMultiSelection); + + // OD 06.11.2003 #i18732# - enable check box 'Follow text flow' for anchor + // type to-paragraph' and to-character + m_aFollowCB.Enable( m_aToParaRB.IsChecked() || m_aToCharRB.IsChecked() ); + + short nId = GetAnchorType(); + + InitPos( nId, USHRT_MAX, 0, USHRT_MAX, 0, LONG_MAX, LONG_MAX); + RangeModifyHdl(0); + + if(m_bHtmlMode) + { + PosHdl(&m_aHoriLB); + PosHdl(&m_aVertLB); + } + return 0; +} +/*-- 05.03.2004 14:20:19--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK( SvxSwPosSizeTabPage, MirrorHdl, CheckBox *, EMPTYARG ) +{ + short nId = GetAnchorType(); + InitPos( nId, USHRT_MAX, 0, USHRT_MAX, 0, LONG_MAX, LONG_MAX); + + return 0; +} +/*-- 05.03.2004 14:20:19--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK( SvxSwPosSizeTabPage, RelHdl, ListBox *, pLB ) +{ + BOOL bHori = pLB == &m_aHoriToLB; + + UpdateExample(); + + if (bHori) + m_bAtHoriPosModified = TRUE; + else + m_bAtVertPosModified = TRUE; + + // OD 12.11.2003 #i22341# - following special handling no longer needed + /* + if (!bHori && m_pVMap == aVCharMap) + { + // Ausrichtung Vertikal + String sEntry; + USHORT nMapPos = GetMapPos(m_pVMap, m_aVertLB); + USHORT nAlign = GetAlignment(m_pVMap, nMapPos, m_aVertLB, m_aVertToLB); + USHORT nRel = GetRelation(m_pVMap, m_aVertToLB); + + if (nRel == SwFPos::REL_CHAR) + sEntry = m_aFramePosString.GetString(SwFPos::FROMBOTTOM); + else + sEntry = m_aFramePosString.GetString(SwFPos::FROMTOP); + + USHORT nOldPos = m_aVertLB.GetSelectEntryPos(); + + String sName = m_aVertLB.GetEntry(m_aVertLB.GetEntryCount() - 1); + if (sName != sEntry) + { + m_aVertLB.RemoveEntry(m_aVertLB.GetEntryCount() - 1); + m_aVertLB.InsertEntry(sEntry); + m_aVertLB.SelectEntryPos(nOldPos); + } + } + */ + if(m_bHtmlMode && TextContentAnchorType_AT_CHARACTER == GetAnchorType()) // wieder Sonderbehandlung + { + if(bHori) + { + USHORT nRel = GetRelation(m_pHMap, m_aHoriToLB); + if(RelOrientation::PRINT_AREA == nRel && 0 == m_aVertLB.GetSelectEntryPos()) + { + m_aVertLB.SelectEntryPos(1); + } + else if(RelOrientation::CHAR == nRel && 1 == m_aVertLB.GetSelectEntryPos()) + { + m_aVertLB.SelectEntryPos(0); + } + } + } + if (pLB) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde + RangeModifyHdl(0); + + return 0; + +} +/*-- 05.03.2004 14:20:19--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK( SvxSwPosSizeTabPage, PosHdl, ListBox *, pLB ) +{ + BOOL bHori = pLB == &m_aHoriLB; + ListBox *pRelLB = bHori ? &m_aHoriToLB : &m_aVertToLB; + FixedText *pRelFT = bHori ? &m_aHoriToFT : &m_aVertToFT; + FrmMap *pMap = bHori ? m_pHMap : m_pVMap; + + + USHORT nMapPos = GetMapPos(pMap, *pLB); + USHORT nAlign = GetAlignment(pMap, nMapPos, *pLB, *pRelLB); + + if (bHori) + { + BOOL bEnable = HoriOrientation::NONE == nAlign; + m_aHoriByMF.Enable( bEnable ); + m_aHoriByFT.Enable( bEnable ); + } + else + { + BOOL bEnable = VertOrientation::NONE == nAlign; + m_aVertByMF.Enable( bEnable ); + m_aVertByFT.Enable( bEnable ); + } + + if (pLB) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde + RangeModifyHdl( 0 ); + + short nRel = 0; + if (pLB->GetSelectEntryCount()) + { + + if (pRelLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) + nRel = ((RelationMap *)pRelLB->GetEntryData(pRelLB->GetSelectEntryPos()))->nRelation; + + FillRelLB(pMap, nMapPos, nAlign, nRel, *pRelLB, *pRelFT); + } + else + pRelLB->Clear(); + + UpdateExample(); + + if (bHori) + m_bAtHoriPosModified = TRUE; + else + m_bAtVertPosModified = TRUE; + + // Sonderbehandlung fuer HTML-Mode mit horz-vert-Abhaengigkeiten + if(m_bHtmlMode && m_nHtmlMode & HTMLMODE_SOME_ABS_POS && + TextContentAnchorType_AT_CHARACTER == GetAnchorType()) + { + BOOL bSet = FALSE; + if(bHori) + { + // rechts ist nur unterhalb erlaubt - von links nur oben + // von links am Zeichen -> unterhalb + if((HoriOrientation::LEFT == nAlign || HoriOrientation::RIGHT == nAlign) && + 0 == m_aVertLB.GetSelectEntryPos()) + { + if(RelOrientation::FRAME == nRel) + m_aVertLB.SelectEntryPos(1); + else + m_aVertLB.SelectEntryPos(0); + bSet = TRUE; + } + else if(HoriOrientation::LEFT == nAlign && 1 == m_aVertLB.GetSelectEntryPos()) + { + m_aVertLB.SelectEntryPos(0); + bSet = TRUE; + } + else if(HoriOrientation::NONE == nAlign && 1 == m_aVertLB.GetSelectEntryPos()) + { + m_aVertLB.SelectEntryPos(0); + bSet = TRUE; + } + if(bSet) + PosHdl(&m_aVertLB); + } + else + { + if(VertOrientation::TOP == nAlign) + { + if(1 == m_aHoriLB.GetSelectEntryPos()) + { + m_aHoriLB.SelectEntryPos(0); + bSet = TRUE; + } + m_aHoriToLB.SelectEntryPos(1); + } + else if(VertOrientation::CHAR_BOTTOM == nAlign) + { + if(2 == m_aHoriLB.GetSelectEntryPos()) + { + m_aHoriLB.SelectEntryPos(0); + bSet = TRUE; + } + m_aHoriToLB.SelectEntryPos(0) ; + } + if(bSet) + PosHdl(&m_aHoriLB); + } + + } + return 0; +} +/*-- 05.03.2004 14:20:19--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK( SvxSwPosSizeTabPage, ModifyHdl, Edit *, pEdit ) +{ + sal_Int64 nWidth = m_aWidthMF.Denormalize(m_aWidthMF.GetValue(FUNIT_TWIP)); + sal_Int64 nHeight = m_aHeightMF.Denormalize(m_aHeightMF.GetValue(FUNIT_TWIP)); + if ( m_aKeepRatioCB.IsChecked() ) + { + if ( pEdit == &m_aWidthMF ) + { + nHeight = sal_Int64((double)nWidth / m_fWidthHeightRatio); + m_aHeightMF.SetValue(m_aHeightMF.Normalize(nHeight), FUNIT_TWIP); + } + else if(pEdit == &m_aHeightMF) + { + nWidth = sal_Int64((double)nHeight * m_fWidthHeightRatio); + m_aWidthMF.SetValue(m_aWidthMF.Normalize(nWidth), FUNIT_TWIP); + } + } + m_fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0; + UpdateExample(); + return 0; +} +/*-- 11.03.2004 15:40:17--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK( SvxSwPosSizeTabPage, ProtectHdl, TriStateBox *, EMPTYARG) +{ + m_aSizeCB.Enable(m_aPositionCB.IsEnabled() && !m_aPositionCB.IsChecked()); + return 0; +} +/*-- 05.03.2004 14:20:19--------------------------------------------------- + + -----------------------------------------------------------------------*/ +short SvxSwPosSizeTabPage::GetRelation(FrmMap *, ListBox &rRelationLB) +{ + short nRel = 0; + USHORT nPos = rRelationLB.GetSelectEntryPos(); + + if (nPos != LISTBOX_ENTRY_NOTFOUND) + { + RelationMap *pEntry = (RelationMap *)rRelationLB.GetEntryData(nPos); + nRel = pEntry->nRelation; + } + + return nRel; +} +/*-- 05.03.2004 14:20:19--------------------------------------------------- + + -----------------------------------------------------------------------*/ +short SvxSwPosSizeTabPage::GetAlignment(FrmMap *pMap, USHORT nMapPos, ListBox &/*rAlignLB*/, ListBox &rRelationLB) +{ + short nAlign = 0; + + // OD 14.11.2003 #i22341# - special handling also for map , + // because it contains ambigous items for alignment + if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap || + pMap == aVCharMap ) + { + if (rRelationLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) + { + ULONG nRel = ((RelationMap *)rRelationLB.GetEntryData(rRelationLB.GetSelectEntryPos()))->nLBRelation; + std::size_t nMapCount = ::lcl_GetFrmMapCount(pMap); + SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId; + + for (std::size_t i = 0; i < nMapCount; i++) + { + if (pMap[i].eStrId == eStrId) + { + ULONG nLBRelations = pMap[i].nLBRelations; + if (nLBRelations & nRel) + { + nAlign = pMap[i].nAlign; + break; + } + } + } + } + } + else if (pMap) + nAlign = pMap[nMapPos].nAlign; + + return nAlign; +} +/*-- 05.03.2004 14:20:19--------------------------------------------------- + + -----------------------------------------------------------------------*/ +USHORT SvxSwPosSizeTabPage::GetMapPos(FrmMap *pMap, ListBox &rAlignLB) +{ + USHORT nMapPos = 0; + USHORT nLBSelPos = rAlignLB.GetSelectEntryPos(); + + if (nLBSelPos != LISTBOX_ENTRY_NOTFOUND) + { + if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap) + { + std::size_t nMapCount = ::lcl_GetFrmMapCount(pMap); + String sSelEntry(rAlignLB.GetSelectEntry()); + + for (std::size_t i = 0; i < nMapCount; i++) + { + SvxSwFramePosString::StringId eResId = pMap[i].eStrId; + + String sEntry = m_aFramePosString.GetString(eResId); + + if (sEntry == sSelEntry) + { + nMapPos = sal::static_int_cast< USHORT >(i); + break; + } + } + } + else + nMapPos = nLBSelPos; + } + + return nMapPos; +} +/*-- 05.03.2004 14:20:19--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvxSwPosSizeTabPage::InitPos(short nAnchor, + USHORT nH, + USHORT nHRel, + USHORT nV, + USHORT nVRel, + long nX, + long nY) +{ + USHORT nPos = m_aVertLB.GetSelectEntryPos(); + if ( nPos != LISTBOX_ENTRY_NOTFOUND && m_pVMap ) + { + m_nOldV = m_pVMap[nPos].nAlign; + nPos = m_aVertToLB.GetSelectEntryPos(); + if (nPos != LISTBOX_ENTRY_NOTFOUND) + m_nOldVRel = ((RelationMap *)m_aVertToLB.GetEntryData(nPos))->nRelation; + } + + nPos = m_aHoriLB.GetSelectEntryPos(); + if ( nPos != LISTBOX_ENTRY_NOTFOUND && m_pHMap ) + { + m_nOldH = m_pHMap[nPos].nAlign; + + nPos = m_aHoriToLB.GetSelectEntryPos(); + if (nPos != LISTBOX_ENTRY_NOTFOUND) + m_nOldHRel = ((RelationMap *)m_aHoriToLB.GetEntryData(nPos))->nRelation; + } + + BOOL bEnable = TRUE; + if( m_bIsMultiSelection ) + { + m_pVMap = aVMultiSelectionMap; + m_pHMap = aHMultiSelectionMap; + } + else if( nAnchor == TextContentAnchorType_AT_PAGE ) + { + m_pVMap = m_bHtmlMode ? aVPageHtmlMap : aVPageMap; + m_pHMap = m_bHtmlMode ? aHPageHtmlMap : aHPageMap; + } + else if ( nAnchor == TextContentAnchorType_AT_FRAME ) + { + // OD 19.09.2003 #i18732# - own vertical alignment map for to frame + // anchored objects. + m_pVMap = m_bHtmlMode ? aVFlyHtmlMap : aVFrameMap; + m_pHMap = m_bHtmlMode ? aHFlyHtmlMap : aHFrameMap; + } + else if ( nAnchor == TextContentAnchorType_AT_PARAGRAPH ) + { + if(m_bHtmlMode) + { + m_pVMap = aVParaHtmlMap; + m_pHMap = m_nHtmlMode & HTMLMODE_SOME_ABS_POS ? aHParaHtmlAbsMap : aHParaHtmlMap; + } + else + { + m_pVMap = aVParaMap; + m_pHMap = aHParaMap; + } + } + else if ( nAnchor == TextContentAnchorType_AT_CHARACTER ) + { + if(m_bHtmlMode) + { + m_pVMap = m_nHtmlMode & HTMLMODE_SOME_ABS_POS ? aVCharHtmlAbsMap : aVCharHtmlMap; + m_pHMap = m_nHtmlMode & HTMLMODE_SOME_ABS_POS ? aHCharHtmlAbsMap : aHCharHtmlMap; + } + else + { + m_pVMap = aVCharMap; + m_pHMap = aHCharMap; + } + } + else if ( nAnchor == TextContentAnchorType_AS_CHARACTER ) + { + m_pVMap = m_bHtmlMode ? aVAsCharHtmlMap : aVAsCharMap; + m_pHMap = 0; + bEnable = FALSE; + } + m_aHoriLB.Enable( bEnable ); + m_aHoriFT.Enable( bEnable ); + + // aktuelle Pos selektieren + // Horizontal + if ( nH == USHRT_MAX ) + { + nH = m_nOldH; + nHRel = m_nOldHRel; + } + // OD 12.11.2003 #i22341# - pass as 3rd parameter to method + USHORT nMapPos = FillPosLB(m_pHMap, nH, nHRel, m_aHoriLB); + FillRelLB(m_pHMap, nMapPos, nH, nHRel, m_aHoriToLB, m_aHoriToFT); + + // Vertikal + if ( nV == USHRT_MAX ) + { + nV = m_nOldV; + nVRel = m_nOldVRel; + } + // OD 12.11.2003 #i22341# - pass as 3rd parameter to method + nMapPos = FillPosLB(m_pVMap, nV, nVRel, m_aVertLB); + FillRelLB(m_pVMap, nMapPos, nV, nVRel, m_aVertToLB, m_aVertToFT); + + // Edits init + bEnable = nH == HoriOrientation::NONE && + nAnchor != TextContentAnchorType_AS_CHARACTER;//#61359# warum nicht in Formaten&& !bFormat; + if (!bEnable) + { + m_aHoriByMF.SetValue( 0, FUNIT_TWIP ); + if (nX != LONG_MAX && m_bHtmlMode) + m_aHoriByMF.SetModifyFlag(); + } + else if(m_bIsMultiSelection) + { + m_aHoriByMF.SetValue( m_aHoriByMF.Normalize(m_aRect.Left()), FUNIT_TWIP ); + } + else + { + if (nX != LONG_MAX) + m_aHoriByMF.SetValue( m_aHoriByMF.Normalize(nX), FUNIT_TWIP ); + } + m_aHoriByFT.Enable( bEnable ); + m_aHoriByMF.Enable( bEnable ); + + bEnable = nV == VertOrientation::NONE; + if ( !bEnable ) + { + m_aVertByMF.SetValue( 0, FUNIT_TWIP ); + if(nY != LONG_MAX && m_bHtmlMode) + m_aVertByMF.SetModifyFlag(); + } + else if(m_bIsMultiSelection) + { + m_aVertByMF.SetValue( m_aVertByMF.Normalize(m_aRect.Top()), FUNIT_TWIP ); + } + else + { + if ( nAnchor == TextContentAnchorType_AS_CHARACTER ) + { + if ( nY == LONG_MAX ) + nY = 0; + else + nY *= -1; + } + if ( nY != LONG_MAX ) + m_aVertByMF.SetValue( m_aVertByMF.Normalize(nY), FUNIT_TWIP ); + } + m_aVertByFT.Enable( bEnable ); + m_aVertByMF.Enable( bEnable ); + UpdateExample(); +} +/*-- 05.03.2004 14:20:19--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvxSwPosSizeTabPage::UpdateExample() +{ + USHORT nPos = m_aHoriLB.GetSelectEntryPos(); + if ( m_pHMap && nPos != LISTBOX_ENTRY_NOTFOUND ) + { + USHORT nMapPos = GetMapPos(m_pHMap, m_aHoriLB); + short nAlign = GetAlignment(m_pHMap, nMapPos, m_aHoriLB, m_aHoriToLB); + short nRel = GetRelation(m_pHMap, m_aHoriToLB); + + m_aExampleWN.SetHAlign(nAlign); + m_aExampleWN.SetHoriRel(nRel); + } + + nPos = m_aVertLB.GetSelectEntryPos(); + if ( m_pVMap && nPos != LISTBOX_ENTRY_NOTFOUND ) + { + USHORT nMapPos = GetMapPos(m_pVMap, m_aVertLB); + USHORT nAlign = GetAlignment(m_pVMap, nMapPos, m_aVertLB, m_aVertToLB); + USHORT nRel = GetRelation(m_pVMap, m_aVertToLB); + + m_aExampleWN.SetVAlign(nAlign); + m_aExampleWN.SetVertRel(nRel); + } + + // Size + long nXPos = static_cast(m_aHoriByMF.Denormalize(m_aHoriByMF.GetValue(FUNIT_TWIP))); + long nYPos = static_cast(m_aVertByMF.Denormalize(m_aVertByMF.GetValue(FUNIT_TWIP))); + m_aExampleWN.SetRelPos(Point(nXPos, nYPos)); + + m_aExampleWN.SetAnchor( GetAnchorType() ); + m_aExampleWN.Invalidate(); +} +/*-- 05.03.2004 14:20:19--------------------------------------------------- + + -----------------------------------------------------------------------*/ +ULONG SvxSwPosSizeTabPage::FillRelLB(FrmMap *pMap, USHORT nMapPos, USHORT nAlign, + USHORT nRel, ListBox &rLB, FixedText &rFT) +{ + String sSelEntry; + ULONG nLBRelations = 0; + std::size_t nMapCount = ::lcl_GetFrmMapCount(pMap); + + rLB.Clear(); + + if (nMapPos < nMapCount) + { + if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap) + { + String sOldEntry(rLB.GetSelectEntry()); + USHORT nRelCount = sizeof(aAsCharRelationMap) / sizeof(RelationMap); + SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId; + + for (std::size_t _nMapPos = 0; _nMapPos < nMapCount; _nMapPos++) + { + if (pMap[_nMapPos].eStrId == eStrId) + { + nLBRelations = pMap[_nMapPos].nLBRelations; + for (USHORT nRelPos = 0; nRelPos < nRelCount; nRelPos++) + { + if (nLBRelations & aAsCharRelationMap[nRelPos].nLBRelation) + { + SvxSwFramePosString::StringId sStrId1 = aAsCharRelationMap[nRelPos].eStrId; + + sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, m_bIsVerticalFrame, m_bIsInRightToLeft); + String sEntry = m_aFramePosString.GetString(sStrId1); + USHORT nPos = rLB.InsertEntry(sEntry); + rLB.SetEntryData(nPos, &aAsCharRelationMap[nRelPos]); + if (pMap[_nMapPos].nAlign == nAlign) + sSelEntry = sEntry; + break; + } + } + } + } + if (sSelEntry.Len()) + rLB.SelectEntry(sSelEntry); + else + { + rLB.SelectEntry(sOldEntry); + + if (!rLB.GetSelectEntryCount()) + { + for (USHORT i = 0; i < rLB.GetEntryCount(); i++) + { + RelationMap *pEntry = (RelationMap *)rLB.GetEntryData(i); + if (pEntry->nLBRelation == LB_REL_CHAR) // Default + { + rLB.SelectEntryPos(i); + break; + } + } + } + } + } + else + { + USHORT nRelCount = sizeof(aRelationMap) / sizeof(RelationMap); + + // OD 14.11.2003 #i22341# - special handling for map , + // because its ambigous in its /. + if ( pMap == aVCharMap ) + { + nLBRelations = ::lcl_GetLBRelationsForStrID( pMap, + ( m_aHoriMirrorCB.IsChecked() + ? pMap[nMapPos].eMirrorStrId + : pMap[nMapPos].eStrId ), + m_aHoriMirrorCB.IsChecked() ); + } + else + { + nLBRelations = pMap[nMapPos].nLBRelations; + } + + for (ULONG nBit = 1; nBit < 0x80000000; nBit <<= 1) + { + if (nLBRelations & nBit) + { + for (USHORT nRelPos = 0; nRelPos < nRelCount; nRelPos++) + { + if (aRelationMap[nRelPos].nLBRelation == nBit) + { + SvxSwFramePosString::StringId sStrId1 = m_aHoriMirrorCB.IsChecked() ? aRelationMap[nRelPos].eMirrorStrId : aRelationMap[nRelPos].eStrId; + sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, m_bIsVerticalFrame, m_bIsInRightToLeft); + String sEntry = m_aFramePosString.GetString(sStrId1); + USHORT nPos = rLB.InsertEntry(sEntry); + rLB.SetEntryData(nPos, &aRelationMap[nRelPos]); + if (!sSelEntry.Len() && aRelationMap[nRelPos].nRelation == nRel) + sSelEntry = sEntry; + } + } + } + } + if (sSelEntry.Len()) + rLB.SelectEntry(sSelEntry); + else + { + // Warscheinlich Ankerwechsel. Daher aehnliche Relation suchen + switch (nRel) + { + case RelOrientation::FRAME: nRel = RelOrientation::PAGE_FRAME; break; + case RelOrientation::PRINT_AREA: nRel = RelOrientation::PAGE_PRINT_AREA; break; + case RelOrientation::PAGE_LEFT: nRel = RelOrientation::FRAME_LEFT; break; + case RelOrientation::PAGE_RIGHT: nRel = RelOrientation::FRAME_RIGHT; break; + case RelOrientation::FRAME_LEFT: nRel = RelOrientation::PAGE_LEFT; break; + case RelOrientation::FRAME_RIGHT: nRel = RelOrientation::PAGE_RIGHT; break; + case RelOrientation::PAGE_FRAME: nRel = RelOrientation::FRAME; break; + case RelOrientation::PAGE_PRINT_AREA: nRel = RelOrientation::PRINT_AREA; break; + + default: + if (rLB.GetEntryCount()) + { + RelationMap *pEntry = (RelationMap *)rLB.GetEntryData(rLB.GetEntryCount() - 1); + nRel = pEntry->nRelation; + } + break; + } + + for (USHORT i = 0; i < rLB.GetEntryCount(); i++) + { + RelationMap *pEntry = (RelationMap *)rLB.GetEntryData(i); + if (pEntry->nRelation == nRel) + { + rLB.SelectEntryPos(i); + break; + } + } + + if (!rLB.GetSelectEntryCount()) + rLB.SelectEntryPos(0); + } + } + } + + rLB.Enable(rLB.GetEntryCount() != 0); + rFT.Enable(rLB.GetEntryCount() != 0); + + RelHdl(&rLB); + + return nLBRelations; +} +/*-- 05.03.2004 14:20:19--------------------------------------------------- + + -----------------------------------------------------------------------*/ +USHORT SvxSwPosSizeTabPage::FillPosLB(FrmMap *_pMap, + USHORT _nAlign, + const USHORT _nRel, + ListBox &_rLB) +{ + String sSelEntry, sOldEntry; + sOldEntry = _rLB.GetSelectEntry(); + + _rLB.Clear(); + + // OD 12.11.2003 #i22341# - determine all possible listbox relations for + // given relation for map + const ULONG nLBRelations = (_pMap != aVCharMap) + ? 0L + : ::lcl_GetLBRelationsForRelations( _nRel ); + + // Listbox fuellen + std::size_t nCount = ::lcl_GetFrmMapCount(_pMap); + for (std::size_t i = 0; _pMap && i < nCount; ++i) + { +// #61359# Warum nicht von links/von innen bzw. von oben? +// if (!bFormat || (pMap[i].eStrId != SwFPos::FROMLEFT && pMap[i].eStrId != SwFPos::FROMTOP)) + { + SvxSwFramePosString::StringId eStrId = m_aHoriMirrorCB.IsChecked() ? _pMap[i].eMirrorStrId : _pMap[i].eStrId; + eStrId = lcl_ChangeResIdToVerticalOrRTL(eStrId, m_bIsVerticalFrame, m_bIsInRightToLeft); + String sEntry(m_aFramePosString.GetString(eStrId)); + if (_rLB.GetEntryPos(sEntry) == LISTBOX_ENTRY_NOTFOUND) + { + // bei zeichengebundenen Rahmen keine doppelten Eintraege einfuegen + _rLB.InsertEntry(sEntry); + } + // OD 12.11.2003 #i22341# - add condition to handle map + // that is ambigous in the alignment. + if ( _pMap[i].nAlign == _nAlign && + ( !(_pMap == aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) ) + { + sSelEntry = sEntry; + } + } + } + + _rLB.SelectEntry(sSelEntry); + if (!_rLB.GetSelectEntryCount()) + _rLB.SelectEntry(sOldEntry); + + if (!_rLB.GetSelectEntryCount()) + _rLB.SelectEntryPos(0); + + PosHdl(&_rLB); + + return GetMapPos(_pMap, _rLB); +} +/*-- 09.03.2004 15:37:50--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvxSwPosSizeTabPage::SetView( const SdrView* pSdrView ) +{ + m_pSdrView = pSdrView; + if(!m_pSdrView) + { + DBG_ERROR("No SdrView* set"); + return; + } + + // Setzen des Rechtecks und der Workingarea + m_aRect = m_pSdrView->GetAllMarkedRect(); + m_pSdrView->GetSdrPageView()->LogicToPagePos( m_aRect ); + + // get WorkArea + m_aWorkArea = m_pSdrView->GetWorkArea(); + + // Beruecksichtigung Ankerposition (bei Writer) + const SdrMarkList& rMarkList = m_pSdrView->GetMarkedObjectList(); + if( rMarkList.GetMarkCount() >= 1 ) + { + const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); + m_aAnchorPos = pObj->GetAnchorPos(); + + if( m_aAnchorPos != Point(0,0) ) // -> Writer + { + for( USHORT i = 1; i < rMarkList.GetMarkCount(); i++ ) + { + pObj = rMarkList.GetMark( i )->GetMarkedSdrObj(); + if( m_aAnchorPos != pObj->GetAnchorPos() ) + { + // different anchor positions -> disable positioning + m_aPositionFL.Enable(FALSE); + m_aHoriFT.Enable(FALSE); + m_aHoriLB.Enable(FALSE); + m_aHoriByFT.Enable(FALSE); + m_aHoriByMF.Enable(FALSE); + m_aHoriToFT.Enable(FALSE); + m_aHoriToLB.Enable(FALSE); + m_aHoriMirrorCB.Enable(FALSE); + m_aVertFT.Enable(FALSE); + m_aVertLB.Enable(FALSE); + m_aVertByFT.Enable(FALSE); + m_aVertByMF.Enable(FALSE); + m_aVertToFT.Enable(FALSE); + m_aVertToLB.Enable(FALSE); + m_aFollowCB.Enable(FALSE); + m_aHoriByMF.SetText(String()); + m_aVertByMF.SetText(String()); + + m_bPositioningDisabled = true; + return; + } + } + } + Point aPt = m_aAnchorPos * -1; + Point aPt2 = aPt; + + aPt += m_aWorkArea.TopLeft(); + m_aWorkArea.SetPos( aPt ); + + aPt2 += m_aRect.TopLeft(); + m_aRect.SetPos( aPt2 ); + } + + // this should happen via SID_ATTR_TRANSFORM_AUTOSIZE + if( rMarkList.GetMarkCount() == 1 ) + { + const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); + SdrObjKind eKind = (SdrObjKind) pObj->GetObjIdentifier(); + if( ( pObj->GetObjInventor() == SdrInventor ) && + ( eKind==OBJ_TEXT || eKind==OBJ_TITLETEXT || eKind==OBJ_OUTLINETEXT) && + ( (SdrTextObj*) pObj )->HasText() ) + { + DBG_ERROR("AutoWidth/AutoHeight should be enabled"); + } + } + else + m_bIsMultiSelection = true; + + // use page offset and recalculate + Point aPt( m_pSdrView->GetSdrPageView()->GetPageOrigin() ); + + // Massstab + Fraction aUIScale = m_pSdrView->GetModel()->GetUIScale(); + +// lcl_ScaleRect( m_aWorkArea, aUIScale ); +// lcl_ScaleRect( m_aRect, aUIScale ); +// lcl_ScalePoint( aPt, aUIScale ); + + // Metrik konvertieren +// int nDigits = maMtrPosX.GetDecimalDigits(); + +// aPt = lcl_ConvertPoint( aPt, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); +// m_aWorkArea = lcl_ConvertRect( m_aWorkArea, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); +// m_aRect = lcl_ConvertRect( m_aRect, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); + + // use page offset +// aPt *= -1; +// aPt += m_aWorkArea.TopLeft(); +// m_aWorkArea.SetPos( aPt ); + + //SetMinMaxPosition(); +} + diff --git a/cui/source/tabpages/swpossizetabpage.hrc b/cui/source/tabpages/swpossizetabpage.hrc new file mode 100644 index 000000000000..af4a081cb045 --- /dev/null +++ b/cui/source/tabpages/swpossizetabpage.hrc @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: swpossizetabpage.hrc,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define FL_SIZE 1 +#define FT_WIDTH 2 +#define MF_WIDTH 3 +#define FT_HEIGHT 4 +#define MF_HEIGHT 5 +#define CB_KEEPRATIO 6 +#define FL_SEPARATOR 7 +#define FL_ANCHOR 8 +#define RB_TOPAGE 9 +#define RB_TOPARA 10 +#define RB_TOCHAR 11 +#define RB_ASCHAR 12 +#define RB_TOFRAME 13 +#define FL_PROTECTION 14 +#define CB_POSITION 15 +#define CB_SIZE 16 +#define FL_POSITION 17 +#define FT_HORI 18 +#define LB_HORI 19 +#define FT_HORIBY 20 +#define MF_HORIBY 21 +#define FT_HORITO 22 +#define LB_HORITO 23 +#define CB_HORIMIRROR 24 +#define FT_VERT 25 +#define LB_VERT 26 +#define FT_VERTBY 27 +#define MF_VERTBY 28 +#define FT_VERTTO 29 +#define LB_VERTTO 30 +#define CB_FOLLOW 31 +#define WN_EXAMPLE 32 diff --git a/cui/source/tabpages/swpossizetabpage.hxx b/cui/source/tabpages/swpossizetabpage.hxx new file mode 100644 index 000000000000..911d72de1f48 --- /dev/null +++ b/cui/source/tabpages/swpossizetabpage.hxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: swpossizetabpage.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_SWPOSSIZETABPAGE_HXX +#define _SVX_SWPOSSIZETABPAGE_HXX + +#include +#include +#include +#include +#include +#include + +/*-- 01.03.2004 15:45:01--------------------------------------------------- + SvxSwPosSizeTabPage - position and size page for Writer drawing objects + -----------------------------------------------------------------------*/ +struct FrmMap; +class SdrView; +class SvxSwPosSizeTabPage : public SfxTabPage +{ + using TabPage::DeactivatePage; + + FixedLine m_aSizeFL; + FixedText m_aWidthFT; + MetricField m_aWidthMF; + FixedText m_aHeightFT; + MetricField m_aHeightMF; + CheckBox m_aKeepRatioCB; + + FixedLine m_aSeparatorFL; + + FixedLine m_aAnchorFL; + RadioButton m_aToPageRB; + RadioButton m_aToParaRB; + RadioButton m_aToCharRB; + RadioButton m_aAsCharRB; + RadioButton m_aToFrameRB; + + FixedLine m_aProtectionFL; + TriStateBox m_aPositionCB; + TriStateBox m_aSizeCB; + + FixedLine m_aPositionFL; + FixedText m_aHoriFT; + ListBox m_aHoriLB; + FixedText m_aHoriByFT; + MetricField m_aHoriByMF; + FixedText m_aHoriToFT; + ListBox m_aHoriToLB; + + CheckBox m_aHoriMirrorCB; + + FixedText m_aVertFT; + ListBox m_aVertLB; + FixedText m_aVertByFT; + MetricField m_aVertByMF; + FixedText m_aVertToFT; + ListBox m_aVertToLB; + + CheckBox m_aFollowCB; + + SvxSwFrameExample m_aExampleWN; + + Link m_aValidateLink; + + //'string provider' + SvxSwFramePosString m_aFramePosString; + + Rectangle m_aRect; //size of all selected objects + Rectangle m_aWorkArea; + Point m_aAnchorPos; + + FrmMap* m_pVMap; + FrmMap* m_pHMap; + const SdrView* m_pSdrView; + + // initial values + short m_nOldH; + short m_nOldHRel; + short m_nOldV; + short m_nOldVRel; + + double m_fWidthHeightRatio; //width-to-height ratio to support the KeepRatio button + USHORT m_nHtmlMode; + bool m_bHtmlMode; + bool m_bAtHoriPosModified; + bool m_bAtVertPosModified; + bool m_bIsVerticalFrame; + bool m_bPositioningDisabled; + bool m_bIsMultiSelection; + bool m_bIsInRightToLeft; + + + + DECL_LINK( RangeModifyHdl, Edit * ); + DECL_LINK( AnchorTypeHdl, RadioButton * ); + DECL_LINK( PosHdl, ListBox * ); + DECL_LINK( RelHdl, ListBox * ); + DECL_LINK( MirrorHdl, CheckBox * ); + DECL_LINK( ModifyHdl, Edit * ); + DECL_LINK( ProtectHdl, TriStateBox *); + + void InitPos(short nAnchorType, USHORT nH, USHORT nHRel, + USHORT nV, USHORT nVRel, + long nX, long nY); + USHORT GetMapPos(FrmMap *pMap, ListBox &rAlignLB); + short GetAlignment(FrmMap *pMap, USHORT nMapPos, ListBox &rAlignLB, ListBox &rRelationLB); + short GetRelation(FrmMap *pMap, ListBox &rRelationLB); + short GetAnchorType(bool* pbHasChanged = 0); + ULONG FillRelLB(FrmMap *pMap, USHORT nLBSelPos, USHORT nAlign, USHORT nRel, ListBox &rLB, FixedText &rFT); + USHORT FillPosLB(FrmMap *pMap, USHORT nAlign, const USHORT _nRel, ListBox &rLB); + + void UpdateExample(); + +public: + SvxSwPosSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs ); + ~SvxSwPosSizeTabPage(); + + static SfxTabPage* Create( Window*, const SfxItemSet& ); + static USHORT* GetRanges(); + + virtual BOOL FillItemSet( SfxItemSet& ); + virtual void Reset( const SfxItemSet & ); + + virtual int DeactivatePage( SfxItemSet* pSet ); + + void EnableAnchorTypes(USHORT nAnchorEnable); + + void SetValidateFramePosLink( const Link& rLink ) + {m_aValidateLink = rLink;} + + void SetView( const SdrView* pSdrView ); +}; + +#endif diff --git a/cui/source/tabpages/swpossizetabpage.src b/cui/source/tabpages/swpossizetabpage.src new file mode 100644 index 000000000000..ee8bac14f688 --- /dev/null +++ b/cui/source/tabpages/swpossizetabpage.src @@ -0,0 +1,299 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: swpossizetabpage.src,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include ------------------------------------------------------------------ +#include "helpid.hrc" +#include +#include "swpossizetabpage.hrc" + // pragma ------------------------------------------------------------------- + + + // RID_SVXPAGE_POSITION_SIZE ------------------------------------------------ +TabPage RID_SVXPAGE_SWPOSSIZE +{ + HelpId = HID_SVXPAGE_SWPOSSIZE; + Hide = TRUE ; + Text[ en-US ] = "Position and Size" ; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedLine FL_SIZE + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 104 , 8 ) ; + Text [ en-US ] = "Size" ; + }; + FixedText FT_WIDTH + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 43 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "~Width" ; + }; + MetricField MF_WIDTH + { + Pos = MAP_APPFONT ( 59 , 14 ) ; + Size = MAP_APPFONT ( 45 , 12 ) ; + Border = TRUE ; + Text = "12,99" ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 5 ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 5 ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_HEIGHT + { + Pos = MAP_APPFONT ( 12 , 32 ) ; + Size = MAP_APPFONT ( 43 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "H~eight" ; + }; + MetricField MF_HEIGHT + { + Pos = MAP_APPFONT ( 59 , 30 ) ; + Size = MAP_APPFONT ( 45 , 12 ) ; + Border = TRUE ; + Text = "12,99" ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 5 ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 5 ; + Last = 9999 ; + SpinSize = 10 ; + }; + CheckBox CB_KEEPRATIO + { + Pos = MAP_APPFONT ( 12 , 45 ) ; + Size = MAP_APPFONT ( 95 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Keep ratio" ; + }; + FixedLine FL_SEPARATOR + { + Pos = MAP_APPFONT ( 111 , 14 ) ; + Size = MAP_APPFONT ( 4 , 66 ) ; + Vert = TRUE; + }; + FixedLine FL_ANCHOR + { + Pos = MAP_APPFONT ( 116 , 3 ) ; + Size = MAP_APPFONT ( 80 , 8 ) ; + Text [ en-US ] = "Anchor" ; + }; + RadioButton RB_TOPAGE + { + Pos = MAP_APPFONT ( 122 , 14 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "To ~page"; + }; + RadioButton RB_TOPARA + { + Pos = MAP_APPFONT ( 122 , 28 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "To paragrap~h"; + }; + RadioButton RB_TOCHAR + { + Pos = MAP_APPFONT ( 122 , 42 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "To cha~racter"; + }; + RadioButton RB_ASCHAR + { + Pos = MAP_APPFONT ( 122 , 56 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "~As character" ; + }; + RadioButton RB_TOFRAME + { + Hide = TRUE; + Pos = MAP_APPFONT ( 122 , 70 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "To ~frame"; + }; + Window WN_EXAMPLE + { + Pos = MAP_APPFONT ( 202 , 14 ) ; + Size = MAP_APPFONT ( 52 , 66 ) ; + }; + FixedLine FL_PROTECTION + { + Pos = MAP_APPFONT ( 6 , 86 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Protect" ; + }; + TriStateBox CB_POSITION + { + Pos = MAP_APPFONT ( 12 , 97 ) ; + Size = MAP_APPFONT ( 113 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Position" ; + }; + TriStateBox CB_SIZE + { + Pos = MAP_APPFONT ( 122 , 97 ) ; + Size = MAP_APPFONT ( 113 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Size" ; + }; + FixedLine FL_POSITION + { + Pos = MAP_APPFONT ( 6 , 113 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Position" ; + }; + FixedText FT_HORI + { + Pos = MAP_APPFONT ( 12 , 126 ) ; + Size = MAP_APPFONT ( 35 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "Hori~zontal" ; + }; + ListBox LB_HORI + { + Pos = MAP_APPFONT ( 49 , 124 ) ; + Size = MAP_APPFONT ( 50 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_HORIBY + { + Pos = MAP_APPFONT ( 101 , 126 ) ; + Size = MAP_APPFONT ( 20 , 8 ) ; + Center = TRUE ; + Text [ en-US ] = "b~y" ; + }; + MetricField MF_HORIBY + { + Border = TRUE ; + Pos = MAP_APPFONT ( 123 , 124 ) ; + Size = MAP_APPFONT ( 35 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -9999 ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = -9999 ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_HORITO + { + Pos = MAP_APPFONT ( 160 , 126 ) ; + Size = MAP_APPFONT ( 21 , 8 ) ; + Center = TRUE ; + Text [ en-US ] = "~to" ; + }; + ListBox LB_HORITO + { + Pos = MAP_APPFONT ( 183 , 124 ) ; + Size = MAP_APPFONT ( 65 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + CheckBox CB_HORIMIRROR + { + Pos = MAP_APPFONT ( 12 , 139 ) ; + Size = MAP_APPFONT ( 236 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Mirror on even pages" ; + }; + FixedText FT_VERT + { + Pos = MAP_APPFONT ( 12 , 155 ) ; + Size = MAP_APPFONT ( 35 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "~Vertical" ; + }; + ListBox LB_VERT + { + Pos = MAP_APPFONT ( 49 , 153 ) ; + Size = MAP_APPFONT ( 50 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_VERTBY + { + Pos = MAP_APPFONT ( 101 , 155 ) ; + Size = MAP_APPFONT ( 20 , 8 ) ; + Center = TRUE ; + Text [ en-US ] = "by" ; + }; + MetricField MF_VERTBY + { + Border = TRUE ; + Pos = MAP_APPFONT ( 123 , 153 ) ; + Size = MAP_APPFONT ( 35 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -9999 ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = -9999 ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_VERTTO + { + Pos = MAP_APPFONT ( 160 , 155 ) ; + Size = MAP_APPFONT ( 21 , 8 ) ; + Center = TRUE ; + Text [ en-US ] = "t~o" ; + }; + ListBox LB_VERTTO + { + Pos = MAP_APPFONT ( 183 , 153 ) ; + Size = MAP_APPFONT ( 65 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + CheckBox CB_FOLLOW + { + Pos = MAP_APPFONT ( 12 , 168 ) ; + Size = MAP_APPFONT ( 113 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Follow text flow" ; + }; +}; diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx new file mode 100644 index 000000000000..412b1affe5c4 --- /dev/null +++ b/cui/source/tabpages/tabarea.cxx @@ -0,0 +1,370 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tabarea.cxx,v $ + * $Revision: 1.13 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- + +#include +#include +#include +#include +#include +#include +#include +#include + +#define _SVX_TABAREA_CXX + +#include +#include +#include "svx/globl3d.hxx" +#include +#include "svx/drawitem.hxx" +#include "cuitabarea.hxx" +#include "tabarea.hrc" +#include "dlgname.hxx" +//#include "dlgname.hrc" +#include + +#define DLGWIN this->GetParent()->GetParent() + +/************************************************************************* +|* +|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu +|* +|************************************************************************/ + +SvxAreaTabDialog::SvxAreaTabDialog +( + Window* pParent, + const SfxItemSet* pAttr, + SdrModel* pModel, + const SdrView* /* pSdrView */ +) : + + SfxTabDialog( pParent, SVX_RES( RID_SVXDLG_AREA ), pAttr ), + + mpDrawModel ( pModel ), +// mpView ( pSdrView ), + mpColorTab ( pModel->GetColorTable() ), + mpNewColorTab ( pModel->GetColorTable() ), + mpGradientList ( pModel->GetGradientList() ), + mpNewGradientList ( pModel->GetGradientList() ), + mpHatchingList ( pModel->GetHatchList() ), + mpNewHatchingList ( pModel->GetHatchList() ), + mpBitmapList ( pModel->GetBitmapList() ), + mpNewBitmapList ( pModel->GetBitmapList() ), + mrOutAttrs ( *pAttr ), + mnColorTableState ( CT_NONE ), + mnBitmapListState ( CT_NONE ), + mnGradientListState ( CT_NONE ), + mnHatchingListState ( CT_NONE ), + mnPageType( PT_AREA ), + mnDlgType( 0 ), + mnPos( 0 ), + mbAreaTP( sal_False ), + mbDeleteColorTable( TRUE ) +{ + FreeResource(); + + AddTabPage( RID_SVXPAGE_AREA, SvxAreaTabPage::Create, 0 ); + AddTabPage( RID_SVXPAGE_SHADOW, SvxShadowTabPage::Create, 0 ); + AddTabPage( RID_SVXPAGE_TRANSPARENCE, SvxTransparenceTabPage::Create, 0); + AddTabPage( RID_SVXPAGE_COLOR, SvxColorTabPage::Create, 0 ); + AddTabPage( RID_SVXPAGE_GRADIENT, SvxGradientTabPage::Create, 0 ); + AddTabPage( RID_SVXPAGE_HATCH, SvxHatchTabPage::Create, 0 ); + AddTabPage( RID_SVXPAGE_BITMAP, SvxBitmapTabPage::Create, 0); + + SetCurPageId( RID_SVXPAGE_AREA ); + + CancelButton& rBtnCancel = GetCancelButton(); + rBtnCancel.SetClickHdl( LINK( this, SvxAreaTabDialog, CancelHdlImpl ) ); +//! rBtnCancel.SetText( SVX_RESSTR( RID_SVXSTR_CLOSE ) ); +} + +// ----------------------------------------------------------------------- + +SvxAreaTabDialog::~SvxAreaTabDialog() +{ +} + + +// ----------------------------------------------------------------------- + +void SvxAreaTabDialog::SavePalettes() +{ + SfxObjectShell* pShell = SfxObjectShell::Current(); + /*uno::Reference< frame::XDispatchProvider > xDispatchProvider; + if ( !pShell ) + { + uno::Reference< frame::XModel> xModel = mpDrawModel->getUnoModel(); + if ( xModel.is() ) + xDispatchProvider.set(xModel->getCurrentController(),uno::UNO_QUERY); + }*/ + if( mpNewColorTab != mpDrawModel->GetColorTable() ) + { + if(mbDeleteColorTable) + delete mpDrawModel->GetColorTable(); + mpDrawModel->SetColorTable( mpNewColorTab ); + SvxColorTableItem aColorTableItem( mpNewColorTab, SID_COLOR_TABLE ); + if ( pShell ) + pShell->PutItem( aColorTableItem ); + else + { + mpDrawModel->GetItemPool().Put(aColorTableItem,SID_COLOR_TABLE); + } + mpColorTab = mpDrawModel->GetColorTable(); + } + if( mpNewGradientList != mpDrawModel->GetGradientList() ) + { + delete mpDrawModel->GetGradientList(); + mpDrawModel->SetGradientList( mpNewGradientList ); + SvxGradientListItem aItem( mpNewGradientList, SID_GRADIENT_LIST ); + if ( pShell ) + pShell->PutItem( aItem ); + else + { + mpDrawModel->GetItemPool().Put(aItem,SID_GRADIENT_LIST); + } + mpGradientList = mpDrawModel->GetGradientList(); + } + if( mpNewHatchingList != mpDrawModel->GetHatchList() ) + { + delete mpDrawModel->GetHatchList(); + mpDrawModel->SetHatchList( mpNewHatchingList ); + SvxHatchListItem aItem( mpNewHatchingList, SID_HATCH_LIST ); + if ( pShell ) + pShell->PutItem( aItem ); + else + { + mpDrawModel->GetItemPool().Put(aItem,SID_HATCH_LIST); + } + mpHatchingList = mpDrawModel->GetHatchList(); + } + if( mpNewBitmapList != mpDrawModel->GetBitmapList() ) + { + delete mpDrawModel->GetBitmapList(); + mpDrawModel->SetBitmapList( mpNewBitmapList ); + SvxBitmapListItem aItem( mpNewBitmapList, SID_BITMAP_LIST ); + if ( pShell ) + pShell->PutItem( aItem ); + else + { + mpDrawModel->GetItemPool().Put(aItem,SID_BITMAP_LIST); + } + mpBitmapList = mpDrawModel->GetBitmapList(); + } + + // Speichern der Tabellen, wenn sie geaendert wurden. + + const String aPath( SvtPathOptions().GetPalettePath() ); + + if( mnHatchingListState & CT_MODIFIED ) + { + mpHatchingList->SetPath( aPath ); + mpHatchingList->Save(); + + SvxHatchListItem aItem( mpHatchingList, SID_HATCH_LIST ); + // ToolBoxControls werden benachrichtigt: + if ( pShell ) + pShell->PutItem( aItem ); + else + { + mpDrawModel->GetItemPool().Put(aItem); + } + } + + if( mnBitmapListState & CT_MODIFIED ) + { + mpBitmapList->SetPath( aPath ); + mpBitmapList->Save(); + + SvxBitmapListItem aItem( mpBitmapList, SID_BITMAP_LIST ); + // ToolBoxControls werden benachrichtigt: + if ( pShell ) + pShell->PutItem( aItem ); + else + { + mpDrawModel->GetItemPool().Put(aItem); + } + } + + if( mnGradientListState & CT_MODIFIED ) + { + mpGradientList->SetPath( aPath ); + mpGradientList->Save(); + + SvxGradientListItem aItem( mpGradientList, SID_GRADIENT_LIST ); + // ToolBoxControls werden benachrichtigt: + if ( pShell ) + pShell->PutItem( aItem ); + else + { + mpDrawModel->GetItemPool().Put(aItem); + } + } + + if( mnColorTableState & CT_MODIFIED ) + { + mpColorTab->SetPath( aPath ); + mpColorTab->Save(); + + SvxColorTableItem aItem( mpColorTab, SID_COLOR_TABLE ); + // ToolBoxControls werden benachrichtigt: + if ( pShell ) + pShell->PutItem( aItem ); + else + { + mpDrawModel->GetItemPool().Put(aItem); + } + } +} +// ----------------------------------------------------------------------- + +short SvxAreaTabDialog::Ok() +{ + SavePalettes(); + + // Es wird RET_OK zurueckgeliefert, wenn wenigstens eine + // TabPage in FillItemSet() TRUE zurueckliefert. Dieses + // geschieht z.Z. standardmaessig. + return( SfxTabDialog::Ok() ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK_INLINE_START( SvxAreaTabDialog, CancelHdlImpl, void *, EMPTYARG) +{ + SavePalettes(); + + EndDialog( RET_CANCEL ); + return 0; +} +IMPL_LINK_INLINE_END( SvxAreaTabDialog, CancelHdlImpl, void *, p ) + +// ----------------------------------------------------------------------- + +void SvxAreaTabDialog::PageCreated( USHORT nId, SfxTabPage &rPage ) +{ + switch( nId ) + { + case RID_SVXPAGE_AREA: + ( (SvxAreaTabPage&) rPage ).SetColorTable( mpColorTab ); + ( (SvxAreaTabPage&) rPage ).SetGradientList( mpGradientList ); + ( (SvxAreaTabPage&) rPage ).SetHatchingList( mpHatchingList ); + ( (SvxAreaTabPage&) rPage ).SetBitmapList( mpBitmapList ); + //CHINA001 ( (SvxAreaTabPage&) rPage ).SetPageType( &mnPageType ); + ( (SvxAreaTabPage&) rPage ).SetPageType( mnPageType ); //add CHINA001 + //CHINA001 ( (SvxAreaTabPage&) rPage ).SetDlgType( &mnDlgType ); + ( (SvxAreaTabPage&) rPage ).SetDlgType( mnDlgType );//add CHINA001 + //CHINA001 ( (SvxAreaTabPage&) rPage ).SetPos( &nPos ); + ( (SvxAreaTabPage&) rPage ).SetPos( mnPos );//add CHINA001 + ( (SvxAreaTabPage&) rPage ).SetAreaTP( &mbAreaTP ); + ( (SvxAreaTabPage&) rPage ).SetGrdChgd( &mnGradientListState ); + ( (SvxAreaTabPage&) rPage ).SetHtchChgd( &mnHatchingListState ); + ( (SvxAreaTabPage&) rPage ).SetBmpChgd( &mnBitmapListState ); + ( (SvxAreaTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + ( (SvxAreaTabPage&) rPage ).Construct(); + // ActivatePage() wird das erste mal nicht gerufen + ( (SvxAreaTabPage&) rPage ).ActivatePage( mrOutAttrs ); + + break; + + case RID_SVXPAGE_SHADOW: + { + ( (SvxShadowTabPage&) rPage ).SetColorTable( mpColorTab ); + ( (SvxShadowTabPage&) rPage ).SetPageType( mnPageType );//CHINA001 ( (SvxShadowTabPage&) rPage ).SetPageType( &mnPageType ); + ( (SvxShadowTabPage&) rPage ).SetDlgType( mnDlgType );//CHINA001 ( (SvxShadowTabPage&) rPage ).SetDlgType( &mnDlgType ); + //( (SvxShadowTabPage&) rPage ).SetPos( &nPos ); + ( (SvxShadowTabPage&) rPage ).SetAreaTP( &mbAreaTP ); + ( (SvxShadowTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + ( (SvxShadowTabPage&) rPage ).Construct(); + } + break; + + case RID_SVXPAGE_GRADIENT: + ( (SvxGradientTabPage&) rPage ).SetColorTable( mpColorTab ); + ( (SvxGradientTabPage&) rPage ).SetGradientList( mpGradientList ); + ( (SvxGradientTabPage&) rPage ).SetPageType( &mnPageType ); + ( (SvxGradientTabPage&) rPage ).SetDlgType( &mnDlgType ); + ( (SvxGradientTabPage&) rPage ).SetPos( &mnPos ); + ( (SvxGradientTabPage&) rPage ).SetAreaTP( &mbAreaTP ); + ( (SvxGradientTabPage&) rPage ).SetGrdChgd( &mnGradientListState ); + ( (SvxGradientTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + ( (SvxGradientTabPage&) rPage ).Construct(); + break; + + case RID_SVXPAGE_HATCH: + ( (SvxHatchTabPage&) rPage ).SetColorTable( mpColorTab ); + ( (SvxHatchTabPage&) rPage ).SetHatchingList( mpHatchingList ); + ( (SvxHatchTabPage&) rPage ).SetPageType( &mnPageType ); + ( (SvxHatchTabPage&) rPage ).SetDlgType( &mnDlgType ); + ( (SvxHatchTabPage&) rPage ).SetPos( &mnPos ); + ( (SvxHatchTabPage&) rPage ).SetAreaTP( &mbAreaTP ); + ( (SvxHatchTabPage&) rPage ).SetHtchChgd( &mnHatchingListState ); + ( (SvxHatchTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + ( (SvxHatchTabPage&) rPage ).Construct(); + break; + + case RID_SVXPAGE_BITMAP: + ( (SvxBitmapTabPage&) rPage ).SetColorTable( mpColorTab ); + ( (SvxBitmapTabPage&) rPage ).SetBitmapList( mpBitmapList ); + ( (SvxBitmapTabPage&) rPage ).SetPageType( &mnPageType ); + ( (SvxBitmapTabPage&) rPage ).SetDlgType( &mnDlgType ); + ( (SvxBitmapTabPage&) rPage ).SetPos( &mnPos ); + ( (SvxBitmapTabPage&) rPage ).SetAreaTP( &mbAreaTP ); + ( (SvxBitmapTabPage&) rPage ).SetBmpChgd( &mnBitmapListState ); + ( (SvxBitmapTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + ( (SvxBitmapTabPage&) rPage ).Construct(); + break; + + case RID_SVXPAGE_COLOR: + ( (SvxColorTabPage&) rPage ).SetColorTable( mpColorTab ); + ( (SvxColorTabPage&) rPage ).SetPageType( &mnPageType ); + ( (SvxColorTabPage&) rPage ).SetDlgType( &mnDlgType ); + ( (SvxColorTabPage&) rPage ).SetPos( &mnPos ); + ( (SvxColorTabPage&) rPage ).SetAreaTP( &mbAreaTP ); + ( (SvxColorTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + ( (SvxColorTabPage&) rPage ).SetDeleteColorTable( mbDeleteColorTable ); + ( (SvxColorTabPage&) rPage ).Construct(); + break; + + case RID_SVXPAGE_TRANSPARENCE: + ( (SvxTransparenceTabPage&) rPage ).SetPageType( mnPageType );//CHINA001 ( (SvxTransparenceTabPage&) rPage ).SetPageType( &mnPageType ); + ( (SvxTransparenceTabPage&) rPage ).SetDlgType( mnDlgType );//CHINA001 ( (SvxTransparenceTabPage&) rPage ).SetDlgType( &mnDlgType ); + ( (SvxTransparenceTabPage&) rPage ).Construct(); + break; + + } +} + + diff --git a/cui/source/tabpages/tabarea.hrc b/cui/source/tabpages/tabarea.hrc new file mode 100644 index 000000000000..c79e52d82380 --- /dev/null +++ b/cui/source/tabpages/tabarea.hrc @@ -0,0 +1,190 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tabarea.hrc,v $ + * $Revision: 1.10 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define BTN_LOAD 5 +#define BTN_SAVE 6 +#define GRP_FILL 1 +#define GRP_SHADOW 2 +#define GRP_PREVIEW 3 +#define GRP_TRANSPARENT 4 +#define GRP_STEPCOUNT 5 +#define CTL_PREVIEW 1 +#define CTL_POSITION 2 +//#define CTL_GRADIENT_PREVIEW 3 +//#define CTL_HATCHING_PREVIEW 4 +#define CTL_COLOR_PREVIEW 5 +#define CTL_BITMAP_PREVIEW 6 +#define MTR_FLD_DISTANCE 1 +#define TSB_INVISIBLE 1 +#define TSB_SHOW_SHADOW 2 +#define TSB_STEPCOUNT 3 +#define TSB_TILE 4 +#define TSB_STRETCH 5 +#define TSB_ORIGINAL 6 +#define AREADLG_INVISIBLE 0 +#define AREADLG_COLOR 1 +#define AREADLG_GRADIENT 2 +#define AREADLG_HATCH 3 +#define AREADLG_BITMAP 4 + +#define LB_COLOR 1 +#define LB_GRADIENT 2 +#define LB_HATCHING 3 +#define LB_BITMAP 4 +//#define LB_TRANSPARENT 5 +#define LB_BITMAPS 4 +#define LB_BACKGROUND_COLOR 3 +#define LB_DLG_TYPE 99 +#define GRP_COLOR 1 +#define BTN_ADD 1 +#define BTN_IMPORT 2 +#define BTN_MODIFY 3 +#define BTN_DELETE 4 +#define FT_COLOR 1 +#define FT_BACKGROUND_COLOR 2 +#define FT_POSITION 2 +#define FT_DISTANCE 1 +#define FT_LINE_COLOR 2 +#define FT_LINE_TYPE 1 +#define FT_LINE_DISTANCE 3 +#define FT_LINE_ANGLE 4 +#define GRP_LINE 1 +#define GRP_HATCHINGS 5 +#define MTR_FLD_ANGLE 3 +#define CTL_ANGLE 2 +#define LB_HATCHINGS 4 +#define LB_LINE_TYPE 1 +#define LB_LINE_COLOR 3 +#define GRP_GRADIENTS 4 +#define GRP_GRADIENT_TYPE 5 +#define LB_GRADIENTS 3 +#define LB_GRADIENT_TYPES 4 +#define LB_COLOR_FROM 1 +#define LB_COLOR_TO 2 +#define FT_COLOR_FROM 1 +#define FT_COLOR_TO 2 +#define FT_CENTER_X 3 +#define FT_CENTER_Y 5 +#define FT_ANGLE 4 +#define FT_BORDER 6 +#define MTR_COLOR_FROM 4 +#define MTR_COLOR_TO 5 +#define MTR_CENTER_X 2 +#define MTR_CENTER_Y 3 +#define MTR_BORDER 6 +#define MTR_ANGLE 1 +#define NUM_FLD_STEPCOUNT 1 +#define FT_PIXEL_EDIT 4 +#define CTL_PIXEL 2 +#define FT_TYPE 7 +#define FT_SHADOW_COLOR 10 +#define LB_SHADOW_COLOR 10 +#define FL_PROP 2 +#define FL_SIZE 3 +#define FL_POSITION 4 +#define FL_OFFSET 5 +#define FL_STEPCOUNT 7 + +// Farben definieren TabPage +// nur temporaer !!! +// #define RID_SVXPAGE_COLOR 999 + +//#define GRP_COLORTABLE 1 +//#define GRP_COLORMODEL 2 + +#define BTN_WORK_ON 2 +#define CTL_COLORTABLE 3 +#define CTL_PREVIEW_OLD 1 +#define CTL_PREVIEW_NEW 2 +#define FT_NAME 2 +#define EDT_NAME 1 +// #define LB_COLOR 1 +#define LB_COLORMODEL 2 +#define FT_1 3 +#define FT_2 4 +#define FT_3 5 +#define FT_4 6 +#define MTR_FLD_1 1 +#define MTR_FLD_2 2 +#define MTR_FLD_3 3 +#define MTR_FLD_4 4 +#define FT_TABLE_NAME 7 +#define MTR_FLD_X_SIZE 4 +#define MTR_FLD_Y_SIZE 5 +#define GRP_SIZE 6 +#define TSB_SCALE 1 +#define GRP_POSITION 7 +#define FT_X_OFFSET 1 +#define FT_Y_OFFSET 2 +#define MTR_FLD_X_OFFSET 1 +#define MTR_FLD_Y_OFFSET 2 +#define LB_AREA_TYPE 19 +#define RBT_ROW 6 +#define RBT_COLUMN 7 +#define MTR_FLD_OFFSET 3 +#define GRP_OFFSET 8 + +#define FT_TRANSPARENT 9 +#define FT_X_SIZE 10 +#define FT_Y_SIZE 11 +#define FT_BITMAPS_HIDDEN 12 + +#define RBT_TRANS_OFF 8 +#define RBT_TRANS_LINEAR 9 +#define RBT_TRANS_GRADIENT 10 +#define GRP_TRANS_MODE 9 +#define GRP_TRANS_GRADIENT 10 +#define CTL_TRANS_PREVIEW 19 + +#define FT_TRGR_TYPE 12 +#define LB_TRGR_GRADIENT_TYPES 3 +#define FT_TRGR_CENTER_X 13 +#define MTR_TRGR_CENTER_X 4 +#define FT_TRGR_CENTER_Y 14 +#define MTR_TRGR_CENTER_Y 5 +#define FT_TRGR_ANGLE 15 +#define MTR_TRGR_ANGLE 6 +#define FT_TRGR_BORDER 16 +#define MTR_TRGR_BORDER 7 +#define FT_TRGR_START_VALUE 17 +#define MTR_TRGR_START_VALUE 8 +#define FT_TRGR_END_VALUE 18 +#define MTR_TRGR_END_VALUE 9 +#define MTR_TRANSPARENT 10 + +#define MTR_SHADOW_TRANSPARENT 11 + +// Hatch-Background on Area-TabPage +#define GRP_HATCHBCKGRD 20 +#define CB_HATCHBCKGRD 21 +#define LB_HATCHBCKGRDCOLOR 22 + + +#define IMG_LOAD_H 23 +#define IMG_SAVE_H 24 diff --git a/cui/source/tabpages/tabarea.src b/cui/source/tabpages/tabarea.src new file mode 100644 index 000000000000..877d1c5799fd --- /dev/null +++ b/cui/source/tabpages/tabarea.src @@ -0,0 +1,1541 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tabarea.src,v $ + * $Revision: 1.65 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include "helpid.hrc" +#include +#include "tabarea.hrc" + +#define MASKCOLOR MaskColor = Color{ Red = 0xff00 ; Green = 0x0000 ; Blue = 0xff00 ; }; + + + // RID_SVXPAGE_AREA ------------------------------------------------------ +#define TRANS_GRAD_OFFSET_X 6 +#define TRANS_GRAD_OFFSET_Y 64 +#define TRANS_GRAD_FIELD_SEPARATION 24 + +TabPage RID_SVXPAGE_TRANSPARENCE +{ + HelpID = HID_AREA_TRANSPARENCE; + Hide = TRUE; + Size = MAP_APPFONT ( 260 , 185 ); + FixedLine FL_PROP + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248, 8 ) ; + Text [ en-US ] = "Transparency mode"; + }; + RadioButton RBT_TRANS_OFF + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 110 , 10 ) ; + Text [ en-US ] = "~No transparency"; + }; + RadioButton RBT_TRANS_LINEAR + { + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "~Transparency"; + }; + MetricField MTR_TRANSPARENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 72 , 26 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + RadioButton RBT_TRANS_GRADIENT + { + Pos = MAP_APPFONT ( 12 , 42 ) ; + Size = MAP_APPFONT ( 110 , 10 ) ; + Text [ en-US ] = "Gradient"; + }; + FixedText FT_TRGR_TYPE + { + Pos = MAP_APPFONT ( 21 , 56 ) ; + Size = MAP_APPFONT ( 41 , 8 ) ; + Text [ en-US ] = "Ty~pe"; + }; + ListBox LB_TRGR_GRADIENT_TYPES + { + Border = TRUE ; + Pos = MAP_APPFONT ( 72 , 54 ) ; + Size = MAP_APPFONT ( 53 , 63 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Linear" ; Default ; > ; + < "Axial" ; Default ; > ; + < "Radial" ; Default ; > ; + < "Ellipsoid" ; Default ; > ; + < "Quadratic" ; Default ; > ; + < "Square" ; Default ; > ; + }; + }; + FixedText FT_TRGR_CENTER_X + { + Pos = MAP_APPFONT ( 21 , 72 ) ; + Size = MAP_APPFONT ( 41 , 8 ) ; + Text [ en-US ] = "Center ~X"; + }; + MetricField MTR_TRGR_CENTER_X + { + Border = TRUE ; + Pos = MAP_APPFONT ( 72 , 70 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_TRGR_CENTER_Y + { + Pos = MAP_APPFONT ( 21 , 88 ) ; + Size = MAP_APPFONT ( 41 , 8 ) ; + Text [ en-US ] = "Center ~Y"; + }; + MetricField MTR_TRGR_CENTER_Y + { + Border = TRUE ; + Pos = MAP_APPFONT ( 72 , 86 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_TRGR_ANGLE + { + Pos = MAP_APPFONT ( 21 , 104 ) ; + Size = MAP_APPFONT ( 41 , 8 ) ; + Text [ en-US ] = "~Angle"; + }; + MetricField MTR_TRGR_ANGLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 72 , 102 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 359 ; + Unit = FUNIT_CUSTOM ; + Last = 359 ; + SpinSize = 15 ; + CustomUnitText [ en-US ] = " degrees"; + }; + FixedText FT_TRGR_BORDER + { + Pos = MAP_APPFONT ( 15 + TRANS_GRAD_OFFSET_X, 56 + TRANS_GRAD_OFFSET_Y) ; + Size = MAP_APPFONT ( 41, 8 ) ; + Text [ en-US ] = "~Border"; + }; + MetricField MTR_TRGR_BORDER + { + Border = TRUE ; + Pos = MAP_APPFONT ( 66 + TRANS_GRAD_OFFSET_X, 54 + TRANS_GRAD_OFFSET_Y) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_TRGR_START_VALUE + { + Pos = MAP_APPFONT ( 21 , 136 ) ; + Size = MAP_APPFONT ( 41 , 8 ) ; + Text [ en-US ] = "~Start value"; + }; + MetricField MTR_TRGR_START_VALUE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 72 , 134 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_TRGR_END_VALUE + { + Pos = MAP_APPFONT ( 21 , 152 ) ; + Size = MAP_APPFONT ( 41 , 8 ) ; + Text [ en-US ] = "~End value"; + }; + MetricField MTR_TRGR_END_VALUE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 72 , 150 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + Control CTL_BITMAP_PREVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 138 , 14 ) ; + Size = MAP_APPFONT ( 110 , 42 ) ; + }; + Control CTL_TRANS_PREVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 138 , 14 ) ; + Size = MAP_APPFONT ( 110 , 42 ) ; + }; + Text [ en-US ] = "Transparency"; +}; + + // RID_SVXPAGE_AREA ------------------------------------------------------ +TabPage RID_SVXPAGE_AREA +{ + Size = MAP_APPFONT ( 260 , 185 ) ; + HelpID = HID_AREA_AREA ; + Hide = TRUE ; + Text [ en-US ] = "Area" ; + + FixedLine FL_PROP + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 120, 8 ) ; + Text [ en-US ] = "Fill"; + }; + ListBox LB_AREA_TYPE + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 108 , 60 ) ; + DropDown = TRUE; + Border = TRUE; + StringList [ en-US ] = + { + < "None" ; Default ; > ; + < "Color" ; Default ; > ; + < "Gradient" ; Default ; > ; + < "Hatching" ; Default ; > ; + < "Bitmap" ; Default ; > ; + }; + }; + + + ListBox LB_COLOR + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 30 ) ; + Size = MAP_APPFONT ( 108 , 103 ) ; + TabStop = TRUE ; + }; + ListBox LB_GRADIENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 30 ) ; + Size = MAP_APPFONT ( 108 , 103 ) ; + TabStop = TRUE ; + }; + ListBox LB_HATCHING + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 30 ) ; + Size = MAP_APPFONT ( 108 , 103 ) ; + TabStop = TRUE ; + }; + ListBox LB_BITMAP + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 30 ) ; + Size = MAP_APPFONT ( 108 , 103 ) ; + TabStop = TRUE ; + }; + + // ---------- preview ---------- + + Control CTL_COLOR_PREVIEW + { + Border = TRUE; + Pos = MAP_APPFONT ( 12 , 137 ) ; + Size = MAP_APPFONT ( 110 , 42 ) ; + }; + Control CTL_BITMAP_PREVIEW + { + Border = TRUE; + Pos = MAP_APPFONT ( 12 , 137 ) ; + Size = MAP_APPFONT ( 110 , 42 ) ; + Hide = TRUE ; + }; + + // ---------- for gradients ---------- + + FixedLine FL_STEPCOUNT + { + Pos = MAP_APPFONT ( 132 , 3 ) ; + Size = MAP_APPFONT ( 122 , 8 ) ; + Text [ en-US ] = "Increments" ; + }; + TriStateBox TSB_STEPCOUNT + { + Pos = MAP_APPFONT ( 138 , 15 ) ; + Size = MAP_APPFONT ( 68 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "A~utomatic" ; + }; + NumericField NUM_FLD_STEPCOUNT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 208 , 14 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 3 ; + First = 3 ; + Maximum = 256 ; + Last = 256 ; + StrictFormat = TRUE ; + }; + + // ---------- for hatches ---------- + + CheckBox CB_HATCHBCKGRD + { + Pos = MAP_APPFONT ( 132 , 3 ) ; + Size = MAP_APPFONT ( 122 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Background color" ; + }; + ListBox LB_HATCHBCKGRDCOLOR + { + Border = TRUE ; + Pos = MAP_APPFONT ( 141 , 16 ) ; + Size = MAP_APPFONT ( 70 , 100 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + + // ---------- for bitmaps ---------- + + FixedLine FL_SIZE + { + Pos = MAP_APPFONT ( 132 , 3 ) ; + Size = MAP_APPFONT ( 122 , 8 ) ; + Text [ en-US ] = "Size" ; + }; + TriStateBox TSB_ORIGINAL + { + Pos = MAP_APPFONT ( 138 , 15 ) ; + Size = MAP_APPFONT ( 48 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Original" ; + }; + TriStateBox TSB_SCALE + { + Pos = MAP_APPFONT ( 138 , 30 ) ; + Size = MAP_APPFONT ( 48 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Re~lative" ; + }; + FixedText FT_X_SIZE + { + Pos = MAP_APPFONT ( 187 , 15 ) ; + Size = MAP_APPFONT ( 24 , 8 ) ; + Text [ en-US ] = "Wi~dth" ; + }; + MetricField MTR_FLD_X_SIZE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 212 , 14 ) ; + Size = MAP_APPFONT ( 36 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + CustomUnitText = "%" ; + Minimum = 5 ; + Maximum = 100 ; + First = 5 ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_Y_SIZE + { + Pos = MAP_APPFONT ( 187 , 31 ) ; + Size = MAP_APPFONT ( 24 , 8 ) ; + Text [ en-US ] = "H~eight" ; + }; + MetricField MTR_FLD_Y_SIZE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 212 , 29 ) ; + Size = MAP_APPFONT ( 36 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + CustomUnitText = "%" ; + Minimum = 5 ; + Maximum = 100 ; + First = 5 ; + Last = 100 ; + SpinSize = 5 ; + SpinSize = 5 ; + }; + FixedLine FL_POSITION + { + Pos = MAP_APPFONT ( 132 , 47 ) ; + Size = MAP_APPFONT ( 122 , 8 ) ; + Text [ en-US ] = "Position" ; + }; + + Control CTL_POSITION + { + Border = TRUE ; + Pos = MAP_APPFONT ( 138 , 57 ) ; + Size = MAP_APPFONT ( 40 , 27 ) ; + TabStop = TRUE ; + }; + FixedText FT_X_OFFSET + { + Pos = MAP_APPFONT ( 138 , 89 ) ; + Size = MAP_APPFONT ( 39 , 8 ) ; + Text [ en-US ] = "~X Offset" ; + }; + FixedText FT_Y_OFFSET + { + Pos = MAP_APPFONT ( 139 , 104 ) ; + Size = MAP_APPFONT ( 78 , 8 ) ; + Text [ en-US ] = "~Y Offset" ; + }; + MetricField MTR_FLD_X_OFFSET + { + Border = TRUE ; + Pos = MAP_APPFONT ( 219 , 87 ) ; + Size = MAP_APPFONT ( 29 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Maximum = 100 ; + Last = 100 ; + SpinSize = 5 ; + }; + MetricField MTR_FLD_Y_OFFSET + { + Border = TRUE ; + Pos = MAP_APPFONT ( 219 , 102 ) ; + Size = MAP_APPFONT ( 29 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + TriStateBox TSB_TILE + { + Pos = MAP_APPFONT ( 138 , 117 ) ; + Size = MAP_APPFONT ( 54 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Tile" ; + }; + TriStateBox TSB_STRETCH + { + Pos = MAP_APPFONT ( 194 , 117 ) ; + Size = MAP_APPFONT ( 54 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Auto~Fit" ; + }; + FixedLine FL_OFFSET + { + Pos = MAP_APPFONT ( 132 , 133 ) ; + Size = MAP_APPFONT ( 122 , 8 ) ; + Text [ en-US ] = "Offset" ; + }; + RadioButton RBT_ROW + { + Pos = MAP_APPFONT ( 138 , 144 ) ; + Size = MAP_APPFONT ( 75 , 10 ) ; + Text [ en-US ] = "Ro~w" ; + }; + RadioButton RBT_COLUMN + { + Pos = MAP_APPFONT ( 138 , 158 ) ; + Size = MAP_APPFONT ( 75 , 10 ) ; + Text [ en-US ] = "Colu~mn" ; + }; + MetricField MTR_FLD_OFFSET + { + Border = TRUE ; + Pos = MAP_APPFONT ( 219 , 157 ) ; + Size = MAP_APPFONT ( 29 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; +}; + // RID_SVXPAGE_SHADOW ------------------------------------------------------ +TabPage RID_SVXPAGE_SHADOW +{ + HelpID = HID_AREA_SHADOW ; + Hide = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Text [ en-US ] = "Shadow" ; + FixedLine FL_PROP + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248, 8 ) ; + Text [ en-US ] = "Properties"; + }; + TriStateBox TSB_SHOW_SHADOW + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 110 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Use shadow"; + }; + FixedText FT_POSITION + { + Pos = MAP_APPFONT ( 12 , 33 ) ; + Size = MAP_APPFONT ( 50 , 10 ) ; + Text [ en-US ] = "~Position"; + }; + Control CTL_POSITION + { + HelpId = HID_TPSHADOW_CTRL ; + Pos = MAP_APPFONT ( 65 , 31 ) ; + Size = MAP_APPFONT ( 57 , 29 ) ; + Border = TRUE ; + TabStop = TRUE ; + }; + FixedText FT_DISTANCE + { + Pos = MAP_APPFONT ( 12 , 69 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Distance"; + }; + MetricField MTR_FLD_DISTANCE + { + Pos = MAP_APPFONT ( 65 , 67 ) ; + Size = MAP_APPFONT ( 47 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 99999 ; + Minimum = 0 ; // #i33700# + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + Last = 99999 ; + /*SpinSize = 100 ; */ + SpinSize = 1 ; + }; + ListBox LB_SHADOW_COLOR + { + Pos = MAP_APPFONT ( 65 , 86 ) ; + Size = MAP_APPFONT ( 57 , 100 ) ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + Border = TRUE ; + TabStop = TRUE ; + }; + FixedText FT_SHADOW_COLOR + { + Pos = MAP_APPFONT ( 12 , 88 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Color" ; + }; + FixedText FT_TRANSPARENT + { + Pos = MAP_APPFONT ( 12 , 107 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Transparency"; + }; + MetricField MTR_SHADOW_TRANSPARENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 65 , 105 ) ; + Size = MAP_APPFONT ( 47 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + Control CTL_COLOR_PREVIEW + { + Border = TRUE; + Pos = MAP_APPFONT ( 138 , 14 ) ; + Size = MAP_APPFONT ( 110 , 42 ) ; + TabStop = FALSE ; + }; +}; + // RID_SVXPAGE_HATCH -------------------------------------------------------- +TabPage RID_SVXPAGE_HATCH +{ + HelpID = HID_AREA_HATCH ; + Hide = TRUE ; + Text [ en-US ] = "Hatching" ; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedLine FL_PROP + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248, 8 ) ; + Text [ en-US ] = "Properties"; + }; + FixedText FT_LINE_DISTANCE + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 78 , 8 ) ; + Text [ en-US ] = "~Spacing" ; + }; + MetricField MTR_FLD_DISTANCE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 25 ) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 30 ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + First = 30 ; + Last = 9999 ; + SpinSize = 100 ; + }; + FixedText FT_LINE_ANGLE + { + Pos = MAP_APPFONT ( 12 , 41 ) ; + Size = MAP_APPFONT ( 78 , 8 ) ; + Text [ en-US ] = "A~ngle" ; + }; + MetricField MTR_FLD_ANGLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 52 ) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 359 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText [ en-US ] = " degrees" ; + Last = 359 ; + SpinSize = 15 ; + }; + Control CTL_ANGLE + { + HelpId = HID_TPHATCH_CTRL ; + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 72 ) ; + Size = MAP_APPFONT ( 39 , 39 ) ; + TabStop = TRUE ; + }; + FixedText FT_LINE_TYPE + { + Pos = MAP_APPFONT ( 12 , 123 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Line type" ; + }; + ListBox LB_LINE_TYPE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 134 ) ; + Size = MAP_APPFONT ( 62 , 62 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Single" ; Default ; > ; + < "Crossed" ; Default ; > ; + < "Triple" ; Default ; > ; + }; + }; + FixedText FT_LINE_COLOR + { + Pos = MAP_APPFONT ( 12 , 150 ) ; + Size = MAP_APPFONT ( 49 , 8 ) ; + Text [ en-US ] = "Line ~color" ; + }; + ListBox LB_LINE_COLOR + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 161 ) ; + Size = MAP_APPFONT ( 62 , 100 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + ListBox LB_HATCHINGS + { + Border = TRUE ; + Pos = MAP_APPFONT ( 103 , 14 ) ; + Size = MAP_APPFONT ( 88 , 110 ) ; + TabStop = TRUE ; + }; + Control CTL_PREVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 103 , 131 ) ; + Size = MAP_APPFONT ( 88 , 42 ) ; + }; + PushButton BTN_ADD + { + Pos = MAP_APPFONT ( 197 , 14 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Add..." ; + TabStop = TRUE ; + }; + PushButton BTN_MODIFY + { + Pos = MAP_APPFONT ( 197 , 32 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Modify..." ; + TabStop = TRUE ; + }; + PushButton BTN_DELETE + { + Pos = MAP_APPFONT ( 197 , 68 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Delete..." ; + TabStop = TRUE ; + }; + ImageButton BTN_LOAD + { + Pos = MAP_APPFONT ( 197 , 104 ) ; + Size = MAP_APPFONT ( 16 , 16 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Load Hatches List" ; + ButtonImage = Image + { + ImageBitmap = Bitmap + { + File = "sc05501.bmp" ; + }; + MASKCOLOR + }; + }; + ImageButton BTN_SAVE + { + Pos = MAP_APPFONT ( 197 , 124 ) ; + Size = MAP_APPFONT ( 16 , 16 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Save Hatches List" ; + ButtonImage = Image + { + ImageBitmap = Bitmap + { + File = "sc05502.bmp" ; + }; + MASKCOLOR + }; + }; +}; + // RID_SVXPAGE_BITMAP ------------------------------------------------------- +TabPage RID_SVXPAGE_BITMAP +{ + HelpID = HID_AREA_BITMAP ; + Hide = TRUE ; + Text [ en-US ] = "Bitmap Patterns" ; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedLine FL_PROP + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248, 8 ) ; + Text [ en-US ] = "Properties"; + }; + FixedText FT_PIXEL_EDIT + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 85 , 8 ) ; + Text [ en-US ] = "Pattern Editor"; + }; + Control CTL_PIXEL + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 25 ) ; + Size = MAP_APPFONT ( 72 , 72 ) ; + TabStop = TRUE ; + }; + FixedText FT_COLOR + { + Pos = MAP_APPFONT ( 12 , 104 ) ; + Size = MAP_APPFONT ( 85 , 8 ) ; + Text [ en-US ] = "~Foreground color"; + }; + ListBox LB_COLOR + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 115 ) ; + Size = MAP_APPFONT ( 62 , 100 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + FixedText FT_BACKGROUND_COLOR + { + Pos = MAP_APPFONT ( 12 , 131 ) ; + Size = MAP_APPFONT ( 85 , 8 ) ; + Text [ en-US ] = "~Background color"; + }; + ListBox LB_BACKGROUND_COLOR + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 142 ) ; + Size = MAP_APPFONT ( 62 , 100 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + FixedText FT_BITMAPS_HIDDEN + { + // Hidden label that provides the name for the bitmaps list box. + Text [ en-US ] = "Bitmap"; + }; + ListBox LB_BITMAPS + { + Border = TRUE ; + Pos = MAP_APPFONT ( 103 , 14 ) ; + Size = MAP_APPFONT ( 88 , 110 ) ; + TabStop = TRUE ; + }; + Control CTL_PREVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 103 , 131 ) ; + Size = MAP_APPFONT ( 88 , 42 ) ; + }; + PushButton BTN_ADD + { + Pos = MAP_APPFONT ( 197 , 14 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Add..." ; + TabStop = TRUE ; + }; + PushButton BTN_MODIFY + { + Pos = MAP_APPFONT ( 197 , 32 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Modify..." ; + TabStop = TRUE ; + }; + PushButton BTN_IMPORT + { + Pos = MAP_APPFONT ( 197 , 50 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Import..." ; + TabStop = TRUE ; + }; + PushButton BTN_DELETE + { + Pos = MAP_APPFONT ( 197 , 68 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Delete..." ; + TabStop = TRUE ; + }; + ImageButton BTN_LOAD + { + Pos = MAP_APPFONT ( 197 , 104 ) ; + Size = MAP_APPFONT ( 16 , 16 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Load Bitmap List" ; + ButtonImage = Image + { + ImageBitmap = Bitmap + { + File = "sc05501.bmp" ; + }; + MASKCOLOR + }; + }; + ImageButton BTN_SAVE + { + Pos = MAP_APPFONT ( 197 , 124 ) ; + Size = MAP_APPFONT ( 16 , 16 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Save Bitmap List" ; + ButtonImage = Image + { + ImageBitmap = Bitmap + { + File = "sc05502.bmp" ; + }; + MASKCOLOR + }; + }; +}; + // RID_SVXPAGE_GRADIENT ----------------------------------------------------- +TabPage RID_SVXPAGE_GRADIENT +{ + HelpID = HID_AREA_GRADIENT ; + Hide = TRUE ; + Text [ en-US ] = "Gradients" ; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedLine FL_PROP + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248, 8 ) ; + Text [ en-US ] = "Properties"; + }; + FixedText FT_TYPE + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 26 , 8 ) ; + Text [ en-US ] = "Ty~pe" ; + }; + ListBox LB_GRADIENT_TYPES + { + Border = TRUE ; + Pos = MAP_APPFONT ( 49 , 14 ) ; + Size = MAP_APPFONT ( 48, 63 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Linear" ; Default ; > ; + < "Axial" ; Default ; > ; + < "Radial" ; Default ; > ; + < "Ellipsoid" ; Default ; > ; + < "Square" ; Default ; > ; + < "Rectangular" ; Default ; > ; + }; + }; + FixedText FT_CENTER_X + { + Pos = MAP_APPFONT ( 12 , 32 ) ; + Size = MAP_APPFONT ( 37 , 8 ) ; + Text [ en-US ] = "Center ~X" ; + }; + MetricField MTR_CENTER_X + { + Border = TRUE ; + Pos = MAP_APPFONT ( 49 , 30 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_CENTER_Y + { + Pos = MAP_APPFONT ( 12 , 48 ) ; + Size = MAP_APPFONT ( 37 , 8 ) ; + Text [ en-US ] = "Center ~Y" ; + }; + MetricField MTR_CENTER_Y + { + Border = TRUE ; + Pos = MAP_APPFONT ( 49 , 46 ) ; + Size = MAP_APPFONT ( 40, 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_ANGLE + { + Pos = MAP_APPFONT ( 12 , 64 ) ; + Size = MAP_APPFONT ( 37 , 8 ) ; + Text [ en-US ] = "A~ngle" ; + }; + MetricField MTR_ANGLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 49 , 62 ) ; + Size = MAP_APPFONT ( 40, 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 359 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText [ en-US ] = " degrees" ; + Last = 359 ; + SpinSize = 15 ; + }; + FixedText FT_BORDER + { + Pos = MAP_APPFONT ( 12 , 80 ) ; + Size = MAP_APPFONT ( 32 , 8 ) ; + Text [ en-US ] = "~Border" ; + }; + MetricField MTR_BORDER + { + Border = TRUE ; + Pos = MAP_APPFONT ( 49 , 78 ) ; + Size = MAP_APPFONT ( 40, 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_COLOR_FROM + { + Pos = MAP_APPFONT ( 12 , 99 ) ; + Size = MAP_APPFONT ( 32 , 8 ) ; + Text [ en-US ] = "~From" ; + }; + ListBox LB_COLOR_FROM + { + Border = TRUE ; + Pos = MAP_APPFONT ( 49 , 97 ) ; + Size = MAP_APPFONT ( 48, 100 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + MetricField MTR_COLOR_FROM + { + Border = TRUE ; + Pos = MAP_APPFONT ( 49 , 113 ) ; + Size = MAP_APPFONT ( 40, 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_COLOR_TO + { + Pos = MAP_APPFONT ( 12 , 133 ) ; + Size = MAP_APPFONT ( 32 , 8 ) ; + Text [ en-US ] = "~To" ; + }; + ListBox LB_COLOR_TO + { + Border = TRUE ; + Pos = MAP_APPFONT ( 49 , 131 ) ; + Size = MAP_APPFONT ( 48, 100 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + MetricField MTR_COLOR_TO + { + Border = TRUE ; + Pos = MAP_APPFONT ( 49 , 147 ) ; + Size = MAP_APPFONT ( 40, 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + ListBox LB_GRADIENTS + { + Border = TRUE ; + Pos = MAP_APPFONT ( 103 , 14 ) ; + Size = MAP_APPFONT ( 88 , 110 ) ; + TabStop = TRUE ; + }; + Control CTL_PREVIEW + { + Border = TRUE; + Pos = MAP_APPFONT ( 103 , 131 ) ; + Size = MAP_APPFONT ( 88 , 42 ) ; + }; + PushButton BTN_ADD + { + Pos = MAP_APPFONT ( 197 , 14 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Add..." ; + TabStop = TRUE ; + }; + PushButton BTN_MODIFY + { + Pos = MAP_APPFONT ( 197 , 32 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Modify..." ; + TabStop = TRUE ; + }; + PushButton BTN_DELETE + { + Pos = MAP_APPFONT ( 197 , 68 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Delete..." ; + TabStop = TRUE ; + }; + ImageButton BTN_LOAD + { + Pos = MAP_APPFONT ( 197 , 104 ) ; + Size = MAP_APPFONT ( 16 , 16 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Load Gradients List" ; + ButtonImage = Image + { + ImageBitmap = Bitmap + { + File = "sc05501.bmp" ; + }; + MASKCOLOR + }; + }; + ImageButton BTN_SAVE + { + Pos = MAP_APPFONT ( 197 , 124 ) ; + Size = MAP_APPFONT ( 16 , 16 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Save Gradients List" ; + ButtonImage = Image + { + ImageBitmap = Bitmap + { + File = "sc05502.bmp" ; + }; + MASKCOLOR + }; + }; +}; + // RID_SVXPAGE_COLOR -------------------------------------------------------- +TabPage RID_SVXPAGE_COLOR +{ + HelpId = HID_OPTIONS_COLOR ; + Hide = TRUE ; + Text [ en-US ] = "Colors" ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedLine FL_PROP + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248, 8 ) ; + Text [ en-US ] = "Properties"; + }; + FixedText FT_NAME + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 28 , 8 ) ; + Text [ en-US ] = "~Name" ; + }; + Edit EDT_NAME + { + Border = TRUE ; + Pos = MAP_APPFONT ( 42 , 14 ) ; + Size = MAP_APPFONT ( 76 , 12 ) ; + TabStop = TRUE ; + }; + FixedText FT_COLOR + { + Pos = MAP_APPFONT ( 12 , 32 ) ; + Size = MAP_APPFONT ( 28 , 8 ) ; + Text [ en-US ] = "C~olor" ; + }; + ListBox LB_COLOR + { + Border = TRUE ; + Pos = MAP_APPFONT ( 42 , 30 ) ; + Size = MAP_APPFONT ( 76 , 100 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + + FixedText FT_TABLE_NAME + { + Pos = MAP_APPFONT ( 42 , 48 ) ; + Size = MAP_APPFONT ( 94 , 8 ) ; + Text [ en-US ] = "Color table" ; + }; + Control CTL_COLORTABLE + { + Border = TRUE ; + Hide = TRUE ; + Pos = MAP_APPFONT ( 42 , 59 ) ; + Size = MAP_APPFONT ( 94 , 117 ) ; + TabStop = TRUE ; + }; + + Control CTL_PREVIEW_OLD + { + Border = TRUE; + Pos = MAP_APPFONT ( 157 , 14 ) ; + Size = MAP_APPFONT ( 34 , 25 ) ; + }; + Control CTL_PREVIEW_NEW + { + Border = TRUE; + Pos = MAP_APPFONT ( 157, 39 ) ; + Size = MAP_APPFONT ( 34 , 25 ) ; + }; + ListBox LB_COLORMODEL + { + Border = TRUE ; + Pos = MAP_APPFONT ( 157 , 71 ) ; + Size = MAP_APPFONT ( 34 , 12 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "RGB" ; Default ; > ; + < "CMYK" ; Default ; > ; + }; + }; + FixedText FT_1 + { + Pos = MAP_APPFONT ( 142 , 89 ) ; + Size = MAP_APPFONT ( 15 , 8 ) ; + Text = "~C" ; + }; + MetricField MTR_FLD_1 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 157 , 87 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + }; + FixedText FT_2 + { + Pos = MAP_APPFONT ( 142 , 105 ) ; + Size = MAP_APPFONT ( 15 , 8 ) ; + Text = "~M" ; + }; + MetricField MTR_FLD_2 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 157 , 103 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + }; + FixedText FT_3 + { + Pos = MAP_APPFONT ( 142 , 121 ) ; + Size = MAP_APPFONT ( 15 , 8 ) ; + Text = "~Y" ; + }; + MetricField MTR_FLD_3 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 157 , 119 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + }; + FixedText FT_4 + { + Pos = MAP_APPFONT ( 142 , 137 ) ; + Size = MAP_APPFONT ( 15 , 8 ) ; + Text = "~K" ; + }; + MetricField MTR_FLD_4 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 157 , 135 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + }; + PushButton BTN_ADD + { + Pos = MAP_APPFONT ( 197 , 14 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Add" ; + TabStop = TRUE ; + }; + PushButton BTN_WORK_ON + { + Pos = MAP_APPFONT ( 197 , 50 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Edit..." ; + TabStop = TRUE ; + }; + PushButton BTN_DELETE + { + Pos = MAP_APPFONT ( 197 , 68 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Delete..." ; + TabStop = TRUE ; + }; + PushButton BTN_MODIFY + { + Pos = MAP_APPFONT ( 197, 32 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Modify" ; + TabStop = TRUE ; + }; + ImageButton BTN_LOAD + { + Pos = MAP_APPFONT ( 197 , 104 ) ; + Size = MAP_APPFONT ( 16 , 16 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Load Color List" ; + ButtonImage = Image + { + ImageBitmap = Bitmap + { + File = "sc05501.bmp" ; + }; + MASKCOLOR + }; + }; + ImageButton BTN_SAVE + { + Pos = MAP_APPFONT ( 197 , 124 ) ; + Size = MAP_APPFONT ( 16 , 16 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Save Color List" ; + ButtonImage = Image + { + ImageBitmap = Bitmap + { + File = "sc05502.bmp" ; + }; + MASKCOLOR + }; + }; +}; + // RID_SVXDLG_AREA ---------------------------------------------------------- +TabDialog RID_SVXDLG_AREA +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 289 , 176 ) ; + Text [ en-US ] = "Area" ; + Moveable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 3 , 3 ) ; + PageList = + { + PageItem + { + Identifier = RID_SVXPAGE_AREA ; + Text [ en-US ] = "Area" ; + PageResID = RID_SVXPAGE_AREA ; + }; + PageItem + { + Identifier = RID_SVXPAGE_SHADOW ; + PageResID = RID_SVXPAGE_SHADOW ; + Text [ en-US ] = "Shadow" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_TRANSPARENCE ; + Text [ en-US ] = "Transparency"; + }; + PageItem + { + Identifier = RID_SVXPAGE_COLOR ; + Text [ en-US ] = "Colors" ; + PageResID = RID_SVXPAGE_COLOR ; + }; + PageItem + { + Identifier = RID_SVXPAGE_GRADIENT ; + Text [ en-US ] = "Gradients" ; + PageResID = RID_SVXPAGE_GRADIENT ; + }; + PageItem + { + Identifier = RID_SVXPAGE_HATCH ; + Text [ en-US ] = "Hatching" ; + PageResID = RID_SVXPAGE_HATCH ; + }; + PageItem + { + Identifier = RID_SVXPAGE_BITMAP ; + Text [ en-US ] = "Bitmaps" ; + PageResID = RID_SVXPAGE_BITMAP ; + }; + }; + }; +}; + +Image RID_SVXIMG_LOAD_H +{ + ImageBitmap = Bitmap + { + File = "sch05501.bmp" ; + }; + MASKCOLOR +}; + +Image RID_SVXIMG_SAVE_H +{ + ImageBitmap = Bitmap + { + File = "sch05502.bmp" ; + }; + MASKCOLOR +}; + + // ********************************************************************** EOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/tabline.cxx b/cui/source/tabpages/tabline.cxx new file mode 100644 index 000000000000..c25aabb5aeed --- /dev/null +++ b/cui/source/tabpages/tabline.cxx @@ -0,0 +1,300 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tabline.cxx,v $ + * $Revision: 1.13 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include +#include +#include + +#define _SVX_TABLINE_CXX +#include +#include "tabline.hrc" +//#include "dlgname.hrc" + +#include "cuitabarea.hxx" +#include "cuitabline.hxx" +#include "dlgname.hxx" +#include +#include +#include +#include "svx/drawitem.hxx" + +#define DLGWIN this->GetParent()->GetParent() + +#define BITMAP_WIDTH 32 +#define BITMAP_HEIGHT 12 +#define XOUT_WIDTH 150 + +/************************************************************************* +|* +|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu +|* +\************************************************************************/ + +SvxLineTabDialog::SvxLineTabDialog +( + Window* pParent, + const SfxItemSet* pAttr, + SdrModel* pModel, + const SdrObject* pSdrObj, + BOOL bHasObj +) : + + SfxTabDialog ( pParent, SVX_RES( RID_SVXDLG_LINE ), pAttr ), + pDrawModel ( pModel ), + pObj ( pSdrObj ), + rOutAttrs ( *pAttr ), + pColorTab ( pModel->GetColorTable() ), + mpNewColorTab ( pModel->GetColorTable() ), + pDashList ( pModel->GetDashList() ), + pNewDashList ( pModel->GetDashList() ), + pLineEndList ( pModel->GetLineEndList() ), + pNewLineEndList ( pModel->GetLineEndList() ), + bObjSelected ( bHasObj ), + nLineEndListState( CT_NONE ), + nDashListState( CT_NONE ), + mnColorTableState( CT_NONE ), + nPageType( 0 ), // wird hier in erster Linie benutzt, um mit FillItemSet + // die richtigen Attribute zu erhalten ( noch Fragen? ) + nDlgType( 0 ), + nPosDashLb( 0 ), + nPosLineEndLb( 0 ), + mnPos( 0 ), + mbAreaTP( sal_False ), + mbDeleteColorTable( TRUE ) +{ + FreeResource(); + + bool bLineOnly = false; + if( pObj && pObj->GetObjInventor() == SdrInventor ) + { + switch( pObj->GetObjIdentifier() ) + { + case OBJ_LINE: + case OBJ_PLIN: + case OBJ_PATHLINE: + case OBJ_FREELINE: + case OBJ_MEASURE: + case OBJ_EDGE: + bLineOnly = true; + + default: + break; + } + + } + + AddTabPage( RID_SVXPAGE_LINE, SvxLineTabPage::Create, 0); + if( bLineOnly ) + AddTabPage( RID_SVXPAGE_SHADOW, SvxShadowTabPage::Create, 0 ); + else + RemoveTabPage( RID_SVXPAGE_SHADOW ); + + AddTabPage( RID_SVXPAGE_LINE_DEF, SvxLineDefTabPage::Create, 0); + AddTabPage( RID_SVXPAGE_LINEEND_DEF, SvxLineEndDefTabPage::Create, 0); +// AddTabPage( RID_SVXPAGE_COLOR, SvxColorTabPage::Create, 0 ); + + SetCurPageId( RID_SVXPAGE_LINE ); + + CancelButton& rBtnCancel = GetCancelButton(); + rBtnCancel.SetClickHdl( LINK( this, SvxLineTabDialog, CancelHdlImpl ) ); +//! rBtnCancel.SetText( SVX_RESSTR( RID_SVXSTR_CLOSE ) ); +} + +// ----------------------------------------------------------------------- + +SvxLineTabDialog::~SvxLineTabDialog() +{ +} + +// ----------------------------------------------------------------------- + +void SvxLineTabDialog::SavePalettes() +{ + SfxObjectShell* pShell = SfxObjectShell::Current(); + if( mpNewColorTab != pDrawModel->GetColorTable() ) + { + if(mbDeleteColorTable) + delete pDrawModel->GetColorTable(); + pDrawModel->SetColorTable( mpNewColorTab ); + if ( pShell ) + pShell->PutItem( SvxColorTableItem( mpNewColorTab, SID_COLOR_TABLE ) ); + pColorTab = pDrawModel->GetColorTable(); + } + if( pNewDashList != pDrawModel->GetDashList() ) + { + delete pDrawModel->GetDashList(); + pDrawModel->SetDashList( pNewDashList ); + if ( pShell ) + pShell->PutItem( SvxDashListItem( pNewDashList, SID_DASH_LIST ) ); + pDashList = pDrawModel->GetDashList(); + } + if( pNewLineEndList != pDrawModel->GetLineEndList() ) + { + delete pDrawModel->GetLineEndList(); + pDrawModel->SetLineEndList( pNewLineEndList ); + if ( pShell ) + pShell->PutItem( SvxLineEndListItem( pNewLineEndList, SID_LINEEND_LIST ) ); + pLineEndList = pDrawModel->GetLineEndList(); + } + + // Speichern der Tabellen, wenn sie geaendert wurden. + + const String aPath( SvtPathOptions().GetPalettePath() ); + + if( nDashListState & CT_MODIFIED ) + { + pDashList->SetPath( aPath ); + pDashList->Save(); + + // ToolBoxControls werden benachrichtigt: + if ( pShell ) + pShell->PutItem( SvxDashListItem( pDashList, SID_DASH_LIST ) ); + } + + if( nLineEndListState & CT_MODIFIED ) + { + pLineEndList->SetPath( aPath ); + pLineEndList->Save(); + + // ToolBoxControls werden benachrichtigt: + if ( pShell ) + pShell->PutItem( SvxLineEndListItem( pLineEndList, SID_LINEEND_LIST ) ); + } + + if( mnColorTableState & CT_MODIFIED ) + { + pColorTab->SetPath( aPath ); + pColorTab->Save(); + + // ToolBoxControls werden benachrichtigt: + if ( pShell ) + pShell->PutItem( SvxColorTableItem( pColorTab, SID_COLOR_TABLE ) ); + } +} + +// ----------------------------------------------------------------------- + +short SvxLineTabDialog::Ok() +{ + SavePalettes(); + + // Es wird RET_OK zurueckgeliefert, wenn wenigstens eine + // TabPage in FillItemSet() TRUE zurueckliefert. Dieses + // geschieht z.Z. standardmaessig. + return( SfxTabDialog::Ok() ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK_INLINE_START( SvxLineTabDialog, CancelHdlImpl, void *, EMPTYARG ) +{ + SavePalettes(); + + EndDialog( RET_CANCEL ); + return 0; +} +IMPL_LINK_INLINE_END( SvxLineTabDialog, CancelHdlImpl, void *, EMPTYARG ) + +// ----------------------------------------------------------------------- + +void SvxLineTabDialog::PageCreated( USHORT nId, SfxTabPage &rPage ) +{ + switch( nId ) + { + case RID_SVXPAGE_LINE: + ( (SvxLineTabPage&) rPage ).SetColorTable( pColorTab ); + ( (SvxLineTabPage&) rPage ).SetDashList( pDashList ); + ( (SvxLineTabPage&) rPage ).SetLineEndList( pLineEndList ); + ( (SvxLineTabPage&) rPage ).SetDlgType( nDlgType );//CHINA001 ( (SvxLineTabPage&) rPage ).SetDlgType( &nDlgType ); + ( (SvxLineTabPage&) rPage ).SetPageType( nPageType );//CHINA001 ( (SvxLineTabPage&) rPage ).SetPageType( &nPageType ); + ( (SvxLineTabPage&) rPage ).SetPosDashLb( &nPosDashLb ); + ( (SvxLineTabPage&) rPage ).SetPosLineEndLb( &nPosLineEndLb ); + ( (SvxLineTabPage&) rPage ).SetDashChgd( &nDashListState ); + ( (SvxLineTabPage&) rPage ).SetLineEndChgd( &nLineEndListState ); + ( (SvxLineTabPage&) rPage ).SetObjSelected( bObjSelected ); + ( (SvxLineTabPage&) rPage ).Construct(); + ( (SvxLineTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + // ActivatePage() wird das erste mal nicht gerufen + ( (SvxLineTabPage&) rPage ).ActivatePage( rOutAttrs ); + break; + + case RID_SVXPAGE_LINE_DEF: + ( (SvxLineDefTabPage&) rPage ).SetDashList( pDashList ); + ( (SvxLineDefTabPage&) rPage ).SetDlgType( &nDlgType ); + ( (SvxLineDefTabPage&) rPage ).SetPageType( &nPageType ); + ( (SvxLineDefTabPage&) rPage ).SetPosDashLb( &nPosDashLb ); + ( (SvxLineDefTabPage&) rPage ).SetDashChgd( &nDashListState ); + ( (SvxLineDefTabPage&) rPage ).SetObjSelected( bObjSelected ); + ( (SvxLineDefTabPage&) rPage ).Construct(); + break; + + case RID_SVXPAGE_LINEEND_DEF: + ( (SvxLineEndDefTabPage&) rPage ).SetLineEndList( pLineEndList ); + ( (SvxLineEndDefTabPage&) rPage ).SetPolyObj( pObj ); + ( (SvxLineEndDefTabPage&) rPage ).SetDlgType( &nDlgType ); + ( (SvxLineEndDefTabPage&) rPage ).SetPageType( &nPageType ); + ( (SvxLineEndDefTabPage&) rPage ).SetPosLineEndLb( &nPosLineEndLb ); + ( (SvxLineEndDefTabPage&) rPage ).SetLineEndChgd( &nLineEndListState ); + ( (SvxLineEndDefTabPage&) rPage ).SetObjSelected( bObjSelected ); + ( (SvxLineEndDefTabPage&) rPage ).Construct(); + break; + + case RID_SVXPAGE_SHADOW: + { + ( (SvxShadowTabPage&) rPage ).SetColorTable( pColorTab ); + ( (SvxShadowTabPage&) rPage ).SetPageType( nPageType ); + ( (SvxShadowTabPage&) rPage ).SetDlgType( nDlgType ); + ( (SvxShadowTabPage&) rPage ).SetAreaTP( &mbAreaTP ); + ( (SvxShadowTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + ( (SvxShadowTabPage&) rPage ).Construct(); + } + break; +/* + case RID_SVXPAGE_COLOR: + ( (SvxColorTabPage&) rPage ).SetColorTable( pColorTab ); + ( (SvxColorTabPage&) rPage ).SetPageType( &nPageType ); + ( (SvxColorTabPage&) rPage ).SetDlgType( &nDlgType ); + ( (SvxColorTabPage&) rPage ).SetPos( &mnPos ); + ( (SvxColorTabPage&) rPage ).SetAreaTP( &mbAreaTP ); + ( (SvxColorTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + ( (SvxColorTabPage&) rPage ).SetDeleteColorTable( mbDeleteColorTable ); + ( (SvxColorTabPage&) rPage ).Construct(); + break; +*/ + } +} + + diff --git a/cui/source/tabpages/tabline.hrc b/cui/source/tabpages/tabline.hrc new file mode 100644 index 000000000000..c1e884ad4ab3 --- /dev/null +++ b/cui/source/tabpages/tabline.hrc @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tabline.hrc,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define TAB_CONTROL 1 +#define LB_COLOR 1 +#define FT_COLOR 1 +#define LB_LINE_STYLE 2 +#define FT_LINE_STYLE 3 +#define FT_LINE_WIDTH 2 +#define MTR_FLD_LINE_WIDTH 1 +#define TSB_INVISIBLE 1 +#define FL_LINE 1 +#define FL_LINE_ENDS 2 +#define FT_LINE_START 4 +#define FT_LINE_END 8 +#define FT_LINE_ENDS_STYLE 5 +#define FT_LINE_ENDS_WIDTH 6 +#define LB_START_STYLE 3 +#define LB_END_STYLE 4 +#define MTR_FLD_START_WIDTH 3 +#define MTR_FLD_END_WIDTH 2 +#define CBX_SYNCHRONIZE 1 +#define FL_MEASURING 3 +#define CTL_POSITION 2 +#define FT_POSITION 9 +#define TSB_SHOW_MEASURING 2 +#define CTL_PREVIEW 1 +#define FL_DEFINITION 1 +#define FT_NUMBER 3 +#define FT_DISTANCE 2 +#define FT_LENGTH 4 +#define TSB_SYNCHRONIZE 3 +#define LB_TYPE_1 3 +#define FT_TYPE 1 +#define LB_TYPE_2 1 +#define NUM_FLD_1 1 +#define NUM_FLD_2 2 +#define MTR_FLD_DISTANCE 1 +#define MTR_FLD_LENGTH_1 3 +#define MTR_FLD_LENGTH_2 4 +#define FT_LINESTYLE 10 +#define LB_LINESTYLES 2 +#define BTN_ADD 1 +#define BTN_MODIFY 2 +#define BTN_DELETE 3 +#define BTN_LOAD 5 +#define BTN_SAVE 6 +#define EDT_NAME 1 +#define LB_LINEENDS 1 +#define FL_TIP 1 +#define FI_TIP 10 +#define TSB_CENTER_START 4 +#define TSB_CENTER_END 5 +#define FT_TRANSPARENT 10 +#define MTR_LINE_TRANSPARENT 5 +#define FL_SEPARATOR 4 +#define FT_LINE_END_STYLE 11 +#define FT_TITLE 12 + +// #116827# +#define FL_EDGE_STYLE 5 +#define FT_EDGE_STYLE 13 +#define LB_EDGE_STYLE 5 + +//Symbole (fuer StarChart) +#define FT_SYMBOL_WIDTH 20 +#define FT_SYMBOL_HEIGHT 21 +#define MF_SYMBOL_WIDTH 22 +#define MF_SYMBOL_HEIGHT 23 +#define CB_SYMBOL_RATIO 24 +#define FL_SYMBOL_FORMAT 25 +#define MB_SYMBOL_BITMAP 26 + + +#define MN_GRAPHIC_DLG 1 +#define MN_GALLERY 2 +#define MN_SYMBOLS 3 +#define MN_SYMBOLS_NONE 4 +#define MN_SYMBOLS_AUTO 5 +#define MN_GALLERY_ENTRY 100 + + diff --git a/cui/source/tabpages/tabline.src b/cui/source/tabpages/tabline.src new file mode 100644 index 000000000000..55e50c0e78b4 --- /dev/null +++ b/cui/source/tabpages/tabline.src @@ -0,0 +1,803 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tabline.src,v $ + * $Revision: 1.45 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include ------------------------------------------------------------------ +#include +#include "helpid.hrc" +#include "tabline.hrc" + +// Selecting LineStyle / Color / Width -------------------- + +#define MASKCOLOR MaskColor = Color{ Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; + + +TabPage RID_SVXPAGE_LINE +{ + Size = MAP_APPFONT ( 260 , 185 ); + HelpId = HID_LINE_LINE ; + Hide = TRUE ; + Text [ en-US ] = "Lines" ; + FixedLine FL_LINE + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 112 , 8 ) ; + Text [ en-US ] = "Line properties" ; + }; + FixedText FT_LINE_STYLE + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 100 , 8 ) ; + Text [ en-US ] = "~Style" ; + }; + ListBox LB_LINE_STYLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 25 ) ; + Size = MAP_APPFONT ( 100 , 100 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + FixedText FT_COLOR + { + Pos = MAP_APPFONT ( 12 , 41 ) ; + Size = MAP_APPFONT ( 100 , 8 ) ; + Text [ en-US ] = "Colo~r" ; + }; + ListBox LB_COLOR + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 52 ) ; + Size = MAP_APPFONT ( 100 , 100 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + FixedText FT_LINE_WIDTH + { + Pos = MAP_APPFONT ( 12 , 68 ) ; + Size = MAP_APPFONT ( 100 , 8 ) ; + Text [ en-US ] = "~Width" ; + }; + MetricField MTR_FLD_LINE_WIDTH + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 79 ) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + TabStop = TRUE ; + Right = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 5000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Value = 1 ; + Unit = FUNIT_MM ; + Last = 5000 ; + SpinSize = 10 ; + }; + FixedText FT_TRANSPARENT + { + Pos = MAP_APPFONT ( 12 , 95 ) ; + Size = MAP_APPFONT ( 100 , 8 ) ; + Text [ en-US ] = "~Transparency" ; + }; + MetricField MTR_LINE_TRANSPARENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 106 ) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedLine FL_SEPARATOR + { + Pos = MAP_APPFONT ( 118 , 14 ) ; + Size = MAP_APPFONT ( 6 , 111 ) ; + Vert = TRUE; + }; + FixedLine FL_LINE_ENDS + { + Pos = MAP_APPFONT ( 124 , 3 ) ; + Size = MAP_APPFONT ( 130 , 8 ) ; + Text [ en-US ] = "Arrow styles" ; + }; + FixedText FT_LINE_ENDS_STYLE + { + Pos = MAP_APPFONT ( 130 , 14 ) ; + Size = MAP_APPFONT ( 118 , 8 ) ; + Text [ en-US ] = "St~yle" ; + }; + ListBox LB_START_STYLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 130 , 25 ) ; + Size = MAP_APPFONT ( 57 , 99 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + ListBox LB_END_STYLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 191 , 25 ) ; + Size = MAP_APPFONT ( 57 , 100 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + FixedText FT_LINE_ENDS_WIDTH + { + Pos = MAP_APPFONT ( 130 , 41 ) ; + Size = MAP_APPFONT ( 118 , 8 ) ; + Text [ en-US ] = "Wi~dth" ; + }; + MetricField MTR_FLD_START_WIDTH + { + Border = TRUE ; + Pos = MAP_APPFONT ( 130 , 52 ) ; + Size = MAP_APPFONT ( 45 , 12 ) ; + TabStop = TRUE ; + Right = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 5000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Value = 1 ; + Unit = FUNIT_MM ; + Last = 5000 ; + SpinSize = 10 ; + }; + MetricField MTR_FLD_END_WIDTH + { + Border = TRUE ; + Pos = MAP_APPFONT ( 191 , 52 ) ; + Size = MAP_APPFONT ( 45 , 12 ) ; + TabStop = TRUE ; + Right = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 5000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Value = 1 ; + Unit = FUNIT_MM ; + Last = 5000 ; + SpinSize = 10 ; + }; + TriStateBox TSB_CENTER_START + { + Pos = MAP_APPFONT ( 130 , 68 ) ; + Size = MAP_APPFONT ( 57 , 10 ) ; + Text [ en-US ] = "Ce~nter" ; + TabStop = TRUE ; + }; + TriStateBox TSB_CENTER_END + { + Pos = MAP_APPFONT ( 191 , 68 ) ; + Size = MAP_APPFONT ( 57 , 10 ) ; + Text [ en-US ] = "C~enter" ; + TabStop = TRUE ; + }; + CheckBox CBX_SYNCHRONIZE + { + // #116827# + // Pos = MAP_APPFONT ( 130 , 107 ) ; + Pos = MAP_APPFONT ( 130 , 68 + (16 - 4) ) ; + Size = MAP_APPFONT ( 118 , 10 ) ; + Text [ en-US ] = "Synchroni~ze ends" ; + TabStop = TRUE ; + }; + + ////////////////////////////////////////////////////////////////////////////// + // #116827# + + FixedLine FL_EDGE_STYLE + { + Pos = MAP_APPFONT ( 124 , 3 + (16 * 6) - 4 ) ; + Size = MAP_APPFONT ( 130 , 8 ) ; + Text [ en-US ] = "Corner style" ; + }; + FixedText FT_EDGE_STYLE + { + Pos = MAP_APPFONT ( 130 , 14 + (16 * 6) - 4 ) ; + Size = MAP_APPFONT ( 118 , 8 ) ; + Text [ en-US ] = "Sty~le" ; + }; + ListBox LB_EDGE_STYLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 130 , 25 + (16 * 6) - 4 ) ; + Size = MAP_APPFONT ( 57 , 99 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Rounded" ; Default ; > ; + < "- none -" ; > ; + < "Mitered" ; > ; + < "Beveled" ; > ; + }; + }; + + ////////////////////////////////////////////////////////////////////////////// + + Control CTL_PREVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 135 ) ; + Size = MAP_APPFONT ( 248 , 40 ) ; + }; + + //#58425# Symbole auf einer Linie (z.B. StarChart) -> + FixedLine FL_SYMBOL_FORMAT + { + Hide = TRUE ; + + Pos = MAP_APPFONT ( 124 , 3 ) ; + Size = MAP_APPFONT ( 130 , 8 ) ; + Text [ en-US ] = "Icon"; + }; + + MenuButton MB_SYMBOL_BITMAP + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 130 , 14 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + ButtonMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = MN_SYMBOLS_NONE; + Text [ en-US ] = "No Symbol"; + }; + MenuItem + { + Identifier = MN_SYMBOLS_AUTO; + Text [ en-US ] = "Automatic"; + }; + MenuItem + { + Identifier = MN_GRAPHIC_DLG ; + Text [ en-US ] = "From file..." ; + }; + MenuItem + { + Identifier = MN_GALLERY ; + Text [ en-US ] = "Gallery"; + }; + MenuItem + { + Identifier = MN_SYMBOLS; + Text [ en-US ] = "Symbols"; + }; + }; + }; + Text [ en-US ] = "Select..." ; + }; + FixedText FT_SYMBOL_WIDTH + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 130 , 32 ) ; + Size = MAP_APPFONT ( 57 , 8 ) ; + Text [ en-US ] = "Width" ; + }; + MetricField MF_SYMBOL_WIDTH + { + Pos = MAP_APPFONT ( 191 , 30 ); + Size = MAP_APPFONT ( 57 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 1999 ; + DecimalDigits = 2 ; + Value = 0 ; + Unit = FUNIT_CM ; + First = 0 ; + Last = 1999 ; + SpinSize = 5 ; + Hide = TRUE ; + }; + FixedText FT_SYMBOL_HEIGHT + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 130 , 48 ) ; + Size = MAP_APPFONT ( 57 , 8 ) ; + Text [ en-US ] = "Height" ; + }; + MetricField MF_SYMBOL_HEIGHT + { + Pos = MAP_APPFONT ( 191 , 46 ); + Size = MAP_APPFONT ( 57 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 1999 ; + DecimalDigits = 2 ; + Value = 0 ; + Unit = FUNIT_CM ; + First = 0 ; + Last = 1999 ; + SpinSize = 5 ; + Hide = TRUE ; + }; + CheckBox CB_SYMBOL_RATIO + { + Hide = TRUE ; + Pos = MAP_APPFONT ( 130 , 62 ); + Size = MAP_APPFONT ( 118 , 10 ) ; + Text [ en-US ] = "Keep ratio" ; + }; +}; + +// Defining LineStyles -------------------- + +TabPage RID_SVXPAGE_LINE_DEF +{ + Size = MAP_APPFONT ( 260 , 185 ) ; + HelpId = HID_LINE_DEF ; + Hide = TRUE ; + Text [ en-US ] = "Define line styles" ; + + FixedLine FL_DEFINITION + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Properties" ; + }; + FixedText FT_TYPE + { + Pos = MAP_APPFONT ( 12 , 34 ) ; + Size = MAP_APPFONT ( 52 , 8 ) ; + Text [ en-US ] = "~Type" ; + }; + ListBox LB_TYPE_1 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 66 , 32 ) ; + Size = MAP_APPFONT ( 43 , 49 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Dot" ; Default ; > ; + < "Dash" ; Default ; > ; + }; + }; + ListBox LB_TYPE_2 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 113 , 32 ) ; + Size = MAP_APPFONT ( 43 , 49 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Dot" ; Default ; > ; + < "Dash" ; Default ; > ; + }; + }; + FixedText FT_NUMBER + { + Pos = MAP_APPFONT ( 12 , 50 ) ; + Size = MAP_APPFONT ( 52 , 8 ) ; + Text [ en-US ] = "~Number" ; + }; + NumericField NUM_FLD_1 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 66 , 48 ) ; + Size = MAP_APPFONT ( 43 , 12 ) ; + TabStop = TRUE ; + Right = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 99 ; + StrictFormat = TRUE ; + Last = 99 ; + SpinSize = 1 ; + }; + NumericField NUM_FLD_2 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 113 , 48 ) ; + Size = MAP_APPFONT ( 43 , 12 ) ; + TabStop = TRUE ; + Right = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 99 ; + StrictFormat = TRUE ; + Last = 99 ; + SpinSize = 1 ; + }; + FixedText FT_LENGTH + { + Pos = MAP_APPFONT ( 12 , 66 ) ; + Size = MAP_APPFONT ( 52 , 8 ) ; + Text [ en-US ] = "~Length" ; + }; + MetricField MTR_FLD_LENGTH_1 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 66 , 64 ) ; + Size = MAP_APPFONT ( 43 , 12 ) ; + TabStop = TRUE ; + Right = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + First = 1 ; + Maximum = 5000 ; + Last = 5000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Value = 1 ; + Unit = FUNIT_MM ; + CustomUnitText = " %" ; + SpinSize = 10 ; + }; + MetricField MTR_FLD_LENGTH_2 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 113 , 64 ) ; + Size = MAP_APPFONT ( 43 , 12 ) ; + TabStop = TRUE ; + Right = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + First = 1 ; + Maximum = 5000 ; + Last = 5000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Value = 1 ; + Unit = FUNIT_MM ; + CustomUnitText = " %" ; + SpinSize = 10 ; + }; + FixedText FT_DISTANCE + { + Pos = MAP_APPFONT ( 12 , 81 ) ; + Size = MAP_APPFONT ( 52 , 8 ) ; + Text [ en-US ] = "~Spacing" ; + }; + MetricField MTR_FLD_DISTANCE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 66 , 79 ) ; + Size = MAP_APPFONT ( 43 , 12 ) ; + TabStop = TRUE ; + Right = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 5000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Value = 1 ; + Unit = FUNIT_MM ; + CustomUnitText = " %" ; + Last = 5000 ; + SpinSize = 10 ; + }; + CheckBox CBX_SYNCHRONIZE + { + Pos = MAP_APPFONT ( 12 , 95 ) ; + Size = MAP_APPFONT ( 174 , 10 ) ; + Text [ en-US ] = "~Fit to line width" ; + TabStop = TRUE ; + }; + + // ---------------------------------------- + + FixedText FT_LINESTYLE + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 52 , 8 ) ; + Text [ en-US ] = "Line style" ; + }; + ListBox LB_LINESTYLES + { + Border = TRUE ; + Pos = MAP_APPFONT ( 66 , 14 ) ; + Size = MAP_APPFONT ( 120 , 80 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + PushButton BTN_ADD + { + Pos = MAP_APPFONT ( 198 , 14 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Add..." ; + TabStop = TRUE ; + }; + PushButton BTN_MODIFY + { + Pos = MAP_APPFONT ( 198 , 34 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Modify..." ; + TabStop = TRUE ; + }; + PushButton BTN_DELETE + { + Pos = MAP_APPFONT ( 198 , 54 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Delete..." ; + TabStop = TRUE ; + }; + ImageButton BTN_LOAD + { + Pos = MAP_APPFONT ( 198 , 74 ) ; + Size = MAP_APPFONT ( 16 , 16 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Load Line Styles" ; + ButtonImage = Image + { + ImageBitmap = Bitmap + { + File = "sc05501.bmp" ; + }; + MASKCOLOR + }; + }; + ImageButton BTN_SAVE + { + Pos = MAP_APPFONT ( 198 , 96 ) ; + Size = MAP_APPFONT ( 16 , 16 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Save Line Styles" ; + ButtonImage = Image + { + ImageBitmap = Bitmap + { + File = "sc05502.bmp" ; + }; + MASKCOLOR + }; + }; + Control CTL_PREVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 135 ) ; + Size = MAP_APPFONT ( 248 , 40 ) ; + }; + +}; + +// Defining LineEnds -------------------- + +TabPage RID_SVXPAGE_LINEEND_DEF +{ + Size = MAP_APPFONT ( 260 , 185 ) ; + HelpId = HID_LINE_ENDDEF ; + Hide = TRUE ; + Text [ en-US ] = "Arrowheads" ; + + FixedLine FL_TIP + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Organize arrow styles" ; + }; + FixedText FI_TIP + { + Pos = MAP_APPFONT ( 6 , 123 ) ; + Size = MAP_APPFONT ( 252 , 8 ) ; + Text [ en-US ] = "Add a selected object to create new arrow styles." ; + WordBreak = TRUE ; + }; + + FixedText FT_LINE_END_STYLE + { + Pos = MAP_APPFONT ( 12 , 32 ) ; + Size = MAP_APPFONT ( 84 , 8 ) ; + Text [ en-US ] = "Arrow style" ; + }; + Edit EDT_NAME + { + Border = TRUE ; + Pos = MAP_APPFONT ( 98 , 14 ) ; + Size = MAP_APPFONT ( 87 , 12 ) ; + TabStop = TRUE ; + }; + FixedText FT_TITLE + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 84 , 8 ) ; + Text [ en-US ] = "~Title" ; + }; + ListBox LB_LINEENDS + { + Border = TRUE ; + Pos = MAP_APPFONT ( 98 , 30 ) ; + Size = MAP_APPFONT ( 87 , 80 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + PushButton BTN_ADD + { + Pos = MAP_APPFONT ( 198 , 14 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Add..." ; + TabStop = TRUE ; + }; + PushButton BTN_MODIFY + { + Pos = MAP_APPFONT ( 198 , 34 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Modify..." ; + TabStop = TRUE ; + }; + PushButton BTN_DELETE + { + Pos = MAP_APPFONT ( 198 , 54 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Delete..." ; + TabStop = TRUE ; + }; + ImageButton BTN_LOAD + { + Pos = MAP_APPFONT ( 198 , 74 ) ; + Size = MAP_APPFONT ( 16 , 16 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Load Arrow Styles" ; + ButtonImage = Image + { + ImageBitmap = Bitmap + { + File = "sc05501.bmp" ; + }; + MASKCOLOR + }; + }; + ImageButton BTN_SAVE + { + Pos = MAP_APPFONT ( 198 , 96 ) ; + Size = MAP_APPFONT ( 16 , 16 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Save Arrow Styles" ; + ButtonImage = Image + { + ImageBitmap = Bitmap + { + File = "sc05502.bmp" ; + }; + MASKCOLOR + }; + }; + + Control CTL_PREVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 135 ) ; + Size = MAP_APPFONT ( 248 , 40 ) ; + }; + +}; + // RID_SVXDLG_LINE ---------------------------------------------------------- +TabDialog RID_SVXDLG_LINE +{ + OutputSize = TRUE ; + SvLook = TRUE ; + Size = MAP_APPFONT ( 289 , 176 ) ; + Text [ en-US ] = "Line" ; + Moveable = TRUE ; + TabControl TAB_CONTROL + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 3 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = RID_SVXPAGE_LINE ; + Text [ en-US ] = "Line" ; + PageResID = RID_SVXPAGE_LINE ; + }; + PageItem + { + Identifier = RID_SVXPAGE_SHADOW ; + PageResID = RID_SVXPAGE_SHADOW ; + Text [ en-US ] = "Shadow" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_LINE_DEF ; + Text [ en-US ] = "Line Styles" ; + PageResID = RID_SVXPAGE_LINE_DEF ; + }; + PageItem + { + Identifier = RID_SVXPAGE_LINEEND_DEF ; + Text [ en-US ] = "Arrow Styles" ; + PageResID = RID_SVXPAGE_LINEEND_DEF ; + }; +/* + PageItem + { + Identifier = RID_SVXPAGE_COLOR ; + Text [ en-US ] = "Colors" ; + PageResID = RID_SVXPAGE_COLOR ; + }; +*/ + }; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx new file mode 100644 index 000000000000..a1effa923086 --- /dev/null +++ b/cui/source/tabpages/tabstpge.cxx @@ -0,0 +1,746 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tabstpge.cxx,v $ + * $Revision: 1.27 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- + +#include +#include +#include + +#define _SVX_TABSTPGE_CXX + +#include +#include "tabstpge.hrc" +#include +#include "tabstpge.hxx" +#include +#include "svx/dlgutil.hxx" +#include +#include +#include +#include +#include //CHINA001 +#include //add CHINA001 +#include //add CHINA001 + +// class TabWin_Impl ----------------------------------------------------- + +class TabWin_Impl : public Window +{ +private: + USHORT nTabStyle; + +public: + TabWin_Impl( Window* pParent, const ResId& rId, USHORT nStyle ) : + Window( pParent, rId ), + nTabStyle( nStyle ) {} + + virtual void Paint( const Rectangle& rRect ); +}; + +// static ---------------------------------------------------------------- + +static USHORT pRanges[] = +{ + SID_ATTR_TABSTOP, + SID_ATTR_TABSTOP_OFFSET, + 0 +}; + +// C-Funktion ------------------------------------------------------------ + +void FillUpWithDefTabs_Impl( long nDefDist, SvxTabStopItem& rTabs ) +{ + if( rTabs.Count() ) + return; + { + SvxTabStop aSwTabStop( nDefDist, SVX_TAB_ADJUST_DEFAULT ); + rTabs.Insert( aSwTabStop ); + } +} + +// class TabWin_Impl ----------------------------------------------------- + +void TabWin_Impl::Paint( const Rectangle& ) +{ + // Tabulatoren malen + Point aPnt; + Size aSize = GetOutputSizePixel(); + aPnt.X() = aSize.Width() / 2; + aPnt.Y() = aSize.Height() / 2; + Ruler::DrawTab( this, aPnt, nTabStyle ); +} + +// class SvxTabulatorTabPage --------------------------------------------- + +SvxTabulatorTabPage::SvxTabulatorTabPage( Window* pParent, + const SfxItemSet& rAttr ): + + SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_TABULATOR ), rAttr ), + + aTabBox ( this, SVX_RES( ED_TABPOS ) ), + aTabLabel ( this, SVX_RES( FL_TABPOS ) ), + aTabLabelVert ( this, SVX_RES( FL_TABPOS_VERT ) ), + aLeftTab ( this, SVX_RES( BTN_TABTYPE_LEFT ) ), + aRightTab ( this, SVX_RES( BTN_TABTYPE_RIGHT ) ), + aCenterTab ( this, SVX_RES( BTN_TABTYPE_CENTER ) ), + aDezTab ( this, SVX_RES( BTN_TABTYPE_DECIMAL ) ), + pLeftWin ( new TabWin_Impl( this, SVX_RES( WIN_TABLEFT ), (USHORT)(RULER_TAB_LEFT|WB_HORZ) ) ), + pRightWin ( new TabWin_Impl( this, SVX_RES( WIN_TABRIGHT ), (USHORT)(RULER_TAB_RIGHT|WB_HORZ) ) ), + pCenterWin ( new TabWin_Impl( this, SVX_RES( WIN_TABCENTER ), (USHORT)(RULER_TAB_CENTER|WB_HORZ) ) ), + pDezWin ( new TabWin_Impl( this, SVX_RES( WIN_TABDECIMAL ), (USHORT)(RULER_TAB_DECIMAL|WB_HORZ) ) ), + aDezCharLabel ( this, SVX_RES( FT_TABTYPE_DECCHAR ) ), + aDezChar ( this, SVX_RES( ED_TABTYPE_DECCHAR ) ), + aTabTypeLabel ( this, SVX_RES( FL_TABTYPE ) ), + aNoFillChar ( this, SVX_RES( BTN_FILLCHAR_NO ) ), + aFillPoints ( this, SVX_RES( BTN_FILLCHAR_POINTS ) ), + aFillDashLine ( this, SVX_RES( BTN_FILLCHAR_DASHLINE ) ), + aFillSolidLine ( this, SVX_RES( BTN_FILLCHAR_UNDERSCORE ) ), + aFillSpecial ( this, SVX_RES( BTN_FILLCHAR_OTHER ) ), + aFillChar ( this, SVX_RES( ED_FILLCHAR_OTHER ) ), + aFillLabel ( this, SVX_RES( FL_FILLCHAR ) ), + aNewBtn ( this, SVX_RES( BTN_NEW ) ), + aDelAllBtn ( this, SVX_RES( BTN_DELALL ) ), + aDelBtn ( this, SVX_RES( BTN_DEL ) ), + + aAktTab ( 0 ), + aNewTabs ( 0, 0, SVX_TAB_ADJUST_LEFT, GetWhich( SID_ATTR_TABSTOP ) ), + nDefDist ( 0 ), + eDefUnit( FUNIT_100TH_MM ), + bCheck ( FALSE ) + +{ + SvtCJKOptions aCJKOptions; + if(aCJKOptions.IsAsianTypographyEnabled()) + { + aLeftTab .SetText(String(SVX_RES( ST_LEFTTAB_ASIAN ))); + aRightTab .SetText(String(SVX_RES( ST_RIGHTTAB_ASIAN ))); + } + + // diese Page braucht ExchangeSupport + SetExchangeSupport(); + + + // Metrik einstellen + FieldUnit eFUnit = GetModuleFieldUnit( &rAttr ); + SetFieldUnit( aTabBox, eFUnit ); + + // Buttons initialisieren + aNewBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, NewHdl_Impl ) ); + aDelBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, DelHdl_Impl ) ); + aDelAllBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, DelAllHdl_Impl ) ); + + Link aLink = LINK( this, SvxTabulatorTabPage, TabTypeCheckHdl_Impl ); + aLeftTab.SetClickHdl( aLink ); + aRightTab.SetClickHdl( aLink ); + aDezTab.SetClickHdl( aLink ); + aCenterTab.SetClickHdl( aLink ); + + aDezChar.SetLoseFocusHdl( LINK( this, SvxTabulatorTabPage, GetDezCharHdl_Impl ) ); + aDezChar.SetMaxTextLen(1); + aDezChar.Disable(); + aDezCharLabel.Disable(); + + aLink = LINK( this, SvxTabulatorTabPage, FillTypeCheckHdl_Impl ); + aNoFillChar.SetClickHdl( aLink ); + aFillPoints.SetClickHdl( aLink ); + aFillDashLine.SetClickHdl( aLink ); + aFillSolidLine.SetClickHdl( aLink ); + aFillSpecial.SetClickHdl( aLink ); + aFillChar.SetLoseFocusHdl( LINK( this, SvxTabulatorTabPage, GetFillCharHdl_Impl ) ); + aFillChar.SetMaxTextLen(1); + aFillChar.Disable(); + + aTabBox.SetDoubleClickHdl( LINK( this, SvxTabulatorTabPage, SelectHdl_Impl ) ); + aTabBox.SetModifyHdl( LINK( this, SvxTabulatorTabPage, ModifyHdl_Impl ) ); + + // das Default-Dezimalzeichen vom System holen + LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); + aAktTab.GetDecimal() = aLocaleWrapper.getNumDecimalSep().GetChar(0); + FreeResource(); +} + +// ----------------------------------------------------------------------- + +SvxTabulatorTabPage::~SvxTabulatorTabPage() +{ + delete pLeftWin; + delete pRightWin; + delete pCenterWin; + delete pDezWin; +} + +// ----------------------------------------------------------------------- + +USHORT* SvxTabulatorTabPage::GetRanges() +{ + return pRanges; +} + +// ----------------------------------------------------------------------- + +BOOL SvxTabulatorTabPage::FillItemSet( SfxItemSet& rSet ) +{ + BOOL bModified = FALSE; + + // Hier die Werte aus den Controls eintueten + if ( aNewBtn.IsEnabled() ) + NewHdl_Impl( 0 ); + + // call at first the LoseFocus-Handler + GetDezCharHdl_Impl( &aDezChar ); + GetFillCharHdl_Impl( &aFillChar ); + + FillUpWithDefTabs_Impl( nDefDist, aNewTabs ); + SfxItemPool* pPool = rSet.GetPool(); + MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) ); + const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_TABSTOP ); + + if ( MAP_100TH_MM != eUnit ) + { + // Wenn sich im ItemSet ein LRSpaceItem mit negativen Erstzeileneinzug + // befindet, muss im TabStopItem auf der Position 0 ein DefTab sein. + const SfxPoolItem* pLRSpace; + // wenn nicht im neuen Set, dann vielleicht im alten + if ( SFX_ITEM_SET != + rSet.GetItemState( GetWhich( SID_ATTR_LRSPACE ), TRUE, &pLRSpace ) ) + pLRSpace = GetOldItem( rSet, SID_ATTR_LRSPACE ); + + if ( pLRSpace && ( (SvxLRSpaceItem*)pLRSpace )->GetTxtFirstLineOfst() < 0 ) + { + SvxTabStop aNull( 0, SVX_TAB_ADJUST_DEFAULT ); + aNewTabs.Insert( aNull ); + } + + SvxTabStopItem aTmp( aNewTabs ); + aTmp.Remove( 0, aTmp.Count() ); + + for ( USHORT i = 0; i < aNewTabs.Count(); ++i ) + { + SvxTabStop aTmpStop = aNewTabs[i]; + aTmpStop.GetTabPos() = + LogicToLogic( aTmpStop.GetTabPos(), MAP_100TH_MM, eUnit ); + aTmp.Insert( aTmpStop ); + } + + if ( !pOld || !( *( (SvxTabStopItem*)pOld ) == aTmp ) ) + { + rSet.Put( aTmp ); + bModified = TRUE; + } + } + else if ( !pOld || !( *( (SvxTabStopItem*)pOld ) == aNewTabs ) ) + { + rSet.Put( aNewTabs ); + bModified = TRUE; + } + return bModified; +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxTabulatorTabPage::Create( Window* pParent, + const SfxItemSet& rSet) +{ + return ( new SvxTabulatorTabPage( pParent, rSet ) ); +} + +// ----------------------------------------------------------------------- + +void SvxTabulatorTabPage::Reset( const SfxItemSet& rSet ) +{ + SfxItemPool* pPool = rSet.GetPool(); + MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) ); + + // Aktuelle Tabs + const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_TABSTOP ); + + if ( pItem ) + { + if ( MAP_100TH_MM != eUnit ) + { + SvxTabStopItem aTmp( *( (const SvxTabStopItem*)pItem ) ); + aNewTabs.Remove( 0, aNewTabs.Count() ); + + for ( USHORT i = 0; i < aTmp.Count(); ++i ) + { + SvxTabStop aTmpStop = aTmp[i]; + aTmpStop.GetTabPos() = + LogicToLogic( aTmpStop.GetTabPos(), eUnit, MAP_100TH_MM ); + aNewTabs.Insert( aTmpStop ); + } + } + else + aNewTabs = *( (const SvxTabStopItem*)pItem ); + } + else + aNewTabs.Remove( 0, aNewTabs.Count() ); + + // Default-Tab - Abstand + nDefDist = SVX_TAB_DEFDIST; + pItem = GetItem( rSet, SID_ATTR_TABSTOP_DEFAULTS ); + + if ( pItem ) + nDefDist = LogicToLogic( + (long)((const SfxUInt16Item*)pItem)->GetValue(), eUnit, MAP_100TH_MM ); + + // Aktuell selektierte Tab-Pos + USHORT nTabPos = 0; + pItem = GetItem( rSet, SID_ATTR_TABSTOP_POS ); + + if ( pItem ) + nTabPos = ( (const SfxUInt16Item*)pItem )->GetValue(); + + InitTabPos_Impl( nTabPos ); +} + +// ----------------------------------------------------------------------- + +void SvxTabulatorTabPage::DisableControls( const USHORT nFlag ) +{ + if ( ( TABTYPE_LEFT & nFlag ) == TABTYPE_LEFT ) + { + aLeftTab.Disable(); + pLeftWin->Disable(); + } + if ( ( TABTYPE_RIGHT & nFlag ) == TABTYPE_RIGHT ) + { + aRightTab.Disable(); + pRightWin->Disable(); + } + if ( ( TABTYPE_CENTER & nFlag ) == TABTYPE_CENTER ) + { + aCenterTab.Disable(); + pCenterWin->Disable(); + } + if ( ( TABTYPE_DEZIMAL & nFlag ) == TABTYPE_DEZIMAL ) + { + aDezTab.Disable(); + pDezWin->Disable(); + aDezCharLabel.Disable(); + aDezChar.Disable(); + } + if ( ( TABTYPE_ALL & nFlag ) == TABTYPE_ALL ) + aTabTypeLabel.Disable(); + if ( ( TABFILL_NONE & nFlag ) == TABFILL_NONE ) + aNoFillChar.Disable(); + if ( ( TABFILL_POINT & nFlag ) == TABFILL_POINT ) + aFillPoints.Disable(); + if ( ( TABFILL_DASHLINE & nFlag ) == TABFILL_DASHLINE ) + aFillDashLine.Disable(); + if ( ( TABFILL_SOLIDLINE & nFlag ) == TABFILL_SOLIDLINE ) + aFillSolidLine.Disable(); + if ( ( TABFILL_SPECIAL & nFlag ) == TABFILL_SPECIAL ) + { + aFillSpecial.Disable(); + aFillChar.Disable(); + } + if ( ( TABFILL_ALL & nFlag ) == TABFILL_ALL ) + aFillLabel.Disable(); +} + +// ----------------------------------------------------------------------- + +int SvxTabulatorTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if ( _pSet ) + FillItemSet( *_pSet ); + return LEAVE_PAGE; +} + +// ----------------------------------------------------------------------- + +void SvxTabulatorTabPage::InitTabPos_Impl( USHORT nTabPos ) +{ + aTabBox.Clear(); + + long nOffset = 0; + const SfxPoolItem* pItem = 0; + if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET, TRUE, &pItem ) + == SFX_ITEM_SET ) + { + nOffset = ( (const SfxInt32Item*)pItem )->GetValue(); + MapUnit eUnit = (MapUnit)GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) ); + nOffset = OutputDevice::LogicToLogic( nOffset, eUnit, MAP_100TH_MM ); + } + + // Aktuelle TabPos korrigieren und Defaults-Tabs + for ( USHORT i = 0; i < aNewTabs.Count(); i++ ) + { + if ( aNewTabs[i].GetAdjustment() != SVX_TAB_ADJUST_DEFAULT ) + { + aTabBox.InsertValue( aTabBox.Normalize( + aNewTabs[i].GetTabPos() + nOffset ), eDefUnit ); + } + else + aNewTabs.Remove( i-- ); + } + + // aktuellen Tabulator auswaehlen + const USHORT nSize = aNewTabs.Count(); + + if ( nTabPos >= nSize ) + nTabPos = 0; + + // alle RadioButtons erstmal ausschalten + aLeftTab.Check( TRUE ); + aNoFillChar.Check( TRUE ); + + if( aTabBox.GetEntryCount() > 0 ) + { + aTabBox.SetText( aTabBox.GetEntry( nTabPos ) ); + aAktTab = aNewTabs[nTabPos]; + + SetFillAndTabType_Impl(); + aNewBtn.Disable(); + aDelBtn.Enable(); + } + else + { // kein Eintrag dann ist 0 der Default-Wert + aTabBox.SetValue( 0, eDefUnit ); + + aNewBtn.Enable(); + aDelBtn.Disable(); + } +} + +// ----------------------------------------------------------------------- + +void SvxTabulatorTabPage::SetFillAndTabType_Impl() +{ + RadioButton* pTypeBtn = 0; + RadioButton* pFillBtn = 0; + + aDezChar.Disable(); + aDezCharLabel.Disable(); + + if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_LEFT ) + pTypeBtn = &aLeftTab; + else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_RIGHT ) + pTypeBtn = &aRightTab; + else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_DECIMAL ) + { + pTypeBtn = &aDezTab; + aDezChar.Enable(); + aDezCharLabel.Enable(); + aDezChar.SetText( String( (sal_Unicode)aAktTab.GetDecimal() ) ); + } + else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_CENTER ) + pTypeBtn = &aCenterTab; + + if ( pTypeBtn ) + pTypeBtn->Check(); + + aFillChar.Disable(); + aFillChar.SetText( String() ); + + if ( aAktTab.GetFill() == ' ' ) + pFillBtn = &aNoFillChar; + else if ( aAktTab.GetFill() == '-' ) + pFillBtn = &aFillDashLine; + else if ( aAktTab.GetFill() == '_' ) + pFillBtn = &aFillSolidLine; + else if ( aAktTab.GetFill() == '.' ) + pFillBtn = &aFillPoints; + else + { + pFillBtn = &aFillSpecial; + aFillChar.Enable(); + aFillChar.SetText( String( (sal_Unicode)aAktTab.GetFill() ) ); + } + pFillBtn->Check(); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxTabulatorTabPage, NewHdl_Impl, Button *, pBtn ) +{ + // Einen neuen Hinzufuegen und Selectieren + // Wert aus der Anzeige holen + long nVal = static_cast(aTabBox.Denormalize( aTabBox.GetValue( eDefUnit ) )); + + // Wenn der pBtn == 0 && der Value == 0 dann keinen Tab Erzeugen + // weil ueber OK erzeugt + if ( nVal == 0 && pBtn == 0 ) + return 0; + + long nOffset = 0; + const SfxPoolItem* pItem = 0; + + if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET, TRUE, &pItem ) == + SFX_ITEM_SET ) + { + nOffset = ( (const SfxInt32Item*)pItem )->GetValue(); + MapUnit eUnit = (MapUnit)GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) ); + nOffset = OutputDevice::LogicToLogic( nOffset, eUnit, MAP_100TH_MM ); + } + const long nReal = nVal - nOffset; + USHORT nSize = aTabBox.GetEntryCount(); + + USHORT i; + for( i = 0; i < nSize; i++ ) + { + if ( nReal < aNewTabs[i].GetTabPos() ) + break; + } + + // ListBox-Eintrag vornehmen + aTabBox.InsertValue( aTabBox.Normalize( nVal ), eDefUnit, i ); + aAktTab.GetTabPos() = nReal; + SvxTabAdjust eAdj = SVX_TAB_ADJUST_LEFT; + + if ( aRightTab.IsChecked() ) + eAdj = SVX_TAB_ADJUST_RIGHT; + else if ( aCenterTab.IsChecked() ) + eAdj = SVX_TAB_ADJUST_CENTER; + else if ( aDezTab.IsChecked() ) + eAdj = SVX_TAB_ADJUST_DECIMAL; + + aAktTab.GetAdjustment() = eAdj; + aNewTabs.Insert( aAktTab ); + + aNewBtn.Disable(); + aDelBtn.Enable(); + aTabBox.GrabFocus(); + + // falls kein RadioButton geclickt wurde, + // muss trotzdem geputtet werden + bCheck |= TRUE; + // set the selection into the position Edit + aTabBox.SetSelection(Selection(0, aTabBox.GetText().Len())); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxTabulatorTabPage, DelHdl_Impl, Button *, EMPTYARG ) +{ + USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue() ); + + if ( nPos == COMBOBOX_ENTRY_NOTFOUND ) + return 0; + + if ( aTabBox.GetEntryCount() == 1 ) + { + DelAllHdl_Impl( 0 ); + return 0; + } + + // Tab loeschen + aTabBox.RemoveEntry( nPos ); + aNewTabs.Remove( nPos ); + + // aAktTab neu setzen + const USHORT nSize = aNewTabs.Count(); + + if ( nSize > 0 ) + { + // Pos korrigieren + nPos = ( ( nSize - 1 ) >= nPos) ? nPos : nPos - 1; + aTabBox.SetValue( aTabBox.GetValue( nPos ) ); + aAktTab = aNewTabs[nPos]; + } + + // Falls keine Tabs Enable Disable Controls + if ( aTabBox.GetEntryCount() == 0 ) + { + aDelBtn.Disable(); + aNewBtn.Enable(); + aTabBox.GrabFocus(); + } + + // falls kein RadioButton geclickt wurde, + // muss trotzdem geputtet werden + bCheck |= TRUE; + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxTabulatorTabPage, DelAllHdl_Impl, Button *, EMPTYARG ) +{ + if ( aNewTabs.Count() ) + { + aNewTabs = SvxTabStopItem( 0 ); + InitTabPos_Impl(); + + // damit in FillItemSet() geputtet wird + bCheck |= TRUE; + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxTabulatorTabPage, TabTypeCheckHdl_Impl, RadioButton *, pBox ) +{ + bCheck |= TRUE; + SvxTabAdjust eAdj; + aDezChar.Disable(); + aDezCharLabel.Disable(); + aDezChar.SetText( String() ); + + if ( pBox == &aLeftTab ) + eAdj = SVX_TAB_ADJUST_LEFT; + else if ( pBox == &aRightTab ) + eAdj = SVX_TAB_ADJUST_RIGHT; + else if ( pBox == &aCenterTab ) + eAdj = SVX_TAB_ADJUST_CENTER; + else + { + eAdj = SVX_TAB_ADJUST_DECIMAL; + aDezChar.Enable(); + aDezCharLabel.Enable(); + aDezChar.SetText( String( (sal_Unicode)aAktTab.GetDecimal() ) ); + } + + aAktTab.GetAdjustment() = eAdj; + USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit ); + + if ( nPos != COMBOBOX_ENTRY_NOTFOUND ) + { + aNewTabs.Remove( nPos ); + aNewTabs.Insert( aAktTab ); + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxTabulatorTabPage, FillTypeCheckHdl_Impl, RadioButton *, pBox ) +{ + bCheck |= TRUE; + BYTE cFill = ' '; + aFillChar.SetText( String() ); + aFillChar.Disable(); + + if( pBox == &aFillSpecial ) + aFillChar.Enable(); + else if ( pBox == &aNoFillChar ) + cFill = ' '; + else if ( pBox == &aFillSolidLine ) + cFill = '_'; + else if ( pBox == &aFillPoints ) + cFill = '.'; + else if ( pBox == &aFillDashLine ) + cFill = '-'; + + aAktTab.GetFill() = cFill; + USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit ); + + if ( nPos != COMBOBOX_ENTRY_NOTFOUND ) + { + aNewTabs.Remove( nPos ); + aNewTabs.Insert( aAktTab ); + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxTabulatorTabPage, GetFillCharHdl_Impl, Edit *, pEdit ) +{ + String aChar( pEdit->GetText() ); + + if ( aChar.Len() > 0 ) + aAktTab.GetFill() = aChar.GetChar( 0 ); + + const USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit); + if ( nPos != COMBOBOX_ENTRY_NOTFOUND ) + { + aNewTabs.Remove( nPos ); + aNewTabs.Insert( aAktTab ); + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxTabulatorTabPage, GetDezCharHdl_Impl, Edit *, pEdit ) +{ + String aChar( pEdit->GetText() ); + if ( aChar.Len() > 0 && ( aChar.GetChar( 0 ) >= ' ')) + aAktTab.GetDecimal() = aChar.GetChar( 0 ); + + USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit ); + if ( nPos != COMBOBOX_ENTRY_NOTFOUND ) + { + aNewTabs.Remove( nPos ); + aNewTabs.Insert( aAktTab ); + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxTabulatorTabPage, SelectHdl_Impl, MetricBox *, EMPTYARG ) +{ + USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit ); + if ( nPos != COMBOBOX_ENTRY_NOTFOUND ) + { + aAktTab = aNewTabs[nPos]; + aNewBtn.Disable(); + SetFillAndTabType_Impl(); + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxTabulatorTabPage, ModifyHdl_Impl, MetricBox *, EMPTYARG ) +{ + USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit ); + if ( nPos != COMBOBOX_ENTRY_NOTFOUND ) + { + aAktTab = aNewTabs[nPos]; + SetFillAndTabType_Impl(); + + aAktTab.GetTabPos() = + static_cast(aTabBox.Denormalize( aTabBox.GetValue( eDefUnit ) )); + + aNewBtn.Disable(); + aDelBtn.Enable(); + return 0; + } + aNewBtn.Enable(); + aDelBtn.Disable(); + return 0; +} +//add CHINA001 Begin +void SvxTabulatorTabPage::PageCreated(SfxAllItemSet aSet) +{ + SFX_ITEMSET_ARG (&aSet,pControlItem,SfxUInt16Item,SID_SVXTABULATORTABPAGE_CONTROLFLAGS,sal_False); + if (pControlItem) + DisableControls(pControlItem->GetValue()); +} +//end of CHINA001 diff --git a/cui/source/tabpages/tabstpge.hrc b/cui/source/tabpages/tabstpge.hrc new file mode 100644 index 000000000000..60752fa70109 --- /dev/null +++ b/cui/source/tabpages/tabstpge.hrc @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tabstpge.hrc,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_TABSTPGE_HRC +#define _SVX_TABSTPGE_HRC + +// defines ------------------------------------------------------------------ + +#define ED_TABPOS 10 +#define FL_TABPOS 11 +#define FL_TABPOS_VERT 12 + +#define BTN_TABTYPE_LEFT 20 +#define WIN_TABLEFT 21 +#define BTN_TABTYPE_RIGHT 22 +#define WIN_TABRIGHT 23 +#define BTN_TABTYPE_CENTER 24 +#define WIN_TABCENTER 25 +#define BTN_TABTYPE_DECIMAL 26 +#define WIN_TABDECIMAL 27 +#define ED_TABTYPE_DECCHAR 28 +#define FT_TABTYPE_DECCHAR 29 +#define FL_TABTYPE 30 + + +#define BTN_FILLCHAR_NO 40 +#define BTN_FILLCHAR_POINTS 41 +#define BTN_FILLCHAR_DASHLINE 42 +#define BTN_FILLCHAR_UNDERSCORE 43 +#define BTN_FILLCHAR_OTHER 44 +#define ED_FILLCHAR_OTHER 45 +#define FL_FILLCHAR 46 + +#define BTN_NEW 50 +#define BTN_DEL 51 +#define BTN_DELALL 52 +#define ST_LEFTTAB_ASIAN 53 +#define ST_RIGHTTAB_ASIAN 54 +#endif + diff --git a/cui/source/tabpages/tabstpge.src b/cui/source/tabpages/tabstpge.src new file mode 100644 index 000000000000..2b3649ef968f --- /dev/null +++ b/cui/source/tabpages/tabstpge.src @@ -0,0 +1,234 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tabstpge.src,v $ + * $Revision: 1.31 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include "helpid.hrc" +#include +#include "tabstpge.hrc" + // pragma ---------------------------------------------------------------- + + // RID_SVXPAGE_TABULATOR ------------------------------------------------- +TabPage RID_SVXPAGE_TABULATOR +{ + HelpId = HID_TABULATOR ; + Hide = TRUE ; + Text [ en-US ] = "Tabs" ; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedLine FL_TABPOS + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 48 , 8 ) ; + Text [ en-US ] = "Position" ; + }; + MetricBox ED_TABPOS + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 39 , 165 ) ; + Minimum = -5600 ; + Maximum = 5600 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + }; + FixedLine FL_TABPOS_VERT + { + Pos = MAP_APPFONT ( 55 , 14 ) ; + Size = MAP_APPFONT ( 4 , 165 ) ; + Vert = TRUE; + }; + FixedLine FL_TABTYPE + { + Pos = MAP_APPFONT ( 60 , 3 ) ; + Size = MAP_APPFONT ( 138 , 8 ) ; + Text [ en-US ] = "Type" ; + }; + RadioButton BTN_TABTYPE_LEFT + { + Pos = MAP_APPFONT ( 66 , 14 ) ; + Size = MAP_APPFONT ( 89 , 10 ) ; + Text [ en-US ] = "~Left" ; + Check = TRUE ; + }; + Window WIN_TABLEFT + { + Pos = MAP_APPFONT ( 157 , 14 ) ; + Size = MAP_APPFONT ( 7 , 10 ) ; + }; + RadioButton BTN_TABTYPE_RIGHT + { + Pos = MAP_APPFONT ( 66 , 28 ) ; + Size = MAP_APPFONT ( 89 , 10 ) ; + Text [ en-US ] = "Righ~t" ; + }; + Window WIN_TABRIGHT + { + Pos = MAP_APPFONT ( 157 , 28 ) ; + Size = MAP_APPFONT ( 7 , 10 ) ; + }; + RadioButton BTN_TABTYPE_CENTER + { + Pos = MAP_APPFONT ( 66 , 42 ) ; + Size = MAP_APPFONT ( 89 , 10 ) ; + Text [ en-US ] = "C~entered" ; + }; + Window WIN_TABCENTER + { + Pos = MAP_APPFONT ( 157 , 42 ) ; + Size = MAP_APPFONT ( 7 , 10 ) ; + }; + RadioButton BTN_TABTYPE_DECIMAL + { + Pos = MAP_APPFONT ( 66 , 56 ) ; + Size = MAP_APPFONT ( 89 , 10 ) ; + Text [ en-US ] = "Deci~mal" ; + }; + Window WIN_TABDECIMAL + { + Pos = MAP_APPFONT ( 157 , 56 ) ; + Size = MAP_APPFONT ( 7 , 10 ) ; + }; + FixedText FT_TABTYPE_DECCHAR + { + Pos = MAP_APPFONT ( 75 , 70 ) ; + Size = MAP_APPFONT ( 79 , 8 ) ; + Text [ en-US ] = "~Character" ; + }; + Edit ED_TABTYPE_DECCHAR + { + Border = TRUE ; + Pos = MAP_APPFONT ( 156 , 68 ) ; + Size = MAP_APPFONT ( 9 , 12 ) ; + Left = TRUE ; + }; + FixedLine FL_FILLCHAR + { + Pos = MAP_APPFONT ( 60 , 86 ) ; + Size = MAP_APPFONT ( 138 , 8 ) ; + Text [ en-US ] = "Fill character" ; + }; + RadioButton BTN_FILLCHAR_NO + { + Pos = MAP_APPFONT ( 66 , 97 ) ; + Size = MAP_APPFONT ( 89 , 10 ) ; + Text [ en-US ] = "N~one" ; + Check = TRUE ; + }; + RadioButton BTN_FILLCHAR_POINTS + { + Pos = MAP_APPFONT ( 66 , 111 ) ; + Size = MAP_APPFONT ( 89 , 10 ) ; + Text = "~........" ; + }; + RadioButton BTN_FILLCHAR_DASHLINE + { + Pos = MAP_APPFONT ( 66 , 125 ) ; + Size = MAP_APPFONT ( 89 , 10 ) ; + Text = "~--------" ; + }; + RadioButton BTN_FILLCHAR_UNDERSCORE + { + Pos = MAP_APPFONT ( 66 , 139 ) ; + Size = MAP_APPFONT ( 89 , 10 ) ; + Text = "~_____" ; + }; + RadioButton BTN_FILLCHAR_OTHER + { + Pos = MAP_APPFONT ( 66 , 153 ) ; + Size = MAP_APPFONT ( 89 , 10 ) ; + Text [ en-US ] = "Character" ; + }; + Edit ED_FILLCHAR_OTHER + { + Border = TRUE ; + Pos = MAP_APPFONT ( 156 , 151 ) ; + Size = MAP_APPFONT ( 9 , 12 ) ; + Left = TRUE ; + }; + PushButton BTN_NEW + { + Pos = MAP_APPFONT ( 204 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~New" ; + }; + PushButton BTN_DELALL + { + Pos = MAP_APPFONT ( 204 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "Delete ~All" ; + }; + PushButton BTN_DEL + { + Pos = MAP_APPFONT ( 204 , 40 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Delete" ; + }; + String ST_LEFTTAB_ASIAN + { + Text [ en-US ] = "~Left/Top" ; + }; + String ST_RIGHTTAB_ASIAN + { + Text [ en-US ] = "Righ~t/Bottom" ; + }; +}; + // ********************************************************************** EOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/textanim.cxx b/cui/source/tabpages/textanim.cxx new file mode 100644 index 000000000000..a278d11970bf --- /dev/null +++ b/cui/source/tabpages/textanim.cxx @@ -0,0 +1,759 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: textanim.cxx,v $ + * $Revision: 1.17 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include + +#include + +#ifndef _SVX_TEXTANIM_CXX +#define _SVX_TEXTANIM_CXX +#endif +#include "textanim.hxx" +#include "textanim.hrc" +#include "textattr.hxx" +#include +#include "svx/dlgutil.hxx" + +static USHORT pRanges[] = +{ + SDRATTR_TEXT_ANIKIND, + SDRATTR_TEXT_ANIAMOUNT, + 0 +}; + +/************************************************************************* +|* +|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu +|* +\************************************************************************/ + +__EXPORT SvxTextTabDialog::SvxTextTabDialog( Window* pParent, + const SfxItemSet* pAttr, + const SdrView* pSdrView ) : + SfxTabDialog ( pParent, SVX_RES( RID_SVXDLG_TEXT ), pAttr ), + rOutAttrs ( *pAttr ), + pView ( pSdrView ) +{ + FreeResource(); + + AddTabPage( RID_SVXPAGE_TEXTATTR, SvxTextAttrPage::Create, 0); + AddTabPage( RID_SVXPAGE_TEXTANIMATION, SvxTextAnimationPage::Create, 0); +} + +/************************************************************************* +|* +|* PageCreated() +|* +\************************************************************************/ + +void __EXPORT SvxTextTabDialog::PageCreated( USHORT nId, SfxTabPage &rPage ) +{ + switch( nId ) + { + case RID_SVXPAGE_TEXTATTR: + { + ( (SvxTextAttrPage&) rPage ).SetView( pView ); + ( (SvxTextAttrPage&) rPage ).Construct(); + } + break; + + case RID_SVXPAGE_TEXTANIMATION: + break; + + default: + break; + } +} + + +/************************************************************************* +|* +|* Page +|* +\************************************************************************/ + +SvxTextAnimationPage::SvxTextAnimationPage( Window* pWindow, const SfxItemSet& rInAttrs ) : + SfxTabPage ( pWindow, SVX_RES( RID_SVXPAGE_TEXTANIMATION ), + rInAttrs ), + aFlEffect ( this, SVX_RES(FL_EFFECT)), + aFtEffects ( this, SVX_RES(FT_EFFECTS)), + aLbEffect ( this, SVX_RES( LB_EFFECT ) ), + //aCtlEffect ( this, SVX_RES( CTL_EFFECT ) ), + aFtDirection ( this, SVX_RES(FT_DIRECTION) ), + aBtnUp ( this, SVX_RES( BTN_UP ) ), + aBtnLeft ( this, SVX_RES( BTN_LEFT ) ), + aBtnRight ( this, SVX_RES( BTN_RIGHT ) ), + aBtnDown ( this, SVX_RES( BTN_DOWN ) ), + + aFlProperties ( this, SVX_RES(FL_PROPERTIES)), + aTsbStartInside ( this, SVX_RES( TSB_START_INSIDE ) ), + aTsbStopInside ( this, SVX_RES( TSB_STOP_INSIDE ) ), + + aFtCount ( this, SVX_RES(FT_COUNT)), + aTsbEndless ( this, SVX_RES( TSB_ENDLESS ) ), + aNumFldCount ( this, SVX_RES( NUM_FLD_COUNT ) ), + + aFtAmount ( this, SVX_RES(FT_AMOUNT)), + aTsbPixel ( this, SVX_RES( TSB_PIXEL ) ), + aMtrFldAmount ( this, SVX_RES( MTR_FLD_AMOUNT ) ), + + aFtDelay ( this, SVX_RES(FT_DELAY)), + aTsbAuto ( this, SVX_RES( TSB_AUTO ) ), + aMtrFldDelay ( this, SVX_RES( MTR_FLD_DELAY ) ), + + rOutAttrs ( rInAttrs ), + eAniKind ( SDRTEXTANI_NONE ) +{ + FreeResource(); + + eFUnit = GetModuleFieldUnit( &rInAttrs ); + SfxItemPool* pPool = rOutAttrs.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST ); + + Construct(); + + aLbEffect.SetSelectHdl( + LINK( this, SvxTextAnimationPage, SelectEffectHdl_Impl ) ); + aTsbEndless.SetClickHdl( + LINK( this, SvxTextAnimationPage, ClickEndlessHdl_Impl ) ); + aTsbAuto.SetClickHdl( + LINK( this, SvxTextAnimationPage, ClickAutoHdl_Impl ) ); + aTsbPixel.SetClickHdl( + LINK( this, SvxTextAnimationPage, ClickPixelHdl_Impl ) ); + + Link aLink( LINK( this, SvxTextAnimationPage, ClickDirectionHdl_Impl ) ); + aBtnUp.SetClickHdl( aLink ); + aBtnLeft.SetClickHdl( aLink ); + aBtnRight.SetClickHdl( aLink ); + aBtnDown.SetClickHdl( aLink ); +} + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +SvxTextAnimationPage::~SvxTextAnimationPage() +{ +} + +/************************************************************************* +|* +|* Liest uebergebenen Item-Set +|* +\************************************************************************/ + +void __EXPORT SvxTextAnimationPage::Reset( const SfxItemSet& rAttrs ) +{ + const SfxItemPool* pPool = rAttrs.GetPool(); + + // Animationstyp + const SfxPoolItem* pItem = GetItem( rAttrs, SDRATTR_TEXT_ANIKIND ); + + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIKIND ); + if( pItem ) + { + eAniKind = ( ( const SdrTextAniKindItem* )pItem )->GetValue(); + aLbEffect.SelectEntryPos( sal::static_int_cast< USHORT >(eAniKind) ); + } + else + aLbEffect.SetNoSelection(); + aLbEffect.SaveValue(); + + // Animationsrichtung + pItem = GetItem( rAttrs, SDRATTR_TEXT_ANIDIRECTION ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIDIRECTION ); + if( pItem ) + { + SdrTextAniDirection eValue = ( ( const SdrTextAniDirectionItem* )pItem )->GetValue(); + SelectDirection( eValue ); + } + else + { + aBtnUp.Check( FALSE ); + aBtnLeft.Check( FALSE ); + aBtnRight.Check( FALSE ); + aBtnDown.Check( FALSE ); + } + aBtnUp.SaveValue(); + aBtnLeft.SaveValue(); + aBtnRight.SaveValue(); + aBtnDown.SaveValue(); + + // Start inside + pItem = GetItem( rAttrs, SDRATTR_TEXT_ANISTARTINSIDE ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANISTARTINSIDE ); + if( pItem ) + { + aTsbStartInside.EnableTriState( FALSE ); + BOOL bValue = ( ( const SdrTextAniStartInsideItem* )pItem )->GetValue(); + if( bValue ) + aTsbStartInside.SetState( STATE_CHECK ); + else + aTsbStartInside.SetState( STATE_NOCHECK ); + } + else + aTsbStartInside.SetState( STATE_DONTKNOW ); + aTsbStartInside.SaveValue(); + + // Stop inside + pItem = GetItem( rAttrs, SDRATTR_TEXT_ANISTOPINSIDE ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANISTOPINSIDE ); + if( pItem ) + { + aTsbStopInside.EnableTriState( FALSE ); + BOOL bValue = ( ( const SdrTextAniStopInsideItem* )pItem )->GetValue(); + if( bValue ) + aTsbStopInside.SetState( STATE_CHECK ); + else + aTsbStopInside.SetState( STATE_NOCHECK ); + } + else + aTsbStopInside.SetState( STATE_DONTKNOW ); + aTsbStopInside.SaveValue(); + + // Anzahl + pItem = GetItem( rAttrs, SDRATTR_TEXT_ANICOUNT ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANICOUNT ); + if( pItem ) + { + aTsbEndless.EnableTriState( FALSE ); + long nValue = (long) ( ( const SdrTextAniCountItem* )pItem )->GetValue(); + aNumFldCount.SetValue( nValue ); + if( nValue == 0 ) + { + if( eAniKind == SDRTEXTANI_SLIDE ) + { + aTsbEndless.SetState( STATE_NOCHECK ); + aTsbEndless.Enable( FALSE ); + } + else + { + aTsbEndless.SetState( STATE_CHECK ); + aNumFldCount.SetEmptyFieldValue(); + } + } + else + aTsbEndless.SetState( STATE_NOCHECK ); + } + else + { + aNumFldCount.SetEmptyFieldValue(); + aTsbEndless.SetState( STATE_DONTKNOW ); + } + aTsbEndless.SaveValue(); + aNumFldCount.SaveValue(); + + // Verzoegerung + pItem = GetItem( rAttrs, SDRATTR_TEXT_ANIDELAY ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIDELAY ); + if( pItem ) + { + aTsbAuto.EnableTriState( FALSE ); + long nValue = (long) ( ( const SdrTextAniDelayItem* )pItem )->GetValue(); + aMtrFldDelay.SetValue( nValue ); + if( nValue == 0 ) + { + aTsbAuto.SetState( STATE_CHECK ); + aMtrFldDelay.SetEmptyFieldValue(); + } + else + aTsbAuto.SetState( STATE_NOCHECK ); + } + else + { + aMtrFldDelay.SetEmptyFieldValue(); + aTsbAuto.SetState( STATE_DONTKNOW ); + } + aTsbAuto.SaveValue(); + aMtrFldDelay.SaveValue(); + + // Schrittweite + pItem = GetItem( rAttrs, SDRATTR_TEXT_ANIAMOUNT ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIAMOUNT ); + if( pItem ) + { + aTsbPixel.EnableTriState( FALSE ); + long nValue = (long) ( ( const SdrTextAniAmountItem* )pItem )->GetValue(); + if( nValue <= 0 ) + { + aTsbPixel.SetState( STATE_CHECK ); + nValue = -nValue; + if( nValue == 0 ) + nValue++; + aMtrFldAmount.SetUnit( FUNIT_CUSTOM ); + aMtrFldAmount.SetDecimalDigits( 0 ); + + aMtrFldAmount.SetSpinSize( 1 ); + aMtrFldAmount.SetMin( 1 ); + aMtrFldAmount.SetFirst( 1 ); + aMtrFldAmount.SetMax( 100 ); + aMtrFldAmount.SetLast( 100 ); + + aMtrFldAmount.SetValue( nValue ); + } + else + { + aTsbPixel.SetState( STATE_NOCHECK ); + aMtrFldAmount.SetUnit( eFUnit ); + aMtrFldAmount.SetDecimalDigits( 2 ); + + aMtrFldAmount.SetSpinSize( 10 ); + aMtrFldAmount.SetMin( 1 ); + aMtrFldAmount.SetFirst( 1 ); + aMtrFldAmount.SetMax( 10000 ); + aMtrFldAmount.SetLast( 10000 ); + + SetMetricValue( aMtrFldAmount, nValue, eUnit ); + } + } + else + { + aMtrFldAmount.Disable(); + aMtrFldAmount.SetEmptyFieldValue(); + aTsbPixel.SetState( STATE_DONTKNOW ); + } + aTsbPixel.SaveValue(); + aMtrFldAmount.SaveValue(); + + + SelectEffectHdl_Impl( NULL ); + ClickEndlessHdl_Impl( NULL ); + ClickAutoHdl_Impl( NULL ); + //ClickPixelHdl_Impl( NULL ); +} + +/************************************************************************* +|* +|* Fuellt uebergebenen Item-Set mit Dialogbox-Attributen +|* +\************************************************************************/ + +BOOL SvxTextAnimationPage::FillItemSet( SfxItemSet& rAttrs) +{ + BOOL bModified = FALSE; + USHORT nPos; + TriState eState; + + // Animationstyp + nPos = aLbEffect.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND && + nPos != aLbEffect.GetSavedValue() ) + { + rAttrs.Put( SdrTextAniKindItem( (SdrTextAniKind) nPos ) ); + bModified = TRUE; + } + + // Animationsrichtung + if( aBtnUp.GetSavedValue() != aBtnUp.IsChecked() || + aBtnLeft.GetSavedValue() != aBtnLeft.IsChecked() || + aBtnRight.GetSavedValue() != aBtnRight.IsChecked() || + aBtnDown.GetSavedValue() != aBtnDown.IsChecked() ) + { + SdrTextAniDirection eValue = (SdrTextAniDirection) GetSelectedDirection(); + rAttrs.Put( SdrTextAniDirectionItem( eValue ) ); + bModified = TRUE; + } + + // Start inside + eState = aTsbStartInside.GetState(); + if( eState != aTsbStartInside.GetSavedValue() ) + { + rAttrs.Put( SdrTextAniStartInsideItem( (BOOL) STATE_CHECK == eState ) ); + bModified = TRUE; + } + + // Stop inside + eState = aTsbStopInside.GetState(); + if( eState != aTsbStopInside.GetSavedValue() ) + { + rAttrs.Put( SdrTextAniStopInsideItem( (BOOL) STATE_CHECK == eState ) ); + bModified = TRUE; + } + + // Anzahl + eState = aTsbEndless.GetState(); + String aStr = aNumFldCount.GetText(); + if( eState != aTsbEndless.GetSavedValue() || + aStr != aNumFldCount.GetSavedValue() ) + { + sal_Int64 nValue = 0; + if( eState == STATE_CHECK /*#89844#*/ && aTsbEndless.IsEnabled()) + bModified = TRUE; + else + { + if( aStr != aNumFldCount.GetSavedValue() ) + { + nValue = aNumFldCount.GetValue(); + bModified = TRUE; + } + } + if( bModified ) + rAttrs.Put( SdrTextAniCountItem( (UINT16) nValue ) ); + } + + // Verzoegerung + eState = aTsbAuto.GetState(); + aStr = aMtrFldDelay.GetText(); + if( eState != aTsbAuto.GetSavedValue() || + aStr != aMtrFldDelay.GetSavedValue() ) + { + sal_Int64 nValue = 0; + if( eState == STATE_CHECK ) + bModified = TRUE; + else + { + if( aStr != aMtrFldDelay.GetSavedValue() ) + { + nValue = aMtrFldDelay.GetValue(); + bModified = TRUE; + } + } + if( bModified ) + rAttrs.Put( SdrTextAniDelayItem( (UINT16) nValue ) ); + } + + // Schrittweite + eState = aTsbPixel.GetState(); + aStr = aMtrFldAmount.GetText(); + if( eState != aTsbPixel.GetSavedValue() || + aStr != aMtrFldAmount.GetSavedValue() ) + { + sal_Int64 nValue = 0; + if( eState == STATE_CHECK ) + { + nValue = aMtrFldAmount.GetValue(); + nValue = -nValue; + } + else + { + nValue = GetCoreValue( aMtrFldAmount, eUnit ); + } + rAttrs.Put( SdrTextAniAmountItem( (INT16) nValue ) ); + + bModified = TRUE; + } + + return( bModified ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +void SvxTextAnimationPage::Construct() +{ +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +USHORT* SvxTextAnimationPage::GetRanges() +{ + return( pRanges ); +} + +/************************************************************************* +|* +|* Erzeugt die Seite +|* +\************************************************************************/ + +SfxTabPage* SvxTextAnimationPage::Create( Window* pWindow, + const SfxItemSet& rAttrs ) +{ + return( new SvxTextAnimationPage( pWindow, rAttrs ) ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +IMPL_LINK( SvxTextAnimationPage, SelectEffectHdl_Impl, void *, EMPTYARG ) +{ + USHORT nPos = aLbEffect.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + eAniKind = (SdrTextAniKind) nPos; + switch( eAniKind ) + { + case SDRTEXTANI_NONE: + { + aFtDirection.Disable(); + aBtnUp.Disable(); + aBtnLeft.Disable(); + aBtnRight.Disable(); + aBtnDown.Disable(); + aTsbStartInside.Disable(); + aTsbStopInside.Disable(); + + aTsbEndless.Disable(); + aNumFldCount.Disable(); + aFtCount.Disable(); + + aTsbAuto.Disable(); + aMtrFldDelay.Disable(); + aFtDelay.Disable(); + + aTsbPixel.Disable(); + aMtrFldAmount.Disable(); + aFtAmount.Disable(); + } + break; + + case SDRTEXTANI_BLINK: + case SDRTEXTANI_SCROLL: + case SDRTEXTANI_ALTERNATE: + case SDRTEXTANI_SLIDE: + { + if( eAniKind == SDRTEXTANI_SLIDE ) + { + aTsbStartInside.Disable(); + aTsbStopInside.Disable(); + + aTsbEndless.Disable(); + aNumFldCount.Enable(); + aNumFldCount.SetValue( aNumFldCount.GetValue() ); + } + else + { + aTsbStartInside.Enable(); + aTsbStopInside.Enable(); + + aTsbEndless.Enable(); + ClickEndlessHdl_Impl( NULL ); + } + aFtCount.Enable(); + + aTsbAuto.Enable(); + aFtDelay.Enable(); + ClickAutoHdl_Impl( NULL ); + + if( eAniKind == SDRTEXTANI_BLINK ) + { + aFtDirection.Disable(); + aBtnUp.Disable(); + aBtnLeft.Disable(); + aBtnRight.Disable(); + aBtnDown.Disable(); + + aTsbPixel.Disable(); + aMtrFldAmount.Disable(); + aFtAmount.Disable(); + } + else + { + aFtDirection.Enable(); + aBtnUp.Enable(); + aBtnLeft.Enable(); + aBtnRight.Enable(); + aBtnDown.Enable(); + + aTsbPixel.Enable(); + aMtrFldAmount.Enable(); + aFtAmount.Enable(); + } + } + break; + } + + } + return( 0L ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +IMPL_LINK( SvxTextAnimationPage, ClickEndlessHdl_Impl, void *, EMPTYARG ) +{ + + if( eAniKind != SDRTEXTANI_SLIDE ) + { + TriState eState = aTsbEndless.GetState(); + if( eState != STATE_NOCHECK ) + { + aNumFldCount.Disable(); + aNumFldCount.SetEmptyFieldValue(); + } + else + { + aNumFldCount.Enable(); + aNumFldCount.SetValue( aNumFldCount.GetValue() ); + } + } + return( 0L ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +IMPL_LINK( SvxTextAnimationPage, ClickAutoHdl_Impl, void *, EMPTYARG ) +{ + TriState eState = aTsbAuto.GetState(); + if( eState != STATE_NOCHECK ) + { + aMtrFldDelay.Disable(); + aMtrFldDelay.SetEmptyFieldValue(); + } + else + { + aMtrFldDelay.Enable(); + aMtrFldDelay.SetValue( aMtrFldDelay.GetValue() ); + } + + return( 0L ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +IMPL_LINK( SvxTextAnimationPage, ClickPixelHdl_Impl, void *, EMPTYARG ) +{ + TriState eState = aTsbPixel.GetState(); + if( eState == STATE_CHECK ) + { + sal_Int64 nValue = aMtrFldAmount.GetValue() / 10; + aMtrFldAmount.Enable(); + aMtrFldAmount.SetUnit( FUNIT_CUSTOM ); + //SetFieldUnit( aMtrFldAmount, FUNIT_CUSTOM ); + aMtrFldAmount.SetDecimalDigits( 0 ); + + aMtrFldAmount.SetSpinSize( 1 ); + aMtrFldAmount.SetMin( 1 ); + aMtrFldAmount.SetFirst( 1 ); + aMtrFldAmount.SetMax( 100 ); + aMtrFldAmount.SetLast( 100 ); + + aMtrFldAmount.SetValue( nValue ); + } + else if( eState == STATE_NOCHECK ) + { + sal_Int64 nValue = aMtrFldAmount.GetValue() * 10; + aMtrFldAmount.Enable(); + aMtrFldAmount.SetUnit( eFUnit ); + //SetFieldUnit( aMtrFldAmount, eFUnit ); + aMtrFldAmount.SetDecimalDigits( 2 ); + + aMtrFldAmount.SetSpinSize( 10 ); + aMtrFldAmount.SetMin( 1 ); + aMtrFldAmount.SetFirst( 1 ); + aMtrFldAmount.SetMax( 10000 ); + aMtrFldAmount.SetLast( 10000 ); + + aMtrFldAmount.SetValue( nValue ); + } + + return( 0L ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +IMPL_LINK( SvxTextAnimationPage, ClickDirectionHdl_Impl, ImageButton *, pBtn ) +{ + aBtnUp.Check( pBtn == &aBtnUp ); + aBtnLeft.Check( pBtn == &aBtnLeft ); + aBtnRight.Check( pBtn == &aBtnRight ); + aBtnDown.Check( pBtn == &aBtnDown ); + + return( 0L ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +void SvxTextAnimationPage::SelectDirection( SdrTextAniDirection nValue ) +{ + aBtnUp.Check( nValue == SDRTEXTANI_UP ); + aBtnLeft.Check( nValue == SDRTEXTANI_LEFT ); + aBtnRight.Check( nValue == SDRTEXTANI_RIGHT ); + aBtnDown.Check( nValue == SDRTEXTANI_DOWN ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +USHORT SvxTextAnimationPage::GetSelectedDirection() +{ + USHORT nValue = 0; + + if( aBtnUp.IsChecked() ) + nValue = SDRTEXTANI_UP; + else if( aBtnLeft.IsChecked() ) + nValue = SDRTEXTANI_LEFT; + else if( aBtnRight.IsChecked() ) + nValue = SDRTEXTANI_RIGHT; + else if( aBtnDown.IsChecked() ) + nValue = SDRTEXTANI_DOWN; + + return( nValue ); +} + + diff --git a/cui/source/tabpages/textanim.hrc b/cui/source/tabpages/textanim.hrc new file mode 100644 index 000000000000..97d6b7c64525 --- /dev/null +++ b/cui/source/tabpages/textanim.hrc @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: textanim.hrc,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define LB_EFFECT 1 +#define CTL_EFFECT 1 +#define TSB_START_INSIDE 1 +#define TSB_STOP_INSIDE 2 +#define FL_EFFECT 1 +#define FT_EFFECTS 1 +#define FT_DIRECTION 2 +#define FL_PROPERTIES 2 +#define FT_COUNT 3 +#define TSB_ENDLESS 3 +#define NUM_FLD_COUNT 1 +#define FT_AMOUNT 4 +#define MTR_FLD_AMOUNT 1 +#define FT_DELAY 5 +#define MTR_FLD_DELAY 2 +#define TSB_PIXEL 4 +#define TSB_AUTO 5 +#define BTN_UP 1 +#define BTN_LEFT 2 +#define BTN_RIGHT 3 +#define BTN_DOWN 4 diff --git a/cui/source/tabpages/textanim.src b/cui/source/tabpages/textanim.src new file mode 100644 index 000000000000..d9c211a020f5 --- /dev/null +++ b/cui/source/tabpages/textanim.src @@ -0,0 +1,322 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: textanim.src,v $ + * $Revision: 1.38 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // pragma ---------------------------------------------------------------- + +#include +#include +#include "textanim.hrc" + +// direction image buttons +#define MA_HALFBUTTON_WIDTH 7 +#define MA_BUTTON_WIDTH (2 * MA_HALFBUTTON_WIDTH) +#define MA_BUTTON_HEIGHT (2 * MA_HALFBUTTON_WIDTH) +#define BUTTON_SIZE MAP_APPFONT( MA_BUTTON_WIDTH, MA_BUTTON_WIDTH ) +#define MA_MOVEBUT_GRACE_X 6 + +// height of first group Text effects +#define MA_EFFECTSGROUP_HEIGHT (RSC_CD_FIXEDLINE_HEIGHT + \ + RSC_SP_FLGR_INNERBORDER_LEFT + \ +/* direction buttons */ 3*MA_BUTTON_HEIGHT + \ + RSC_SP_FLGR_INNERBORDER_BOTTOM + RSC_SP_FLGR_SPACE_Y) + +// height of second group height of FIXEDTEXT +#define MA_PROPERTIESGROUP_HEIGHT (RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_LEFT + \ +/* text initially visible */ RSC_CD_CHECKBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y + \ +/* text finally visible */ RSC_CD_CHECKBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y + \ +/* animation runs */ RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_GROUP_Y + \ +/* number of runs */ RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y + \ +/* step size */ RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_GROUP_Y + \ +/* number of pixel */ RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y + \ +/* step delay */ RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_GROUP_Y + \ +/* delay time */ RSC_CD_TEXTBOX_HEIGHT) + + +// left space for real controls +#define MA_LEFT_SPACE (RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT) + +// tabpage total size +#define MA_TOTAL_WIDTH 260 +#define MA_TOTAL_HEIGHT RSC_SP_TBPG_INNERBORDER_TOP + MA_EFFECTSGROUP_HEIGHT + MA_PROPERTIESGROUP_HEIGHT + RSC_SP_TBPG_INNERBORDER_BOTTOM + +// X position and width of effects drop down +#define MA_EFFECTLIST_X 50 +#define MA_EFFECTLIST_WIDTH 95 + + + // RID_SVXPAGE_TEXTANIMATION --------------------------------------------- +TabPage RID_SVXPAGE_TEXTANIMATION +{ + SVLook = TRUE ; + Hide = TRUE ; + Size = MAP_APPFONT ( MA_TOTAL_WIDTH , 185 ) ; + Text [ en-US ] = "Animation" ; + FixedLine FL_EFFECT + { + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT, RSC_SP_TBPG_INNERBORDER_TOP ) ; + Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT, RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Text animation effects" ; + }; +#define MA_CURR_Y RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + MA_BUTTON_HEIGHT + FixedText FT_EFFECTS + { + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y + 3 ) ; + Size = MAP_APPFONT ( MA_EFFECTLIST_X - RSC_SP_CTRL_DESC_X - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_FLGR_INNERBORDER_LEFT, + RSC_CD_FIXEDTEXT_HEIGHT ) ; + Text [ en-US ] = "E~ffect" ; + }; + ListBox LB_EFFECT + { + Border = TRUE ; + Pos = MAP_APPFONT ( MA_EFFECTLIST_X, MA_CURR_Y + 1 ) ; + Size = MAP_APPFONT ( MA_EFFECTLIST_WIDTH , 57 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "No Effect" ; Default ; > ; + < "Blink" ; Default ; > ; + < "Scroll Through" ; Default ; > ; + < "Scroll Back and Forth" ; Default ; > ; + < "Scroll In" ; Default ; > ; + }; + }; + FixedText FT_DIRECTION + { + Pos = MAP_APPFONT ( MA_EFFECTLIST_X + MA_EFFECTLIST_WIDTH + RSC_SP_CTRL_X, MA_CURR_Y + 3 ) ; + Size = MAP_APPFONT ( MA_TOTAL_WIDTH - + (MA_MOVEBUT_GRACE_X + 3*MA_BUTTON_WIDTH + RSC_SP_TBPG_INNERBORDER_RIGHT + RSC_SP_FLGR_INNERBORDER_RIGHT) - + (MA_EFFECTLIST_X + MA_EFFECTLIST_WIDTH + RSC_SP_CTRL_X + RSC_SP_CTRL_DESC_X + 6), + RSC_CD_FIXEDTEXT_HEIGHT ) ; + Right = TRUE; + Text [ en-US ] = "Direction" ; + }; + ImageButton BTN_UP + { + Pos = MAP_APPFONT ( MA_TOTAL_WIDTH - MA_MOVEBUT_GRACE_X - 2*MA_BUTTON_WIDTH - RSC_SP_TBPG_INNERBORDER_RIGHT - RSC_SP_FLGR_INNERBORDER_RIGHT, + RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ); + Size = BUTTON_SIZE ; + Symbol = IMAGEBUTTON_ARROW_UP ; + QuickHelpText [ en-US ] = "To Top" ; + }; + ImageButton BTN_LEFT + { + Pos = MAP_APPFONT ( MA_TOTAL_WIDTH - MA_MOVEBUT_GRACE_X - 3*MA_BUTTON_WIDTH - RSC_SP_TBPG_INNERBORDER_RIGHT - RSC_SP_FLGR_INNERBORDER_RIGHT, + RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + MA_BUTTON_HEIGHT); + Size = BUTTON_SIZE ; + Symbol = IMAGEBUTTON_ARROW_LEFT ; + QuickHelpText [ en-US ] = "To Left" ; + }; + ImageButton BTN_RIGHT + { + Pos = MAP_APPFONT ( MA_TOTAL_WIDTH - MA_MOVEBUT_GRACE_X - MA_BUTTON_WIDTH - RSC_SP_TBPG_INNERBORDER_RIGHT - RSC_SP_FLGR_INNERBORDER_RIGHT, + RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + MA_BUTTON_HEIGHT ) ; + Size = BUTTON_SIZE ; + Symbol = IMAGEBUTTON_ARROW_RIGHT ; + QuickHelpText [ en-US ] = "To Right" ; + }; + ImageButton BTN_DOWN + { + Pos = MAP_APPFONT ( MA_TOTAL_WIDTH - MA_MOVEBUT_GRACE_X - 2*MA_BUTTON_WIDTH - RSC_SP_TBPG_INNERBORDER_RIGHT - RSC_SP_FLGR_INNERBORDER_RIGHT, + RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + 2*MA_BUTTON_HEIGHT ) ; + Size = BUTTON_SIZE ; + Symbol = IMAGEBUTTON_ARROW_DOWN ; + QuickHelpText [ en-US ] = "To Bottom" ; + }; + + FixedLine FL_PROPERTIES + { + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT , RSC_SP_TBPG_INNERBORDER_TOP + MA_EFFECTSGROUP_HEIGHT ) ; + Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT, RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Properties" ; + }; +#define MA_CURR_Y2 RSC_SP_TBPG_INNERBORDER_TOP + MA_EFFECTSGROUP_HEIGHT + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + TriStateBox TSB_START_INSIDE + { + TabStop = TRUE ; + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y2 ) ; + Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT - 12, RSC_CD_CHECKBOX_HEIGHT ); + Text [ en-US ] = "S~tart inside" ; + }; +#define MA_CURR_Y3 MA_CURR_Y2 + RSC_CD_CHECKBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y + TriStateBox TSB_STOP_INSIDE + { + TabStop = TRUE ; + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y3 ) ; + Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT - 12, RSC_CD_CHECKBOX_HEIGHT ); + Text [ en-US ] = "Text visible when exiting" ; + }; +#define MA_CURR_Y4 MA_CURR_Y3 + RSC_CD_CHECKBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y + FixedText FT_COUNT + { + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y4 ) ; + Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT - 12, + RSC_CD_FIXEDTEXT_HEIGHT ) ; + Text [ en-US ] = "Animation cycles" ; + }; +#define MA_CURR_Y5 MA_CURR_Y4 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + TriStateBox TSB_ENDLESS + { + TabStop = TRUE ; + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 9 , MA_CURR_Y5 + 2 ) ; + Size = MAP_APPFONT ( 71 , RSC_CD_CHECKBOX_HEIGHT ) ; + Text [ en-US ] = "~Continuous" ; + }; + NumericField NUM_FLD_COUNT + { + Border = TRUE ; + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 80 + RSC_SP_CTRL_GROUP_X, + MA_CURR_Y5 ) ; + Size = MAP_APPFONT ( 50 , RSC_CD_TEXTBOX_HEIGHT ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + First = 1 ; + }; +#define MA_CURR_Y6 MA_CURR_Y5 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y + FixedText FT_AMOUNT + { + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y6 ) ; + Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT - 12, + RSC_CD_FIXEDTEXT_HEIGHT ) ; + Text [ en-US ] = "Increment" ; + }; +#define MA_CURR_Y7 MA_CURR_Y6 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + TriStateBox TSB_PIXEL + { + TabStop = TRUE ; + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 9 , MA_CURR_Y7 + 2 ) ; + Size = MAP_APPFONT ( 71 , RSC_CD_CHECKBOX_HEIGHT ) ; + Text [ en-US ] = "~Pixels" ; + }; + MetricField MTR_FLD_AMOUNT + { + Border = TRUE ; + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 80 + RSC_SP_CTRL_GROUP_X, + MA_CURR_Y7 ) ; + Size = MAP_APPFONT ( 50 , RSC_CD_TEXTBOX_HEIGHT ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = " Pixel" ; + Minimum = 1 ; + First = 1 ; + Maximum = 10000 ; + Last = 10000 ; + }; +#define MA_CURR_Y8 MA_CURR_Y7 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y + FixedText FT_DELAY + { + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y8 ) ; + Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT - 12, + RSC_CD_FIXEDTEXT_HEIGHT ) ; + Text [ en-US ] = "Delay" ; + }; +#define MA_CURR_Y9 MA_CURR_Y8 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + TriStateBox TSB_AUTO + { + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 9 , MA_CURR_Y9 + 2 ) ; + Size = MAP_APPFONT ( 71 , RSC_CD_CHECKBOX_HEIGHT ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Automatic" ; + }; + MetricField MTR_FLD_DELAY + { + Border = TRUE ; + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 80 + RSC_SP_CTRL_GROUP_X, + MA_CURR_Y9 ) ; + Size = MAP_APPFONT ( 50 , RSC_CD_TEXTBOX_HEIGHT ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Spinsize = 50 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = " ms" ; + Maximum = 30000 ; + Last = 30000 ; + }; +}; + // RID_SVXDLG_TEXT ------------------------------------------------------- +TabDialog RID_SVXDLG_TEXT +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 289 , 185 + 46 ) ; + Text [ en-US ] = "Text" ; + Moveable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 3 , 3 ) ; + Size = MAP_APPFONT ( 260 , 185 ) ; + PageList = + { + PageItem + { + PageResID = RID_SVXPAGE_TEXTATTR ; + Identifier = RID_SVXPAGE_TEXTATTR ; + Text [ en-US ] = "Text" ; + }; + PageItem + { + PageResID = RID_SVXPAGE_TEXTANIMATION ; + Identifier = RID_SVXPAGE_TEXTANIMATION ; + Text [ en-US ] = "Text Animation" ; + }; + }; + }; +}; + // ******************************************************************* EOF + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/textattr.cxx b/cui/source/tabpages/textattr.cxx new file mode 100644 index 000000000000..a4549b3b1d40 --- /dev/null +++ b/cui/source/tabpages/textattr.cxx @@ -0,0 +1,801 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: textattr.cxx,v $ + * $Revision: 1.28 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef _SVX_TEXTATTR_CXX +#define _SVX_TEXTATTR_CXX +#endif +#include "textattr.hxx" +#include "textattr.hrc" +#include +#include "svx/dlgutil.hxx" +#include //add CHINA001 +#include //add CHINA001 +#include //add CHINA001 +#include + +static USHORT pRanges[] = +{ + SDRATTR_MISC_FIRST, SDRATTR_TEXT_HORZADJUST, + SDRATTR_TEXT_WORDWRAP, SDRATTR_TEXT_AUTOGROWSIZE, + 0 +}; + +/************************************************************************* +|* +|* Dialog zum Kopieren von Objekten +|* +\************************************************************************/ + +//CHINA001 SvxTextAttrDialog::SvxTextAttrDialog( Window* pParent, const SfxItemSet& rInAttrs, +//CHINA001 const SdrView* pSdrView ) : +//CHINA001 SfxSingleTabDialog( pParent, rInAttrs, RID_SVXPAGE_TEXTATTR ) +//CHINA001 { +//CHINA001 SvxTextAttrPage* pPage = new SvxTextAttrPage( this, rInAttrs ); +//CHINA001 +//CHINA001 pPage->SetView( pSdrView ); +//CHINA001 pPage->Construct(); +//CHINA001 +//CHINA001 SetTabPage( pPage ); +//CHINA001 SetText( pPage->GetText() ); +//CHINA001 } +//CHINA001 +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +//CHINA001 SvxTextAttrDialog::~SvxTextAttrDialog() +//CHINA001 { +//CHINA001 } + +/************************************************************************* +|* +|* Dialog (Seite) zum Kopieren von Objekten +|* +\************************************************************************/ + +SvxTextAttrPage::SvxTextAttrPage( Window* pWindow, const SfxItemSet& rInAttrs ) : + SvxTabPage ( pWindow, SVX_RES( RID_SVXPAGE_TEXTATTR ), + rInAttrs ), + + aFlText ( this, SVX_RES( FL_TEXT ) ), + aTsbAutoGrowWidth ( this, SVX_RES( TSB_AUTOGROW_WIDTH ) ), + aTsbAutoGrowHeight ( this, SVX_RES( TSB_AUTOGROW_HEIGHT ) ), + aTsbFitToSize ( this, SVX_RES( TSB_FIT_TO_SIZE ) ), + aTsbContour ( this, SVX_RES( TSB_CONTOUR ) ), + aTsbWordWrapText( this, SVX_RES( TSB_WORDWRAP_TEXT ) ), + aTsbAutoGrowSize( this, SVX_RES( TSB_AUTOGROW_SIZE ) ), + aFlDistance ( this, SVX_RES( FL_DISTANCE ) ), + aFtLeft ( this, SVX_RES( FT_LEFT ) ), + aMtrFldLeft ( this, SVX_RES( MTR_FLD_LEFT ) ), + aFtRight ( this, SVX_RES( FT_RIGHT ) ), + aMtrFldRight ( this, SVX_RES( MTR_FLD_RIGHT ) ), + aFtTop ( this, SVX_RES( FT_TOP ) ), + aMtrFldTop ( this, SVX_RES( MTR_FLD_TOP ) ), + aFtBottom ( this, SVX_RES( FT_BOTTOM ) ), + aMtrFldBottom ( this, SVX_RES( MTR_FLD_BOTTOM ) ), + + aFlSeparator ( this, SVX_RES( FL_SEPARATOR ) ), + + aFlPosition ( this, SVX_RES( FL_POSITION ) ), + aCtlPosition ( this, SVX_RES( CTL_POSITION ), + RP_MM, 240, 100 ), + aTsbFullWidth ( this, SVX_RES( TSB_FULL_WIDTH ) ), + + rOutAttrs ( rInAttrs ) +{ + FreeResource(); + + FieldUnit eFUnit = GetModuleFieldUnit( &rInAttrs ); + SetFieldUnit( aMtrFldLeft, eFUnit ); + SetFieldUnit( aMtrFldRight, eFUnit ); + SetFieldUnit( aMtrFldTop, eFUnit ); + SetFieldUnit( aMtrFldBottom, eFUnit ); + + Link aLink( LINK( this, SvxTextAttrPage, ClickHdl_Impl ) ); + aTsbAutoGrowWidth.SetClickHdl( aLink ); + aTsbAutoGrowHeight.SetClickHdl( aLink ); + aTsbFitToSize.SetClickHdl( aLink ); + aTsbContour.SetClickHdl( aLink ); + + aTsbFullWidth.SetClickHdl( + LINK( this, SvxTextAttrPage, ClickFullWidthHdl_Impl ) ); +} + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +SvxTextAttrPage::~SvxTextAttrPage() +{ +} + +/************************************************************************* +|* +|* Liest uebergebenen Item-Set +|* +\************************************************************************/ + +void __EXPORT SvxTextAttrPage::Reset( const SfxItemSet& rAttrs ) +{ + SfxItemPool* pPool = rAttrs.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + SfxMapUnit eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST ); + + // Linker Abstand vom Rahmen + const SfxPoolItem* pItem = GetItem( rAttrs, SDRATTR_TEXT_LEFTDIST ); + + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_LEFTDIST ); + if( pItem ) + { + long nValue = ( ( const SdrTextLeftDistItem* )pItem )->GetValue(); + SetMetricValue( aMtrFldLeft, nValue, eUnit ); + } + else + aMtrFldLeft.SetText( String() ); + aMtrFldLeft.SaveValue(); + + // Rechter Abstand vom Rahmen + pItem = GetItem( rAttrs, SDRATTR_TEXT_RIGHTDIST ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_RIGHTDIST ); + if( pItem ) + { + long nValue = ( ( const SdrTextRightDistItem* )pItem )->GetValue(); + SetMetricValue( aMtrFldRight, nValue, eUnit ); + } + else + aMtrFldRight.SetText( String() ); + aMtrFldRight.SaveValue(); + + // Oberer Abstand vom Rahmen + pItem = GetItem( rAttrs, SDRATTR_TEXT_UPPERDIST ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_UPPERDIST ); + if( pItem ) + { + long nValue = ( ( const SdrTextUpperDistItem* )pItem )->GetValue(); + SetMetricValue( aMtrFldTop, nValue, eUnit ); + } + else + aMtrFldTop.SetText( String() ); + aMtrFldTop.SaveValue(); + + // Unterer Abstand vom Rahmen + pItem = GetItem( rAttrs, SDRATTR_TEXT_LOWERDIST ); + if( !pItem ) + pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_LOWERDIST ); + if( pItem ) + { + long nValue = ( ( const SdrTextLowerDistItem* )pItem )->GetValue(); + SetMetricValue( aMtrFldBottom, nValue, eUnit ); + } + else + aMtrFldBottom.SetText( String() ); + aMtrFldBottom.SaveValue(); + + // An Hoehe anpassen + if ( rAttrs.GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) != SFX_ITEM_DONTCARE ) + { + aTsbAutoGrowHeight.SetState( ( ( const SdrTextAutoGrowHeightItem& )rAttrs.Get( SDRATTR_TEXT_AUTOGROWHEIGHT ) ). + GetValue() ? STATE_CHECK : STATE_NOCHECK ); + aTsbAutoGrowHeight.EnableTriState( FALSE ); + } + else + aTsbAutoGrowHeight.SetState( STATE_DONTKNOW ); + aTsbAutoGrowHeight.SaveValue(); + + // An Breite anpassen + if ( rAttrs.GetItemState( SDRATTR_TEXT_AUTOGROWWIDTH ) != SFX_ITEM_DONTCARE ) + { + aTsbAutoGrowWidth.SetState( ( ( const SdrTextAutoGrowWidthItem& )rAttrs.Get( SDRATTR_TEXT_AUTOGROWWIDTH ) ). + GetValue() ? STATE_CHECK : STATE_NOCHECK ); + aTsbAutoGrowWidth.EnableTriState( FALSE ); + } + else + aTsbAutoGrowWidth.SetState( STATE_DONTKNOW ); + aTsbAutoGrowWidth.SaveValue(); + + // autogrowsize + if ( rAttrs.GetItemState( SDRATTR_TEXT_AUTOGROWSIZE ) != SFX_ITEM_DONTCARE ) + { + aTsbAutoGrowSize.SetState( ( ( const SdrTextAutoGrowHeightItem& )rAttrs.Get( SDRATTR_TEXT_AUTOGROWHEIGHT ) ). + GetValue() ? STATE_CHECK : STATE_NOCHECK ); + aTsbAutoGrowSize.EnableTriState( FALSE ); + } + else + aTsbAutoGrowSize.SetState( STATE_DONTKNOW ); + aTsbAutoGrowSize.SaveValue(); + + // wordwrap text + if ( rAttrs.GetItemState( SDRATTR_TEXT_WORDWRAP ) != SFX_ITEM_DONTCARE ) + { + aTsbWordWrapText.SetState( ( ( const SdrTextWordWrapItem& )rAttrs.Get( SDRATTR_TEXT_WORDWRAP ) ). + GetValue() ? STATE_CHECK : STATE_NOCHECK ); + aTsbWordWrapText.EnableTriState( FALSE ); + } + else + aTsbWordWrapText.SetState( STATE_DONTKNOW ); + aTsbWordWrapText.SaveValue(); + + + // #103516# Do the setup based on states of hor/ver adjust + // Setup center field and FullWidth + SfxItemState eVState = rAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ); + SfxItemState eHState = rAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ); + + if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState) + { + // VertAdjust and HorAdjust are unequivocal, thus + SdrTextVertAdjust eTVA = (SdrTextVertAdjust)((const SdrTextVertAdjustItem&)rAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue(); + SdrTextHorzAdjust eTHA = (SdrTextHorzAdjust)((const SdrTextHorzAdjustItem&)rAttrs.Get(SDRATTR_TEXT_HORZADJUST)).GetValue(); + RECT_POINT eRP = RP_LB; + + aTsbFullWidth.EnableTriState( FALSE ); + + // Translate item values into local anchor position. + switch (eTVA) + { + case SDRTEXTVERTADJUST_TOP: + { + switch (eTHA) + { + case SDRTEXTHORZADJUST_LEFT: eRP = RP_LT; break; + case SDRTEXTHORZADJUST_BLOCK: + case SDRTEXTHORZADJUST_CENTER: eRP = RP_MT; break; + case SDRTEXTHORZADJUST_RIGHT: eRP = RP_RT; break; + } + break; + } + case SDRTEXTVERTADJUST_BLOCK: + case SDRTEXTVERTADJUST_CENTER: + { + switch (eTHA) + { + case SDRTEXTHORZADJUST_LEFT: eRP = RP_LM; break; + case SDRTEXTHORZADJUST_BLOCK: + case SDRTEXTHORZADJUST_CENTER: eRP = RP_MM; break; + case SDRTEXTHORZADJUST_RIGHT: eRP = RP_RM; break; + } + break; + } + case SDRTEXTVERTADJUST_BOTTOM: + { + switch (eTHA) + { + case SDRTEXTHORZADJUST_LEFT: eRP = RP_LB; break; + case SDRTEXTHORZADJUST_BLOCK: + case SDRTEXTHORZADJUST_CENTER: eRP = RP_MB; break; + case SDRTEXTHORZADJUST_RIGHT: eRP = RP_RB; break; + } + break; + } + default: + break; + } + + // See if we have to check the "full width" check button. + sal_Bool bLeftToRight(IsTextDirectionLeftToRight()); + + if((bLeftToRight && (SDRTEXTHORZADJUST_BLOCK == eTHA)) || (!bLeftToRight && (SDRTEXTVERTADJUST_BLOCK == eTVA))) + { + // Move anchor to valid position. + ClickFullWidthHdl_Impl(NULL); + aTsbFullWidth.SetState(STATE_CHECK); + } + + aCtlPosition.SetActualRP( eRP ); + } + else + { + // VertAdjust or HorAdjust is not unequivocal + aCtlPosition.Reset(); + + aCtlPosition.SetState(STATE_DONTKNOW); + aCtlPosition.DoCompletelyDisable(sal_True); + + aTsbFullWidth.SetState(STATE_DONTKNOW); + aTsbFullWidth.Enable( sal_False ); + aFlPosition.Enable( sal_False ); + } + + // Am Rahmen anpassen + if ( rAttrs.GetItemState( SDRATTR_TEXT_FITTOSIZE ) != SFX_ITEM_DONTCARE ) + { + SdrFitToSizeType eFTS = (SdrFitToSizeType) + ( ( const SdrTextFitToSizeTypeItem& )rAttrs.Get( SDRATTR_TEXT_FITTOSIZE ) ).GetValue(); + aTsbFitToSize.SetState( eFTS == SDRTEXTFIT_NONE ? STATE_NOCHECK : STATE_CHECK ); + aTsbFitToSize.EnableTriState( FALSE ); + } + else + aTsbFitToSize.SetState( STATE_DONTKNOW ); + aTsbFitToSize.SaveValue(); + + // Konturfluss + if( rAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME ) != SFX_ITEM_DONTCARE ) + { + BOOL bContour = ( ( const SdrTextContourFrameItem& )rAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue(); + aTsbContour.SetState( bContour ? STATE_CHECK : STATE_NOCHECK ); + aTsbContour.EnableTriState( FALSE ); + } + else + aTsbContour.SetState( STATE_DONTKNOW ); + aTsbContour.SaveValue(); + + ClickHdl_Impl( NULL ); +} + +/************************************************************************* +|* +|* Fuellt uebergebenen Item-Set mit Dialogbox-Attributen +|* +\************************************************************************/ + +BOOL SvxTextAttrPage::FillItemSet( SfxItemSet& rAttrs) +{ + SfxItemPool* pPool = rAttrs.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool" ); + SfxMapUnit eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST ); + + INT32 nValue; + TriState eState; + + if( aMtrFldLeft.GetText() != aMtrFldLeft.GetSavedValue() ) + { + nValue = GetCoreValue( aMtrFldLeft, eUnit ); + rAttrs.Put( SdrTextLeftDistItem( nValue ) ); + } + + if( aMtrFldRight.GetText() != aMtrFldRight.GetSavedValue() ) + { + nValue = GetCoreValue( aMtrFldRight, eUnit ); + rAttrs.Put( SdrTextRightDistItem( nValue ) ); + } + + if( aMtrFldTop.GetText() != aMtrFldTop.GetSavedValue() ) + { + nValue = GetCoreValue( aMtrFldTop, eUnit ); + rAttrs.Put( SdrTextUpperDistItem( nValue ) ); + } + + if( aMtrFldBottom.GetText() != aMtrFldBottom.GetSavedValue() ) + { + nValue = GetCoreValue( aMtrFldBottom, eUnit ); + rAttrs.Put( SdrTextLowerDistItem( nValue ) ); + } + + eState = aTsbAutoGrowHeight.GetState(); + if( eState != aTsbAutoGrowHeight.GetSavedValue() ) + { + rAttrs.Put( SdrTextAutoGrowHeightItem( (BOOL) STATE_CHECK == eState ) ); + } + + eState = aTsbAutoGrowWidth.GetState(); + if( eState != aTsbAutoGrowWidth.GetSavedValue() ) + { + rAttrs.Put( SdrTextAutoGrowWidthItem( (BOOL) STATE_CHECK == eState ) ); + } + + eState = aTsbAutoGrowSize.GetState(); + if( eState != aTsbAutoGrowSize.GetSavedValue() ) + { + rAttrs.Put( SdrTextAutoGrowHeightItem( (BOOL) STATE_CHECK == eState ) ); + } + + eState = aTsbWordWrapText.GetState(); + if( eState != aTsbWordWrapText.GetSavedValue() ) + { + rAttrs.Put( SdrTextWordWrapItem( (BOOL) STATE_CHECK == eState ) ); + } + + // Konturfluss + eState = aTsbContour.GetState(); + if( eState != aTsbContour.GetSavedValue() ) + { + rAttrs.Put( SdrTextContourFrameItem( (BOOL) STATE_CHECK == eState ) ); + } + + eState = aTsbFitToSize.GetState(); + if( eState != aTsbFitToSize.GetSavedValue() ) + { + SdrFitToSizeType eFTS; + switch( eState ) + { + default: ; //prevent warning + DBG_ERROR( "svx::SvxTextAttrPage::FillItemSet(), unhandled state!" ); + case STATE_NOCHECK: eFTS = SDRTEXTFIT_NONE; break; + //case STATE_CHECK: eFTS = SDRTEXTFIT_RESIZEATTR; break; + case STATE_CHECK: eFTS = SDRTEXTFIT_PROPORTIONAL; break; + } + rAttrs.Put( SdrTextFitToSizeTypeItem( eFTS ) ); + } + + // zentriert + RECT_POINT eRP = aCtlPosition.GetActualRP(); + SdrTextVertAdjust eTVA, eOldTVA; + SdrTextHorzAdjust eTHA, eOldTHA; + + switch( eRP ) + { + default: + case RP_LT: eTVA = SDRTEXTVERTADJUST_TOP; + eTHA = SDRTEXTHORZADJUST_LEFT; break; + case RP_LM: eTVA = SDRTEXTVERTADJUST_CENTER; + eTHA = SDRTEXTHORZADJUST_LEFT; break; + case RP_LB: eTVA = SDRTEXTVERTADJUST_BOTTOM; + eTHA = SDRTEXTHORZADJUST_LEFT; break; + case RP_MT: eTVA = SDRTEXTVERTADJUST_TOP; + eTHA = SDRTEXTHORZADJUST_CENTER; break; + case RP_MM: eTVA = SDRTEXTVERTADJUST_CENTER; + eTHA = SDRTEXTHORZADJUST_CENTER; break; + case RP_MB: eTVA = SDRTEXTVERTADJUST_BOTTOM; + eTHA = SDRTEXTHORZADJUST_CENTER; break; + case RP_RT: eTVA = SDRTEXTVERTADJUST_TOP; + eTHA = SDRTEXTHORZADJUST_RIGHT; break; + case RP_RM: eTVA = SDRTEXTVERTADJUST_CENTER; + eTHA = SDRTEXTHORZADJUST_RIGHT; break; + case RP_RB: eTVA = SDRTEXTVERTADJUST_BOTTOM; + eTHA = SDRTEXTHORZADJUST_RIGHT; break; + } + + // #103516# Do not change values if adjust controls were disabled. + sal_Bool bIsDisabled(aCtlPosition.IsCompletelyDisabled()); + + if(!bIsDisabled) + { + if( aTsbFullWidth.GetState() == STATE_CHECK ) + { + if (IsTextDirectionLeftToRight()) + eTHA = SDRTEXTHORZADJUST_BLOCK; + else + eTVA = SDRTEXTVERTADJUST_BLOCK; + } + + if ( rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ) != SFX_ITEM_DONTCARE ) + { + eOldTVA = (SdrTextVertAdjust) + ( ( const SdrTextVertAdjustItem& )rOutAttrs.Get( SDRATTR_TEXT_VERTADJUST ) ).GetValue(); + if( eOldTVA != eTVA ) + rAttrs.Put( SdrTextVertAdjustItem( eTVA ) ); + } + else + rAttrs.Put( SdrTextVertAdjustItem( eTVA ) ); + + if ( rOutAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ) != SFX_ITEM_DONTCARE ) + { + eOldTHA = (SdrTextHorzAdjust) + ( ( const SdrTextHorzAdjustItem& )rOutAttrs.Get( SDRATTR_TEXT_HORZADJUST ) ).GetValue(); + if( eOldTHA != eTHA ) + rAttrs.Put( SdrTextHorzAdjustItem( eTHA ) ); + } + else + rAttrs.Put( SdrTextHorzAdjustItem( eTHA ) ); + } + + return( TRUE ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +void SvxTextAttrPage::Construct() +{ + DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" ); + + bFitToSizeEnabled = bContourEnabled = TRUE; + bWordWrapTextEnabled = bAutoGrowSizeEnabled = bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = FALSE; + + const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); + if( rMarkList.GetMarkCount() == 1 ) + { + const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); + SdrObjKind eKind = (SdrObjKind) pObj->GetObjIdentifier(); + if( pObj->GetObjInventor() == SdrInventor ) + { + switch( eKind ) + { + case OBJ_TEXT : + case OBJ_TITLETEXT : + case OBJ_OUTLINETEXT : + case OBJ_CAPTION : + { + if ( ((SdrTextObj*)pObj)->HasText() ) + { + // Konturfluss ist NICHT bei reinen Textobjekten m�glich + bContourEnabled = FALSE; + + // Breite und Hoehe anpassen ist NUR bei reinen Textobjekten m�glich + bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = TRUE; + } + } + break; + case OBJ_CUSTOMSHAPE : + { + bFitToSizeEnabled = bContourEnabled = FALSE; + bAutoGrowSizeEnabled = TRUE; + bWordWrapTextEnabled = TRUE; + } + break; + default: ;//prevent warning + } + } + } + aTsbAutoGrowHeight.Enable( bAutoGrowHeightEnabled ); + aTsbAutoGrowWidth.Enable( bAutoGrowWidthEnabled ); + aTsbFitToSize.Enable( bFitToSizeEnabled ); + aTsbContour.Enable( bContourEnabled ); + aTsbAutoGrowSize.Enable( bAutoGrowSizeEnabled ); + aTsbWordWrapText.Enable( bWordWrapTextEnabled ); +} + +/************************************************************************* +|* +|* Erzeugt die Seite +|* +\************************************************************************/ + +SfxTabPage* SvxTextAttrPage::Create( Window* pWindow, + const SfxItemSet& rAttrs ) +{ + return( new SvxTextAttrPage( pWindow, rAttrs ) ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +USHORT* SvxTextAttrPage::GetRanges() +{ + return( pRanges ); +} + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +/** Check whether we have to uncheck the "Full width" check box. +*/ +void SvxTextAttrPage::PointChanged( Window*, RECT_POINT eRP ) +{ + if (aTsbFullWidth.GetState() == STATE_CHECK) + { + // Depending on write direction and currently checked anchor we have + // to uncheck the "full width" button. + if (IsTextDirectionLeftToRight()) + switch( eRP ) + { + case RP_LT: + case RP_LM: + case RP_LB: + case RP_RT: + case RP_RM: + case RP_RB: + aTsbFullWidth.SetState( STATE_NOCHECK ); + break; + default: ;//prevent warning + } + else + switch (eRP) + { + case RP_LT: + case RP_MT: + case RP_RT: + case RP_LB: + case RP_MB: + case RP_RB: + aTsbFullWidth.SetState( STATE_NOCHECK ); + break; + default: ;//prevent warning + } + } +} + +/************************************************************************* +|* +|* Aendert evtl. die Position des Positions-Controls +|* +\************************************************************************/ + +/** When switching the "full width" check button on the text anchor may have + to be moved to a valid and adjacent position. This position depends on + the current anchor position and the text writing direction. +*/ +IMPL_LINK( SvxTextAttrPage, ClickFullWidthHdl_Impl, void *, EMPTYARG ) +{ + if( aTsbFullWidth.GetState() == STATE_CHECK ) + { + if (IsTextDirectionLeftToRight()) + { + // Move text anchor to horizontal middle axis. + switch( aCtlPosition.GetActualRP() ) + { + case RP_LT: + case RP_RT: + aCtlPosition.SetActualRP( RP_MT ); + break; + + case RP_LM: + case RP_RM: + aCtlPosition.SetActualRP( RP_MM ); + break; + + case RP_LB: + case RP_RB: + aCtlPosition.SetActualRP( RP_MB ); + break; + default: ;//prevent warning + } + } + else + { + // Move text anchor to vertical middle axis. + switch( aCtlPosition.GetActualRP() ) + { + case RP_LT: + case RP_LB: + aCtlPosition.SetActualRP( RP_LM ); + break; + + case RP_MT: + case RP_MB: + aCtlPosition.SetActualRP( RP_MM ); + break; + + case RP_RT: + case RP_RB: + aCtlPosition.SetActualRP( RP_RM ); + break; + default: ;//prevent warning + } + } + } + return( 0L ); +} + +/************************************************************************* +|* +|* Enabled/Disabled "Groesse an Text" oder "Am Rahmen Anpassen" +|* +\************************************************************************/ + +IMPL_LINK( SvxTextAttrPage, ClickHdl_Impl, void *, EMPTYARG ) +{ + BOOL bAutoGrowWidth = aTsbAutoGrowWidth.GetState() == STATE_CHECK; + BOOL bAutoGrowHeight = aTsbAutoGrowHeight.GetState() == STATE_CHECK; + BOOL bFitToSize = aTsbFitToSize.GetState() == STATE_CHECK; + BOOL bContour = aTsbContour.GetState() == STATE_CHECK; + + aTsbContour.Enable( !bFitToSize && + !( ( bAutoGrowWidth && bAutoGrowWidthEnabled ) || ( bAutoGrowHeight && bAutoGrowHeightEnabled ) ) && + bContourEnabled ); + + aTsbAutoGrowWidth.Enable( !bFitToSize && + !( bContour && bContourEnabled ) && + bAutoGrowWidthEnabled ); + + aTsbAutoGrowHeight.Enable( !bFitToSize && + !( bContour && bContourEnabled ) && + bAutoGrowHeightEnabled ); + + aTsbFitToSize.Enable( !( ( bAutoGrowWidth && bAutoGrowWidthEnabled ) || ( bAutoGrowHeight && bAutoGrowHeightEnabled ) ) && + !( bContour && bContourEnabled ) && + bFitToSizeEnabled ); + + // #101901# enable/disable metric fields and decorations dependent of contour + aMtrFldLeft.Enable(!bContour); + aMtrFldRight.Enable(!bContour); + aMtrFldTop.Enable(!bContour); + aMtrFldBottom.Enable(!bContour); + aFlDistance.Enable(!bContour); + aFtLeft.Enable(!bContour); + aFtRight.Enable(!bContour); + aFtTop.Enable(!bContour); + aFtBottom.Enable(!bContour); + + if( bContour && bContourEnabled ) + { + aMtrFldLeft.SetValue( 0 ); + aMtrFldRight.SetValue( 0 ); + aMtrFldTop.SetValue( 0 ); + aMtrFldBottom.SetValue( 0 ); + } + + // #103516# Do the setup based on states of hor/ver adjust + SfxItemState eVState = rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ); + SfxItemState eHState = rOutAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ); + sal_Bool bHorAndVer(SFX_ITEM_DONTCARE == eVState || SFX_ITEM_DONTCARE == eHState); + + // #83698# enable/disable text anchoring dependent of contour + aCtlPosition.Enable(!bContour && !bHorAndVer); + aTsbFullWidth.Enable(!bContour && !bHorAndVer); + aFlPosition.Enable(!bContour && !bHorAndVer); + + return( 0L ); +} + + +bool SvxTextAttrPage::IsTextDirectionLeftToRight (void) const +{ + // Determine the text writing direction with left to right as default. + bool bLeftToRightDirection = true; + SfxItemState eState = rOutAttrs.GetItemState(SDRATTR_TEXTDIRECTION); + + if(SFX_ITEM_DONTCARE != eState) + { + const SvxWritingModeItem& rItem = static_cast ( + rOutAttrs.Get (SDRATTR_TEXTDIRECTION)); + if (rItem.GetValue() == com::sun::star::text::WritingMode_TB_RL) + bLeftToRightDirection = false; + } + return bLeftToRightDirection; +} + +//add CHINA001 begin +void SvxTextAttrPage::PageCreated(SfxAllItemSet aSet) +{ + SFX_ITEMSET_ARG (&aSet,pViewItem,OfaPtrItem,SID_SVXTEXTATTRPAGE_VIEW,sal_False); + + if (pViewItem) + SetView( static_cast(pViewItem->GetValue())); + + Construct(); +} + +//end of CHINA001 diff --git a/cui/source/tabpages/textattr.hrc b/cui/source/tabpages/textattr.hrc new file mode 100644 index 000000000000..5abc50f04250 --- /dev/null +++ b/cui/source/tabpages/textattr.hrc @@ -0,0 +1,49 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: textattr.hrc,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define FL_TEXT 2 +#define FL_DISTANCE 1 +#define FL_POSITION 3 +#define FL_SEPARATOR 4 +#define TSB_AUTOGROW_HEIGHT 1 +#define TSB_AUTOGROW_WIDTH 2 +#define TSB_FIT_TO_SIZE 3 +#define TSB_FULL_WIDTH 4 +#define TSB_CONTOUR 5 +#define TSB_WORDWRAP_TEXT 6 +#define TSB_AUTOGROW_SIZE 7 +#define CTL_POSITION 1 +#define FT_LEFT 1 +#define MTR_FLD_LEFT 1 +#define FT_RIGHT 2 +#define MTR_FLD_RIGHT 2 +#define FT_TOP 3 +#define MTR_FLD_TOP 3 +#define FT_BOTTOM 4 +#define MTR_FLD_BOTTOM 4 diff --git a/cui/source/tabpages/textattr.src b/cui/source/tabpages/textattr.src new file mode 100644 index 000000000000..d0d22044bb51 --- /dev/null +++ b/cui/source/tabpages/textattr.src @@ -0,0 +1,247 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: textattr.src,v $ + * $Revision: 1.33 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include +#include +#include "textattr.hrc" +#include "helpid.hrc" + // pragma ---------------------------------------------------------------- + + // RID_SVXPAGE_TEXTATTR -------------------------------------------------- +TabPage RID_SVXPAGE_TEXTATTR +{ + HelpId = HID_PAGE_TEXTATTR ; + Hide = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Text [ en-US ] = "Text" ; + FixedLine FL_TEXT + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Text" ; + }; + TriStateBox TSB_AUTOGROW_WIDTH + { + TabStop = TRUE ; + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 102 , 10 ) ; + Text [ en-US ] = "Fit wi~dth to text" ; + }; + TriStateBox TSB_AUTOGROW_HEIGHT + { + TabStop = TRUE ; + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 102 , 10 ) ; + Text [ en-US ] = "Fit h~eight to text" ; + }; + TriStateBox TSB_FIT_TO_SIZE + { + TabStop = TRUE ; + Pos = MAP_APPFONT ( 12 , 42 ) ; + Size = MAP_APPFONT ( 102 , 10 ) ; + Text [ en-US ] = "~Fit to frame" ; + }; + TriStateBox TSB_CONTOUR + { + TabStop = TRUE ; + Pos = MAP_APPFONT ( 12 , 56 ) ; + Size = MAP_APPFONT ( 102 , 10 ) ; + Text [ en-US ] = "~Adjust to contour" ; + }; + TriStateBox TSB_WORDWRAP_TEXT + { + TabStop = TRUE; + Pos = MAP_APPFONT( 132, 14 ) ; + Size = MAP_APPFONT( 127 , 10 ) ; + Text [ en-US ] = "~Word wrap text in shape"; + }; + TriStateBox TSB_AUTOGROW_SIZE + { + TabStop = TRUE; + Pos = MAP_APPFONT( 132, 28 ); + Size = MAP_APPFONT( 127 , 10 ); + Text [ en-US ] = "~Resize shape to fit text"; + }; + FixedLine FL_DISTANCE + { + Pos = MAP_APPFONT ( 6 , 72 ) ; + Size = MAP_APPFONT ( 114 , RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Spacing to borders" ; + }; + FixedText FT_LEFT + { + Pos = MAP_APPFONT ( 12 , 85 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Left" ; + }; + FixedText FT_RIGHT + { + Pos = MAP_APPFONT ( 12 , 101 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Right" ; + }; + FixedText FT_TOP + { + Pos = MAP_APPFONT ( 12 , 117 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Top" ; + }; + FixedText FT_BOTTOM + { + Pos = MAP_APPFONT ( 12 , 133 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Bottom" ; + }; + MetricField MTR_FLD_LEFT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 69 , 83 ) ; + Size = MAP_APPFONT ( 45 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + Minimum = -10000 ; + First = -10000 ; + Maximum = 10000 ; + Last = 10000 ; + SpinSize = 10 ; + }; + MetricField MTR_FLD_RIGHT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 69 , 99 ) ; + Size = MAP_APPFONT ( 45 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + Minimum = -10000 ; + First = -10000 ; + Maximum = 10000 ; + Last = 10000 ; + SpinSize = 10 ; + }; + MetricField MTR_FLD_TOP + { + Border = TRUE ; + Pos = MAP_APPFONT ( 69 , 115 ) ; + Size = MAP_APPFONT ( 45 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + Minimum = -10000 ; + First = -10000 ; + Maximum = 10000 ; + Last = 10000 ; + SpinSize = 10 ; + }; + MetricField MTR_FLD_BOTTOM + { + Border = TRUE ; + Pos = MAP_APPFONT ( 69 , 131 ) ; + Size = MAP_APPFONT ( 45 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + Minimum = -10000 ; + First = -10000 ; + Maximum = 10000 ; + Last = 10000 ; + SpinSize = 10 ; + }; + FixedLine FL_SEPARATOR + { + Pos = MAP_APPFONT ( 121 , 83 ) ; + Size = MAP_APPFONT ( RSC_CD_FIXEDLINE_WIDTH , 66 ) ; + Vert = TRUE; + }; + FixedLine FL_POSITION + { + Pos = MAP_APPFONT ( 126 , 72 ) ; + Size = MAP_APPFONT ( 128 , RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Text anchor" ; + }; + Control CTL_POSITION + { + HelpId = HID_TEXTATTR_CTL_POSITION ; + Border = TRUE ; + Pos = MAP_APPFONT ( 132 , 83 ) ; + Size = MAP_APPFONT ( 116 , 52 ) ; + TabStop = TRUE ; + }; + TriStateBox TSB_FULL_WIDTH + { + TabStop = TRUE ; + Pos = MAP_APPFONT ( 132 , 139 ) ; + Size = MAP_APPFONT ( 116 , 10 ) ; + Text [ en-US ] = "Full ~width" ; + }; +}; + // ********************************************************************** EOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx new file mode 100644 index 000000000000..82992149715d --- /dev/null +++ b/cui/source/tabpages/tparea.cxx @@ -0,0 +1,2582 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tparea.cxx,v $ + * $Revision: 1.31 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include +#include + +#define _SVX_TPAREA_CXX + +#if defined (UNX) || defined (WTC) || defined (ICC) || defined(WNT) +#include +#endif + +#include "svx/xattr.hxx" +#include +#include +#include "tabarea.hrc" +//#include "dlgname.hrc" +#include +#include +#include +#include +#include "svx/drawitem.hxx" +#include "cuitabarea.hxx" +#include "dlgname.hxx" +#include +#include "svx/dlgutil.hxx" +#include //add CHINA001 +#include //add CHINA001 + +#define DLGWIN this->GetParent()->GetParent() + +// static ---------------------------------------------------------------- + +static USHORT pAreaRanges[] = +{ + XATTR_GRADIENTSTEPCOUNT, + XATTR_GRADIENTSTEPCOUNT, + SID_ATTR_FILL_STYLE, + SID_ATTR_FILL_BITMAP, + 0 +}; + +static USHORT pTransparenceRanges[] = +{ + XATTR_FILLTRANSPARENCE, + XATTR_FILLTRANSPARENCE, + SDRATTR_SHADOWTRANSPARENCE, + SDRATTR_SHADOWTRANSPARENCE, + XATTR_FILLFLOATTRANSPARENCE, + XATTR_FILLFLOATTRANSPARENCE, + 0 +}; + +/************************************************************************* +|* +|* Dialog for transparence +|* +\************************************************************************/ + +IMPL_LINK(SvxTransparenceTabPage, ClickTransOffHdl_Impl, void *, EMPTYARG) +{ + // disable all other controls + ActivateLinear(FALSE); + ActivateGradient(FALSE); + + // Preview + rXFSet.ClearItem (XATTR_FILLTRANSPARENCE); + rXFSet.ClearItem (XATTR_FILLFLOATTRANSPARENCE); + aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); + + InvalidatePreview( FALSE ); + + return( 0L ); +} + +IMPL_LINK(SvxTransparenceTabPage, ClickTransLinearHdl_Impl, void *, EMPTYARG) +{ + // enable linear, disable other + ActivateLinear(TRUE); + ActivateGradient(FALSE); + + // preview + rXFSet.ClearItem (XATTR_FILLFLOATTRANSPARENCE); + ModifyTransparentHdl_Impl (NULL); + + return( 0L ); +} + +IMPL_LINK(SvxTransparenceTabPage, ClickTransGradientHdl_Impl, void *, EMPTYARG) +{ + // enable gradient, disable other + ActivateLinear(FALSE); + ActivateGradient(TRUE); + + // preview + rXFSet.ClearItem (XATTR_FILLTRANSPARENCE); + ModifiedTrgrHdl_Impl (NULL); + + return( 0L ); +} + +void SvxTransparenceTabPage::ActivateLinear(BOOL bActivate) +{ + aMtrTransparent.Enable(bActivate); +} + +IMPL_LINK(SvxTransparenceTabPage, ModifyTransparentHdl_Impl, void*, EMPTYARG) +{ + UINT16 nPos = (UINT16)aMtrTransparent.GetValue(); + XFillTransparenceItem aItem(nPos); + rXFSet.Put(XFillTransparenceItem(aItem)); + + // preview + InvalidatePreview(); + + return 0L; +} + +IMPL_LINK(SvxTransparenceTabPage, ModifiedTrgrHdl_Impl, void *, pControl) +{ + if(pControl == &aLbTrgrGradientType || pControl == this) + { + XGradientStyle eXGS = (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos(); + SetControlState_Impl( eXGS ); + } + + // preview + UINT8 nStartCol = (UINT8)(((UINT16)aMtrTrgrStartValue.GetValue() * 255) / 100); + UINT8 nEndCol = (UINT8)(((UINT16)aMtrTrgrEndValue.GetValue() * 255) / 100); + XGradient aTmpGradient( + Color(nStartCol, nStartCol, nStartCol), + Color(nEndCol, nEndCol, nEndCol), + (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos(), + (UINT16)aMtrTrgrAngle.GetValue() * 10, + (UINT16)aMtrTrgrCenterX.GetValue(), + (UINT16)aMtrTrgrCenterY.GetValue(), + (UINT16)aMtrTrgrBorder.GetValue(), + 100, 100); + + String aString; + XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aTmpGradient); + rXFSet.Put ( aItem ); + + InvalidatePreview(); + + return( 0L ); +} + +void SvxTransparenceTabPage::ActivateGradient(BOOL bActivate) +{ + aFtTrgrType.Enable(bActivate); + aLbTrgrGradientType.Enable(bActivate); + aFtTrgrCenterX.Enable(bActivate); + aMtrTrgrCenterX.Enable(bActivate); + aFtTrgrCenterY.Enable(bActivate); + aMtrTrgrCenterY.Enable(bActivate); + aFtTrgrAngle.Enable(bActivate); + aMtrTrgrAngle.Enable(bActivate); + aFtTrgrBorder.Enable(bActivate); + aMtrTrgrBorder.Enable(bActivate); + aFtTrgrStartValue.Enable(bActivate); + aMtrTrgrStartValue.Enable(bActivate); + aFtTrgrEndValue.Enable(bActivate); + aMtrTrgrEndValue.Enable(bActivate); + + if(bActivate) + { + XGradientStyle eXGS = (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos(); + SetControlState_Impl( eXGS ); + } +} + +IMPL_LINK(SvxTransparenceTabPage, ChangeTrgrTypeHdl_Impl, void *, EMPTYARG) +{ + return( 0L ); +} + +void SvxTransparenceTabPage::SetControlState_Impl(XGradientStyle eXGS) +{ + switch(eXGS) + { + case XGRAD_LINEAR: + case XGRAD_AXIAL: + aFtTrgrCenterX.Disable(); + aMtrTrgrCenterX.Disable(); + aFtTrgrCenterY.Disable(); + aMtrTrgrCenterY.Disable(); + aFtTrgrAngle.Enable(); + aMtrTrgrAngle.Enable(); + break; + + case XGRAD_RADIAL: + aFtTrgrCenterX.Enable(); + aMtrTrgrCenterX.Enable(); + aFtTrgrCenterY.Enable(); + aMtrTrgrCenterY.Enable(); + aFtTrgrAngle.Disable(); + aMtrTrgrAngle.Disable(); + break; + + case XGRAD_ELLIPTICAL: + aFtTrgrCenterX.Enable(); + aMtrTrgrCenterX.Enable(); + aFtTrgrCenterY.Enable(); + aMtrTrgrCenterY.Enable(); + aFtTrgrAngle.Enable(); + aMtrTrgrAngle.Enable(); + break; + + case XGRAD_SQUARE: + case XGRAD_RECT: + aFtTrgrCenterX.Enable(); + aMtrTrgrCenterX.Enable(); + aFtTrgrCenterY.Enable(); + aMtrTrgrCenterY.Enable(); + aFtTrgrAngle.Enable(); + aMtrTrgrAngle.Enable(); + break; + } +} + +SvxTransparenceTabPage::SvxTransparenceTabPage(Window* pParent, const SfxItemSet& rInAttrs) +: SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_TRANSPARENCE ), rInAttrs), + rOutAttrs ( rInAttrs ), + nPageType(0), + nDlgType(0), + + aFlProp ( this, SVX_RES( FL_PROP ) ), + aRbtTransOff ( this, SVX_RES( RBT_TRANS_OFF ) ), + aRbtTransLinear ( this, SVX_RES( RBT_TRANS_LINEAR ) ), + aRbtTransGradient ( this, SVX_RES( RBT_TRANS_GRADIENT ) ), + + aMtrTransparent ( this, SVX_RES( MTR_TRANSPARENT ) ), + + aFtTrgrType ( this, SVX_RES( FT_TRGR_TYPE ) ), + aLbTrgrGradientType ( this, SVX_RES( LB_TRGR_GRADIENT_TYPES ) ), + aFtTrgrCenterX ( this, SVX_RES( FT_TRGR_CENTER_X ) ), + aMtrTrgrCenterX ( this, SVX_RES( MTR_TRGR_CENTER_X ) ), + aFtTrgrCenterY ( this, SVX_RES( FT_TRGR_CENTER_Y ) ), + aMtrTrgrCenterY ( this, SVX_RES( MTR_TRGR_CENTER_Y ) ), + aFtTrgrAngle ( this, SVX_RES( FT_TRGR_ANGLE ) ), + aMtrTrgrAngle ( this, SVX_RES( MTR_TRGR_ANGLE ) ), + aFtTrgrBorder ( this, SVX_RES( FT_TRGR_BORDER ) ), + aMtrTrgrBorder ( this, SVX_RES( MTR_TRGR_BORDER ) ), + aFtTrgrStartValue ( this, SVX_RES( FT_TRGR_START_VALUE ) ), + aMtrTrgrStartValue ( this, SVX_RES( MTR_TRGR_START_VALUE ) ), + aFtTrgrEndValue ( this, SVX_RES( FT_TRGR_END_VALUE ) ), + aMtrTrgrEndValue ( this, SVX_RES( MTR_TRGR_END_VALUE ) ), + + aCtlBitmapPreview ( this, SVX_RES( CTL_BITMAP_PREVIEW ) ), + aCtlXRectPreview ( this, SVX_RES( CTL_TRANS_PREVIEW ) ), + bBitmap ( FALSE ), + pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), + aXFillAttr ( pXPool ), + rXFSet ( aXFillAttr.GetItemSet() ) +{ + FreeResource(); + + // main selection + aRbtTransOff.SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransOffHdl_Impl)); + aRbtTransLinear.SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransLinearHdl_Impl)); + aRbtTransGradient.SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransGradientHdl_Impl)); + + // linear transparency + aMtrTransparent.SetValue( 50 ); + aMtrTransparent.SetModifyHdl(LINK(this, SvxTransparenceTabPage, ModifyTransparentHdl_Impl)); + + // gradient transparency + aMtrTrgrEndValue.SetValue( 100 ); + aMtrTrgrStartValue.SetValue( 0 ); + aLbTrgrGradientType.SetSelectHdl(LINK(this, SvxTransparenceTabPage, ChangeTrgrTypeHdl_Impl)); + Link aLink = LINK( this, SvxTransparenceTabPage, ModifiedTrgrHdl_Impl); + aLbTrgrGradientType.SetSelectHdl( aLink ); + aMtrTrgrCenterX.SetModifyHdl( aLink ); + aMtrTrgrCenterY.SetModifyHdl( aLink ); + aMtrTrgrAngle.SetModifyHdl( aLink ); + aMtrTrgrBorder.SetModifyHdl( aLink ); + aMtrTrgrStartValue.SetModifyHdl( aLink ); + aMtrTrgrEndValue.SetModifyHdl( aLink ); + + // this page needs ExchangeSupport + SetExchangeSupport(); +} + +void SvxTransparenceTabPage::Construct() +{ +} + +SfxTabPage* SvxTransparenceTabPage::Create(Window* pWindow, const SfxItemSet& rAttrs) +{ + return(new SvxTransparenceTabPage(pWindow, rAttrs)); +} + +UINT16* SvxTransparenceTabPage::GetRanges() +{ + return(pTransparenceRanges); +} + +BOOL SvxTransparenceTabPage::FillItemSet(SfxItemSet& rAttrs) +{ + const SfxPoolItem* pGradientItem = NULL; + const SfxPoolItem* pLinearItem = NULL; + SfxItemState eStateGradient(rOutAttrs.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem)); + SfxItemState eStateLinear(rOutAttrs.GetItemState(XATTR_FILLTRANSPARENCE, TRUE, &pLinearItem)); + BOOL bGradActive = (eStateGradient == SFX_ITEM_SET && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled()); + BOOL bLinearActive = (eStateLinear == SFX_ITEM_SET && ((XFillTransparenceItem*)pLinearItem)->GetValue() != 0); + + // #103765# + BOOL bGradUsed = (eStateGradient == SFX_ITEM_DONTCARE); + BOOL bLinearUsed = (eStateLinear == SFX_ITEM_DONTCARE); + + BOOL bModified(FALSE); + BOOL bSwitchOffLinear(FALSE); + BOOL bSwitchOffGradient(FALSE); + + if(aMtrTransparent.IsEnabled()) + { + // linear transparence + UINT16 nPos = (UINT16)aMtrTransparent.GetValue(); + if(nPos != (UINT16)aMtrTransparent.GetSavedValue().ToInt32() || !bLinearActive) + { + XFillTransparenceItem aItem(nPos); + SdrShadowTransparenceItem aShadowItem(nPos); + const SfxPoolItem* pOld = GetOldItem(rAttrs, XATTR_FILLTRANSPARENCE); + if(!pOld || !(*(const XFillTransparenceItem*)pOld == aItem) || !bLinearActive) + { + rAttrs.Put(aItem); + rAttrs.Put(aShadowItem); + bModified = TRUE; + bSwitchOffGradient = TRUE; + } + } + } + else if(aLbTrgrGradientType.IsEnabled()) + { + // transparence gradient, fill ItemSet from values + if(!bGradActive + || (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos() != (XGradientStyle)aLbTrgrGradientType.GetSavedValue() + || (UINT16)aMtrTrgrAngle.GetValue() != (UINT16)aMtrTrgrAngle.GetSavedValue().ToInt32() + || (UINT16)aMtrTrgrCenterX.GetValue() != (UINT16)aMtrTrgrCenterX.GetSavedValue().ToInt32() + || (UINT16)aMtrTrgrCenterY.GetValue() != (UINT16)aMtrTrgrCenterY.GetSavedValue().ToInt32() + || (UINT16)aMtrTrgrBorder.GetValue() != (UINT16)aMtrTrgrBorder.GetSavedValue().ToInt32() + || (UINT16)aMtrTrgrStartValue.GetValue() != (UINT16)aMtrTrgrStartValue.GetSavedValue().ToInt32() + || (UINT16)aMtrTrgrEndValue.GetValue() != (UINT16)aMtrTrgrEndValue.GetSavedValue().ToInt32() ) + { + UINT8 nStartCol = (UINT8)(((UINT16)aMtrTrgrStartValue.GetValue() * 255) / 100); + UINT8 nEndCol = (UINT8)(((UINT16)aMtrTrgrEndValue.GetValue() * 255) / 100); + XGradient aTmpGradient( + Color(nStartCol, nStartCol, nStartCol), + Color(nEndCol, nEndCol, nEndCol), + (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos(), + (UINT16)aMtrTrgrAngle.GetValue() * 10, + (UINT16)aMtrTrgrCenterX.GetValue(), + (UINT16)aMtrTrgrCenterY.GetValue(), + (UINT16)aMtrTrgrBorder.GetValue(), + 100, 100); + + String aString; + XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aTmpGradient); + const SfxPoolItem* pOld = GetOldItem(rAttrs, XATTR_FILLFLOATTRANSPARENCE); + + if(!pOld || !(*(const XFillFloatTransparenceItem*)pOld == aItem) || !bGradActive) + { + rAttrs.Put(aItem); + bModified = TRUE; + bSwitchOffLinear = TRUE; + } + } + } + else + { + // no transparence + bSwitchOffGradient = TRUE; + bSwitchOffLinear = TRUE; + } + + // disable unused XFillFloatTransparenceItem + if(bSwitchOffGradient && (bGradActive || bGradUsed)) + { + Color aColor(COL_BLACK); + XGradient aGrad(aColor, Color(COL_WHITE)); + aGrad.SetStartIntens(100); + aGrad.SetEndIntens(100); + String aString; + XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aGrad); + aItem.SetEnabled(FALSE); + rAttrs.Put(aItem); + bModified = TRUE; + } + + // disable unused XFillFloatTransparenceItem + if(bSwitchOffLinear && (bLinearActive || bLinearUsed)) + { + XFillTransparenceItem aItem(0); + SdrShadowTransparenceItem aShadowItem(0); + rAttrs.Put(aItem); + rAttrs.Put(aShadowItem); + bModified = TRUE; + } + //add CHINA001 begin + rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType)); + //add CHINA001 end + return bModified; +} + +void SvxTransparenceTabPage::Reset(const SfxItemSet& rAttrs) +{ + const SfxPoolItem* pGradientItem = NULL; + SfxItemState eStateGradient(rAttrs.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem)); + if(!pGradientItem) + pGradientItem = &rAttrs.Get(XATTR_FILLFLOATTRANSPARENCE); + BOOL bGradActive = (eStateGradient == SFX_ITEM_SET && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled()); + + const SfxPoolItem* pLinearItem = NULL; + SfxItemState eStateLinear(rAttrs.GetItemState(XATTR_FILLTRANSPARENCE, TRUE, &pLinearItem)); + if(!pLinearItem) + pLinearItem = &rAttrs.Get(XATTR_FILLTRANSPARENCE); + BOOL bLinearActive = (eStateLinear == SFX_ITEM_SET && ((XFillTransparenceItem*)pLinearItem)->GetValue() != 0); + + // transparence gradient + const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue(); + XGradientStyle eXGS(rGradient.GetGradientStyle()); + aLbTrgrGradientType.SelectEntryPos(sal::static_int_cast< USHORT >(eXGS)); + aMtrTrgrAngle.SetValue(rGradient.GetAngle() / 10); + aMtrTrgrBorder.SetValue(rGradient.GetBorder()); + aMtrTrgrCenterX.SetValue(rGradient.GetXOffset()); + aMtrTrgrCenterY.SetValue(rGradient.GetYOffset()); + aMtrTrgrStartValue.SetValue((UINT16)((((UINT16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255)); + aMtrTrgrEndValue.SetValue((UINT16)((((UINT16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255)); + + // linear transparence + UINT16 nTransp = ((XFillTransparenceItem*)pLinearItem)->GetValue(); + aMtrTransparent.SetValue(bLinearActive ? nTransp : 50); + ModifyTransparentHdl_Impl(NULL); + + // select the correct radio button + if(bGradActive) + { + // transparence gradient, set controls appropriate to item + aRbtTransGradient.Check(); + ClickTransGradientHdl_Impl(NULL); + } + else if(bLinearActive) + { + // linear transparence + aRbtTransLinear.Check(); + ClickTransLinearHdl_Impl(NULL); + } + else + { + // no transparence + aRbtTransOff.Check(); + ClickTransOffHdl_Impl(NULL); + ModifiedTrgrHdl_Impl(NULL); + } + + // save values + aMtrTransparent.SaveValue(); + aLbTrgrGradientType.SaveValue(); + aMtrTrgrCenterX.SaveValue(); + aMtrTrgrCenterY.SaveValue(); + aMtrTrgrAngle.SaveValue(); + aMtrTrgrBorder.SaveValue(); + aMtrTrgrStartValue.SaveValue(); + aMtrTrgrEndValue.SaveValue(); + + BOOL bActive = InitPreview ( rAttrs ); + InvalidatePreview ( bActive ); +} + +void SvxTransparenceTabPage::ActivatePage(const SfxItemSet& rSet) +{ + //add CHINA001 Begin + SFX_ITEMSET_ARG (&rSet,pPageTypeItem,CntUInt16Item,SID_PAGE_TYPE,sal_False); + if (pPageTypeItem) + SetPageType(pPageTypeItem->GetValue()); + //add CHINA001 end + //CHINA001 if(*pDlgType == 0) // Flaechen-Dialog + //CHINA001 *pPageType = PT_TRANSPARENCE; + if(nDlgType == 0) //add CHINA001 // Flaechen-Dialog + nPageType = PT_TRANSPARENCE; //add CHINA001 + + InitPreview ( rSet ); +} + +int SvxTransparenceTabPage::DeactivatePage(SfxItemSet* _pSet) +{ + if( _pSet ) + FillItemSet( *_pSet ); + return(LEAVE_PAGE); +} + +void SvxTransparenceTabPage::PointChanged(Window* , RECT_POINT eRcPt) +{ + eRP = eRcPt; +} + +// +// Preview-Methods +// +BOOL SvxTransparenceTabPage::InitPreview ( const SfxItemSet& rSet ) +{ + // set transparencetyp for preview + if ( aRbtTransOff.IsChecked() ) + { + ClickTransOffHdl_Impl(NULL); + } else if ( aRbtTransLinear.IsChecked() ) + { + ClickTransLinearHdl_Impl(NULL); + } else if ( aRbtTransGradient.IsChecked() ) + { + ClickTransGradientHdl_Impl(NULL); + } + + // Get fillstyle for preview + rXFSet.Put ( ( XFillStyleItem& ) rSet.Get(XATTR_FILLSTYLE) ); + rXFSet.Put ( ( XFillColorItem& ) rSet.Get(XATTR_FILLCOLOR) ); + rXFSet.Put ( ( XFillGradientItem& ) rSet.Get(XATTR_FILLGRADIENT) ); + rXFSet.Put ( ( XFillHatchItem& ) rSet.Get(XATTR_FILLHATCH) ); + rXFSet.Put ( ( XFillBackgroundItem&)rSet.Get(XATTR_FILLBACKGROUND) ); + rXFSet.Put ( ( XFillBitmapItem& ) rSet.Get(XATTR_FILLBITMAP) ); + + aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); + + bBitmap = ( ( ( XFillStyleItem& )rSet.Get(XATTR_FILLSTYLE) ).GetValue() == XFILL_BITMAP ); + + // show the right preview window + if ( bBitmap ) + { + aCtlBitmapPreview.Show(); + aCtlXRectPreview.Hide(); + } + else + { + aCtlBitmapPreview.Hide(); + aCtlXRectPreview.Show(); + } + + return !aRbtTransOff.IsChecked(); +} + +void SvxTransparenceTabPage::InvalidatePreview (BOOL bEnable) +{ + if ( bBitmap ) + { + if ( bEnable ) + { + aCtlBitmapPreview.Enable(); + aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); + } + else + aCtlBitmapPreview.Disable(); + aCtlBitmapPreview.Invalidate(); + } + else + { + if ( bEnable ) + { + aCtlXRectPreview.Enable(); + aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); + } + else + aCtlXRectPreview.Disable(); + aCtlXRectPreview.Invalidate(); + } +} + +void SvxTransparenceTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 +{ + SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); + SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False); + + if (pPageTypeItem) + SetPageType(pPageTypeItem->GetValue()); + if (pDlgTypeItem) + SetDlgType(pDlgTypeItem->GetValue()); + Construct(); +} +/************************************************************************* +|* +|* Dialog to modify fill-attributes +|* +\************************************************************************/ + +SvxAreaTabPage::SvxAreaTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : + + SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_AREA ), rInAttrs ), + + aFlProp ( this, SVX_RES( FL_PROP ) ), + aTypeLB ( this, SVX_RES( LB_AREA_TYPE ) ), + + aLbColor ( this, SVX_RES( LB_COLOR ) ), + aLbGradient ( this, SVX_RES( LB_GRADIENT ) ), + aLbHatching ( this, SVX_RES( LB_HATCHING ) ), + aLbBitmap ( this, SVX_RES( LB_BITMAP ) ), + aCtlBitmapPreview ( this, SVX_RES( CTL_BITMAP_PREVIEW ) ), + + aTsbStepCount ( this, SVX_RES( TSB_STEPCOUNT ) ), + aFlStepCount ( this, SVX_RES( FL_STEPCOUNT ) ), + aNumFldStepCount ( this, SVX_RES( NUM_FLD_STEPCOUNT ) ), + + aCbxHatchBckgrd ( this, SVX_RES( CB_HATCHBCKGRD ) ), + aLbHatchBckgrdColor ( this, SVX_RES( LB_HATCHBCKGRDCOLOR ) ), + + aFlSize ( this, SVX_RES( FL_SIZE ) ), + aTsbOriginal ( this, SVX_RES( TSB_ORIGINAL ) ), + aTsbScale ( this, SVX_RES( TSB_SCALE ) ), + aFtXSize ( this, SVX_RES( FT_X_SIZE ) ), + aMtrFldXSize ( this, SVX_RES( MTR_FLD_X_SIZE ) ), + aFtYSize ( this, SVX_RES( FT_Y_SIZE ) ), + aMtrFldYSize ( this, SVX_RES( MTR_FLD_Y_SIZE ) ), + aFlPosition ( this, SVX_RES( FL_POSITION ) ), + aCtlPosition ( this, SVX_RES( CTL_POSITION ), RP_RM, 110, 80, CS_RECT ), + aFtXOffset ( this, SVX_RES( FT_X_OFFSET ) ), + aMtrFldXOffset ( this, SVX_RES( MTR_FLD_X_OFFSET ) ), + aFtYOffset ( this, SVX_RES( FT_Y_OFFSET ) ), + aMtrFldYOffset ( this, SVX_RES( MTR_FLD_Y_OFFSET ) ), + aTsbTile ( this, SVX_RES( TSB_TILE ) ), + aTsbStretch ( this, SVX_RES( TSB_STRETCH ) ), + aFlOffset ( this, SVX_RES( FL_OFFSET ) ), + aRbtRow ( this, SVX_RES( RBT_ROW ) ), + aRbtColumn ( this, SVX_RES( RBT_COLUMN ) ), + aMtrFldOffset ( this, SVX_RES( MTR_FLD_OFFSET ) ), + + aCtlXRectPreview ( this, SVX_RES( CTL_COLOR_PREVIEW ) ), + + rOutAttrs ( rInAttrs ), + + pColorTab( NULL ), + pGradientList( NULL ), + pHatchingList( NULL ), + pBitmapList( NULL ), + + pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), + aXFillAttr ( pXPool ), + rXFSet ( aXFillAttr.GetItemSet() ) +{ + FreeResource(); + + // Gruppen, die sich ueberlagern + aLbBitmap.Hide(); + aCtlBitmapPreview.Hide(); + + aFlStepCount.Hide(); + aTsbStepCount.Hide(); + aNumFldStepCount.Hide(); + + aTsbTile.Hide(); + aTsbStretch.Hide(); + aTsbScale.Hide(); + aTsbOriginal.Hide(); + aFtXSize.Hide(); + aMtrFldXSize.Hide(); + aFtYSize.Hide(); + aMtrFldYSize.Hide(); + aFlSize.Hide(); + aRbtRow.Hide(); + aRbtColumn.Hide(); + aMtrFldOffset.Hide(); + aFlOffset.Hide(); + aCtlPosition.Hide(); + aFtXOffset.Hide(); + aMtrFldXOffset.Hide(); + aFtYOffset.Hide(); + aMtrFldYOffset.Hide(); + aFlPosition.Hide(); + // Controls for Hatch-Background + aCbxHatchBckgrd.Hide(); + aLbHatchBckgrdColor.Hide(); + + + aTsbOriginal.EnableTriState( FALSE ); + + + // this page needs ExchangeSupport + SetExchangeSupport(); + + // set Metrics + eFUnit = GetModuleFieldUnit( &rInAttrs ); + + switch ( eFUnit ) + { + case FUNIT_M: + case FUNIT_KM: + eFUnit = FUNIT_MM; + break; + default: ;//prevent warning + } + SetFieldUnit( aMtrFldXSize, eFUnit, TRUE ); + SetFieldUnit( aMtrFldYSize, eFUnit, TRUE ); + + // get PoolUnit + SfxItemPool* pPool = rOutAttrs.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool?" ); + ePoolUnit = pPool->GetMetric( XATTR_FILLBMP_SIZEX ); + + // Setzen Output-Devices + rXFSet.Put( XFillStyleItem( XFILL_SOLID ) ); + rXFSet.Put( XFillColorItem( String(), COL_BLACK ) ); + aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); + + aLbColor.SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyColorHdl_Impl ) ); + aLbHatchBckgrdColor.SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyHatchBckgrdColorHdl_Impl ) ); + aCbxHatchBckgrd.SetToggleHdl( LINK( this, SvxAreaTabPage, ToggleHatchBckgrdColorHdl_Impl ) ); + + aLbGradient.SetSelectHdl( + LINK( this, SvxAreaTabPage, ModifyGradientHdl_Impl ) ); + aLbHatching.SetSelectHdl( + LINK( this, SvxAreaTabPage, ModifyHatchingHdl_Impl ) ); + aLbBitmap.SetSelectHdl( + LINK( this, SvxAreaTabPage, ModifyBitmapHdl_Impl ) ); + + aTsbStepCount.SetClickHdl( + LINK( this, SvxAreaTabPage, ModifyStepCountHdl_Impl ) ); + aNumFldStepCount.SetModifyHdl( + LINK( this, SvxAreaTabPage, ModifyStepCountHdl_Impl ) ); + + Link aLink( LINK( this, SvxAreaTabPage, ModifyTileHdl_Impl ) ); + aTsbTile.SetClickHdl( aLink ); + aTsbStretch.SetClickHdl( aLink ); + aTsbOriginal.SetClickHdl( aLink ); + aMtrFldXSize.SetModifyHdl( aLink ); + aMtrFldYSize.SetModifyHdl( aLink ); + aRbtRow.SetClickHdl( aLink ); + aRbtColumn.SetClickHdl( aLink ); + aMtrFldOffset.SetModifyHdl( aLink ); + aMtrFldXOffset.SetModifyHdl( aLink ); + aMtrFldYOffset.SetModifyHdl( aLink ); + aTsbScale.SetClickHdl( LINK( this, SvxAreaTabPage, ClickScaleHdl_Impl ) ); + + aTypeLB.SetSelectHdl( LINK( this, SvxAreaTabPage, SelectDialogTypeHdl_Impl ) ); + + // #i76307# always paint the preview in LTR, because this is what the document does + aCtlXRectPreview.EnableRTL(FALSE); +} + +// ----------------------------------------------------------------------- + +void SvxAreaTabPage::Construct() +{ + // fill colortables / lists + aLbColor.Fill( pColorTab ); + aLbHatchBckgrdColor.Fill ( pColorTab ); + + aLbGradient.Fill( pGradientList ); + aLbHatching.Fill( pHatchingList ); + aLbBitmap.Fill( pBitmapList ); +} + +// ----------------------------------------------------------------------- + +void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) +{ + USHORT _nPos = 0; + USHORT nCount; + //add CHINA001 Begin + SFX_ITEMSET_ARG (&rSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); + SFX_ITEMSET_ARG (&rSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,sal_False); + if (pPageTypeItem) + SetPageType(pPageTypeItem->GetValue()); + if (pPosItem) + SetPos(pPosItem->GetValue()); + //add CHINA001 end + if( nDlgType == 0 )//CHINA001 if( *pDlgType == 0 ) // Flaechen-Dialog + { + *pbAreaTP = TRUE; + + if( pColorTab ) + { + // Bitmapliste + if( *pnBitmapListState ) + { + if( *pnBitmapListState & CT_CHANGED ) + pBitmapList = ( (SvxAreaTabDialog*) DLGWIN )-> + GetNewBitmapList(); + + _nPos = aLbBitmap.GetSelectEntryPos(); + + aLbBitmap.Clear(); + aLbBitmap.Fill( pBitmapList ); + nCount = aLbBitmap.GetEntryCount(); + if( nCount == 0 ) + ; // This case should never occur + else if( nCount <= _nPos ) + aLbBitmap.SelectEntryPos( 0 ); + else + aLbBitmap.SelectEntryPos( _nPos ); + ModifyBitmapHdl_Impl( this ); + } + // hatch-liste + if( *pnHatchingListState ) + { + if( *pnHatchingListState & CT_CHANGED ) + pHatchingList = ( (SvxAreaTabDialog*) DLGWIN )-> + GetNewHatchingList(); + + _nPos = aLbHatching.GetSelectEntryPos(); + + aLbHatching.Clear(); + aLbHatching.Fill( pHatchingList ); + nCount = aLbHatching.GetEntryCount(); + if( nCount == 0 ) + ; // This case should never occur + else if( nCount <= _nPos ) + aLbHatching.SelectEntryPos( 0 ); + else + aLbHatching.SelectEntryPos( _nPos ); + ModifyHatchingHdl_Impl( this ); + + ModifyHatchBckgrdColorHdl_Impl( this ); + } + // gradient-liste + if( *pnGradientListState ) + { + if( *pnGradientListState & CT_CHANGED ) + pGradientList = ( (SvxAreaTabDialog*) DLGWIN )-> + GetNewGradientList(); + + _nPos = aLbGradient.GetSelectEntryPos(); + + aLbGradient.Clear(); + aLbGradient.Fill( pGradientList ); + nCount = aLbGradient.GetEntryCount(); + if( nCount == 0 ) + ; // This case should never occur + else if( nCount <= _nPos ) + aLbGradient.SelectEntryPos( 0 ); + else + aLbGradient.SelectEntryPos( _nPos ); + ModifyGradientHdl_Impl( this ); + } + // ColorTable + if( *pnColorTableState ) + { + if( *pnColorTableState & CT_CHANGED ) + pColorTab = ( (SvxAreaTabDialog*) DLGWIN )-> + GetNewColorTable(); + // aLbColor + _nPos = aLbColor.GetSelectEntryPos(); + aLbColor.Clear(); + aLbColor.Fill( pColorTab ); + nCount = aLbColor.GetEntryCount(); + if( nCount == 0 ) + ; // This case should never occur + else if( nCount <= _nPos ) + aLbColor.SelectEntryPos( 0 ); + else + aLbColor.SelectEntryPos( _nPos ); + + ModifyColorHdl_Impl( this ); + + // Backgroundcolor of hatch + _nPos = aLbHatchBckgrdColor.GetSelectEntryPos(); + aLbHatchBckgrdColor.Clear(); + aLbHatchBckgrdColor.Fill( pColorTab ); + nCount = aLbHatchBckgrdColor.GetEntryCount(); + if( nCount == 0 ) + ; // This case should never occur + else if( nCount <= _nPos ) + aLbHatchBckgrdColor.SelectEntryPos( 0 ); + else + aLbHatchBckgrdColor.SelectEntryPos( _nPos ); + + ModifyHatchBckgrdColorHdl_Impl( this ); + } + + // evaluate if any other Tabpage set another filltype + if( aTypeLB.GetSelectEntryPos() > XFILL_NONE) + { + switch( nPageType )//CHINA001 switch( *pPageType ) + { + case PT_GRADIENT: + aTypeLB.SelectEntryPos( XFILL_GRADIENT ); + aLbGradient.SelectEntryPos( _nPos );//CHINA001 aLbGradient.SelectEntryPos( *pPos ); + ClickGradientHdl_Impl( this ); + break; + + case PT_HATCH: + aTypeLB.SelectEntryPos( XFILL_HATCH ); + aLbHatching.SelectEntryPos( _nPos );//CHINA001 aLbHatching.SelectEntryPos( *pPos ); + ClickHatchingHdl_Impl( this ); + break; + + case PT_BITMAP: + aTypeLB.SelectEntryPos( XFILL_BITMAP ); + aLbBitmap.SelectEntryPos( _nPos );//CHINA001 aLbBitmap.SelectEntryPos( *pPos ); + ClickBitmapHdl_Impl( this ); + break; + + case PT_COLOR: + aTypeLB.SelectEntryPos( XFILL_SOLID ); + aLbColor.SelectEntryPos( _nPos );//CHINA001 aLbColor.SelectEntryPos( *pPos ); + aLbHatchBckgrdColor.SelectEntryPos( _nPos ); //CHINA001 aLbHatchBckgrdColor.SelectEntryPos( *pPos ); + ClickColorHdl_Impl( this ); + break; + } + } + nPageType = PT_AREA;//CHINA001 *pPageType = PT_AREA; + } + } +} + +// ----------------------------------------------------------------------- + +int SvxAreaTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if( nDlgType == 0 ) // Flaechen-Dialog//CHINA001 if( *pDlgType == 0 ) // Flaechen-Dialog + { + XFillStyle eStyle = (XFillStyle) aTypeLB.GetSelectEntryPos(); + switch( eStyle ) + { + case XFILL_GRADIENT: + { + nPageType = PT_GRADIENT;//CHINA001 *pPageType = PT_GRADIENT; + nPos = aLbGradient.GetSelectEntryPos();//CHINA001 *pPos = aLbGradient.GetSelectEntryPos(); + } + break; + case XFILL_HATCH: + { + nPageType = PT_HATCH;//CHINA001 *pPageType = PT_HATCH; + nPos = aLbHatching.GetSelectEntryPos();//CHINA001 *pPos = aLbHatching.GetSelectEntryPos(); + } + break; + case XFILL_BITMAP: + { + nPageType = PT_BITMAP;//CHINA001 *pPageType = PT_BITMAP; + nPos = aLbBitmap.GetSelectEntryPos();//CHINA001 *pPos = aLbBitmap.GetSelectEntryPos(); + } + break; + case XFILL_SOLID: + { + nPageType = PT_COLOR;//CHINA001 *pPageType = PT_COLOR; + nPos = aLbColor.GetSelectEntryPos();//CHINA001 *pPos = aLbColor.GetSelectEntryPos(); + } + break; + default: ;//prevent warning + } + } + + if( _pSet ) + FillItemSet( *_pSet ); + + return( LEAVE_PAGE ); +} + +// ----------------------------------------------------------------------- + +BOOL SvxAreaTabPage::FillItemSet( SfxItemSet& rAttrs ) +{ + const SfxPoolItem* pOld = NULL; + USHORT _nPos; + BOOL bModified = FALSE; + + if( nDlgType != 0 || *pbAreaTP )//CHINA001 if( *pDlgType != 0 || *pbAreaTP ) + { + XFillStyle eStyle = (XFillStyle) aTypeLB.GetSelectEntryPos(); + XFillStyle eSavedStyle = (XFillStyle) aTypeLB.GetSavedValue(); + switch( eStyle ) + { + case XFILL_NONE: + { + if( eSavedStyle != eStyle ) + { + XFillStyleItem aStyleItem( XFILL_NONE ); + pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE ); + if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) ) + { + rAttrs.Put( aStyleItem ); + bModified = TRUE; + } + } + } + break; + case XFILL_SOLID: + { + _nPos = aLbColor.GetSelectEntryPos(); + if( _nPos != LISTBOX_ENTRY_NOTFOUND && + _nPos != aLbColor.GetSavedValue() ) + { + XFillColorItem aItem( aLbColor.GetSelectEntry(), + aLbColor.GetSelectEntryColor() ); + pOld = GetOldItem( rAttrs, XATTR_FILLCOLOR ); + if ( !pOld || !( *(const XFillColorItem*)pOld == aItem ) ) + { + rAttrs.Put( aItem ); + bModified = TRUE; + } + } + // NEU + if( (eSavedStyle != eStyle) && + ( bModified || + SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), TRUE ) ) ) + { + XFillStyleItem aStyleItem( XFILL_SOLID ); + pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE ); + if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) ) + { + rAttrs.Put( aStyleItem ); + bModified = TRUE; + } + } + } + break; + case XFILL_GRADIENT: + { + _nPos = aLbGradient.GetSelectEntryPos(); + if( _nPos != LISTBOX_ENTRY_NOTFOUND && + _nPos != aLbGradient.GetSavedValue() ) + { + XGradient aGradient = pGradientList->GetGradient( _nPos )->GetGradient(); + String aString = aLbGradient.GetSelectEntry(); + XFillGradientItem aItem( aString, aGradient ); + pOld = GetOldItem( rAttrs, XATTR_FILLGRADIENT ); + if ( !pOld || !( *(const XFillGradientItem*)pOld == aItem ) ) + { + rAttrs.Put( aItem ); + bModified = TRUE; + } + } + // NEU + if( (eSavedStyle != eStyle) && + ( bModified || + SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), TRUE ) ) ) + { + XFillStyleItem aStyleItem( XFILL_GRADIENT ); + pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE ); + if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) ) + { + rAttrs.Put( aStyleItem ); + bModified = TRUE; + } + } + } + break; + case XFILL_HATCH: + { + _nPos = aLbHatching.GetSelectEntryPos(); + if( _nPos != LISTBOX_ENTRY_NOTFOUND && + _nPos != aLbHatching.GetSavedValue() ) + { + XHatch aHatching = pHatchingList->GetHatch( _nPos )->GetHatch(); + String aString = aLbHatching.GetSelectEntry(); + XFillHatchItem aItem( aString, aHatching ); + pOld = GetOldItem( rAttrs, XATTR_FILLHATCH ); + if ( !pOld || !( *(const XFillHatchItem*)pOld == aItem ) ) + { + rAttrs.Put( aItem ); + bModified = TRUE; + } + } + XFillBackgroundItem aItem ( aCbxHatchBckgrd.IsChecked() ); + rAttrs.Put( aItem ); + nPos = aLbHatchBckgrdColor.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND && + nPos != aLbHatchBckgrdColor.GetSavedValue() ) + { + XFillColorItem aFillColorItem( aLbHatchBckgrdColor.GetSelectEntry(), + aLbHatchBckgrdColor.GetSelectEntryColor() ); + pOld = GetOldItem( rAttrs, XATTR_FILLCOLOR ); + if ( !pOld || !( *(const XFillColorItem*)pOld == aFillColorItem ) ) + { + rAttrs.Put( aFillColorItem ); + bModified = TRUE; + } + } + // NEU + if( (eSavedStyle != eStyle) && + ( bModified || + SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), TRUE ) ) ) + { + XFillStyleItem aStyleItem( XFILL_HATCH ); + pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE ); + if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) ) + { + rAttrs.Put( aStyleItem ); + bModified = TRUE; + } + } + } + break; + case XFILL_BITMAP: + { + nPos = aLbBitmap.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND && + nPos != aLbBitmap.GetSavedValue() ) + { + XOBitmap aXOBitmap = pBitmapList->GetBitmap( nPos )->GetXBitmap(); + String aString = aLbBitmap.GetSelectEntry(); + XFillBitmapItem aFillBitmapItem( aString, aXOBitmap ); + pOld = GetOldItem( rAttrs, XATTR_FILLBITMAP ); + if ( !pOld || !( *(const XFillBitmapItem*)pOld == aFillBitmapItem ) ) + { + rAttrs.Put( aFillBitmapItem ); + bModified = TRUE; + } + } + // NEU + if( (eSavedStyle != eStyle) && + ( bModified || + SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), TRUE ) ) ) + { + XFillStyleItem aStyleItem( XFILL_BITMAP ); + pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE ); + if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) ) + { + rAttrs.Put( aStyleItem ); + bModified = TRUE; + } + } + } + break; + } + + // Schrittweite + if( aTsbStepCount.IsEnabled() ) + { + UINT16 nValue = 0; + BOOL bValueModified = FALSE; + TriState eState = aTsbStepCount.GetState(); + if( eState == STATE_CHECK ) + { + if( eState != aTsbStepCount.GetSavedValue() ) + bValueModified = TRUE; + } + else + { + // Zustand != Disabled ? + if( aNumFldStepCount.GetText().Len() > 0 ) + { + nValue = (UINT16) aNumFldStepCount.GetValue(); + if( nValue != (UINT16) aNumFldStepCount.GetSavedValue().ToInt32() ) + bValueModified = TRUE; + } + } + if( bValueModified ) + { + XGradientStepCountItem aFillBitmapItem( nValue ); + pOld = GetOldItem( rAttrs, XATTR_GRADIENTSTEPCOUNT ); + if ( !pOld || !( *(const XGradientStepCountItem*)pOld == aFillBitmapItem ) ) + { + rAttrs.Put( aFillBitmapItem ); + bModified = TRUE; + } + } + } + + // Kacheln + if( aTsbTile.IsEnabled() ) + { + TriState eState = aTsbTile.GetState(); + if( eState != aTsbTile.GetSavedValue() ) + { + XFillBmpTileItem aFillBmpTileItem( + sal::static_int_cast< BOOL >( eState ) ); + pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILE ); + if ( !pOld || !( *(const XFillBmpTileItem*)pOld == aFillBmpTileItem ) ) + { + rAttrs.Put( aFillBmpTileItem ); + bModified = TRUE; + } + } + } + // Stretchen + if( aTsbStretch.IsEnabled() ) + { + TriState eState = aTsbStretch.GetState(); + if( eState != aTsbStretch.GetSavedValue() ) + { + XFillBmpStretchItem aFillBmpStretchItem( + sal::static_int_cast< BOOL >( eState ) ); + pOld = GetOldItem( rAttrs, XATTR_FILLBMP_STRETCH ); + if ( !pOld || !( *(const XFillBmpStretchItem*)pOld == aFillBmpStretchItem ) ) + { + rAttrs.Put( aFillBmpStretchItem ); + bModified = TRUE; + } + } + } + + // Originalgroesse (im UI) wird wie folgt benutzt: + // Controls sind disabled, muessen aber gesetzt werden. + // SizeX = 0; SizeY = 0; Log = TRUE + + //aTsbScale + TriState eState = aTsbScale.GetState(); + if( eState != aTsbScale.GetSavedValue() || + ( !aTsbScale.IsEnabled() && + aTsbOriginal.IsEnabled() && + aTsbScale.GetSavedValue() != STATE_CHECK ) ) + { + XFillBmpSizeLogItem* pItem = NULL; + if( aTsbScale.IsEnabled() ) + pItem = new XFillBmpSizeLogItem( eState == STATE_NOCHECK ); + else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK ) + pItem = new XFillBmpSizeLogItem( TRUE ); + + if( pItem ) + { + pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZELOG ); + if ( !pOld || !( *(const XFillBmpSizeLogItem*)pOld == *pItem ) ) + { + rAttrs.Put( *pItem ); + bModified = TRUE; + } + delete pItem; + } + } + + //aMtrFldXSize + String aStr = aMtrFldXSize.GetText(); + { + XFillBmpSizeXItem* pItem = NULL; + TriState eScaleState = aTsbScale.GetState(); + + if( aMtrFldXSize.IsEnabled() && + aStr.Len() > 0 && + aStr != aMtrFldXSize.GetSavedValue() ) + { + if( eScaleState == STATE_NOCHECK ) + pItem = new XFillBmpSizeXItem( GetCoreValue( aMtrFldXSize, ePoolUnit ) ); + else + { + // Prozentwerte werden negativ gesetzt, damit + // diese nicht skaliert werden; dieses wird + // im Item beruecksichtigt ( KA05.11.96 ) + pItem = new XFillBmpSizeXItem( -labs( static_cast(aMtrFldXSize.GetValue()) ) ); + } + } + else if( aTsbOriginal.IsEnabled() && + aTsbOriginal.GetState() == STATE_CHECK && + aMtrFldXSize.GetSavedValue().Len() > 0 ) + pItem = new XFillBmpSizeXItem( 0 ); + + if( pItem ) + { + pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZEX ); + if ( !pOld || !( *(const XFillBmpSizeXItem*)pOld == *pItem ) ) + { + rAttrs.Put( *pItem ); + bModified = TRUE; + } + delete pItem; + } + } + + //aMtrFldYSize + aStr = aMtrFldYSize.GetText(); + { + XFillBmpSizeYItem* pItem = NULL; + TriState eScaleState = aTsbScale.GetState(); + + if( aMtrFldYSize.IsEnabled() && + aStr.Len() > 0 && + aStr != aMtrFldYSize.GetSavedValue() ) + { + if( eScaleState == STATE_NOCHECK ) + pItem = new XFillBmpSizeYItem( GetCoreValue( aMtrFldYSize, ePoolUnit ) ); + else + { + // Prozentwerte werden negativ gesetzt, damit + // diese vom MetricItem nicht skaliert werden; + // dieses wird im Item beruecksichtigt ( KA05.11.96 ) + pItem = new XFillBmpSizeYItem( -labs( static_cast(aMtrFldYSize.GetValue()) ) ); + } + } + else if( aTsbOriginal.IsEnabled() && + aTsbOriginal.GetState() == STATE_CHECK && + aMtrFldYSize.GetSavedValue().Len() > 0 ) + pItem = new XFillBmpSizeYItem( 0 ); + + if( pItem ) + { + pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZEY ); + if ( !pOld || !( *(const XFillBmpSizeYItem*)pOld == *pItem ) ) + { + rAttrs.Put( *pItem ); + bModified = TRUE; + } + delete pItem; + } + } + + //aRbtRow + //aRbtColumn + //aMtrFldOffset + if( aMtrFldOffset.IsEnabled() ) + { + String aMtrString = aMtrFldOffset.GetText(); + if( ( aMtrString.Len() > 0 && + aMtrString != aMtrFldOffset.GetSavedValue() ) || + aRbtRow.GetSavedValue() != aRbtRow.IsChecked() || + aRbtColumn.GetSavedValue() != aRbtColumn.IsChecked() ) + { + if( aRbtRow.IsChecked() ) + { + XFillBmpTileOffsetXItem aFillBmpTileOffsetXItem( (UINT16) aMtrFldOffset.GetValue() ); + pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILEOFFSETX ); + if ( !pOld || !( *(const XFillBmpTileOffsetXItem*)pOld == aFillBmpTileOffsetXItem ) ) + { + rAttrs.Put( aFillBmpTileOffsetXItem ); + rAttrs.Put( XFillBmpTileOffsetYItem( 0 ) ); + bModified = TRUE; + } + } + else if( aRbtColumn.IsChecked() ) + { + XFillBmpTileOffsetYItem aFillBmpTileOffsetYItem( (UINT16) aMtrFldOffset.GetValue() ); + pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILEOFFSETY ); + if ( !pOld || !( *(const XFillBmpTileOffsetYItem*)pOld == aFillBmpTileOffsetYItem ) ) + { + rAttrs.Put( aFillBmpTileOffsetYItem ); + rAttrs.Put( XFillBmpTileOffsetXItem( 0 ) ); + bModified = TRUE; + } + } + } + } + + //aCtlPosition + if( aCtlPosition.IsEnabled() ) + { + BOOL bPut = FALSE; + RECT_POINT _eRP = aCtlPosition.GetActualRP(); + + if( SFX_ITEM_DONTCARE == rOutAttrs.GetItemState( XATTR_FILLBMP_POS ) ) + bPut = TRUE; + else + { + RECT_POINT eValue = ( ( const XFillBmpPosItem& ) rOutAttrs.Get( XATTR_FILLBMP_POS ) ).GetValue(); + if( eValue != _eRP ) + bPut = TRUE; + } + if( bPut ) + { + XFillBmpPosItem aFillBmpPosItem( _eRP ); + pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POS ); + if ( !pOld || !( *(const XFillBmpPosItem*)pOld == aFillBmpPosItem ) ) + { + rAttrs.Put( aFillBmpPosItem ); + bModified = TRUE; + } + } + } + + //aMtrFldXOffset + if( aMtrFldXOffset.IsEnabled() ) + { + String sMtrXOffset = aMtrFldXOffset.GetText(); + if( sMtrXOffset.Len() > 0 && + sMtrXOffset != aMtrFldXOffset.GetSavedValue() ) + { + XFillBmpPosOffsetXItem aFillBmpPosOffsetXItem( (UINT16) aMtrFldXOffset.GetValue() ); + pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POSOFFSETX ); + if ( !pOld || !( *(const XFillBmpPosOffsetXItem*)pOld == aFillBmpPosOffsetXItem ) ) + { + rAttrs.Put( aFillBmpPosOffsetXItem ); + bModified = TRUE; + } + } + } + + //aMtrFldYOffset + if( aMtrFldYOffset.IsEnabled() ) + { + String sMtrYOffset = aMtrFldYOffset.GetText(); + if( sMtrYOffset.Len() > 0 && + sMtrYOffset != aMtrFldYOffset.GetSavedValue() ) + { + XFillBmpPosOffsetYItem aFillBmpPosOffsetYItem( (UINT16) aMtrFldYOffset.GetValue() ); + pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POSOFFSETY ); + if ( !pOld || !( *(const XFillBmpPosOffsetYItem*)pOld == aFillBmpPosOffsetYItem ) ) + { + rAttrs.Put( aFillBmpPosOffsetYItem ); + bModified = TRUE; + } + } + } + //add CHINA001 begin + rAttrs.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType)); + rAttrs.Put (SfxUInt16Item(SID_TABPAGE_POS,nPos)); + //add CHINA001 end + } + + return( bModified ); +} + +// ----------------------------------------------------------------------- + +void SvxAreaTabPage::Reset( const SfxItemSet& rAttrs ) +{ + //const SfxPoolItem *pPoolItem = NULL; + + XFillStyle eXFS; + if( rAttrs.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DONTCARE ) + { + eXFS = (XFillStyle) ( ( ( const XFillStyleItem& ) rAttrs. + Get( GetWhich( XATTR_FILLSTYLE ) ) ).GetValue() ); + aTypeLB.SelectEntryPos( sal::static_int_cast< USHORT >( eXFS ) ); + switch( eXFS ) + { + case XFILL_NONE: + ClickInvisibleHdl_Impl( this ); + break; + + case XFILL_SOLID: + //if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), TRUE, &pPoolItem ) ) + if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLCOLOR ) ) + { + XFillColorItem aColorItem( ( const XFillColorItem& ) + rAttrs.Get( XATTR_FILLCOLOR ) ); + + aLbColor.SelectEntry( aColorItem.GetColorValue() ); + aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() ); + } + ClickColorHdl_Impl( this ); + + break; + + case XFILL_GRADIENT: + //if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), TRUE, &pPoolItem ) ) + if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLGRADIENT ) ) + { + XFillGradientItem aGradientItem( ( ( const XFillGradientItem& ) + rAttrs.Get( XATTR_FILLGRADIENT ) ) ); + String aString( aGradientItem.GetName() ); + XGradient aGradient( aGradientItem.GetGradientValue() ); + + aLbGradient.SelectEntryByList( pGradientList, aString, aGradient ); + } + ClickGradientHdl_Impl( this ); + break; + + case XFILL_HATCH: + //if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), TRUE, &pPoolItem ) ) + if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLHATCH ) ) + { + aLbHatching.SelectEntry( ( ( const XFillHatchItem& ) + rAttrs.Get( XATTR_FILLHATCH ) ).GetName() ); + } + ClickHatchingHdl_Impl( this ); + + if ( SFX_ITEM_DONTCARE != rAttrs.GetItemState ( XATTR_FILLBACKGROUND ) ) + { + aCbxHatchBckgrd.Check ( ( ( const XFillBackgroundItem& ) rAttrs.Get ( XATTR_FILLBACKGROUND ) ).GetValue() ); + } + ToggleHatchBckgrdColorHdl_Impl( this ); + if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLCOLOR ) ) + { + XFillColorItem aColorItem( ( const XFillColorItem& ) + rAttrs.Get( XATTR_FILLCOLOR ) ); + + aLbColor.SelectEntry( aColorItem.GetColorValue() ); + aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() ); + } + break; + + case XFILL_BITMAP: + { + if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLBITMAP ) ) + { + XFillBitmapItem aBitmapItem( ( const XFillBitmapItem& ) + rAttrs.Get( XATTR_FILLBITMAP ) ); + + String aString( aBitmapItem.GetName() ); + aLbBitmap.SelectEntry( aString ); + } + ClickBitmapHdl_Impl( this ); + } + break; + + default: + //aLbColor.SelectEntryPos(0); + //aRbtColor.Check(); + break; + } + } + else + { + // Alle LBs nicht zug"anglich machen + aLbColor.Hide(); + aLbGradient.Hide(); + aLbHatching.Hide(); + aLbBitmap.Hide(); + aCtlBitmapPreview.Hide(); + aLbColor.Disable(); + aLbColor.Show(); + + // Damit Reset() auch mit Zurueck richtig funktioniert + aTypeLB.SetNoSelection(); + } + + // Schrittweite + if( ( rAttrs.GetItemState( XATTR_GRADIENTSTEPCOUNT ) != SFX_ITEM_DONTCARE ) || + ( rAttrs.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DONTCARE ) ) + { + aTsbStepCount.EnableTriState( FALSE ); + UINT16 nValue = ( ( const XGradientStepCountItem& ) rAttrs.Get( XATTR_GRADIENTSTEPCOUNT ) ).GetValue(); + if( nValue == 0 ) + { + aTsbStepCount.SetState( STATE_CHECK ); + aNumFldStepCount.SetText( String() ); + } + else + { + aTsbStepCount.SetState( STATE_NOCHECK ); + aNumFldStepCount.SetValue( nValue ); + } + ModifyStepCountHdl_Impl( &aTsbStepCount ); + } + else + { + aTsbStepCount.SetState( STATE_DONTKNOW ); + aNumFldStepCount.SetText( String() ); + } + + // Attribute fuer die Bitmap-Fuellung + + // Ist Kacheln gesetzt? + if( rAttrs.GetItemState( XATTR_FILLBMP_TILE ) != SFX_ITEM_DONTCARE ) + { + aTsbTile.EnableTriState( FALSE ); + + if( ( ( const XFillBmpTileItem& ) rAttrs.Get( XATTR_FILLBMP_TILE ) ).GetValue() ) + aTsbTile.SetState( STATE_CHECK ); + else + aTsbTile.SetState( STATE_NOCHECK ); + } + else + aTsbTile.SetState( STATE_DONTKNOW ); + + // Ist Stretchen gesetzt? + if( rAttrs.GetItemState( XATTR_FILLBMP_STRETCH ) != SFX_ITEM_DONTCARE ) + { + aTsbStretch.EnableTriState( FALSE ); + + if( ( ( const XFillBmpStretchItem& ) rAttrs.Get( XATTR_FILLBMP_STRETCH ) ).GetValue() ) + aTsbStretch.SetState( STATE_CHECK ); + else + aTsbStretch.SetState( STATE_NOCHECK ); + } + else + aTsbStretch.SetState( STATE_DONTKNOW ); + + + //aTsbScale + if( rAttrs.GetItemState( XATTR_FILLBMP_SIZELOG ) != SFX_ITEM_DONTCARE ) + { + aTsbScale.EnableTriState( FALSE ); + + if( ( ( const XFillBmpSizeLogItem& ) rAttrs.Get( XATTR_FILLBMP_SIZELOG ) ).GetValue() ) + aTsbScale.SetState( STATE_NOCHECK ); + else + aTsbScale.SetState( STATE_CHECK ); + + ClickScaleHdl_Impl( NULL ); + } + else + aTsbScale.SetState( STATE_DONTKNOW ); + + + // Status fuer Originalgroesse ermitteln + TriState eOriginal = STATE_NOCHECK; + + //aMtrFldXSize + if( rAttrs.GetItemState( XATTR_FILLBMP_SIZEX ) != SFX_ITEM_DONTCARE ) + { + INT32 nValue = ( ( const XFillBmpSizeXItem& ) rAttrs.Get( XATTR_FILLBMP_SIZEX ) ).GetValue(); + if( aTsbScale.GetState() == STATE_CHECK ) + { + // Wenn im Item eine Prozentangabe steckt, + // so ist diese wegen des MetricItems negativ + aMtrFldXSize.SetValue( labs( nValue ) ); + } + else + SetMetricValue( aMtrFldXSize, nValue, ePoolUnit ); + aMtrFldXSize.SaveValue(); + + if( nValue == 0 ) + { + eOriginal = STATE_CHECK; + // Wert ist beim Ausschalten von Originalgroesse sonst zu klein + // (Performance-Problem) + aMtrFldXSize.SetValue( 100 ); + } + } + else + { + aMtrFldXSize.SetText( String() ); + aMtrFldXSize.SaveValue(); + } + + //aMtrFldYSize + if( rAttrs.GetItemState( XATTR_FILLBMP_SIZEY ) != SFX_ITEM_DONTCARE ) + { + INT32 nValue = ( ( const XFillBmpSizeYItem& ) rAttrs.Get( XATTR_FILLBMP_SIZEY ) ).GetValue(); + if( aTsbScale.GetState() == STATE_CHECK ) + { + // Wenn im Item eine Prozentangabe steckt, + // so ist diese wegen des MetricItems negativ + aMtrFldYSize.SetValue( labs( nValue ) ); + } + else + SetMetricValue( aMtrFldYSize, nValue, ePoolUnit ); + aMtrFldYSize.SaveValue(); + + if( nValue == 0 ) + aMtrFldYSize.SetValue( 100 ); //s.o. + else + eOriginal = STATE_NOCHECK; + } + else + { + aMtrFldYSize.SetText( String() ); + aMtrFldYSize.SaveValue(); + eOriginal = STATE_NOCHECK; + } + + // aTsbOriginal + aTsbOriginal.SetState( eOriginal ); + + // #93372# Setting proper state after changing button + ModifyTileHdl_Impl( NULL ); + + //aRbtRow + //aRbtColumn + //aMtrFldOffset + if( rAttrs.GetItemState( XATTR_FILLBMP_TILEOFFSETX ) != SFX_ITEM_DONTCARE ) + { + UINT16 nValue = ( ( const XFillBmpTileOffsetXItem& ) rAttrs.Get( XATTR_FILLBMP_TILEOFFSETX ) ).GetValue(); + if( nValue > 0 ) + { + aMtrFldOffset.SetValue( nValue ); + aRbtRow.Check(); + } + else if( rAttrs.GetItemState( XATTR_FILLBMP_TILEOFFSETY ) != SFX_ITEM_DONTCARE ) + { + nValue = ( ( const XFillBmpTileOffsetYItem& ) rAttrs.Get( XATTR_FILLBMP_TILEOFFSETY ) ).GetValue(); + if( nValue > 0 ) + { + aMtrFldOffset.SetValue( nValue ); + aRbtColumn.Check(); + } + } + else + aMtrFldOffset.SetValue( 0 ); + } + else + aMtrFldOffset.SetText( String() ); + + + //aCtlPosition + if( rAttrs.GetItemState( XATTR_FILLBMP_POS ) != SFX_ITEM_DONTCARE ) + { + RECT_POINT eValue = ( ( const XFillBmpPosItem& ) rAttrs.Get( XATTR_FILLBMP_POS ) ).GetValue(); + aCtlPosition.SetActualRP( eValue ); + } + else + aCtlPosition.Reset(); + + //aMtrFldXOffset + if( rAttrs.GetItemState( XATTR_FILLBMP_POSOFFSETX ) != SFX_ITEM_DONTCARE ) + { + INT32 nValue = ( ( const XFillBmpPosOffsetXItem& ) rAttrs.Get( XATTR_FILLBMP_POSOFFSETX ) ).GetValue(); + aMtrFldXOffset.SetValue( nValue ); + } + else + aMtrFldXOffset.SetText( String() ); + + //aMtrFldYOffset + if( rAttrs.GetItemState( XATTR_FILLBMP_POSOFFSETY ) != SFX_ITEM_DONTCARE ) + { + INT32 nValue = ( ( const XFillBmpPosOffsetYItem& ) rAttrs.Get( XATTR_FILLBMP_POSOFFSETY ) ).GetValue(); + aMtrFldYOffset.SetValue( nValue ); + } + else + aMtrFldYOffset.SetText( String() ); + + // Erst hier, damit Tile und Stretch mit beruecksichtigt wird + if( aTypeLB.GetSelectEntryPos() == XFILL_BITMAP ) + ClickBitmapHdl_Impl( NULL ); + + // Werte sichern + aTypeLB.SaveValue(); + aLbColor.SaveValue(); + aLbGradient.SaveValue(); + aLbHatching.SaveValue(); + //aCbxHatchBckgrd.SaveValue(); + aLbHatchBckgrdColor.SaveValue(); + aLbBitmap.SaveValue(); +// aLbTransparent.SaveValue(); + aTsbStepCount.SaveValue(); + aNumFldStepCount.SaveValue(); + aTsbTile.SaveValue(); + aTsbStretch.SaveValue(); + aTsbScale.SaveValue(); + aRbtRow.SaveValue(); + aRbtColumn.SaveValue(); + aMtrFldOffset.SaveValue(); + aMtrFldXOffset.SaveValue(); + aMtrFldYOffset.SaveValue(); + //aMtrFldXSize.SaveValue(); <- wird oben behandelt + //aMtrFldYSize.SaveValue(); <- wird oben behandelt +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxAreaTabPage::Create( Window* pWindow, + const SfxItemSet& rAttrs ) +{ + return( new SvxAreaTabPage( pWindow, rAttrs ) ); +} + +//------------------------------------------------------------------------ + +USHORT* SvxAreaTabPage::GetRanges() +{ + return( pAreaRanges ); +} + +//------------------------------------------------------------------------ +IMPL_LINK( SvxAreaTabPage, SelectDialogTypeHdl_Impl, ListBox *, EMPTYARG ) +{ + switch( (XFillStyle)aTypeLB.GetSelectEntryPos() ) + { + case XFILL_NONE: ClickInvisibleHdl_Impl( this ); break; + case XFILL_SOLID: ClickColorHdl_Impl( this ); break; + case XFILL_GRADIENT: ClickGradientHdl_Impl( this ); break; + case XFILL_HATCH: ClickHatchingHdl_Impl( this ); break; + case XFILL_BITMAP: ClickBitmapHdl_Impl( this ); break; + } + + return 0; +} + +IMPL_LINK( SvxAreaTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG ) +{ + aTsbTile.Hide(); + aTsbStretch.Hide(); + aTsbScale.Hide(); + aTsbOriginal.Hide(); + aFtXSize.Hide(); + aMtrFldXSize.Hide(); + aFtYSize.Hide(); + aMtrFldYSize.Hide(); + aFlSize.Hide(); + aRbtRow.Hide(); + aRbtColumn.Hide(); + aMtrFldOffset.Hide(); + aFlOffset.Hide(); + aCtlPosition.Hide(); + aFtXOffset.Hide(); + aMtrFldXOffset.Hide(); + aFtYOffset.Hide(); + aMtrFldYOffset.Hide(); + aFlPosition.Hide(); + + aLbColor.Hide(); + aLbGradient.Hide(); + aLbHatching.Hide(); + aLbBitmap.Hide(); + aCtlXRectPreview.Hide(); + aCtlBitmapPreview.Hide(); + + aFlStepCount.Hide(); + aTsbStepCount.Hide(); + aNumFldStepCount.Hide(); + + // Controls for Hatch-Background + aCbxHatchBckgrd.Hide(); + aLbHatchBckgrdColor.Hide(); + + rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); + aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); + + aCtlXRectPreview.Invalidate(); + aCtlBitmapPreview.Invalidate(); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxAreaTabPage, ClickColorHdl_Impl, void *, EMPTYARG ) +{ + aTsbTile.Hide(); + aTsbStretch.Hide(); + aTsbScale.Hide(); + aTsbOriginal.Hide(); + aFtXSize.Hide(); + aMtrFldXSize.Hide(); + aFtYSize.Hide(); + aMtrFldYSize.Hide(); + aFlSize.Hide(); + aRbtRow.Hide(); + aRbtColumn.Hide(); + aMtrFldOffset.Hide(); + aFlOffset.Hide(); + aCtlPosition.Hide(); + aFtXOffset.Hide(); + aMtrFldXOffset.Hide(); + aFtYOffset.Hide(); + aMtrFldYOffset.Hide(); + aFlPosition.Hide(); + + aLbColor.Enable(); + aLbColor.Show(); + aLbGradient.Hide(); + aLbHatching.Hide(); + aLbBitmap.Hide(); + aCtlXRectPreview.Enable(); + aCtlXRectPreview.Show(); + aCtlBitmapPreview.Hide(); + + aFlStepCount.Hide(); + aTsbStepCount.Hide(); + aNumFldStepCount.Hide(); + + // Controls for Hatch-Background + aCbxHatchBckgrd.Hide(); + aLbHatchBckgrdColor.Hide(); + + // Text der Tabelle setzen + String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + INetURLObject aURL( pColorTab->GetPath() ); + + aURL.Append( pColorTab->GetName() ); + DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + if( aURL.getBase().getLength() > 18 ) + { + aString += String(aURL.getBase()).Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String(aURL.getBase()); + + ModifyColorHdl_Impl( this ); + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxAreaTabPage, ModifyColorHdl_Impl, void *, EMPTYARG ) +{ + const SfxPoolItem* pPoolItem = NULL; + USHORT _nPos = aLbColor.GetSelectEntryPos(); + aLbHatchBckgrdColor.SelectEntryPos( _nPos ); + if( _nPos != LISTBOX_ENTRY_NOTFOUND ) + { + rXFSet.Put( XFillStyleItem( XFILL_SOLID ) ); + rXFSet.Put( XFillColorItem( String(), + aLbColor.GetSelectEntryColor() ) ); + } + // NEU + else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), TRUE, &pPoolItem ) ) + { + rXFSet.Put( XFillStyleItem( XFILL_SOLID ) ); + Color aColor( ( ( const XFillColorItem* ) pPoolItem )->GetColorValue() ); + rXFSet.Put( XFillColorItem( String(), aColor ) ); + } + else + rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); + + aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlXRectPreview.Invalidate(); + + return( 0L ); +} +//------------------------------------------------------------------------ + +IMPL_LINK( SvxAreaTabPage, ClickGradientHdl_Impl, void *, EMPTYARG ) +{ + aTsbTile.Hide(); + aTsbStretch.Hide(); + aTsbScale.Hide(); + aTsbOriginal.Hide(); + aFtXSize.Hide(); + aMtrFldXSize.Hide(); + aFtYSize.Hide(); + aMtrFldYSize.Hide(); + aFlSize.Hide(); + aRbtRow.Hide(); + aRbtColumn.Hide(); + aMtrFldOffset.Hide(); + aFlOffset.Hide(); + aCtlPosition.Hide(); + aFtXOffset.Hide(); + aMtrFldXOffset.Hide(); + aFtYOffset.Hide(); + aMtrFldYOffset.Hide(); + aFlPosition.Hide(); + + aLbColor.Hide(); + aLbGradient.Enable(); + aLbGradient.Show(); + aLbHatching.Hide(); + aLbBitmap.Hide(); + aCtlXRectPreview.Enable(); + aCtlXRectPreview.Show(); + aCtlBitmapPreview.Hide(); + + aFlStepCount.Enable(); + aFlStepCount.Show(); + aTsbStepCount.Enable(); + aTsbStepCount.Show(); + aNumFldStepCount.Show(); + + // Controls for Hatch-Background + aCbxHatchBckgrd.Hide(); + aLbHatchBckgrdColor.Hide(); + + // Text der Tabelle setzen + String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + INetURLObject aURL( pGradientList->GetPath() ); + + aURL.Append( pGradientList->GetName() ); + DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + if( aURL.getBase().getLength() > 18 ) + { + aString += String(aURL.getBase()).Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String(aURL.getBase()); + + ModifyGradientHdl_Impl( this ); + ModifyStepCountHdl_Impl( &aTsbStepCount ); + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxAreaTabPage, ModifyGradientHdl_Impl, void *, EMPTYARG ) +{ + const SfxPoolItem* pPoolItem = NULL; + USHORT _nPos = aLbGradient.GetSelectEntryPos(); + if( _nPos != LISTBOX_ENTRY_NOTFOUND ) + { + // ItemSet fuellen und an aCtlXRectPreview weiterleiten + XGradientEntry* pEntry = pGradientList->GetGradient( _nPos ); + + rXFSet.Put( XFillStyleItem( XFILL_GRADIENT ) ); + rXFSet.Put( XFillGradientItem( String(), + pEntry->GetGradient() ) ); + } + // NEU + else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), TRUE, &pPoolItem ) ) + { + rXFSet.Put( XFillStyleItem( XFILL_GRADIENT ) ); + rXFSet.Put( XFillGradientItem( String(), ( ( const XFillGradientItem* ) pPoolItem )->GetGradientValue() ) ); + } + else + rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); + + aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlXRectPreview.Invalidate(); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxAreaTabPage, ClickHatchingHdl_Impl, void *, EMPTYARG ) +{ + aLbColor.Hide(); + aLbGradient.Hide(); + aLbHatching.Enable(); + aLbHatching.Show(); + aLbBitmap.Hide(); + aCtlXRectPreview.Enable(); + aCtlXRectPreview.Show(); + aCtlBitmapPreview.Hide(); + +// aGrpTransparent.Hide(); +// aLbTransparent.Hide(); + aFlStepCount.Hide(); + aTsbStepCount.Hide(); + aNumFldStepCount.Hide(); + + aTsbTile.Hide(); + aTsbStretch.Hide(); + aTsbScale.Hide(); + aTsbOriginal.Hide(); + aFtXSize.Hide(); + aMtrFldXSize.Hide(); + aFtYSize.Hide(); + aMtrFldYSize.Hide(); + aFlSize.Hide(); + aRbtRow.Hide(); + aRbtColumn.Hide(); + aMtrFldOffset.Hide(); + aFlOffset.Hide(); + aCtlPosition.Hide(); + aFtXOffset.Hide(); + aMtrFldXOffset.Hide(); + aFtYOffset.Hide(); + aMtrFldYOffset.Hide(); + aFlPosition.Hide(); + + // Controls for Hatch-Background + aCbxHatchBckgrd.Show(); + aLbHatchBckgrdColor.Show(); + aCbxHatchBckgrd.Enable(); + aLbHatchBckgrdColor.Enable(); + + // Text der Tabelle setzen + String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + INetURLObject aURL( pHatchingList->GetPath() ); + + aURL.Append( pHatchingList->GetName() ); + DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + if( aURL.getBase().getLength() > 18 ) + { + aString += String(String(aURL.getBase()).Copy( 0, 15 )); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String(aURL.getBase()); + + ModifyHatchingHdl_Impl( this ); + ModifyHatchBckgrdColorHdl_Impl( this ); + ToggleHatchBckgrdColorHdl_Impl( this ); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxAreaTabPage, ModifyHatchingHdl_Impl, void *, EMPTYARG ) +{ + const SfxPoolItem* pPoolItem = NULL; + USHORT _nPos = aLbHatching.GetSelectEntryPos(); + if( _nPos != LISTBOX_ENTRY_NOTFOUND ) + { + // ItemSet fuellen und an aCtlXRectPreview weiterleiten + XHatchEntry* pEntry = pHatchingList->GetHatch( _nPos ); + + rXFSet.Put( XFillStyleItem( XFILL_HATCH ) ); + rXFSet.Put( XFillHatchItem( String(), pEntry->GetHatch() ) ); + } + // NEU + else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), TRUE, &pPoolItem ) ) + { + rXFSet.Put( XFillStyleItem( XFILL_HATCH ) ); + rXFSet.Put( XFillHatchItem( String(), ( ( const XFillHatchItem* ) pPoolItem )->GetHatchValue() ) ); + } + else + rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); + + aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlXRectPreview.Invalidate(); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxAreaTabPage, ModifyHatchBckgrdColorHdl_Impl, void *, EMPTYARG ) +{ + const SfxPoolItem* pPoolItem = NULL; + USHORT _nPos = aLbHatchBckgrdColor.GetSelectEntryPos(); + aLbColor.SelectEntryPos( _nPos ); + if( _nPos != LISTBOX_ENTRY_NOTFOUND ) + { +// rXFSet.Put( XFillStyleItem( XFILL_SOLID ) ); + rXFSet.Put( XFillColorItem( String(), + aLbHatchBckgrdColor.GetSelectEntryColor() ) ); + } + // NEU + else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), TRUE, &pPoolItem ) ) + { +// rXFSet.Put( XFillStyleItem( XFILL_SOLID ) ); + Color aColor( ( ( const XFillColorItem* ) pPoolItem )->GetColorValue() ); + rXFSet.Put( XFillColorItem( String(), aColor ) ); + } + else + rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); + + aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlXRectPreview.Invalidate(); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxAreaTabPage, ToggleHatchBckgrdColorHdl_Impl, void *, EMPTYARG ) +{ + // switch on/off backgroundcolor for hatches + aLbHatchBckgrdColor.Enable( aCbxHatchBckgrd.IsChecked() ); + + XFillBackgroundItem aItem( aCbxHatchBckgrd.IsChecked() ); + rXFSet.Put ( aItem, XATTR_FILLBACKGROUND ); + + aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlXRectPreview.Invalidate(); + + if( aLbHatchBckgrdColor.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ) + { + if ( SFX_ITEM_SET == rOutAttrs.GetItemState( XATTR_FILLCOLOR ) )//>= SFX_ITEM_DEFAULT ) + { + XFillColorItem aColorItem( (const XFillColorItem&)rOutAttrs.Get( XATTR_FILLCOLOR ) ); + aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() ); + } + } + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxAreaTabPage, ClickBitmapHdl_Impl, void *, EMPTYARG ) +{ + aLbColor.Hide(); + aLbGradient.Hide(); + aLbHatching.Hide(); + aLbBitmap.Enable(); + aLbBitmap.Show(); + aCtlBitmapPreview.Enable(); + aCtlBitmapPreview.Show(); + aCtlXRectPreview.Hide(); +// aGrpPreview.Hide(); +// aGrpTransparent.Hide(); +// aLbTransparent.Hide(); + aFlStepCount.Hide(); + aTsbStepCount.Hide(); + aNumFldStepCount.Hide(); + + aTsbTile.Enable(); + aTsbStretch.Enable(); + aTsbScale.Enable(); + aTsbOriginal.Enable(); + aFtXSize.Enable(); + aMtrFldXSize.Enable(); + aFtYSize.Enable(); + aMtrFldYSize.Enable(); + aFlSize.Enable(); + aCtlPosition.Enable(); + aFtXOffset.Enable(); + aMtrFldXOffset.Enable(); + aFtYOffset.Enable(); + aMtrFldYOffset.Enable(); + aFlPosition.Enable(); + aRbtRow.Enable(); + aRbtColumn.Enable(); + aMtrFldOffset.Enable(); + aFlOffset.Enable(); + + // Controls for Hatch-Background + aCbxHatchBckgrd.Hide(); + aLbHatchBckgrdColor.Hide(); + + aTsbTile.Show(); + aTsbStretch.Show(); + aTsbScale.Show(); + aTsbOriginal.Show(); + aFtXSize.Show(); + aMtrFldXSize.Show(); + aFtYSize.Show(); + aMtrFldYSize.Show(); + aFlSize.Show(); + aCtlPosition.Show(); + aFtXOffset.Show(); + aMtrFldXOffset.Show(); + aFtYOffset.Show(); + aMtrFldYOffset.Show(); + aFlPosition.Show(); + aRbtRow.Show(); + aRbtColumn.Show(); + aMtrFldOffset.Show(); + aFlOffset.Show(); + + // Text der Tabelle setzen + String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + INetURLObject aURL( pBitmapList->GetPath() ); + + aURL.Append( pBitmapList->GetName() ); + DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + if( aURL.getBase().getLength() > 18 ) + { + aString += String(aURL.getBase()).Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String(aURL.getBase()); + + ModifyBitmapHdl_Impl( this ); + ModifyTileHdl_Impl( &aTsbOriginal ); + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxAreaTabPage, ModifyBitmapHdl_Impl, void *, EMPTYARG ) +{ + const SfxPoolItem* pPoolItem = NULL; + USHORT _nPos = aLbBitmap.GetSelectEntryPos(); + if( _nPos != LISTBOX_ENTRY_NOTFOUND ) + { + // ItemSet fuellen und an aCtlXRectPreview weiterleiten + XBitmapEntry* pEntry = pBitmapList->GetBitmap( _nPos ); + + rXFSet.Put( XFillStyleItem( XFILL_BITMAP ) ); + rXFSet.Put( XFillBitmapItem( String(), pEntry->GetXBitmap() ) ); + } + // NEU + else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), TRUE, &pPoolItem ) ) + { + rXFSet.Put( XFillStyleItem( XFILL_BITMAP ) ); + rXFSet.Put( XFillBitmapItem( String(), ( ( const XFillBitmapItem* ) pPoolItem )->GetBitmapValue() ) ); + } + else + rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); + + aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlBitmapPreview.Invalidate(); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +//IMPL_LINK( SvxAreaTabPage, ModifyTransparentHdl_Impl, void *, EMPTYARG ) +//{ +// USHORT nPos = aLbTransparent.GetSelectEntryPos(); +// if( nPos != LISTBOX_ENTRY_NOTFOUND ) +// { +// XFillTransparenceItem aItem( nPos * 25 ); +// +// rXFSet.Put( XFillTransparenceItem( aItem ) ); +// aCtlXRectPreview.SetAttributes( aXFillAttr ); +// +// aCtlXRectPreview.Invalidate(); +// } +// +// return( 0L ); +//} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxAreaTabPage, ModifyStepCountHdl_Impl, void *, p ) +{ + if( p == &aTsbStepCount ) + { + if( aTsbStepCount.GetState() == STATE_NOCHECK ) + { + if( aNumFldStepCount.GetText().Len() == 0 ) + aNumFldStepCount.SetText( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "64") )); + + aNumFldStepCount.Enable(); + } + else + aNumFldStepCount.Disable(); + } + + UINT16 nValue = 0; + if( aTsbStepCount.GetState() != STATE_CHECK ) + { + // Zustand != Disabled ? + if( aNumFldStepCount.GetText().Len() > 0 ) + nValue = (UINT16) aNumFldStepCount.GetValue(); + } + rXFSet.Put( XGradientStepCountItem( nValue ) ); + aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlXRectPreview.Invalidate(); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxAreaTabPage, ModifyTileHdl_Impl, void *, EMPTYARG ) +{ + TriState eState = aTsbTile.GetState(); + if( eState == STATE_CHECK ) + { + aTsbStretch.Disable(); + aRbtRow.Enable(); + aRbtColumn.Enable(); + aMtrFldOffset.Enable(); + aFlOffset.Enable(); + + aCtlPosition.Enable(); + aCtlPosition.Invalidate(); + aFtXOffset.Enable(); + aMtrFldXOffset.Enable(); + aFtYOffset.Enable(); + aMtrFldYOffset.Enable(); + aFlPosition.Enable(); + + aTsbScale.Enable(); + aTsbOriginal.Enable(); + aFtXSize.Enable(); + aMtrFldXSize.Enable(); + aFtYSize.Enable(); + aMtrFldYSize.Enable(); + aFlSize.Enable(); + } + else if( eState == STATE_NOCHECK ) + { + aTsbStretch.Enable(); + aRbtRow.Disable(); + aRbtColumn.Disable(); + aMtrFldOffset.Disable(); + aFlOffset.Disable(); + + aCtlPosition.Disable(); + aCtlPosition.Invalidate(); + aFtXOffset.Disable(); + aMtrFldXOffset.Disable(); + aFtYOffset.Disable(); + aMtrFldYOffset.Disable(); + aFlPosition.Disable(); + + if( aTsbStretch.GetState() != STATE_NOCHECK ) + { + aTsbScale.Disable(); + aTsbOriginal.Disable(); + aFtXSize.Disable(); + aMtrFldXSize.Disable(); + aFtYSize.Disable(); + aMtrFldYSize.Disable(); + aFlSize.Disable(); + } + else + { + aTsbScale.Enable(); + aTsbOriginal.Enable(); + aFtXSize.Enable(); + aMtrFldXSize.Enable(); + aFtYSize.Enable(); + aMtrFldYSize.Enable(); + aFlSize.Enable(); + } + } + else + { + aTsbStretch.Disable(); + aRbtRow.Disable(); + aRbtColumn.Disable(); + aMtrFldOffset.Disable(); + aFlOffset.Disable(); + + aCtlPosition.Disable(); + aCtlPosition.Invalidate(); + aFtXOffset.Disable(); + aMtrFldXOffset.Disable(); + aFtYOffset.Disable(); + aMtrFldYOffset.Disable(); + aFlPosition.Disable(); + + aTsbScale.Disable(); + aTsbOriginal.Disable(); + aFtXSize.Disable(); + aMtrFldXSize.Disable(); + aFtYSize.Disable(); + aMtrFldYSize.Disable(); + aFlSize.Disable(); + } + + if( aTsbOriginal.GetState() == STATE_CHECK ) + { + aMtrFldXSize.SetText( String() ); + aMtrFldYSize.SetText( String() ); + aFtXSize.Disable(); + aFtYSize.Disable(); + aMtrFldXSize.Disable(); + aMtrFldYSize.Disable(); + aTsbScale.Disable(); + } + else + { + aMtrFldXSize.SetValue( aMtrFldXSize.GetValue() ); + aMtrFldYSize.SetValue( aMtrFldYSize.GetValue() ); + /* + if( eState == STATE_CHECK ) + { + aFtXSize.Enable(); + aFtYSize.Enable(); + aMtrFldXSize.Enable(); + aMtrFldYSize.Enable(); + } + */ + } + + rXFSet.Put( XFillBmpTileItem( sal::static_int_cast< BOOL >( eState ) ) ); + + if( aTsbStretch.IsEnabled() ) + rXFSet.Put( + XFillBmpStretchItem( + sal::static_int_cast< BOOL >( aTsbStretch.GetState() ) ) ); + + if( aTsbScale.IsEnabled() ) + rXFSet.Put( XFillBmpSizeLogItem( aTsbScale.GetState() == STATE_NOCHECK ) ); + + if( aMtrFldXSize.IsEnabled() ) + { + XFillBmpSizeXItem* pItem = NULL; + TriState eScaleState = aTsbScale.GetState(); + + if( eScaleState == STATE_NOCHECK ) + pItem = new XFillBmpSizeXItem( GetCoreValue( aMtrFldXSize, ePoolUnit ) ); + else + pItem = new XFillBmpSizeXItem( -labs( static_cast(aMtrFldXSize.GetValue()) ) ); + + rXFSet.Put( *pItem ); + + delete pItem; + } + else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK ) + { + // Originalgroesse -> Size == 0 + rXFSet.Put( XFillBmpSizeXItem( 0 ) ); + rXFSet.Put( XFillBmpSizeLogItem( TRUE ) ); + } + + if( aMtrFldYSize.IsEnabled() ) + { + XFillBmpSizeYItem* pItem = NULL; + TriState eScaleState = aTsbScale.GetState(); + + if( eScaleState == STATE_NOCHECK ) + pItem = new XFillBmpSizeYItem( GetCoreValue( aMtrFldYSize, ePoolUnit ) ); + else + pItem = new XFillBmpSizeYItem( -labs( static_cast(aMtrFldYSize.GetValue()) ) ); + + rXFSet.Put( *pItem ); + + delete pItem; + } + else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK ) + { + // Originalgroesse -> Size == 0 + rXFSet.Put( XFillBmpSizeYItem( 0 ) ); + rXFSet.Put( XFillBmpSizeLogItem( TRUE ) ); + } + + if( aMtrFldOffset.IsEnabled() ) + { + if( aRbtRow.IsChecked() ) + { + rXFSet.Put( XFillBmpTileOffsetXItem( (UINT16) aMtrFldOffset.GetValue() ) ); + rXFSet.Put( XFillBmpTileOffsetYItem( (UINT16) 0 ) ); + } + else if( aRbtColumn.IsChecked() ) + { + rXFSet.Put( XFillBmpTileOffsetXItem( (UINT16) 0 ) ); + rXFSet.Put( XFillBmpTileOffsetYItem( (UINT16) aMtrFldOffset.GetValue() ) ); + } + } + + if( aCtlPosition.IsEnabled() ) + rXFSet.Put( XFillBmpPosItem( aCtlPosition.GetActualRP() ) ); + + if( aMtrFldXOffset.IsEnabled() ) + rXFSet.Put( XFillBmpPosOffsetXItem( (UINT16) aMtrFldXOffset.GetValue() ) ); + + if( aMtrFldYOffset.IsEnabled() ) + rXFSet.Put( XFillBmpPosOffsetYItem( (UINT16) aMtrFldYOffset.GetValue() ) ); + + + aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlBitmapPreview.Invalidate(); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxAreaTabPage, ClickScaleHdl_Impl, void *, EMPTYARG ) +{ + if( aTsbScale.GetState() == STATE_CHECK ) + { + aMtrFldXSize.SetDecimalDigits( 0 ); + aMtrFldXSize.SetUnit( FUNIT_CUSTOM ); + aMtrFldXSize.SetValue( 100 ); + aMtrFldXSize.SetMax( 100 ); + aMtrFldXSize.SetLast( 100 ); + + aMtrFldYSize.SetDecimalDigits( 0 ); + aMtrFldYSize.SetUnit( FUNIT_CUSTOM ); + aMtrFldYSize.SetValue( 100 ); + aMtrFldYSize.SetMax( 100 ); + aMtrFldYSize.SetLast( 100 ); + } + else + { + aMtrFldXSize.SetDecimalDigits( 2 ); + aMtrFldXSize.SetUnit( eFUnit ); + aMtrFldXSize.SetValue( 100 ); + aMtrFldXSize.SetMax( 999900 ); + aMtrFldXSize.SetLast( 100000 ); + + aMtrFldYSize.SetDecimalDigits( 2 ); + aMtrFldYSize.SetUnit( eFUnit ); + aMtrFldYSize.SetValue( 100 ); + aMtrFldYSize.SetMax( 999900 ); + aMtrFldYSize.SetLast( 100000 ); + } + + ModifyTileHdl_Impl( NULL ); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +void SvxAreaTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt ) +{ + eRP = eRcPt; + + // Ausrichtung der Bitmapfuellung + ModifyTileHdl_Impl( pWindow ); +} + +void SvxAreaTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 +{ + SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False); + SFX_ITEMSET_ARG (&aSet,pGradientListItem,SvxGradientListItem,SID_GRADIENT_LIST,sal_False); + SFX_ITEMSET_ARG (&aSet,pHatchingListItem,SvxHatchListItem,SID_HATCH_LIST,sal_False); + SFX_ITEMSET_ARG (&aSet,pBitmapListItem,SvxBitmapListItem,SID_BITMAP_LIST,sal_False); + SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); + SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False); + SFX_ITEMSET_ARG (&aSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,sal_False); + + if (pColorTabItem) + SetColorTable(pColorTabItem->GetColorTable()); + if (pGradientListItem) + SetGradientList(pGradientListItem->GetGradientList()); + if (pHatchingListItem) + SetHatchingList(pHatchingListItem->GetHatchList()); + if (pBitmapListItem) + SetBitmapList(pBitmapListItem->GetBitmapList()); + if (pPageTypeItem) + SetPageType(pPageTypeItem->GetValue()); + if (pDlgTypeItem) + SetDlgType(pDlgTypeItem->GetValue()); + if (pPosItem) + SetPos(pPosItem->GetValue()); + Construct(); +} + diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx new file mode 100644 index 000000000000..6ced6dd266f8 --- /dev/null +++ b/cui/source/tabpages/tpbitmap.cxx @@ -0,0 +1,1170 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tpbitmap.cxx,v $ + * $Revision: 1.31 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- + +//svdraw.hxx +#define _SVDRAW_HXX +#define _SDR_NOITEMS +#define _SDR_NOTOUCH +#define _SDR_NOTRANSFORM +#define _SDR_NOOBJECTS +#define _SDR_NOVIEWS +#define _SDR_NOVIEWMARKER +#define _SDR_NODRAGMETHODS +#define _SDR_NOUNDO +#define _SDR_NOXOUTDEV +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" +#include + +#define _SVX_TPBITMAP_CXX + +#include +#include "helpid.hrc" +#include "svx/xattr.hxx" +#include +#include +#include "svx/xoutbmp.hxx" +#include "svx/drawitem.hxx" +#include "cuitabarea.hxx" +#include "tabarea.hrc" +#include "defdlgname.hxx" //CHINA001 #include "dlgname.hxx" +//#include "dlgname.hrc" +#include //CHINA001 +#include +#include "svx/opengrf.hxx" + +#define DLGWIN this->GetParent()->GetParent() + +/************************************************************************* +|* +|* Dialog zum Aendern und Definieren der Bitmaps +|* +\************************************************************************/ + +SvxBitmapTabPage::SvxBitmapTabPage +( + Window* pParent, + const SfxItemSet& rInAttrs +) : + + SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_BITMAP ), rInAttrs ), + + aCtlPixel ( this, SVX_RES( CTL_PIXEL ) ), + aFtPixelEdit ( this, SVX_RES( FT_PIXEL_EDIT ) ), + aFtColor ( this, SVX_RES( FT_COLOR ) ), + aLbColor ( this, SVX_RES( LB_COLOR ) ), + aFtBackgroundColor ( this, SVX_RES( FT_BACKGROUND_COLOR ) ), + aLbBackgroundColor ( this, SVX_RES( LB_BACKGROUND_COLOR ) ), + // This fix text is used only to provide the name for the following + // bitmap list box. The fixed text is not displayed. + aLbBitmapsHidden ( this, SVX_RES( FT_BITMAPS_HIDDEN ) ), + aLbBitmaps ( this, SVX_RES( LB_BITMAPS ) ), + aFlProp ( this, SVX_RES( FL_PROP ) ), + aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ), + aBtnAdd ( this, SVX_RES( BTN_ADD ) ), + aBtnModify ( this, SVX_RES( BTN_MODIFY ) ), + aBtnImport ( this, SVX_RES( BTN_IMPORT ) ), + aBtnDelete ( this, SVX_RES( BTN_DELETE ) ), + aBtnLoad ( this, SVX_RES( BTN_LOAD ) ), + aBtnSave ( this, SVX_RES( BTN_SAVE ) ), + + aBitmapCtl ( this, aCtlPreview.GetSizePixel() ), + rOutAttrs ( rInAttrs ), + + pColorTab( NULL ), + pBitmapList( NULL ), + + pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), + aXFStyleItem ( XFILL_BITMAP ), + aXBitmapItem ( String(), XOBitmap() ), + aXFillAttr ( pXPool ), + rXFSet ( aXFillAttr.GetItemSet() ) +{ + aBtnLoad.SetModeImage( Image( SVX_RES( RID_SVXIMG_LOAD_H ) ), BMP_COLOR_HIGHCONTRAST ); + aBtnSave.SetModeImage( Image( SVX_RES( RID_SVXIMG_SAVE_H ) ), BMP_COLOR_HIGHCONTRAST ); + FreeResource(); + + // diese Page braucht ExchangeSupport + SetExchangeSupport(); + + // Setzen des Output-Devices + rXFSet.Put( aXFStyleItem ); + rXFSet.Put( aXBitmapItem ); + //aCtlPreview.SetAttributes( aXFillAttr ); + + aBtnAdd.SetClickHdl( LINK( this, SvxBitmapTabPage, ClickAddHdl_Impl ) ); + aBtnImport.SetClickHdl( + LINK( this, SvxBitmapTabPage, ClickImportHdl_Impl ) ); + aBtnModify.SetClickHdl( + LINK( this, SvxBitmapTabPage, ClickModifyHdl_Impl ) ); + aBtnDelete.SetClickHdl( + LINK( this, SvxBitmapTabPage, ClickDeleteHdl_Impl ) ); + aBtnLoad.SetClickHdl( LINK( this, SvxBitmapTabPage, ClickLoadHdl_Impl ) ); + aBtnSave.SetClickHdl( LINK( this, SvxBitmapTabPage, ClickSaveHdl_Impl ) ); + + aLbBitmaps.SetSelectHdl( + LINK( this, SvxBitmapTabPage, ChangeBitmapHdl_Impl ) ); + aLbColor.SetSelectHdl( + LINK( this, SvxBitmapTabPage, ChangePixelColorHdl_Impl ) ); + aLbBackgroundColor.SetSelectHdl( + LINK( this, SvxBitmapTabPage, ChangeBackgrndColorHdl_Impl ) ); + +} + +// ----------------------------------------------------------------------- + +void SvxBitmapTabPage::Construct() +{ + // Farbtabellen + aLbColor.Fill( pColorTab ); + aLbBackgroundColor.CopyEntries( aLbColor ); + + // Bitmaptabelle + aLbBitmaps.Fill( pBitmapList ); +} + +// ----------------------------------------------------------------------- + +void SvxBitmapTabPage::ActivatePage( const SfxItemSet& ) +{ + USHORT nPos; + USHORT nCount; + + if( *pDlgType == 0 ) // Flaechen-Dialog + { + *pbAreaTP = FALSE; + + if( pColorTab ) + { + // ColorTable + if( *pnColorTableState & CT_CHANGED || + *pnColorTableState & CT_MODIFIED ) + { + if( *pnColorTableState & CT_CHANGED ) + pColorTab = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorTable(); + + // LbColor + nPos = aLbColor.GetSelectEntryPos(); + aLbColor.Clear(); + aLbColor.Fill( pColorTab ); + nCount = aLbColor.GetEntryCount(); + if( nCount == 0 ) + ; // Dieser Fall sollte nicht auftreten + else if( nCount <= nPos ) + aLbColor.SelectEntryPos( 0 ); + else + aLbColor.SelectEntryPos( nPos ); + + // LbColorBackground + nPos = aLbBackgroundColor.GetSelectEntryPos(); + aLbBackgroundColor.Clear(); + aLbBackgroundColor.CopyEntries( aLbColor ); + nCount = aLbBackgroundColor.GetEntryCount(); + if( nCount == 0 ) + ; // Dieser Fall sollte nicht auftreten + else if( nCount <= nPos ) + aLbBackgroundColor.SelectEntryPos( 0 ); + else + aLbBackgroundColor.SelectEntryPos( nPos ); + + ChangePixelColorHdl_Impl( this ); + ChangeBackgrndColorHdl_Impl( this ); + } + + // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + INetURLObject aURL( pBitmapList->GetPath() ); + + aURL.Append( pBitmapList->GetName() ); + DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + if( aURL.getBase().getLength() > 18 ) + { + aString += String(aURL.getBase()).Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String(aURL.getBase()); + + if( *pPageType == PT_BITMAP && *pPos != LISTBOX_ENTRY_NOTFOUND ) + { + aLbBitmaps.SelectEntryPos( *pPos ); + } + // Farben koennten geloescht worden sein + ChangeBitmapHdl_Impl( this ); + + *pPageType = PT_BITMAP; + *pPos = LISTBOX_ENTRY_NOTFOUND; + } + } +} + +// ----------------------------------------------------------------------- + +int SvxBitmapTabPage::DeactivatePage( SfxItemSet* _pSet) +{ + if ( CheckChanges_Impl() == -1L ) + return KEEP_PAGE; + + if( _pSet ) + FillItemSet( *_pSet ); + + return LEAVE_PAGE; +} + +// ----------------------------------------------------------------------- + +BOOL SvxBitmapTabPage::FillItemSet( SfxItemSet& _rOutAttrs ) +{ + if( *pDlgType == 0 && *pbAreaTP == FALSE ) // Flaechen-Dialog + { + if( *pPageType == PT_BITMAP ) + { + // CheckChanges_Impl(); <-- doppelte Abfrage ? + + XOBitmap aXOBitmap; + String aString; + USHORT nPos = aLbBitmaps.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + aXOBitmap = pBitmapList->GetBitmap( nPos )->GetXBitmap(); + aString = aLbBitmaps.GetSelectEntry(); + + } + else + { + aXOBitmap = aBitmapCtl.GetXBitmap(); + + // #85339# if it's an array, force conversion to bitmap before using it. + if(aXOBitmap.GetBitmapType() == XBITMAP_8X8) + aXOBitmap.GetBitmap(); + + } + _rOutAttrs.Put( XFillStyleItem( XFILL_BITMAP ) ); + _rOutAttrs.Put( XFillBitmapItem( aString, aXOBitmap ) ); + } + } + return TRUE; +} + +// ----------------------------------------------------------------------- + +void SvxBitmapTabPage::Reset( const SfxItemSet& ) +{ + // aLbBitmaps.SelectEntryPos( 0 ); + + aBitmapCtl.SetLines( aCtlPixel.GetLineCount() ); + aBitmapCtl.SetPixelColor( aLbColor.GetSelectEntryColor() ); + aBitmapCtl.SetBackgroundColor( aLbBackgroundColor.GetSelectEntryColor() ); + aBitmapCtl.SetBmpArray( aCtlPixel.GetBitmapPixelPtr() ); + + // Bitmap holen und darstellen + XFillBitmapItem aBmpItem( (const String &) String(), aBitmapCtl.GetXBitmap() ); + rXFSet.Put( aBmpItem ); + aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlPreview.Invalidate(); + + ChangeBitmapHdl_Impl( this ); + + // Status der Buttons ermitteln + if( pBitmapList->Count() ) + { + aBtnAdd.Enable(); + aBtnModify.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + else + { + aBtnModify.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxBitmapTabPage::Create( Window* pWindow, + const SfxItemSet& rSet ) +{ + return new SvxBitmapTabPage( pWindow, rSet ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxBitmapTabPage, ChangeBitmapHdl_Impl, void *, EMPTYARG ) +{ + XOBitmap* pXOBitmap = NULL; + int nPos = aLbBitmaps.GetSelectEntryPos(); + + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + pXOBitmap = new XOBitmap( ( (XBitmapEntry*) pBitmapList->GetBitmap( nPos ) )->GetXBitmap() ); + else + { + const SfxPoolItem* pPoolItem = NULL; + if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLSTYLE ), TRUE, &pPoolItem ) ) + { + XFillStyle eXFS = (XFillStyle) ( ( const XFillStyleItem* ) pPoolItem )->GetValue(); + if( ( XFILL_BITMAP == eXFS ) && + ( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), TRUE, &pPoolItem ) ) ) + { + pXOBitmap = new XOBitmap( ( ( const XFillBitmapItem* ) pPoolItem )->GetBitmapValue() ); + } + } + if( !pXOBitmap ) + { + aLbBitmaps.SelectEntryPos( 0 ); + nPos = aLbBitmaps.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + pXOBitmap = new XOBitmap( ( (XBitmapEntry*) pBitmapList->GetBitmap( nPos ) )->GetXBitmap() ); + } + } + if( pXOBitmap ) + { + //WorkWindow aTmpWW( DLGWIN ); + //VirtualDevice aVD( aTmpWW ); + //USHORT nLines = aCtlPixel.GetLineCount(); + //Color aPixelColor, aBackColor; + //BOOL bPixelColor = FALSE; + //USHORT nWidth = pBitmap->GetSizePixel().Width(); + //USHORT nHeight = pBitmap->GetSizePixel().Height(); + + // #85339# try to convert bitmapped item to array item. + if(pXOBitmap->GetBitmapType() == XBITMAP_IMPORT) + { + Bitmap aBitmap(pXOBitmap->GetBitmap()); + Size aSizePixel(aBitmap.GetSizePixel()); + + if(8 == aSizePixel.Width() && 8 == aSizePixel.Height()) + { + sal_uInt16* pPixelArray = new sal_uInt16[64]; + sal_uInt32 nCol1(0xffffffff); // background + sal_uInt32 nCol2(0xffffffff); // pixel + BitmapReadAccess* pAccess = aBitmap.AcquireReadAccess(); + sal_Bool bValid(TRUE); + + if(pAccess) + { + for(sal_uInt32 a(0); bValid && a < 64; a++) + { + const BitmapColor aBmCol = pAccess->GetColor(a>>3, a%8); + Color aRgbCol(aBmCol.GetRed(), aBmCol.GetGreen(), aBmCol.GetBlue()); + sal_uInt32 nColVal = aRgbCol.GetRGBColor(); + + // test with nCol1 + if(nCol1 != nColVal) + { + if(0xffffffff == nCol1) + { + // nCol1 is used first time + nCol1 = nColVal; + pPixelArray[a] = 0; + } + else + { + // test with nCol2 + if(nCol2 != nColVal) + { + if(0xffffffff == nCol2) + { + // nCol2 used first time + nCol2 = nColVal; + pPixelArray[a] = 1; + } + else + { + // Third color detected + bValid = FALSE; + } + } + else + { + // color is pixel color + pPixelArray[a] = 1; + } + } + } + else + { + // color is background color + pPixelArray[a] = 0; + } + } + + // release ReadAccess + aBitmap.ReleaseAccess(pAccess); + } + else + { + // no access -> no success + bValid = FALSE; + } + + if(bValid) + { + Color aCol1(nCol1); + Color aCol2(nCol2); + + // no pixel color found? Use opposite od background color. + if(0xffffffff == nCol2) + { + aCol2 = Color( + 0xff - aCol1.GetRed(), + 0xff - aCol1.GetGreen(), + 0xff - aCol1.GetBlue()); + } + + // transformation did work, create a new Item + delete pXOBitmap; + pXOBitmap = new XOBitmap(pPixelArray, aCol2, aCol1); + } + + // cleanup + delete[] pPixelArray; + } + } + + aLbColor.SetNoSelection(); + aLbBackgroundColor.SetNoSelection(); + + if( pXOBitmap->GetBitmapType() == XBITMAP_IMPORT ) + { + aCtlPixel.Reset(); + aCtlPixel.SetPaintable( FALSE ); + aCtlPixel.Disable(); + aFtPixelEdit.Disable(); + aFtColor.Disable(); + aLbColor.Disable(); + aFtBackgroundColor.Disable(); + aLbBackgroundColor.Disable(); + aBtnModify.Disable(); + aBtnAdd.Disable(); + } + else if( pXOBitmap->GetBitmapType() == XBITMAP_8X8 ) + { + aCtlPixel.SetPaintable( TRUE ); + aCtlPixel.Enable(); + aFtPixelEdit.Enable(); + aFtColor.Enable(); + aLbColor.Enable(); + aFtBackgroundColor.Enable(); + aLbBackgroundColor.Enable(); + aBtnModify.Enable(); + aBtnAdd.Enable(); + + // Setzen des PixelControls + aCtlPixel.SetXBitmap( *pXOBitmap ); + + Color aPixelColor = pXOBitmap->GetPixelColor(); + Color aBackColor = pXOBitmap->GetBackgroundColor(); + + aBitmapCtl.SetPixelColor( aPixelColor ); + aBitmapCtl.SetBackgroundColor( aBackColor ); + + // Wenn der Eintrag nicht in der Listbox ist, wird die Farbe + // temporaer hinzugenommen + if( 0 == aLbBitmaps.GetSelectEntryPos() ) + { + aLbColor.SelectEntry( Color( COL_BLACK ) ); + ChangePixelColorHdl_Impl( this ); + } + else + aLbColor.SelectEntry( aPixelColor ); + if( aLbColor.GetSelectEntryCount() == 0 ) + { + aLbColor.InsertEntry( aPixelColor, String() ); + aLbColor.SelectEntry( aPixelColor ); + } + aLbBackgroundColor.SelectEntry( aBackColor ); + if( aLbBackgroundColor.GetSelectEntryCount() == 0 ) + { + aLbBackgroundColor.InsertEntry( aBackColor, String() ); + aLbBackgroundColor.SelectEntry( aBackColor ); + } + } + aCtlPixel.Invalidate(); + + // Bitmap darstellen + XFillBitmapItem aXBmpItem( (const String &) String(), *pXOBitmap ); + rXFSet.Put( aXBmpItem ); + + aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlPreview.Invalidate(); + + bBmpChanged = FALSE; + delete pXOBitmap; + } + return 0L; +} + +// ----------------------------------------------------------------------- + +long SvxBitmapTabPage::CheckChanges_Impl() +{ + USHORT nPos = aLbBitmaps.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + String aString = aLbBitmaps.GetSelectEntry(); + + if( bBmpChanged ) + { + ResMgr& rMgr = DIALOG_MGR(); + Image aWarningBoxImage = WarningBox::GetStandardImage(); + //CHINA001 SvxMessDialog aMessDlg( DLGWIN, + //CHINA001 String( SVX_RES( RID_SVXSTR_BITMAP, rMgr ) ), + //CHINA001 String( SVX_RES( RID_SVXSTR_ASK_CHANGE_BITMAP, rMgr ) ), + //CHINA001 &aWarningBoxImage ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX, + String( ResId( RID_SVXSTR_BITMAP, rMgr ) ), + String( ResId( RID_SVXSTR_ASK_CHANGE_BITMAP, rMgr ) ), + &aWarningBoxImage ); + DBG_ASSERT(aMessDlg, "Dialogdiet fail!");//CHINA001 + aMessDlg->SetButtonText( MESS_BTN_1, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_1, + String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) ); + aMessDlg->SetButtonText( MESS_BTN_2, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_2, + String( ResId( RID_SVXSTR_ADD, rMgr ) ) ); + + short nRet = aMessDlg->Execute(); //CHINA001 short nRet = aMessDlg.Execute(); + + switch( nRet ) + { + case RET_BTN_1: // Aendern + { + ClickModifyHdl_Impl( this ); + } + break; + + case RET_BTN_2: // Hinzufuegen + { + ClickAddHdl_Impl( this ); + nPos = aLbBitmaps.GetSelectEntryPos(); + } + break; + + case RET_CANCEL: + // return( -1L ); + break; + // return( TRUE ); // Abbruch + } + delete aMessDlg; //add by CHINA001 + } + } + nPos = aLbBitmaps.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + *pPos = nPos; + return 0L; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxBitmapTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) +{ + ResMgr& rMgr = DIALOG_MGR(); + String aNewName( ResId( RID_SVXSTR_BITMAP, rMgr ) ); + String aDesc( ResId( RID_SVXSTR_DESC_NEW_BITMAP, rMgr ) ); + String aName; + + long nCount = pBitmapList->Count(); + long j = 1; + BOOL bDifferent = FALSE; + + while( !bDifferent ) + { + aName = aNewName; + aName += sal_Unicode(' '); + aName += UniString::CreateFromInt32( j++ ); + bDifferent = TRUE; + + for( long i = 0; i < nCount && bDifferent; i++ ) + if( aName == pBitmapList->GetBitmap( i )->GetName() ) + bDifferent = FALSE; + } + + //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME ); + DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 + WarningBox* pWarnBox = NULL; + USHORT nError = RID_SVXSTR_WARN_NAME_DUPLICATE; + + while( pDlg->Execute() == RET_OK ) + { + pDlg->GetName( aName ); + + bDifferent = TRUE; + + for( long i = 0; i < nCount && bDifferent; i++ ) + if( aName == pBitmapList->GetBitmap( i )->GetName() ) + bDifferent = FALSE; + + if( bDifferent ) { + nError = 0; + break; + } + + if( !pWarnBox ) + { + pWarnBox = new WarningBox( DLGWIN, + WinBits( WB_OK_CANCEL ), + String( ResId( nError, rMgr ) ) ); + pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE ); + } + + if( pWarnBox->Execute() != RET_OK ) + break; + } + //Rectangle aDlgRect( pDlg->GetPosPixel(), pDlg->GetSizePixel() ); + delete pDlg; + delete pWarnBox; + + if( !nError ) + { + XBitmapEntry* pEntry = 0; + if( aCtlPixel.IsEnabled() ) + { + XOBitmap aXOBitmap = aBitmapCtl.GetXBitmap(); + + // #85339# if it's an array, force conversion to bitmap before using it. + if(aXOBitmap.GetBitmapType() == XBITMAP_8X8) + aXOBitmap.GetBitmap(); + + pEntry = new XBitmapEntry( aXOBitmap, aName ); + } + else // Es muss sich um eine nicht vorhandene importierte Bitmap handeln + { + const SfxPoolItem* pPoolItem = NULL; + if( SFX_ITEM_SET == rOutAttrs.GetItemState( XATTR_FILLBITMAP, TRUE, &pPoolItem ) ) + { + XOBitmap aXOBitmap( ( ( const XFillBitmapItem* ) pPoolItem )->GetBitmapValue() ); + pEntry = new XBitmapEntry( aXOBitmap, aName ); + } + } + + DBG_ASSERT( pEntry, "SvxBitmapTabPage::ClickAddHdl_Impl(), pEntry == 0 ?" ); + + if( pEntry ) + { + pBitmapList->Insert( pEntry ); + + aLbBitmaps.Append( pEntry ); + aLbBitmaps.SelectEntryPos( aLbBitmaps.GetEntryCount() - 1 ); + +#ifdef WNT + // hack: #31355# W.P. + Rectangle aRect( aLbBitmaps.GetPosPixel(), aLbBitmaps.GetSizePixel() ); + if( TRUE ) { // ??? overlapped with pDlg + // and srolling + Invalidate( aRect ); + //aLbBitmaps.Invalidate(); + } +#endif + + // Flag fuer modifiziert setzen + *pnBitmapListState |= CT_MODIFIED; + + ChangeBitmapHdl_Impl( this ); + } + } + + // Status der Buttons ermitteln + if( pBitmapList->Count() ) + { + aBtnModify.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + return 0L; +} + + +/******************************************************************************/ +/******************************************************************************/ + + +//------------------------------------------------------------------------ + +#ifdef _MSC_VER +#pragma optimize ( "", off ) +#endif + +IMPL_LINK( SvxBitmapTabPage, ClickImportHdl_Impl, void *, EMPTYARG ) +{ + ResMgr& rMgr = DIALOG_MGR(); + SvxOpenGraphicDialog aDlg( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "Import" ) ) ); + aDlg.EnableLink(sal_False); + + if( !aDlg.Execute() ) + { + Graphic aGraphic; + int nError = 1; + + EnterWait(); + nError = aDlg.GetGraphic( aGraphic ); + LeaveWait(); + + if( !nError ) + { + String aDesc( ResId(RID_SVXSTR_DESC_EXT_BITMAP, rMgr) ); + WarningBox* pWarnBox = NULL; + + // convert file URL to UI name + String aName; + INetURLObject aURL( aDlg.GetPath() ); + //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aURL.GetName().GetToken( 0, '.' ), aDesc ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, String(aURL.GetName()).GetToken( 0, '.' ), aDesc, RID_SVXDLG_NAME ); + DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 + nError = RID_SVXSTR_WARN_NAME_DUPLICATE; + + while( pDlg->Execute() == RET_OK ) + { + pDlg->GetName( aName ); + + BOOL bDifferent = TRUE; + long nCount = pBitmapList->Count(); + + for( long i = 0; i < nCount && bDifferent; i++ ) + if( aName == pBitmapList->GetBitmap( i )->GetName() ) + bDifferent = FALSE; + + if( bDifferent ) { + nError = 0; + break; + } + + if( !pWarnBox ) + { + pWarnBox = new WarningBox( DLGWIN, + WinBits( WB_OK_CANCEL ), + String( ResId( nError, rMgr ) ) ); + pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE ); + } + + + if( pWarnBox->Execute() != RET_OK ) + break; + } + //Rectangle aDlgRect( pDlg->GetPosPixel(), pDlg->GetSizePixel() ); + delete pDlg; + delete pWarnBox; + + if( !nError ) + { + Bitmap aBmp( aGraphic.GetBitmap() ); + XBitmapEntry* pEntry = + new XBitmapEntry( XOBitmap( aBmp ), aName ); + pBitmapList->Insert( pEntry ); + + aLbBitmaps.Append( pEntry ); + aLbBitmaps.SelectEntryPos( aLbBitmaps.GetEntryCount() - 1 ); + +#ifdef WNT + // hack: #31355# W.P. + Rectangle aRect( aLbBitmaps.GetPosPixel(), aLbBitmaps.GetSizePixel() ); + if( TRUE ) { // ??? overlapped with pDlg + // and srolling + Invalidate( aRect ); + //aLbBitmaps.Invalidate(); + } +#endif + + // Flag fuer modifiziert setzen + *pnBitmapListState |= CT_MODIFIED; + + ChangeBitmapHdl_Impl( this ); + } + } + else + // Graphik konnte nicht geladen werden + ErrorBox( DLGWIN, + WinBits( WB_OK ), + String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute(); + } + + return 0L; +} + +#ifdef _MSC_VER +#pragma optimize ( "", on ) +#endif + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxBitmapTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) +{ + USHORT nPos = aLbBitmaps.GetSelectEntryPos(); + + if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + ResMgr& rMgr = DIALOG_MGR(); + String aNewName( ResId( RID_SVXSTR_BITMAP, rMgr ) ); + String aDesc( ResId( RID_SVXSTR_DESC_NEW_BITMAP, rMgr ) ); + String aName( pBitmapList->GetBitmap( nPos )->GetName() ); + String aOldName = aName; + + //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME ); + DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 + + long nCount = pBitmapList->Count(); + BOOL bDifferent = FALSE; + BOOL bLoop = TRUE; + + while( bLoop && pDlg->Execute() == RET_OK ) + { + pDlg->GetName( aName ); + bDifferent = TRUE; + + for( long i = 0; i < nCount && bDifferent; i++ ) + { + if( aName == pBitmapList->GetBitmap( i )->GetName() && + aName != aOldName ) + bDifferent = FALSE; + } + + if( bDifferent ) + { + bLoop = FALSE; + XBitmapEntry* pEntry = pBitmapList->GetBitmap( nPos ); + + pEntry->SetName( aName ); + + XOBitmap aXOBitmap = aBitmapCtl.GetXBitmap(); + + // #85339# if it's an array, force conversion to bitmap before using it. + if(aXOBitmap.GetBitmapType() == XBITMAP_8X8) + aXOBitmap.GetBitmap(); + + pEntry->SetXBitmap( aXOBitmap ); + + aLbBitmaps.Modify( pEntry, nPos ); + aLbBitmaps.SelectEntryPos( nPos ); + + // Flag fuer modifiziert setzen + *pnBitmapListState |= CT_MODIFIED; + + bBmpChanged = FALSE; + } + else + { + WarningBox aBox( DLGWIN, WinBits( WB_OK ), String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); + aBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); + aBox.Execute(); + } + } + delete pDlg; + } + return 0L; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxBitmapTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) +{ + USHORT nPos = aLbBitmaps.GetSelectEntryPos(); + + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ), +//! SVX_RES( RID_SVXSTR_DEL_BITMAP ), + String( SVX_RES( RID_SVXSTR_ASK_DEL_BITMAP ) ) ); + + if( aQueryBox.Execute() == RET_YES ) + { + delete pBitmapList->Remove( nPos ); + aLbBitmaps.RemoveEntry( nPos ); + aLbBitmaps.SelectEntryPos( 0 ); + + aCtlPreview.Invalidate(); + aCtlPixel.Invalidate(); + + ChangeBitmapHdl_Impl( this ); + + // Flag fuer modifiziert setzen + *pnBitmapListState |= CT_MODIFIED; + } + } + // Status der Buttons ermitteln + if( !pBitmapList->Count() ) + { + aBtnModify.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } + return 0L; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxBitmapTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) +{ + USHORT nReturn = RET_YES; + ResMgr& rMgr = DIALOG_MGR(); + + if ( *pnBitmapListState & CT_MODIFIED ) + { + nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ), + String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute(); + + if ( nReturn == RET_YES ) + pBitmapList->Save(); + } + + if ( nReturn != RET_CANCEL ) + { + ::sfx2::FileDialogHelper aDlg( + com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, + 0 ); + String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sob" ) ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + + if ( aDlg.Execute() == ERRCODE_NONE ) + { + EnterWait(); + INetURLObject aURL( aDlg.GetPath() ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + // Tabelle speichern + XBitmapList* pBmpList = new XBitmapList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); + pBmpList->SetName( aURL.getName() ); + if( pBmpList->Load() ) + { + if( pBmpList ) + { + // Pruefen, ob Tabelle geloescht werden darf: + if( pBitmapList != ( (SvxAreaTabDialog*) DLGWIN )->GetBitmapList() ) + delete pBitmapList; + + pBitmapList = pBmpList; + ( (SvxAreaTabDialog*) DLGWIN )->SetNewBitmapList( pBitmapList ); + + aLbBitmaps.Clear(); + aLbBitmaps.Fill( pBitmapList ); + Reset( rOutAttrs ); + + pBitmapList->SetName( aURL.getName() ); + + // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( ResId( RID_SVXSTR_TABLE, rMgr ) ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + + if ( aURL.getBase().getLength() > 18 ) + { + aString += String(aURL.getBase()).Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String(aURL.getBase()); + + // Flag fuer gewechselt setzen + *pnBitmapListState |= CT_CHANGED; + // Flag fuer modifiziert entfernen + *pnBitmapListState &= ~CT_MODIFIED; + } + LeaveWait(); + } + else + { + LeaveWait(); + ErrorBox( DLGWIN, WinBits( WB_OK ), + String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute(); + } + } + } + + // Status der Buttons ermitteln + if( pBitmapList->Count() ) + { + aBtnModify.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + else + { + aBtnModify.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } + return 0L; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxBitmapTabPage, ClickSaveHdl_Impl, void *, EMPTYARG ) +{ + ::sfx2::FileDialogHelper aDlg( + com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 ); + String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sob" ) ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + if( pBitmapList->GetName().Len() ) + { + aFile.Append( pBitmapList->GetName() ); + + if( !aFile.getExtension().getLength() ) + aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "sob" ) ) ); + } + + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + if ( aDlg.Execute() == ERRCODE_NONE ) + { + INetURLObject aURL( aDlg.GetPath() ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + pBitmapList->SetName( aURL.getName() ); + pBitmapList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); + + if( pBitmapList->Save() ) + { + // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( SVX_RES( RID_SVXSTR_TABLE ) ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + + if ( aURL.getBase().getLength() > 18 ) + { + aString += String(aURL.getBase()).Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String(aURL.getBase()); + + // Flag fuer gespeichert setzen + *pnBitmapListState |= CT_SAVED; + // Flag fuer modifiziert entfernen + *pnBitmapListState &= ~CT_MODIFIED; + } + else + { + ErrorBox( DLGWIN, WinBits( WB_OK ), + String( SVX_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute(); + } + } + + return 0L; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxBitmapTabPage, ChangePixelColorHdl_Impl, void *, EMPTYARG ) +{ + aCtlPixel.SetPixelColor( aLbColor.GetSelectEntryColor() ); + aCtlPixel.Invalidate(); + + aBitmapCtl.SetPixelColor( aLbColor.GetSelectEntryColor() ); + + // Bitmap holen und darstellen + rXFSet.Put( XFillBitmapItem( String(), aBitmapCtl.GetXBitmap() ) ); + aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlPreview.Invalidate(); + + bBmpChanged = TRUE; + + return 0L; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxBitmapTabPage, ChangeBackgrndColorHdl_Impl, void *, EMPTYARG ) +{ + aCtlPixel.SetBackgroundColor( aLbBackgroundColor.GetSelectEntryColor() ); + aCtlPixel.Invalidate(); + + aBitmapCtl.SetBackgroundColor( aLbBackgroundColor.GetSelectEntryColor() ); + + // Bitmap holen und darstellen + rXFSet.Put( XFillBitmapItem( String(), aBitmapCtl.GetXBitmap() ) ); + aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlPreview.Invalidate(); + + bBmpChanged = TRUE; + + return 0L; +} + +//------------------------------------------------------------------------ + +void SvxBitmapTabPage::PointChanged( Window* pWindow, RECT_POINT ) +{ + if( pWindow == &aCtlPixel ) + { + aBitmapCtl.SetBmpArray( aCtlPixel.GetBitmapPixelPtr() ); + + // Bitmap holen und darstellen + rXFSet.Put( XFillBitmapItem( String(), aBitmapCtl.GetXBitmap() ) ); + aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlPreview.Invalidate(); + + bBmpChanged = TRUE; + } +} + + + + +Window* SvxBitmapTabPage::GetParentLabeledBy( const Window* pLabeled ) const +{ + if (pLabeled == &aLbBitmaps) + return const_cast(&aLbBitmapsHidden); + else + return SvxTabPage::GetParentLabeledBy (pLabeled); +} diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx new file mode 100644 index 000000000000..86c1b5ab7565 --- /dev/null +++ b/cui/source/tabpages/tpcolor.cxx @@ -0,0 +1,1280 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tpcolor.cxx,v $ + * $Revision: 1.33 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" + +#define _SVX_TPCOLOR_CXX + +#include +#include "helpid.hrc" +#include "svx/xattr.hxx" +#include +#include +#include "svx/drawitem.hxx" +#include "cuitabarea.hxx" +#include "tabarea.hrc" +#include "defdlgname.hxx" //CHINA001 #include "dlgname.hxx" +//#include "dlgname.hrc" +#include //CHINA001 +#include +#include + +#define DLGWIN GetParentDialog( this ) + +/************************************************************************* +|* +|* Dialog zum Aendern und Definieren der Farben +|* +\************************************************************************/ + +static Window* GetParentDialog( Window* pWindow ) +{ + while( pWindow ) + { + if( pWindow->IsDialog() ) + break; + + pWindow = pWindow->GetParent(); + } + + return pWindow; +} + +SvxColorTabPage::SvxColorTabPage +( + Window* pParent, + const SfxItemSet& rInAttrs +) : + + SfxTabPage ( pParent, SVX_RES( RID_SVXPAGE_COLOR ), rInAttrs ), + + aFlProp ( this, SVX_RES( FL_PROP ) ), + aFtName ( this, SVX_RES( FT_NAME ) ), + aEdtName ( this, SVX_RES( EDT_NAME ) ), + aFtColor ( this, SVX_RES( FT_COLOR ) ), + aLbColor ( this, SVX_RES( LB_COLOR ) ), + + aTableNameFT ( this, SVX_RES( FT_TABLE_NAME ) ), + aValSetColorTable ( this, SVX_RES( CTL_COLORTABLE ) ), + + aCtlPreviewOld ( this, SVX_RES( CTL_PREVIEW_OLD ) ), + aCtlPreviewNew ( this, SVX_RES( CTL_PREVIEW_NEW ) ), + + aLbColorModel ( this, SVX_RES( LB_COLORMODEL ) ), + aFtColorModel1 ( this, SVX_RES( FT_1 ) ), + aMtrFldColorModel1 ( this, SVX_RES( MTR_FLD_1 ) ), + aFtColorModel2 ( this, SVX_RES( FT_2 ) ), + aMtrFldColorModel2 ( this, SVX_RES( MTR_FLD_2 ) ), + aFtColorModel3 ( this, SVX_RES( FT_3 ) ), + aMtrFldColorModel3 ( this, SVX_RES( MTR_FLD_3 ) ), + aFtColorModel4 ( this, SVX_RES( FT_4 ) ), + aMtrFldColorModel4 ( this, SVX_RES( MTR_FLD_4 ) ), + aBtnAdd ( this, SVX_RES( BTN_ADD ) ), + aBtnModify ( this, SVX_RES( BTN_MODIFY ) ), + aBtnWorkOn ( this, SVX_RES( BTN_WORK_ON ) ), + aBtnDelete ( this, SVX_RES( BTN_DELETE ) ), + aBtnLoad ( this, SVX_RES( BTN_LOAD ) ), + aBtnSave ( this, SVX_RES( BTN_SAVE ) ), + + rOutAttrs ( rInAttrs ), + pColorTab( NULL ), + + bDeleteColorTable ( TRUE ), + + pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), + aXFStyleItem ( XFILL_SOLID ), + aXFillColorItem ( String(), Color( COL_BLACK ) ), + aXFillAttr ( pXPool ), + rXFSet ( aXFillAttr.GetItemSet() ), + + eCM ( CM_RGB ) + +{ + aBtnLoad.SetModeImage( Image( SVX_RES( RID_SVXIMG_LOAD_H ) ), BMP_COLOR_HIGHCONTRAST ); + aBtnSave.SetModeImage( Image( SVX_RES( RID_SVXIMG_SAVE_H ) ), BMP_COLOR_HIGHCONTRAST ); + + FreeResource(); + + // diese Page braucht ExchangeSupport + SetExchangeSupport(); + + // Setzen des Output-Devices + rXFSet.Put( aXFStyleItem ); + rXFSet.Put( aXFillColorItem ); + aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); + + // Handler ueberladen + aLbColor.SetSelectHdl( + LINK( this, SvxColorTabPage, SelectColorLBHdl_Impl ) ); + aValSetColorTable.SetSelectHdl( + LINK( this, SvxColorTabPage, SelectValSetHdl_Impl ) ); + aLbColorModel.SetSelectHdl( + LINK( this, SvxColorTabPage, SelectColorModelHdl_Impl ) ); + + Link aLink = LINK( this, SvxColorTabPage, ModifiedHdl_Impl ); + aMtrFldColorModel1.SetModifyHdl( aLink ); + aMtrFldColorModel2.SetModifyHdl( aLink ); + aMtrFldColorModel3.SetModifyHdl( aLink ); + aMtrFldColorModel4.SetModifyHdl( aLink ); + + aBtnAdd.SetClickHdl( LINK( this, SvxColorTabPage, ClickAddHdl_Impl ) ); + aBtnModify.SetClickHdl( + LINK( this, SvxColorTabPage, ClickModifyHdl_Impl ) ); + aBtnWorkOn.SetClickHdl( + LINK( this, SvxColorTabPage, ClickWorkOnHdl_Impl ) ); + aBtnDelete.SetClickHdl( + LINK( this, SvxColorTabPage, ClickDeleteHdl_Impl ) ); + aBtnLoad.SetClickHdl( LINK( this, SvxColorTabPage, ClickLoadHdl_Impl ) ); + aBtnSave.SetClickHdl( LINK( this, SvxColorTabPage, ClickSaveHdl_Impl ) ); + + // ValueSet + aValSetColorTable.SetStyle( aValSetColorTable.GetStyle() | WB_VSCROLL | WB_ITEMBORDER ); + aValSetColorTable.SetColCount( 8 ); + aValSetColorTable.SetLineCount( 10 ); + aValSetColorTable.SetExtraSpacing( 0 ); + aValSetColorTable.Show(); + +} + +// ----------------------------------------------------------------------- + +void SvxColorTabPage::Construct() +{ + aLbColor.Fill( pColorTab ); + FillValueSet_Impl( aValSetColorTable ); +} + +// ----------------------------------------------------------------------- + +void SvxColorTabPage::ActivatePage( const SfxItemSet& ) +{ + if( *pDlgType == 0 ) // Flaechen-Dialog + { + *pbAreaTP = FALSE; + + if( pColorTab ) + { + if( *pPageType == PT_COLOR && *pPos != LISTBOX_ENTRY_NOTFOUND ) + { + aLbColor.SelectEntryPos( *pPos ); + aValSetColorTable.SelectItem( aLbColor.GetSelectEntryPos() + 1 ); + aEdtName.SetText( aLbColor.GetSelectEntry() ); + + ChangeColorHdl_Impl( this ); + } + else if( *pPageType == PT_COLOR && *pPos == LISTBOX_ENTRY_NOTFOUND ) + { + const SfxPoolItem* pPoolItem = NULL; + if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), TRUE, &pPoolItem ) ) + { + aLbColorModel.SelectEntryPos( CM_RGB ); + + aAktuellColor.SetColor ( ( ( const XFillColorItem* ) pPoolItem )->GetColorValue().GetColor() ); + + aEdtName.SetText( ( ( const XFillColorItem* ) pPoolItem )->GetName() ); + + aMtrFldColorModel1.SetValue( ColorToPercent_Impl( aAktuellColor.GetRed() ) ); + aMtrFldColorModel2.SetValue( ColorToPercent_Impl( aAktuellColor.GetGreen() ) ); + aMtrFldColorModel3.SetValue( ColorToPercent_Impl( aAktuellColor.GetBlue() ) ); + + // ItemSet fuellen und an XOut weiterleiten + rXFSet.Put( XFillColorItem( String(), aAktuellColor ) ); + aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); + + aCtlPreviewNew.Invalidate(); + aCtlPreviewOld.Invalidate(); + } + } + + // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + INetURLObject aURL( pColorTab->GetPath() ); + + aURL.Append( pColorTab->GetName() ); + DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + if ( aURL.getBase().getLength() > 18 ) + { + aString += String(aURL.getBase()).Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String(aURL.getBase()); + + aTableNameFT.SetText( aString ); + + // Damit evtl. geaenderte Farbe verworfen wird + SelectColorLBHdl_Impl( this ); + + *pPageType = PT_COLOR; + *pPos = LISTBOX_ENTRY_NOTFOUND; + } + } + else + { + // Buttons werden gehided, weil Paletten z.Z. nur + // ueber den AreaDlg funktionieren!!! + // ActivatePage() muss von anderen Dialogen explizit + // gerufen werden, da ActivatePage() nicht gerufen wird, + // wenn Seite als Erste im Dialog angezeigt wird + aBtnLoad.Hide(); + aBtnSave.Hide(); + } +} + +// ----------------------------------------------------------------------- + +int SvxColorTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if ( CheckChanges_Impl() == -1L ) + return( KEEP_PAGE ); + + if( _pSet ) + FillItemSet( *_pSet ); + + return( LEAVE_PAGE ); +} + +// ----------------------------------------------------------------------- + +long SvxColorTabPage::CheckChanges_Impl() +{ + // wird hier benutzt, um Aenderungen NICHT zu verlieren + + Color aTmpColor (aAktuellColor); + if (eCM != CM_RGB) + ConvertColorValues (aTmpColor, CM_RGB); + + USHORT nPos = aLbColor.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + Color aColor = pColorTab->GetColor( nPos )->GetColor(); + String aString = aLbColor.GetSelectEntry(); + + // aNewColor, da COL_USER != COL_irgendwas, auch wenn RGB-Werte gleich + // Color aNewColor( aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue() ); + + if( ColorToPercent_Impl( aTmpColor.GetRed() ) != ColorToPercent_Impl( aColor.GetRed() ) || + ColorToPercent_Impl( aTmpColor.GetGreen() ) != ColorToPercent_Impl( aColor.GetGreen() ) || + ColorToPercent_Impl( aTmpColor.GetBlue() ) != ColorToPercent_Impl( aColor.GetBlue() ) || + aString != aEdtName.GetText() ) + { + ResMgr& rMgr = DIALOG_MGR(); + Image aWarningBoxImage = WarningBox::GetStandardImage(); + //CHINA001 SvxMessDialog aMessDlg( DLGWIN, + //CHINA001 String( SVX_RES( RID_SVXSTR_COLOR, pMgr ) ), + //CHINA001 String( ResId( RID_SVXSTR_ASK_CHANGE_COLOR, pMgr ) ), + //CHINA001 &aWarningBoxImage ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX, + String( ResId( RID_SVXSTR_COLOR, rMgr ) ), + String( ResId( RID_SVXSTR_ASK_CHANGE_COLOR, rMgr ) ), + &aWarningBoxImage ); + DBG_ASSERT(aMessDlg, "Dialogdiet fail!");//CHINA001 + aMessDlg->SetButtonText( MESS_BTN_1, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_1, + String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) ); + aMessDlg->SetButtonText( MESS_BTN_2, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_2, + String( ResId( RID_SVXSTR_ADD, rMgr ) ) ); + + short nRet = aMessDlg->Execute(); //CHINA001 short nRet = aMessDlg.Execute(); + + switch( nRet ) + { + case RET_BTN_1: // Aendern + { + ClickModifyHdl_Impl( this ); + aColor = pColorTab->GetColor( nPos )->GetColor(); + } + break; + + case RET_BTN_2: // Hinzufuegen + { + ClickAddHdl_Impl( this ); + nPos = aLbColor.GetSelectEntryPos(); + aColor = pColorTab->GetColor( nPos )->GetColor(); + } + break; + + case RET_CANCEL: + // return( -1L ); <-- wuerde die Seite nicht verlassen + break; + // return( TRUE ); // Abbruch + } + delete aMessDlg; //add by CHINA001 + } + } + if( *pDlgType == 0 ) // Flaechen-Dialog + { + nPos = aLbColor.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + *pPos = nPos; + } + } + return( 0L ); +} + +// ----------------------------------------------------------------------- + +BOOL SvxColorTabPage::FillItemSet( SfxItemSet& rSet ) +{ + if( ( *pDlgType != 0 ) || + ( *pPageType == PT_COLOR && *pbAreaTP == FALSE ) ) + { + String aString; + Color aColor; + + // CheckChanges_Impl(); <-- doppelte Abfrage ? + + USHORT nPos = aLbColor.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + aColor = pColorTab->GetColor( nPos )->GetColor(); + aString = aLbColor.GetSelectEntry(); + } + else + { + aColor.SetColor (aAktuellColor.GetColor()); + if (eCM != CM_RGB) + ConvertColorValues (aColor, CM_RGB); + } + rSet.Put( XFillColorItem( aString, aColor ) ); + rSet.Put( XFillStyleItem( XFILL_SOLID ) ); + } + + return( TRUE ); +} + +// ----------------------------------------------------------------------- + +void SvxColorTabPage::Reset( const SfxItemSet& rSet ) +{ + USHORT nState = rSet.GetItemState( XATTR_FILLCOLOR ); + + if ( nState >= SFX_ITEM_DEFAULT ) + { + XFillColorItem aColorItem( (const XFillColorItem&)rSet.Get( XATTR_FILLCOLOR ) ); + aLbColor.SelectEntry( aColorItem.GetColorValue() ); + aValSetColorTable.SelectItem( aLbColor.GetSelectEntryPos() + 1 ); + aEdtName.SetText( aLbColor.GetSelectEntry() ); + } + + // Farbmodell setzen + String aStr = GetUserData(); + aLbColorModel.SelectEntryPos( (USHORT) aStr.ToInt32() ); + + ChangeColorHdl_Impl( this ); + SelectColorModelHdl_Impl( this ); + + aCtlPreviewOld.Invalidate(); + + // Status der Buttons ermitteln + if( pColorTab->Count() ) + { + aBtnModify.Enable(); + aBtnWorkOn.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + else + { + aBtnModify.Disable(); + aBtnWorkOn.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxColorTabPage::Create( Window* pWindow, + const SfxItemSet& rOutAttrs ) +{ + return( new SvxColorTabPage( pWindow, rOutAttrs ) ); +} + +//------------------------------------------------------------------------ + +// +// Wird aufgerufen, wenn Inhalt der MtrFileds f�r Farbwerte ver�ndert wird +// +IMPL_LINK( SvxColorTabPage, ModifiedHdl_Impl, void *, EMPTYARG ) +{ + // lese aktuelle MtrFields aus, wenn cmyk, dann k-Wert als Trans.-Farbe + aAktuellColor.SetColor ( Color( (UINT8)PercentToColor_Impl( (USHORT) aMtrFldColorModel4.GetValue() ), + (UINT8)PercentToColor_Impl( (USHORT) aMtrFldColorModel1.GetValue() ), + (UINT8)PercentToColor_Impl( (USHORT) aMtrFldColorModel2.GetValue() ), + (UINT8)PercentToColor_Impl( (USHORT) aMtrFldColorModel3.GetValue() ) ).GetColor() ); + + Color aTmpColor(aAktuellColor); + if (eCM != CM_RGB) + ConvertColorValues (aTmpColor, CM_RGB); + + rXFSet.Put( XFillColorItem( String(), aTmpColor ) ); + aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); + + aCtlPreviewNew.Invalidate(); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +// +// Button 'Hinzuf�gen' +// +IMPL_LINK( SvxColorTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) +{ + Window *pWindow = this; + bool bEnabled; + while( pWindow ) + { + bEnabled = pWindow->IsEnabled(); + pWindow = pWindow->GetParent(); + } + + ResMgr& rMgr = DIALOG_MGR(); + String aDesc( ResId( RID_SVXSTR_DESC_COLOR, rMgr ) ); + String aName( aEdtName.GetText() ); + XColorEntry* pEntry; + long nCount = pColorTab->Count(); + BOOL bDifferent = TRUE; + + // Pruefen, ob Name schon vorhanden ist + for ( long i = 0; i < nCount && bDifferent; i++ ) + if ( aName == pColorTab->GetColor( i )->GetName() ) + bDifferent = FALSE; + + // Wenn ja, wird wiederholt ein neuer Name angefordert + if ( !bDifferent ) + { + WarningBox aWarningBox( DLGWIN, WinBits( WB_OK ), + String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); + aWarningBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); + aWarningBox.Execute(); + + //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME ); + DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 + BOOL bLoop = TRUE; + + while ( !bDifferent && bLoop && pDlg->Execute() == RET_OK ) + { + pDlg->GetName( aName ); + bDifferent = TRUE; + + for( long i = 0; i < nCount && bDifferent; i++ ) + { + if( aName == pColorTab->GetColor( i )->GetName() ) + bDifferent = FALSE; + } + + if( bDifferent ) + bLoop = FALSE; + else + aWarningBox.Execute(); + } + delete( pDlg ); + } + + // Wenn nicht vorhanden, wird Eintrag aufgenommen + if( bDifferent ) + { + if (eCM != CM_RGB) + ConvertColorValues (aAktuellColor, CM_RGB); + pEntry = new XColorEntry( aAktuellColor, aName ); + + pColorTab->Insert( pColorTab->Count(), pEntry ); + + aLbColor.Append( pEntry ); + aValSetColorTable.InsertItem( aValSetColorTable.GetItemCount() + 1, + pEntry->GetColor(), pEntry->GetName() ); + + aLbColor.SelectEntryPos( aLbColor.GetEntryCount() - 1 ); + + // Flag fuer modifiziert setzen + *pnColorTableState |= CT_MODIFIED; + + SelectColorLBHdl_Impl( this ); + } + // Status der Buttons ermitteln + if( pColorTab->Count() ) + { + aBtnModify.Enable(); + aBtnWorkOn.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + return( 0L ); +} + +//------------------------------------------------------------------------ + +// +// Button '�ndern' +// +IMPL_LINK( SvxColorTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) +{ + USHORT nPos = aLbColor.GetSelectEntryPos(); + + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + ResMgr& rMgr = DIALOG_MGR(); + String aDesc( ResId( RID_SVXSTR_DESC_COLOR, rMgr ) ); + String aName( aEdtName.GetText() ); + long nCount = pColorTab->Count(); + BOOL bDifferent = TRUE; + + // Pruefen, ob Name schon vorhanden ist + for ( long i = 0; i < nCount && bDifferent; i++ ) + if ( aName == pColorTab->GetColor( i )->GetName() && nPos != i ) + bDifferent = FALSE; + + // Wenn ja, wird wiederholt ein neuer Name angefordert + if ( !bDifferent ) + { + WarningBox aWarningBox( DLGWIN, WinBits( WB_OK ), + String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); + aWarningBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); + aWarningBox.Execute(); + + //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME ); + DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 + BOOL bLoop = TRUE; + + while ( !bDifferent && bLoop && pDlg->Execute() == RET_OK ) + { + pDlg->GetName( aName ); + bDifferent = TRUE; + + for ( long i = 0; i < nCount && bDifferent; i++ ) + if( aName == pColorTab->GetColor( i )->GetName() && nPos != i ) + bDifferent = FALSE; + + if( bDifferent ) + bLoop = FALSE; + else + aWarningBox.Execute(); + } + delete( pDlg ); + } + + // Wenn nicht vorhanden, wird Eintrag aufgenommen + if( bDifferent ) + { + XColorEntry* pEntry = pColorTab->GetColor( nPos ); + + Color aTmpColor (aAktuellColor); + if (eCM != CM_RGB) + ConvertColorValues (aTmpColor, CM_RGB); + + pEntry->SetColor( aTmpColor ); + pEntry->SetName( aName ); + + aLbColor.Modify( pEntry, nPos ); + aLbColor.SelectEntryPos( nPos ); + ///// + aValSetColorTable.SetItemColor( nPos + 1, pEntry->GetColor() ); + aValSetColorTable.SetItemText( nPos + 1, pEntry->GetName() ); + aEdtName.SetText( aName ); + + aCtlPreviewOld.Invalidate(); + + // Flag fuer modifiziert setzen + *pnColorTableState |= CT_MODIFIED; + } + } + return( 0L ); +} + +//------------------------------------------------------------------------ + +// +// Button 'Bearbeiten' +// +IMPL_LINK( SvxColorTabPage, ClickWorkOnHdl_Impl, void *, EMPTYARG ) +{ + SvColorDialog* pColorDlg = new SvColorDialog( DLGWIN ); + + Color aTmpColor (aAktuellColor); + if (eCM != CM_RGB) + ConvertColorValues (aTmpColor, CM_RGB); + + pColorDlg->SetColor (aTmpColor); + + if( pColorDlg->Execute() == RET_OK ) + { + USHORT nK = 0; + Color aPreviewColor = pColorDlg->GetColor(); + aAktuellColor = aPreviewColor; + if (eCM != CM_RGB) + ConvertColorValues (aAktuellColor, eCM); + + aMtrFldColorModel1.SetValue( ColorToPercent_Impl( aAktuellColor.GetRed() ) ); + aMtrFldColorModel2.SetValue( ColorToPercent_Impl( aAktuellColor.GetGreen() ) ); + aMtrFldColorModel3.SetValue( ColorToPercent_Impl( aAktuellColor.GetBlue() ) ); + aMtrFldColorModel4.SetValue( ColorToPercent_Impl( nK ) ); + + // ItemSet fuellen und an XOut weiterleiten + rXFSet.Put( XFillColorItem( String(), aPreviewColor ) ); + //aCtlPreviewOld.SetAttributes( aXFillAttr ); + aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); + + aCtlPreviewNew.Invalidate(); + } + delete( pColorDlg ); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +// +// Button 'Loeschen' +// +IMPL_LINK( SvxColorTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) +{ + USHORT nPos = aLbColor.GetSelectEntryPos(); + + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ), + String( SVX_RES( RID_SVXSTR_ASK_DEL_COLOR ) ) ); + + if( aQueryBox.Execute() == RET_YES ) + { + // Jetzt wird richtig geloescht + ULONG nCount = pColorTab->Count() - 1; + XColorEntry* pEntry; + + pEntry = pColorTab->Remove( nPos ); + DBG_ASSERT( pEntry, "ColorEntry nicht vorhanden (1) !" ); + delete pEntry; + + for( ULONG i = nPos; i < nCount; i++ ) + { + pEntry = pColorTab->Remove( i + 1 ); + DBG_ASSERT( pEntry, "ColorEntry nicht vorhanden (2) !" ); + pColorTab->Insert( i, pEntry ); + } + + // Listbox und ValueSet aktualisieren + aLbColor.RemoveEntry( nPos ); + aValSetColorTable.Clear(); + FillValueSet_Impl( aValSetColorTable ); + + // Positionieren + aLbColor.SelectEntryPos( nPos ); + SelectColorLBHdl_Impl( this ); + + aCtlPreviewOld.Invalidate(); + + // Flag fuer modifiziert setzen + *pnColorTableState |= CT_MODIFIED; + } + } + // Status der Buttons ermitteln + if( !pColorTab->Count() ) + { + aBtnModify.Disable(); + aBtnWorkOn.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } + return( 0L ); +} + +// ----------------------------------------------------------------------- + +// +// Button 'Farbtabelle laden' +// +IMPL_LINK( SvxColorTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) +{ + ResMgr& rMgr = DIALOG_MGR(); + USHORT nReturn = RET_YES; + + if( *pnColorTableState & CT_MODIFIED ) + { + nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ), + String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute(); + + if ( nReturn == RET_YES ) + pColorTab->Save(); + } + + if ( nReturn != RET_CANCEL ) + { + ::sfx2::FileDialogHelper aDlg( + com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, + 0 ); + String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soc" ) ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + + if ( aDlg.Execute() == ERRCODE_NONE ) + { + INetURLObject aURL( aDlg.GetPath() ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + // Tabelle speichern + XColorTable* pColTab = new XColorTable( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); + pColTab->SetName( aURL.getName() ); // XXX + if( pColTab->Load() ) + { + if( pColTab ) + { + // Pruefen, ob Tabelle geloescht werden darf: + const XColorTable *pTempTable = 0; + SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( DLGWIN ); + SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( DLGWIN ); + if( pArea ) + { + pTempTable = pArea->GetColorTable(); + } + else if( pLine ) + { + pTempTable = pLine->GetColorTable(); + } + + if( pColorTab != pTempTable ) + { + if( bDeleteColorTable ) + delete pColorTab; + else + bDeleteColorTable = TRUE; + } + + pColorTab = pColTab; + if( pArea ) + { + pArea->SetNewColorTable( pColorTab ); + } + else if( pLine ) + { + pLine->SetNewColorTable( pColorTab ); + } + + aLbColor.Clear(); + aValSetColorTable.Clear(); + Construct(); + Reset( rOutAttrs ); + + pColorTab->SetName( aURL.getName() ); + + // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( ResId( RID_SVXSTR_TABLE, rMgr ) ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + + if ( aURL.getBase().getLength() > 18 ) + { + aString += String(aURL.getBase()).Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String(aURL.getBase()); + + aTableNameFT.SetText( aString ); + + // Flag fuer gewechselt setzen + *pnColorTableState |= CT_CHANGED; + // Flag fuer modifiziert entfernen + *pnColorTableState &= ~CT_MODIFIED; + + if( aLbColor.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ) + aLbColor.SelectEntryPos( 0 ); + else + aLbColor.SelectEntryPos( aLbColor.GetSelectEntryPos() ); + + ChangeColorHdl_Impl( this ); + SelectColorLBHdl_Impl( this ); + } + } + else + { + //aIStream.Close(); + ErrorBox aErrorBox( DLGWIN, WinBits( WB_OK ), + String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ); + aErrorBox.Execute(); + } + } + } + + // Status der Buttons ermitteln + if ( pColorTab->Count() ) + { + aBtnModify.Enable(); + aBtnWorkOn.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + else + { + aBtnModify.Disable(); + aBtnWorkOn.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } + return( 0L ); +} + +// ----------------------------------------------------------------------- + +// +// Button 'Farbtabelle speichern' +// +IMPL_LINK( SvxColorTabPage, ClickSaveHdl_Impl, void *, EMPTYARG ) +{ + ::sfx2::FileDialogHelper aDlg( + com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 ); + String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soc" ) ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + if( pColorTab->GetName().Len() ) + { + aFile.Append( pColorTab->GetName() ); + + if( !aFile.getExtension().getLength() ) + aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "soc" ) ) ); + } + + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + if ( aDlg.Execute() == ERRCODE_NONE ) + { + INetURLObject aURL( aDlg.GetPath() ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + pColorTab->SetName( aURL.getName() ); + pColorTab->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); + + if( pColorTab->Save() ) + { + // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( SVX_RES( RID_SVXSTR_TABLE ) ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + + if ( aURL.getBase().getLength() > 18 ) + { + aString += String(aURL.getBase()).Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String(aURL.getBase()); + aTableNameFT.SetText( aString ); + + // Flag fuer gespeichert setzen + *pnColorTableState |= CT_SAVED; + // Flag fuer modifiziert entfernen + *pnColorTableState &= ~CT_MODIFIED; + } + else + { + ErrorBox aErrorBox( DLGWIN, WinBits( WB_OK ), + String( SVX_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ); + aErrorBox.Execute(); + } + } + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxColorTabPage, SelectColorLBHdl_Impl, void *, EMPTYARG ) +{ + USHORT nPos = aLbColor.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + aValSetColorTable.SelectItem( nPos + 1 ); + aEdtName.SetText( aLbColor.GetSelectEntry() ); + + rXFSet.Put( XFillColorItem( String(), + aLbColor.GetSelectEntryColor() ) ); + aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); + + aCtlPreviewOld.Invalidate(); + aCtlPreviewNew.Invalidate(); + + ChangeColorHdl_Impl( this ); + } + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxColorTabPage, SelectValSetHdl_Impl, void *, EMPTYARG ) +{ + USHORT nPos = aValSetColorTable.GetSelectItemId(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + aLbColor.SelectEntryPos( nPos - 1 ); + aEdtName.SetText( aLbColor.GetSelectEntry() ); + + rXFSet.Put( XFillColorItem( String(), + aLbColor.GetSelectEntryColor() ) ); + aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); + + aCtlPreviewOld.Invalidate(); + aCtlPreviewNew.Invalidate(); + + ChangeColorHdl_Impl( this ); + } + return( 0L ); +} + +//------------------------------------------------------------------------ + +// +// Farbwerte je nach �bergebenes Farbmodell umrechnen +// +void SvxColorTabPage::ConvertColorValues (Color& rColor, ColorModel eModell) +{ + switch (eModell) + { + case CM_RGB: + { + CmykToRgb_Impl (rColor, (USHORT)rColor.GetTransparency() ); + rColor.SetTransparency ((UINT8) 0); + } + break; + + case CM_CMYK: + { + USHORT nK; + RgbToCmyk_Impl (rColor, nK ); + rColor.SetTransparency ((UINT8) nK); + } + break; + } +} + +// +// Auswahl Listbox 'Farbmodell' (RGB/CMY) +// +IMPL_LINK( SvxColorTabPage, SelectColorModelHdl_Impl, void *, EMPTYARG ) +{ + int nPos = aLbColorModel.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + if (eCM != (ColorModel) nPos) + { + // wenn Farbmodell geaendert wurde, dann Werte umrechnen + ConvertColorValues (aAktuellColor, (ColorModel) nPos); + } + + eCM = (ColorModel) nPos; + + switch( eCM ) + { + case CM_RGB: + { + String aStr( aLbColorModel.GetSelectEntry() ); + String aColorStr( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "~X" ) ) ); + xub_StrLen nIdx = 1; + aColorStr.SetChar( nIdx, aStr.GetChar( 0 ) ); + aFtColorModel1.SetText( aColorStr ); + aColorStr.SetChar( nIdx, aStr.GetChar( 1 ) ); + aFtColorModel2.SetText( aColorStr ); + aColorStr.SetChar( nIdx, aStr.GetChar( 2 ) ); + aFtColorModel3.SetText( aColorStr ); + + aFtColorModel4.Hide(); + aMtrFldColorModel4.Hide(); + aMtrFldColorModel4.SetValue( 0L ); + + aMtrFldColorModel1.SetHelpId( HID_TPCOLOR_RGB_1 ); + aMtrFldColorModel2.SetHelpId( HID_TPCOLOR_RGB_2 ); + aMtrFldColorModel3.SetHelpId( HID_TPCOLOR_RGB_3 ); + + // Da der alte HelpText noch am Control steht wuerde + // ein Umsetzen der HelpID alleine nichts bewirken + aMtrFldColorModel1.SetHelpText( String() ); + aMtrFldColorModel2.SetHelpText( String() ); + aMtrFldColorModel3.SetHelpText( String() ); + + // RGB-Werte im Bereich 0..255 verarbeiten (nicht in %), + // dazu MetricField's entsprechend einstellen + aMtrFldColorModel1.SetUnit(FUNIT_NONE); + aMtrFldColorModel1.SetMin(0); + aMtrFldColorModel1.SetMax(255); + aMtrFldColorModel1.SetLast(255); + + aMtrFldColorModel2.SetUnit(FUNIT_NONE); + aMtrFldColorModel2.SetMin(0); + aMtrFldColorModel2.SetMax(255); + aMtrFldColorModel2.SetLast(255); + + aMtrFldColorModel3.SetUnit(FUNIT_NONE); + aMtrFldColorModel3.SetMin(0); + aMtrFldColorModel3.SetMax(255); + aMtrFldColorModel3.SetLast(255); + } + break; + + case CM_CMYK: + { + String aStr( aLbColorModel.GetSelectEntry() ); + String aColorStr( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "~X" ) ) ); + xub_StrLen nIdx = 1; + aColorStr.SetChar( nIdx, aStr.GetChar( 0 ) ); + aFtColorModel1.SetText( aColorStr ); + aColorStr.SetChar( nIdx, aStr.GetChar( 1 ) ); + aFtColorModel2.SetText( aColorStr ); + aColorStr.SetChar( nIdx,aStr.GetChar( 2 ) ); + aFtColorModel3.SetText( aColorStr ); + aColorStr.SetChar( nIdx,aStr.GetChar( 3 ) ); + aFtColorModel4.SetText( aColorStr ); + + aFtColorModel4.Show(); + aMtrFldColorModel4.Show(); + + aMtrFldColorModel1.SetHelpId( HID_TPCOLOR_CMYK_1 ); + aMtrFldColorModel2.SetHelpId( HID_TPCOLOR_CMYK_2 ); + aMtrFldColorModel3.SetHelpId( HID_TPCOLOR_CMYK_3 ); + + // s.o. + aMtrFldColorModel1.SetHelpText( String() ); + aMtrFldColorModel2.SetHelpText( String() ); + aMtrFldColorModel3.SetHelpText( String() ); + + // CMYK-Werte im Bereich 0..100% verarbeiten, + // dazu MetricField's entsprechend einstellen + String aStrUnit( RTL_CONSTASCII_USTRINGPARAM( " %" ) ); + + aMtrFldColorModel1.SetUnit(FUNIT_CUSTOM); + aMtrFldColorModel1.SetCustomUnitText( aStrUnit ); + aMtrFldColorModel1.SetMin(0); + aMtrFldColorModel1.SetMax(100); + aMtrFldColorModel1.SetLast(100); + + aMtrFldColorModel2.SetUnit(FUNIT_CUSTOM); + aMtrFldColorModel2.SetCustomUnitText( aStrUnit ); + aMtrFldColorModel2.SetMin(0); + aMtrFldColorModel2.SetMax(100); + aMtrFldColorModel2.SetLast(100); + + aMtrFldColorModel3.SetUnit(FUNIT_CUSTOM); + aMtrFldColorModel3.SetCustomUnitText( aStrUnit ); + aMtrFldColorModel3.SetMin(0); + aMtrFldColorModel3.SetMax(100); + aMtrFldColorModel3.SetLast(100); + } + break; + } + + aMtrFldColorModel1.SetValue( ColorToPercent_Impl( aAktuellColor.GetRed() ) ); + aMtrFldColorModel2.SetValue( ColorToPercent_Impl( aAktuellColor.GetGreen() ) ); + aMtrFldColorModel3.SetValue( ColorToPercent_Impl( aAktuellColor.GetBlue() ) ); + aMtrFldColorModel4.SetValue( ColorToPercent_Impl( aAktuellColor.GetTransparency() ) ); + } + return( 0L ); +} + +//------------------------------------------------------------------------ + +long SvxColorTabPage::ChangeColorHdl_Impl( void* ) +{ + int nPos = aLbColor.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + XColorEntry* pEntry = pColorTab->GetColor( nPos ); + + aAktuellColor.SetColor ( pEntry->GetColor().GetColor() ); + if (eCM != CM_RGB) + ConvertColorValues (aAktuellColor, eCM); + + aMtrFldColorModel1.SetValue( ColorToPercent_Impl( aAktuellColor.GetRed() ) ); + aMtrFldColorModel2.SetValue( ColorToPercent_Impl( aAktuellColor.GetGreen() ) ); + aMtrFldColorModel3.SetValue( ColorToPercent_Impl( aAktuellColor.GetBlue() ) ); + aMtrFldColorModel4.SetValue( ColorToPercent_Impl( aAktuellColor.GetTransparency() ) ); + + // ItemSet fuellen und an XOut weiterleiten + rXFSet.Put( XFillColorItem( String(), pEntry->GetColor() ) ); + aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); + + aCtlPreviewNew.Invalidate(); + } + return( 0L ); +} + +//------------------------------------------------------------------------ + +void SvxColorTabPage::FillValueSet_Impl( ValueSet& rVs ) +{ + long nCount = pColorTab->Count(); + XColorEntry* pColorEntry; + + for( long i = 0; i < nCount; i++ ) + { + pColorEntry = pColorTab->GetColor( i ); + rVs.InsertItem( (USHORT) i + 1, pColorEntry->GetColor(), pColorEntry->GetName() ); + } +} + +//------------------------------------------------------------------------ + +// Ein RGB-Wert wird in einen CMYK-Wert konvertiert, wobei die Color- +// Klasse vergewaltigt wird, da R in C, G in M und B in Y umgewandelt +// wird. Der Wert K wird in einer Extra-Variablen gehalten. +// Bei weiteren Farbmodellen sollte man hierfuer eigene Klassen entwickeln, +// die dann auch entsprechende Casts enthalten. + +void SvxColorTabPage::RgbToCmyk_Impl( Color& rColor, USHORT& rK ) +{ + USHORT nColor1, nColor2, nColor3; + USHORT nProzent; // nur temporaer !!! + + nColor1 = 255 - rColor.GetRed(); + nProzent = ColorToPercent_Impl( nColor1 ); + + nColor2 = 255 - rColor.GetGreen(); + nProzent = ColorToPercent_Impl( nColor2 ); + + nColor3 = 255 - rColor.GetBlue(); + nProzent = ColorToPercent_Impl( nColor3 ); + + rK = Min( Min( nColor1, nColor2 ), nColor3 ); + + rColor.SetRed( sal::static_int_cast< UINT8 >( nColor1 - rK ) ); + rColor.SetGreen( sal::static_int_cast< UINT8 >( nColor2 - rK ) ); + rColor.SetBlue( sal::static_int_cast< UINT8 >( nColor3 - rK ) ); +} + +//------------------------------------------------------------------------ + +// Umgekehrter Fall zu RgbToCmyk_Impl (s.o.) + +void SvxColorTabPage::CmykToRgb_Impl( Color& rColor, const USHORT nK ) +{ + long lTemp; + + lTemp = 255 - ( rColor.GetRed() + nK ); + + if( lTemp < 0L ) + lTemp = 0L; + rColor.SetRed( (BYTE)lTemp ); + + lTemp = 255 - ( rColor.GetGreen() + nK ); + + if( lTemp < 0L ) + lTemp = 0L; + rColor.SetGreen( (BYTE)lTemp ); + + lTemp = 255 - ( rColor.GetBlue() + nK ); + + if( lTemp < 0L ) + lTemp = 0L; + rColor.SetBlue( (BYTE)lTemp ); +} + +//------------------------------------------------------------------------ + +USHORT SvxColorTabPage::ColorToPercent_Impl( USHORT nColor ) +{ + USHORT nWert = 0; + + switch (eCM) + { + case CM_RGB : + nWert = nColor; + break; + + case CM_CMYK: + nWert = (USHORT) ( (double) nColor * 100.0 / 255.0 + 0.5 ); + break; + } + + return ( nWert ); +} + +//------------------------------------------------------------------------ + +USHORT SvxColorTabPage::PercentToColor_Impl( USHORT nPercent ) +{ + USHORT nWert = 0; + + switch (eCM) + { + case CM_RGB : + nWert = nPercent; + break; + + case CM_CMYK: + nWert = (USHORT) ( (double) nPercent * 255.0 / 100.0 + 0.5 ); + break; + } + + return ( nWert ); +} + +//------------------------------------------------------------------------ + +void SvxColorTabPage::FillUserData() +{ + // Das Farbmodell wird in der Ini-Datei festgehalten + SetUserData( UniString::CreateFromInt32( eCM ) ); +} + + diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx new file mode 100644 index 000000000000..02e7be1bde3b --- /dev/null +++ b/cui/source/tabpages/tpgradnt.cxx @@ -0,0 +1,943 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tpgradnt.cxx,v $ + * $Revision: 1.26 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" + +#define _SVX_TPGRADNT_CXX + +#include +#include "helpid.hrc" +#include "svx/xattr.hxx" +#include +#include +#include "svx/drawitem.hxx" +#include "cuitabarea.hxx" +#include "tabarea.hrc" +#include "defdlgname.hxx" //CHINA001 #include "dlgname.hxx" +//#include "dlgname.hrc" +#include //CHINA001 +#include + +#define DLGWIN this->GetParent()->GetParent() + +#define BITMAP_WIDTH 32 +#define BITMAP_HEIGHT 12 + +/************************************************************************* +|* +|* Dialog zum Aendern und Definieren der Farbverlaeufe +|* +\************************************************************************/ + +SvxGradientTabPage::SvxGradientTabPage +( + Window* pParent, + const SfxItemSet& rInAttrs +) : + SfxTabPage ( pParent, SVX_RES( RID_SVXPAGE_GRADIENT ), rInAttrs ), + + aFlProp ( this, SVX_RES( FL_PROP ) ), + aFtType ( this, SVX_RES( FT_TYPE ) ), + aLbGradientType ( this, SVX_RES( LB_GRADIENT_TYPES ) ), + aFtCenterX ( this, SVX_RES( FT_CENTER_X ) ), + aMtrCenterX ( this, SVX_RES( MTR_CENTER_X ) ), + aFtCenterY ( this, SVX_RES( FT_CENTER_Y ) ), + aMtrCenterY ( this, SVX_RES( MTR_CENTER_Y ) ), + aFtAngle ( this, SVX_RES( FT_ANGLE ) ), + aMtrAngle ( this, SVX_RES( MTR_ANGLE ) ), + aFtBorder ( this, SVX_RES( FT_BORDER ) ), + aMtrBorder ( this, SVX_RES( MTR_BORDER ) ), + aFtColorFrom ( this, SVX_RES( FT_COLOR_FROM ) ), + aLbColorFrom ( this, SVX_RES( LB_COLOR_FROM ) ), + aMtrColorFrom ( this, SVX_RES( MTR_COLOR_FROM ) ), + aFtColorTo ( this, SVX_RES( FT_COLOR_TO ) ), + aLbColorTo ( this, SVX_RES( LB_COLOR_TO ) ), + aMtrColorTo ( this, SVX_RES( MTR_COLOR_TO ) ), + aLbGradients ( this, SVX_RES( LB_GRADIENTS ) ), + aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ), + aBtnAdd ( this, SVX_RES( BTN_ADD ) ), + aBtnModify ( this, SVX_RES( BTN_MODIFY ) ), + aBtnDelete ( this, SVX_RES( BTN_DELETE ) ), + aBtnLoad ( this, SVX_RES( BTN_LOAD ) ), + aBtnSave ( this, SVX_RES( BTN_SAVE ) ), + + rOutAttrs ( rInAttrs ), + + pColorTab( NULL ), + pGradientList( NULL ), + + pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), + aXFStyleItem ( XFILL_GRADIENT ), + aXGradientItem ( String(), XGradient( COL_BLACK, COL_WHITE ) ), + aXFillAttr ( pXPool ), + rXFSet ( aXFillAttr.GetItemSet() ) +{ + aBtnLoad.SetModeImage( Image( SVX_RES( RID_SVXIMG_LOAD_H ) ), BMP_COLOR_HIGHCONTRAST ); + aBtnSave.SetModeImage( Image( SVX_RES( RID_SVXIMG_SAVE_H ) ), BMP_COLOR_HIGHCONTRAST ); + + FreeResource(); + + // diese Page braucht ExchangeSupport + SetExchangeSupport(); + + // Solange NICHT vom Item unterstuetzt + + //aMtrColorTo.Disable(); + aMtrColorTo.SetValue( 100 ); + //aMtrColorFrom.Disable(); + aMtrColorFrom.SetValue( 100 ); + + // Setzen des Output-Devices + rXFSet.Put( aXFStyleItem ); + rXFSet.Put( aXGradientItem ); + aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); + + // Handler ueberladen + aLbGradients.SetSelectHdl( + LINK( this, SvxGradientTabPage, ChangeGradientHdl_Impl ) ); + aBtnAdd.SetClickHdl( LINK( this, SvxGradientTabPage, ClickAddHdl_Impl ) ); + aBtnModify.SetClickHdl( + LINK( this, SvxGradientTabPage, ClickModifyHdl_Impl ) ); + aBtnDelete.SetClickHdl( + LINK( this, SvxGradientTabPage, ClickDeleteHdl_Impl ) ); + + Link aLink = LINK( this, SvxGradientTabPage, ModifiedHdl_Impl ); + aLbGradientType.SetSelectHdl( aLink ); + aMtrCenterX.SetModifyHdl( aLink ); + aMtrCenterY.SetModifyHdl( aLink ); + aMtrAngle.SetModifyHdl( aLink ); + aMtrBorder.SetModifyHdl( aLink ); + aMtrColorFrom.SetModifyHdl( aLink ); + aLbColorFrom.SetSelectHdl( aLink ); + aMtrColorTo.SetModifyHdl( aLink ); + aLbColorTo.SetSelectHdl( aLink ); + + aBtnLoad.SetClickHdl( + LINK( this, SvxGradientTabPage, ClickLoadHdl_Impl ) ); + aBtnSave.SetClickHdl( + LINK( this, SvxGradientTabPage, ClickSaveHdl_Impl ) ); + + // #i76307# always paint the preview in LTR, because this is what the document does + aCtlPreview.EnableRTL( FALSE ); +} + +// ----------------------------------------------------------------------- + +void SvxGradientTabPage::Construct() +{ + // Farbtabelle + aLbColorFrom.Fill( pColorTab ); + aLbColorTo.CopyEntries( aLbColorFrom ); + + // Farbverlauftabelle + aLbGradients.Fill( pGradientList ); +} + +// ----------------------------------------------------------------------- + +void SvxGradientTabPage::ActivatePage( const SfxItemSet& ) +{ + USHORT nPos; + USHORT nCount; + + if( *pDlgType == 0 ) // Flaechen-Dialog + { + *pbAreaTP = FALSE; + + if( pColorTab ) + { + // ColorTable + if( *pnColorTableState & CT_CHANGED || + *pnColorTableState & CT_MODIFIED ) + { + if( *pnColorTableState & CT_CHANGED ) + pColorTab = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorTable(); + + // LbColorFrom + nPos = aLbColorFrom.GetSelectEntryPos(); + aLbColorFrom.Clear(); + aLbColorFrom.Fill( pColorTab ); + nCount = aLbColorFrom.GetEntryCount(); + if( nCount == 0 ) + ; // Dieser Fall sollte nicht auftreten + else if( nCount <= nPos ) + aLbColorFrom.SelectEntryPos( 0 ); + else + aLbColorFrom.SelectEntryPos( nPos ); + + // LbColorTo + nPos = aLbColorTo.GetSelectEntryPos(); + aLbColorTo.Clear(); + aLbColorTo.CopyEntries( aLbColorFrom ); + nCount = aLbColorTo.GetEntryCount(); + if( nCount == 0 ) + ; // Dieser Fall sollte nicht auftreten + else if( nCount <= nPos ) + aLbColorTo.SelectEntryPos( 0 ); + else + aLbColorTo.SelectEntryPos( nPos ); + + ModifiedHdl_Impl( this ); + } + + // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + INetURLObject aURL( pGradientList->GetPath() ); + + aURL.Append( pGradientList->GetName() ); + DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + if ( aURL.getBase().getLength() > 18 ) + { + aString += String(aURL.getBase()).Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String(aURL.getBase()); + + if ( *pPageType == PT_GRADIENT && *pPos != LISTBOX_ENTRY_NOTFOUND ) + { + aLbGradients.SelectEntryPos( *pPos ); + } + // Farben koennten geloescht worden sein + ChangeGradientHdl_Impl( this ); + + *pPageType = PT_GRADIENT; + *pPos = LISTBOX_ENTRY_NOTFOUND; + } + } +} + +// ----------------------------------------------------------------------- + +int SvxGradientTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if( CheckChanges_Impl() == -1L ) + return KEEP_PAGE; + + if( _pSet ) + FillItemSet( *_pSet ); + + return LEAVE_PAGE; +} + +// ----------------------------------------------------------------------- + +long SvxGradientTabPage::CheckChanges_Impl() +{ + // wird hier benutzt, um Aenderungen NICHT zu verlieren + XGradient aTmpGradient( aLbColorFrom.GetSelectEntryColor(), + aLbColorTo.GetSelectEntryColor(), + (XGradientStyle) aLbGradientType.GetSelectEntryPos(), + static_cast(aMtrAngle.GetValue() * 10), // sollte in Resource geaendert werden + (USHORT) aMtrCenterX.GetValue(), + (USHORT) aMtrCenterY.GetValue(), + (USHORT) aMtrBorder.GetValue(), + (USHORT) aMtrColorFrom.GetValue(), + (USHORT) aMtrColorTo.GetValue() ); + + USHORT nPos = aLbGradients.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + XGradient aGradient = pGradientList->GetGradient( nPos )->GetGradient(); + String aString = aLbGradients.GetSelectEntry(); + + if( !( aTmpGradient == aGradient ) ) + { + ResMgr& rMgr = DIALOG_MGR(); + Image aWarningBoxImage = WarningBox::GetStandardImage(); + //CHINA001 SvxMessDialog aMessDlg( DLGWIN, + //CHINA001 String( ResId( RID_SVXSTR_GRADIENT, rMgr ) ), + //CHINA001 String( ResId( RID_SVXSTR_ASK_CHANGE_GRADIENT, rMgr ) ), + //CHINA001 &aWarningBoxImage ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX, + String( ResId( RID_SVXSTR_GRADIENT, rMgr ) ), + String( ResId( RID_SVXSTR_ASK_CHANGE_GRADIENT, rMgr ) ), + &aWarningBoxImage ); + DBG_ASSERT(aMessDlg, "Dialogdiet fail!");//CHINA001 + aMessDlg->SetButtonText( MESS_BTN_1, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_1, + String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) ); + aMessDlg->SetButtonText( MESS_BTN_2, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_2, + String( ResId( RID_SVXSTR_ADD, rMgr ) ) ); + + short nRet = aMessDlg->Execute(); //CHINA001 short nRet = aMessDlg.Execute(); + + switch( nRet ) + { + case RET_BTN_1: // Aendern + { + ClickModifyHdl_Impl( this ); + aGradient = pGradientList->GetGradient( nPos )->GetGradient(); + } + break; + + case RET_BTN_2: // Hinzufuegen + { + ClickAddHdl_Impl( this ); + nPos = aLbGradients.GetSelectEntryPos(); + aGradient = pGradientList->GetGradient( nPos )->GetGradient(); + } + break; + + case RET_CANCEL: + // return( -1L ); <-- wuerde die Seite nicht verlassen + break; + // return( TRUE ); // Abbruch + } + delete aMessDlg; //add by CHINA001 + } + } + nPos = aLbGradients.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + *pPos = nPos; + } + return 0L; +} + +// ----------------------------------------------------------------------- + +BOOL SvxGradientTabPage::FillItemSet( SfxItemSet& rSet ) +{ + if( *pDlgType == 0 && *pPageType == PT_GRADIENT && *pbAreaTP == FALSE ) + { + // CheckChanges(); <-- doppelte Abfrage ? + + XGradient* pXGradient = NULL; + String aString; + USHORT nPos = aLbGradients.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + pXGradient = new XGradient( pGradientList->GetGradient( nPos )->GetGradient() ); + aString = aLbGradients.GetSelectEntry(); + + } + else + // Farbverlauf wurde (unbekannt) uebergeben + { + pXGradient = new XGradient( aLbColorFrom.GetSelectEntryColor(), + aLbColorTo.GetSelectEntryColor(), + (XGradientStyle) aLbGradientType.GetSelectEntryPos(), + static_cast(aMtrAngle.GetValue() * 10), // sollte in Resource geaendert werden + (USHORT) aMtrCenterX.GetValue(), + (USHORT) aMtrCenterY.GetValue(), + (USHORT) aMtrBorder.GetValue(), + (USHORT) aMtrColorFrom.GetValue(), + (USHORT) aMtrColorTo.GetValue() ); + } + DBG_ASSERT( pXGradient, "XGradient konnte nicht erzeugt werden" ); + rSet.Put( XFillStyleItem( XFILL_GRADIENT ) ); + rSet.Put( XFillGradientItem( aString, *pXGradient ) ); + + delete pXGradient; + } + return TRUE; +} + +// ----------------------------------------------------------------------- + +void SvxGradientTabPage::Reset( const SfxItemSet& ) +{ + // aLbGradients.SelectEntryPos( 0 ); + ChangeGradientHdl_Impl( this ); + + // Status der Buttons ermitteln + if( pGradientList->Count() ) + { + aBtnModify.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + else + { + aBtnModify.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxGradientTabPage::Create( Window* pWindow, + const SfxItemSet& rOutAttrs ) +{ + return new SvxGradientTabPage( pWindow, rOutAttrs ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxGradientTabPage, ModifiedHdl_Impl, void *, pControl ) +{ + XGradientStyle eXGS = (XGradientStyle) aLbGradientType.GetSelectEntryPos(); + + XGradient aXGradient( aLbColorFrom.GetSelectEntryColor(), + aLbColorTo.GetSelectEntryColor(), + eXGS, + static_cast(aMtrAngle.GetValue() * 10), // sollte in Resource geaendert werden + (USHORT) aMtrCenterX.GetValue(), + (USHORT) aMtrCenterY.GetValue(), + (USHORT) aMtrBorder.GetValue(), + (USHORT) aMtrColorFrom.GetValue(), + (USHORT) aMtrColorTo.GetValue() ); + + // Enablen/Disablen von Controls + if( pControl == &aLbGradientType || pControl == this ) + SetControlState_Impl( eXGS ); + + // Anzeigen im XOutDev + rXFSet.Put( XFillGradientItem( String(), aXGradient ) ); + aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); + + aCtlPreview.Invalidate(); + + return 0L; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxGradientTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) +{ + ResMgr& rMgr = DIALOG_MGR(); + String aNewName( ResId( RID_SVXSTR_GRADIENT, rMgr ) ); + String aDesc( ResId( RID_SVXSTR_DESC_GRADIENT, rMgr ) ); + String aName; + + long nCount = pGradientList->Count(); + long j = 1; + BOOL bDifferent = FALSE; + + while( !bDifferent ) + { + aName = aNewName; + aName += sal_Unicode(' '); + aName += UniString::CreateFromInt32( j++ ); + bDifferent = TRUE; + + for( long i = 0; i < nCount && bDifferent; i++ ) + if( aName == pGradientList->GetGradient( i )->GetName() ) + bDifferent = FALSE; + } + + //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME ); + DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 + WarningBox* pWarnBox = NULL; + USHORT nError = RID_SVXSTR_WARN_NAME_DUPLICATE; + + while( pDlg->Execute() == RET_OK ) + { + pDlg->GetName( aName ); + + bDifferent = TRUE; + + for( long i = 0; i < nCount && bDifferent; i++ ) + if( aName == pGradientList->GetGradient( i )->GetName() ) + bDifferent = FALSE; + + if( bDifferent ) + { + nError = 0; + break; + } + + if( !pWarnBox ) + { + pWarnBox = new WarningBox( DLGWIN, + WinBits( WB_OK_CANCEL ), + String( ResId( nError, rMgr ) ) ); + pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE ); + } + + if( pWarnBox->Execute() != RET_OK ) + break; + } + //Rectangle aDlgRect( pDlg->GetPosPixel(), pDlg->GetSizePixel() ); + delete pDlg; + delete pWarnBox; + + if( !nError ) + { + XGradient aXGradient( aLbColorFrom.GetSelectEntryColor(), + aLbColorTo.GetSelectEntryColor(), + (XGradientStyle) aLbGradientType.GetSelectEntryPos(), + static_cast(aMtrAngle.GetValue() * 10), // sollte in Resource geaendert werden + (USHORT) aMtrCenterX.GetValue(), + (USHORT) aMtrCenterY.GetValue(), + (USHORT) aMtrBorder.GetValue(), + (USHORT) aMtrColorFrom.GetValue(), + (USHORT) aMtrColorTo.GetValue() ); + XGradientEntry* pEntry = new XGradientEntry( aXGradient, aName ); + + pGradientList->Insert( pEntry, nCount ); + + aLbGradients.Append( pEntry ); + + aLbGradients.SelectEntryPos( aLbGradients.GetEntryCount() - 1 ); + +#ifdef WNT + // hack: #31355# W.P. + Rectangle aRect( aLbGradients.GetPosPixel(), aLbGradients.GetSizePixel() ); + if( TRUE ) { // ??? overlapped with pDlg + // and srolling + Invalidate( aRect ); + //aLbGradients.Invalidate(); + } +#endif + + // Flag fuer modifiziert setzen + *pnGradientListState |= CT_MODIFIED; + + ChangeGradientHdl_Impl( this ); + } + + // Status der Buttons ermitteln + if( pGradientList->Count() ) + { + aBtnModify.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + return 0L; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxGradientTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) +{ + USHORT nPos = aLbGradients.GetSelectEntryPos(); + + if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + ResMgr& rMgr = DIALOG_MGR(); + String aNewName( ResId( RID_SVXSTR_GRADIENT, rMgr ) ); + String aDesc( ResId( RID_SVXSTR_DESC_GRADIENT, rMgr ) ); + String aName( pGradientList->GetGradient( nPos )->GetName() ); + String aOldName = aName; + + //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME ); + DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 + + long nCount = pGradientList->Count(); + BOOL bDifferent = FALSE; + BOOL bLoop = TRUE; + + while( bLoop && pDlg->Execute() == RET_OK ) + { + pDlg->GetName( aName ); + bDifferent = TRUE; + + for( long i = 0; i < nCount && bDifferent; i++ ) + { + if( aName == pGradientList->GetGradient( i )->GetName() && + aName != aOldName ) + bDifferent = FALSE; + } + + if( bDifferent ) + { + bLoop = FALSE; + XGradient aXGradient( aLbColorFrom.GetSelectEntryColor(), + aLbColorTo.GetSelectEntryColor(), + (XGradientStyle) aLbGradientType.GetSelectEntryPos(), + static_cast(aMtrAngle.GetValue() * 10), // sollte in Resource geaendert werden + (USHORT) aMtrCenterX.GetValue(), + (USHORT) aMtrCenterY.GetValue(), + (USHORT) aMtrBorder.GetValue(), + (USHORT) aMtrColorFrom.GetValue(), + (USHORT) aMtrColorTo.GetValue() ); + + XGradientEntry* pEntry = new XGradientEntry( aXGradient, aName ); + + delete pGradientList->Replace( pEntry, nPos ); + + aLbGradients.Modify( pEntry, nPos ); + + aLbGradients.SelectEntryPos( nPos ); + + // Flag fuer modifiziert setzen + *pnGradientListState |= CT_MODIFIED; + } + else + { + WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); + aBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); + aBox.Execute(); + } + + } + delete pDlg; + } + return 0L; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxGradientTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) +{ + USHORT nPos = aLbGradients.GetSelectEntryPos(); + + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ), +//! SVX_RES( RID_SVXSTR_DEL_GRADIENT ), + String( SVX_RES( RID_SVXSTR_ASK_DEL_GRADIENT ) ) ); + + if ( aQueryBox.Execute() == RET_YES ) + { + delete pGradientList->Remove( nPos ); + aLbGradients.RemoveEntry( nPos ); + aLbGradients.SelectEntryPos( 0 ); + + aCtlPreview.Invalidate(); + + ChangeGradientHdl_Impl( this ); + + // Flag fuer modifiziert setzen + *pnGradientListState |= CT_MODIFIED; + } + } + // Status der Buttons ermitteln + if( !pGradientList->Count() ) + { + aBtnModify.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } + return 0L; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxGradientTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) +{ + ResMgr& rMgr = DIALOG_MGR(); + USHORT nReturn = RET_YES; + + if ( *pnGradientListState & CT_MODIFIED ) + { + nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ), + String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute(); + + if ( nReturn == RET_YES ) + pGradientList->Save(); + } + + if ( nReturn != RET_CANCEL ) + { + ::sfx2::FileDialogHelper aDlg( + com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, + 0 ); + String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sog" ) ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + + if( aDlg.Execute() == ERRCODE_NONE ) + { + EnterWait(); + + INetURLObject aURL( aDlg.GetPath() ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + // Liste speichern + XGradientList* pGrdList = new XGradientList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); + pGrdList->SetName( aURL.getName() ); + + if ( pGrdList->Load() ) + { + if ( pGrdList ) + { + // Pruefen, ob Tabelle geloescht werden darf: + if ( pGradientList != + ( (SvxAreaTabDialog*) DLGWIN )->GetGradientList() ) + delete pGradientList; + + pGradientList = pGrdList; + ( (SvxAreaTabDialog*) DLGWIN )-> + SetNewGradientList( pGradientList ); + + aLbGradients.Clear(); + aLbGradients.Fill( pGradientList ); + Reset( rOutAttrs ); + + pGradientList->SetName( aURL.getName() ); + + // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( ResId( RID_SVXSTR_TABLE, rMgr ) ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + + if ( aURL.getBase().getLength() > 18 ) + { + aString += String(aURL.getBase()).Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String(aURL.getBase()); + + // Flag fuer gewechselt setzen + *pnGradientListState |= CT_CHANGED; + // Flag fuer modifiziert entfernen + *pnGradientListState &= ~CT_MODIFIED; + } + LeaveWait(); + } + else + { + LeaveWait(); + //aIStream.Close(); + ErrorBox( DLGWIN, WinBits( WB_OK ), + String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute(); + } + } + } + + // Status der Buttons ermitteln + if( pGradientList->Count() ) + { + aBtnModify.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + else + { + aBtnModify.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } + return 0L; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxGradientTabPage, ClickSaveHdl_Impl, void *, EMPTYARG ) +{ + ::sfx2::FileDialogHelper aDlg( + com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 ); + String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sog" ) ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + if( pGradientList->GetName().Len() ) + { + aFile.Append( pGradientList->GetName() ); + + if( !aFile.getExtension().getLength() ) + aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "sog" ) ) ); + } + + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + if ( aDlg.Execute() == ERRCODE_NONE ) + { + INetURLObject aURL( aDlg.GetPath() ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + pGradientList->SetName( aURL.getName() ); + pGradientList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); + + if( pGradientList->Save() ) + { + // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( SVX_RES( RID_SVXSTR_TABLE ) ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + + if ( aURL.getBase().getLength() > 18 ) + { + aString += String(aURL.getBase()).Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String(aURL.getBase()); + + // Flag fuer gespeichert setzen + *pnGradientListState |= CT_SAVED; + // Flag fuer modifiziert entfernen + *pnGradientListState &= ~CT_MODIFIED; + } + else + { + ErrorBox( DLGWIN, WinBits( WB_OK ), + String( SVX_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute(); + } + } + + return 0L; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxGradientTabPage, ChangeGradientHdl_Impl, void *, EMPTYARG ) +{ + XGradient* pGradient = NULL; + int nPos = aLbGradients.GetSelectEntryPos(); + + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + pGradient = new XGradient( ( (XGradientEntry*) pGradientList->GetGradient( nPos ) )->GetGradient() ); + else + { + const SfxPoolItem* pPoolItem = NULL; + if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLSTYLE ), TRUE, &pPoolItem ) ) + { + if( ( XFILL_GRADIENT == (XFillStyle) ( ( const XFillStyleItem* ) pPoolItem )->GetValue() ) && + ( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), TRUE, &pPoolItem ) ) ) + { + pGradient = new XGradient( ( ( const XFillGradientItem* ) pPoolItem )->GetGradientValue() ); + } + } + if( !pGradient ) + { + aLbGradients.SelectEntryPos( 0 ); + nPos = aLbGradients.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + pGradient = new XGradient( ( (XGradientEntry*) pGradientList->GetGradient( nPos ) )->GetGradient() ); + } + } + + if( pGradient ) + { + XGradientStyle eXGS = pGradient->GetGradientStyle(); + + aLbGradientType.SelectEntryPos( + sal::static_int_cast< USHORT >( eXGS ) ); + // Wenn der EIntrag nicht in der Listbox ist, werden die Farben + // temporaer hinzugenommen + aLbColorFrom.SetNoSelection(); + aLbColorFrom.SelectEntry( pGradient->GetStartColor() ); + + if ( aLbColorFrom.GetSelectEntryCount() == 0 ) + { + aLbColorFrom.InsertEntry( pGradient->GetStartColor(), + String() ); + aLbColorFrom.SelectEntry( pGradient->GetStartColor() ); + } + aLbColorTo.SetNoSelection(); + aLbColorTo.SelectEntry( pGradient->GetEndColor() ); + + if ( aLbColorTo.GetSelectEntryCount() == 0 ) + { + aLbColorTo.InsertEntry( pGradient->GetEndColor(), String() ); + aLbColorTo.SelectEntry( pGradient->GetEndColor() ); + } + + aMtrAngle.SetValue( pGradient->GetAngle() / 10 ); // sollte in Resource geaendert werden + aMtrBorder.SetValue( pGradient->GetBorder() ); + aMtrCenterX.SetValue( pGradient->GetXOffset() ); + aMtrCenterY.SetValue( pGradient->GetYOffset() ); + aMtrColorFrom.SetValue( pGradient->GetStartIntens() ); + aMtrColorTo.SetValue( pGradient->GetEndIntens() ); + + // Controls Disablen/Enablen + SetControlState_Impl( eXGS ); + + // ItemSet fuellen und an aCtlPreview weiterleiten + rXFSet.Put( XFillGradientItem( String(), *pGradient ) ); + aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); + + aCtlPreview.Invalidate(); + delete pGradient; + } + return 0L; +} + +//------------------------------------------------------------------------ + +void SvxGradientTabPage::SetControlState_Impl( XGradientStyle eXGS ) +{ + switch( eXGS ) + { + case XGRAD_LINEAR: + case XGRAD_AXIAL: + aFtCenterX.Disable(); + aMtrCenterX.Disable(); + aFtCenterY.Disable(); + aMtrCenterY.Disable(); + aFtAngle.Enable(); + aMtrAngle.Enable(); + break; + + case XGRAD_RADIAL: + aFtCenterX.Enable(); + aMtrCenterX.Enable(); + aFtCenterY.Enable(); + aMtrCenterY.Enable(); + aFtAngle.Disable(); + aMtrAngle.Disable(); + break; + + case XGRAD_ELLIPTICAL: + aFtCenterX.Enable(); + aMtrCenterX.Enable(); + aFtCenterY.Enable(); + aMtrCenterY.Enable(); + aFtAngle.Enable(); + aMtrAngle.Enable(); + break; + + case XGRAD_SQUARE: + case XGRAD_RECT: + aFtCenterX.Enable(); + aMtrCenterX.Enable(); + aFtCenterY.Enable(); + aMtrCenterY.Enable(); + aFtAngle.Enable(); + aMtrAngle.Enable(); + break; + } +} + + diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx new file mode 100644 index 000000000000..f1ca099749cd --- /dev/null +++ b/cui/source/tabpages/tphatch.cxx @@ -0,0 +1,901 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tphatch.cxx,v $ + * $Revision: 1.29 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" + +#define _SVX_TPHATCH_CXX + +#include +#include "tabarea.hrc" +//#include "dlgname.hrc" +#include "helpid.hrc" +#include "svx/xattr.hxx" +#include +#include +#include "svx/drawitem.hxx" +#include "cuitabarea.hxx" +#include "defdlgname.hxx" //CHINA001 #include "dlgname.hxx" +#include //CHINA001 +#include +#include "svx/dlgutil.hxx" + +#define DLGWIN this->GetParent()->GetParent() + +#define BITMAP_WIDTH 32 +#define BITMAP_HEIGHT 12 + +/************************************************************************* +|* +|* Dialog zum Aendern und Definieren der Schraffuren +|* +\************************************************************************/ + +SvxHatchTabPage::SvxHatchTabPage +( + Window* pParent, + const SfxItemSet& rInAttrs +) : + + SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_HATCH ), rInAttrs ), + + aFtDistance ( this, SVX_RES( FT_LINE_DISTANCE ) ), + aMtrDistance ( this, SVX_RES( MTR_FLD_DISTANCE ) ), + aFtAngle ( this, SVX_RES( FT_LINE_ANGLE ) ), + aMtrAngle ( this, SVX_RES( MTR_FLD_ANGLE ) ), + aCtlAngle ( this, SVX_RES( CTL_ANGLE ), + RP_RB, 200, 80, CS_ANGLE ), + aFlProp ( this, SVX_RES( FL_PROP ) ), + aFtLineType ( this, SVX_RES( FT_LINE_TYPE ) ), + aLbLineType ( this, SVX_RES( LB_LINE_TYPE ) ), + aFtLineColor ( this, SVX_RES( FT_LINE_COLOR ) ), + aLbLineColor ( this, SVX_RES( LB_LINE_COLOR ) ), + aLbHatchings ( this, SVX_RES( LB_HATCHINGS ) ), + aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ), + aBtnAdd ( this, SVX_RES( BTN_ADD ) ), + aBtnModify ( this, SVX_RES( BTN_MODIFY ) ), + aBtnDelete ( this, SVX_RES( BTN_DELETE ) ), + aBtnLoad ( this, SVX_RES( BTN_LOAD ) ), + aBtnSave ( this, SVX_RES( BTN_SAVE ) ), + + rOutAttrs ( rInAttrs ), + pColorTab( NULL ), + pHatchingList( NULL ), + + pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), + aXFStyleItem ( XFILL_HATCH ), + aXHatchItem ( String(), XHatch() ), + aXFillAttr ( pXPool ), + rXFSet ( aXFillAttr.GetItemSet() ) + +{ + aBtnLoad.SetModeImage( Image( SVX_RES( RID_SVXIMG_LOAD_H ) ), BMP_COLOR_HIGHCONTRAST ); + aBtnSave.SetModeImage( Image( SVX_RES( RID_SVXIMG_SAVE_H ) ), BMP_COLOR_HIGHCONTRAST ); + + FreeResource(); + + // diese Page braucht ExchangeSupport + SetExchangeSupport(); + + // Metrik einstellen + FieldUnit eFUnit = GetModuleFieldUnit( &rInAttrs ); + + switch ( eFUnit ) + { + case FUNIT_M: + case FUNIT_KM: + eFUnit = FUNIT_MM; + break; + default: ;//prevent warning + } + SetFieldUnit( aMtrDistance, eFUnit ); + + // PoolUnit ermitteln + SfxItemPool* pPool = rOutAttrs.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool?" ); + ePoolUnit = pPool->GetMetric( SID_ATTR_FILL_HATCH ); + + // Setzen des Output-Devices + rXFSet.Put( aXFStyleItem ); + rXFSet.Put( aXHatchItem ); + aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); + + aLbHatchings.SetSelectHdl( LINK( this, SvxHatchTabPage, ChangeHatchHdl_Impl ) ); + + Link aLink = LINK( this, SvxHatchTabPage, ModifiedHdl_Impl ); + aMtrDistance.SetModifyHdl( aLink ); + aMtrAngle.SetModifyHdl( aLink ); + aLbLineType.SetSelectHdl( aLink ); + aLbLineColor.SetSelectHdl( aLink ); + + aBtnAdd.SetClickHdl( LINK( this, SvxHatchTabPage, ClickAddHdl_Impl ) ); + aBtnModify.SetClickHdl( + LINK( this, SvxHatchTabPage, ClickModifyHdl_Impl ) ); + aBtnDelete.SetClickHdl( + LINK( this, SvxHatchTabPage, ClickDeleteHdl_Impl ) ); + aBtnLoad.SetClickHdl( LINK( this, SvxHatchTabPage, ClickLoadHdl_Impl ) ); + aBtnSave.SetClickHdl( LINK( this, SvxHatchTabPage, ClickSaveHdl_Impl ) ); + + aCtlPreview.SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); +} + +// ----------------------------------------------------------------------- + +void SvxHatchTabPage::Construct() +{ + // Farbtabelle + aLbLineColor.Fill( pColorTab ); + + // Schraffurentabelle + aLbHatchings.Fill( pHatchingList ); +} + +// ----------------------------------------------------------------------- + +void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) +{ + USHORT nPos; + USHORT nCount; + + if( *pDlgType == 0 ) // Flaechen-Dialog + { + *pbAreaTP = FALSE; + + if( pColorTab ) + { + // ColorTable + if( *pnColorTableState & CT_CHANGED || + *pnColorTableState & CT_MODIFIED ) + { + if( *pnColorTableState & CT_CHANGED ) + pColorTab = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorTable(); + + // LbLineColor + nPos = aLbLineColor.GetSelectEntryPos(); + aLbLineColor.Clear(); + aLbLineColor.Fill( pColorTab ); + nCount = aLbLineColor.GetEntryCount(); + if( nCount == 0 ) + ; // Dieser Fall sollte nicht auftreten + else if( nCount <= nPos ) + aLbLineColor.SelectEntryPos( 0 ); + else + aLbLineColor.SelectEntryPos( nPos ); + + ModifiedHdl_Impl( this ); + } + + // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + INetURLObject aURL( pHatchingList->GetPath() ); + + aURL.Append( pHatchingList->GetName() ); + DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + if ( aURL.getBase().getLength() > 18 ) + { + aString += String(aURL.getBase()).Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String(aURL.getBase()); + + if( *pPageType == PT_HATCH && *pPos != LISTBOX_ENTRY_NOTFOUND ) + { + aLbHatchings.SelectEntryPos( *pPos ); + } + // Farben koennten geloescht worden sein + ChangeHatchHdl_Impl( this ); + + *pPageType = PT_HATCH; + *pPos = LISTBOX_ENTRY_NOTFOUND; + } + } + + rXFSet.Put ( ( XFillColorItem& ) rSet.Get(XATTR_FILLCOLOR) ); + rXFSet.Put ( ( XFillBackgroundItem&)rSet.Get(XATTR_FILLBACKGROUND) ); + aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlPreview.Invalidate(); +} + +// ----------------------------------------------------------------------- + +int SvxHatchTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if ( CheckChanges_Impl() == -1L ) + return KEEP_PAGE; + + if( _pSet ) + FillItemSet( *_pSet ); + + return LEAVE_PAGE; +} + +// ----------------------------------------------------------------------- + +long SvxHatchTabPage::CheckChanges_Impl() +{ + if( aMtrDistance.GetText() != aMtrDistance.GetSavedValue() || + aMtrAngle.GetText() != aMtrAngle.GetSavedValue() || + aLbLineType.GetSelectEntryPos() != aLbLineType.GetSavedValue() || + aLbLineColor.GetSelectEntryPos() != aLbLineColor.GetSavedValue() || + aLbHatchings.GetSelectEntryPos() != aLbHatchings.GetSavedValue() ) + { + ResMgr& rMgr = DIALOG_MGR(); + Image aWarningBoxImage = WarningBox::GetStandardImage(); + //CHINA001 SvxMessDialog aMessDlg( DLGWIN, + //CHINA001 String( ResId( RID_SVXSTR_HATCH, rMgr ) ), + //CHINA001 String( ResId( RID_SVXSTR_ASK_CHANGE_HATCH, rMgr ) ), + //CHINA001 &aWarningBoxImage ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX, + String( ResId( RID_SVXSTR_HATCH, rMgr ) ), + String( ResId( RID_SVXSTR_ASK_CHANGE_HATCH, rMgr ) ), + &aWarningBoxImage ); + DBG_ASSERT(aMessDlg, "Dialogdiet fail!");//CHINA001 + aMessDlg->SetButtonText( MESS_BTN_1, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_1, + String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) ); + aMessDlg->SetButtonText( MESS_BTN_2, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_2, + String( ResId( RID_SVXSTR_ADD, rMgr ) ) ); + + short nRet = aMessDlg->Execute(); //CHINA001 short nRet = aMessDlg.Execute(); + + switch( nRet ) + { + case RET_BTN_1: // Aendern + { + ClickModifyHdl_Impl( this ); + } + break; + + case RET_BTN_2: // Hinzufuegen + { + ClickAddHdl_Impl( this ); + } + break; + + case RET_CANCEL: + // return( -1L ); <-- wuerde die Seite nicht verlassen + break; + // return( TRUE ); // Abbruch + } + delete aMessDlg; //add by CHINA001 + } + + USHORT nPos = aLbHatchings.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + *pPos = nPos; + return 0L; +} + +// ----------------------------------------------------------------------- + +BOOL SvxHatchTabPage::FillItemSet( SfxItemSet& rSet ) +{ + if( *pDlgType == 0 && *pbAreaTP == FALSE ) // Flaechen-Dialog + { + if( *pPageType == PT_HATCH ) + { + // CheckChanges(); <-- doppelte Abfrage ? + + XHatch* pXHatch = NULL; + String aString; + USHORT nPos = aLbHatchings.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + pXHatch = new XHatch( pHatchingList->GetHatch( nPos )->GetHatch() ); + aString = aLbHatchings.GetSelectEntry(); + } + // Farbverlauf wurde (unbekannt) uebergeben + else + { + pXHatch = new XHatch( aLbLineColor.GetSelectEntryColor(), + (XHatchStyle) aLbLineType.GetSelectEntryPos(), + GetCoreValue( aMtrDistance, ePoolUnit ), + static_cast(aMtrAngle.GetValue() * 10) ); + } + DBG_ASSERT( pXHatch, "XHatch konnte nicht erzeugt werden" ); + rSet.Put( XFillStyleItem( XFILL_HATCH ) ); + rSet.Put( XFillHatchItem( aString, *pXHatch ) ); + + delete pXHatch; + } + } + return TRUE; +} + +// ----------------------------------------------------------------------- + +void SvxHatchTabPage::Reset( const SfxItemSet& rSet ) +{ + // aLbHatchings.SelectEntryPos( 0 ); + ChangeHatchHdl_Impl( this ); + + // Status der Buttons ermitteln + if( pHatchingList->Count() ) + { + aBtnModify.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + else + { + aBtnModify.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } + + rXFSet.Put ( ( XFillColorItem& ) rSet.Get(XATTR_FILLCOLOR) ); + rXFSet.Put ( ( XFillBackgroundItem&)rSet.Get(XATTR_FILLBACKGROUND) ); + aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); + aCtlPreview.Invalidate(); +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxHatchTabPage::Create( Window* pWindow, + const SfxItemSet& rSet ) +{ + return new SvxHatchTabPage( pWindow, rSet ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxHatchTabPage, ModifiedHdl_Impl, void *, p ) +{ + if( p == &aMtrAngle ) + { + // Setzen des Winkels im AngleControl + switch( aMtrAngle.GetValue() ) + { + case 135: aCtlAngle.SetActualRP( RP_LT ); break; + case 90: aCtlAngle.SetActualRP( RP_MT ); break; + case 45: aCtlAngle.SetActualRP( RP_RT ); break; + case 180: aCtlAngle.SetActualRP( RP_LM ); break; + case 0: aCtlAngle.SetActualRP( RP_RM ); break; + case 225: aCtlAngle.SetActualRP( RP_LB ); break; + case 270: aCtlAngle.SetActualRP( RP_MB ); break; + case 315: aCtlAngle.SetActualRP( RP_RB ); break; + default: aCtlAngle.SetActualRP( RP_MM ); break; + } + } + + XHatch aXHatch( aLbLineColor.GetSelectEntryColor(), + (XHatchStyle) aLbLineType.GetSelectEntryPos(), + GetCoreValue( aMtrDistance, ePoolUnit ), + static_cast(aMtrAngle.GetValue() * 10) ); + + rXFSet.Put( XFillHatchItem( String(), aXHatch ) ); + aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); + + aCtlPreview.Invalidate(); + + return 0L; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxHatchTabPage, ChangeHatchHdl_Impl, void *, EMPTYARG ) +{ + XHatch* pHatch = NULL; + int nPos = aLbHatchings.GetSelectEntryPos(); + + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + pHatch = new XHatch( ( (XHatchEntry*) pHatchingList->GetHatch( nPos ) )->GetHatch() ); + else + { + const SfxPoolItem* pPoolItem = NULL; + if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLSTYLE ), TRUE, &pPoolItem ) ) + { + if( ( XFILL_HATCH == (XFillStyle) ( ( const XFillStyleItem* ) pPoolItem )->GetValue() ) && + ( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), TRUE, &pPoolItem ) ) ) + { + pHatch = new XHatch( ( ( const XFillHatchItem* ) pPoolItem )->GetHatchValue() ); + } + } + if( !pHatch ) + { + aLbHatchings.SelectEntryPos( 0 ); + nPos = aLbHatchings.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + pHatch = new XHatch( ( (XHatchEntry*) pHatchingList->GetHatch( nPos ) )->GetHatch() ); + } + } + if( pHatch ) + { + aLbLineType.SelectEntryPos( + sal::static_int_cast< USHORT >( pHatch->GetHatchStyle() ) ); + // Wenn der Eintrag nicht in der Listbox ist, wird die Farbe + // temporaer hinzugenommen + aLbLineColor.SetNoSelection(); + aLbLineColor.SelectEntry( pHatch->GetColor() ); + if( aLbLineColor.GetSelectEntryCount() == 0 ) + { + aLbLineColor.InsertEntry( pHatch->GetColor(), String() ); + aLbLineColor.SelectEntry( pHatch->GetColor() ); + } + SetMetricValue( aMtrDistance, pHatch->GetDistance(), ePoolUnit ); + aMtrAngle.SetValue( pHatch->GetAngle() / 10 ); + + // Setzen des Winkels im AngleControl + switch( aMtrAngle.GetValue() ) + { + case 135: aCtlAngle.SetActualRP( RP_LT ); break; + case 90: aCtlAngle.SetActualRP( RP_MT ); break; + case 45: aCtlAngle.SetActualRP( RP_RT ); break; + case 180: aCtlAngle.SetActualRP( RP_LM ); break; + case 0: aCtlAngle.SetActualRP( RP_RM ); break; + case 225: aCtlAngle.SetActualRP( RP_LB ); break; + case 270: aCtlAngle.SetActualRP( RP_MB ); break; + case 315: aCtlAngle.SetActualRP( RP_RB ); break; + default: aCtlAngle.SetActualRP( RP_MM ); break; + } + + // Backgroundcolor + /* + const SfxPoolItem* pPoolItem = NULL; + if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBACKGROUND ), TRUE, &pPoolItem ) ) + { + rXFSet.Put ( XFillBackgroundItem( ( ( XFillBackgroundItem* )pPoolItem)->GetValue() ) ); + if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), TRUE, &pPoolItem ) ) + { + Color aColor( ( ( const XFillColorItem* ) pPoolItem )->GetValue() ); + rXFSet.Put( XFillColorItem( String(), aColor ) ); + } + } + */ + // ItemSet fuellen und an aCtlPreview weiterleiten + rXFSet.Put( XFillHatchItem( String(), *pHatch ) ); + aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); + + aCtlPreview.Invalidate(); + delete pHatch; + } + aMtrDistance.SaveValue(); + aMtrAngle.SaveValue(); + aLbLineType.SaveValue(); + aLbLineColor.SaveValue(); + aLbHatchings.SaveValue(); + + return 0L; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxHatchTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) +{ + ResMgr& rMgr = DIALOG_MGR(); + String aNewName( ResId( RID_SVXSTR_HATCH, rMgr ) ); + String aDesc( ResId( RID_SVXSTR_DESC_HATCH, rMgr ) ); + String aName; + + long nCount = pHatchingList->Count(); + long j = 1; + BOOL bDifferent = FALSE; + + while( !bDifferent ) + { + aName = aNewName; + aName += sal_Unicode(' '); + aName += UniString::CreateFromInt32( j++ ); + bDifferent = TRUE; + + for( long i = 0; i < nCount && bDifferent; i++ ) + if( aName == pHatchingList->GetHatch( i )->GetName() ) + bDifferent = FALSE; + } + + //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME ); + DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 + WarningBox* pWarnBox = NULL; + USHORT nError = RID_SVXSTR_WARN_NAME_DUPLICATE; + + while( pDlg->Execute() == RET_OK ) + { + pDlg->GetName( aName ); + + bDifferent = TRUE; + + for( long i = 0; i < nCount && bDifferent; i++ ) + if( aName == pHatchingList->GetHatch( i )->GetName() ) + bDifferent = FALSE; + + if( bDifferent ) { + nError = 0; + break; + } + + if( !pWarnBox ) + { + pWarnBox = new WarningBox( DLGWIN, + WinBits( WB_OK_CANCEL ), + String( ResId( nError, rMgr ) ) ); + pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE ); + } + + if( pWarnBox->Execute() != RET_OK ) + break; + } + //Rectangle aDlgRect( pDlg->GetPosPixel(), pDlg->GetSizePixel() ); + delete pDlg; + delete pWarnBox; + + if( !nError ) + { + XHatch aXHatch( aLbLineColor.GetSelectEntryColor(), + (XHatchStyle) aLbLineType.GetSelectEntryPos(), + GetCoreValue( aMtrDistance, ePoolUnit ), + static_cast(aMtrAngle.GetValue() * 10) ); + XHatchEntry* pEntry = new XHatchEntry( aXHatch, aName ); + + pHatchingList->Insert( pEntry, nCount ); + + aLbHatchings.Append( pEntry ); + + aLbHatchings.SelectEntryPos( aLbHatchings.GetEntryCount() - 1 ); + +#ifdef WNT + // hack: #31355# W.P. + Rectangle aRect( aLbHatchings.GetPosPixel(), aLbHatchings.GetSizePixel() ); + if( TRUE ) { // ??? overlapped with pDlg + // and srolling + Invalidate( aRect ); + //aLbHatchings.Invalidate(); + } +#endif + + // Flag fuer modifiziert setzen + *pnHatchingListState |= CT_MODIFIED; + + ChangeHatchHdl_Impl( this ); + } + + // Status der Buttons ermitteln + if( pHatchingList->Count() ) + { + aBtnModify.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + return 0L; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxHatchTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) +{ + USHORT nPos = aLbHatchings.GetSelectEntryPos(); + + if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + ResMgr& rMgr = DIALOG_MGR(); + String aNewName( ResId( RID_SVXSTR_HATCH, rMgr ) ); + String aDesc( ResId( RID_SVXSTR_DESC_HATCH, rMgr ) ); + String aName( pHatchingList->GetHatch( nPos )->GetName() ); + String aOldName = aName; + + //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME ); + DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 + + long nCount = pHatchingList->Count(); + BOOL bDifferent = FALSE; + BOOL bLoop = TRUE; + while( bLoop && pDlg->Execute() == RET_OK ) + { + pDlg->GetName( aName ); + bDifferent = TRUE; + + for( long i = 0; i < nCount && bDifferent; i++ ) + { + if( aName == pHatchingList->GetHatch( i )->GetName() && + aName != aOldName ) + bDifferent = FALSE; + } + + if( bDifferent ) + { + bLoop = FALSE; + XHatch aXHatch( aLbLineColor.GetSelectEntryColor(), + (XHatchStyle) aLbLineType.GetSelectEntryPos(), + GetCoreValue( aMtrDistance, ePoolUnit ), + static_cast(aMtrAngle.GetValue() * 10) ); + + XHatchEntry* pEntry = new XHatchEntry( aXHatch, aName ); + + delete pHatchingList->Replace( pEntry, nPos ); + + aLbHatchings.Modify( pEntry, nPos ); + + aLbHatchings.SelectEntryPos( nPos ); + + // Werte sichern fuer Changes-Erkennung ( -> Methode ) + aMtrDistance.SaveValue(); + aMtrAngle.SaveValue(); + aLbLineType.SaveValue(); + aLbLineColor.SaveValue(); + aLbHatchings.SaveValue(); + + // Flag fuer modifiziert setzen + *pnHatchingListState |= CT_MODIFIED; + } + else + { + WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); + aBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); + aBox.Execute(); + } + } + delete( pDlg ); + } + return 0L; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxHatchTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) +{ + USHORT nPos = aLbHatchings.GetSelectEntryPos(); + + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ), +//! SVX_RES( RID_SVXSTR_DEL_HATCH ), + String( SVX_RES( RID_SVXSTR_ASK_DEL_HATCH ) ) ); + + if( aQueryBox.Execute() == RET_YES ) + { + delete pHatchingList->Remove( nPos ); + aLbHatchings.RemoveEntry( nPos ); + aLbHatchings.SelectEntryPos( 0 ); + + aCtlPreview.Invalidate(); + + ChangeHatchHdl_Impl( this ); + + // Flag fuer modifiziert setzen + *pnHatchingListState |= CT_MODIFIED; + } + } + // Status der Buttons ermitteln + if( !pHatchingList->Count() ) + { + aBtnModify.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } + return 0L; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxHatchTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) +{ + ResMgr& rMgr = DIALOG_MGR(); + USHORT nReturn = RET_YES; + + if ( *pnHatchingListState & CT_MODIFIED ) + { + nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ), + String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute(); + + if ( nReturn == RET_YES ) + pHatchingList->Save(); + } + + if ( nReturn != RET_CANCEL ) + { + ::sfx2::FileDialogHelper aDlg( + com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, + 0 ); + String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soh" ) ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + + if( aDlg.Execute() == ERRCODE_NONE ) + { + INetURLObject aURL( aDlg.GetPath() ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + // Liste speichern + XHatchList* pHatchList = new XHatchList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); + pHatchList->SetName( aURL.getName() ); + if( pHatchList->Load() ) + { + if( pHatchList ) + { + // Pruefen, ob Tabelle geloescht werden darf: + if( pHatchingList != ( (SvxAreaTabDialog*) DLGWIN )->GetHatchingList() ) + delete pHatchingList; + + pHatchingList = pHatchList; + ( (SvxAreaTabDialog*) DLGWIN )->SetNewHatchingList( pHatchingList ); + + aLbHatchings.Clear(); + aLbHatchings.Fill( pHatchingList ); + Reset( rOutAttrs ); + + pHatchingList->SetName( aURL.getName() ); + + // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( ResId( RID_SVXSTR_TABLE, rMgr ) ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + + if ( aURL.getBase().getLength() > 18 ) + { + aString += String(aURL.getBase()).Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String(aURL.getBase()); + + // Flag fuer gewechselt setzen + *pnHatchingListState |= CT_CHANGED; + // Flag fuer modifiziert entfernen + *pnHatchingListState &= ~CT_MODIFIED; + } + } + else + ErrorBox( DLGWIN, WinBits( WB_OK ), + String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute(); + } + } + + // Status der Buttons ermitteln + if ( pHatchingList->Count() ) + { + aBtnModify.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + else + { + aBtnModify.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } + return 0L; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxHatchTabPage, ClickSaveHdl_Impl, void *, EMPTYARG ) +{ + ::sfx2::FileDialogHelper aDlg( + com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 ); + String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soh" ) ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + if( pHatchingList->GetName().Len() ) + { + aFile.Append( pHatchingList->GetName() ); + + if( !aFile.getExtension().getLength() ) + aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "soh" ) ) ); + } + + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + if ( aDlg.Execute() == ERRCODE_NONE ) + { + INetURLObject aURL( aDlg.GetPath() ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + pHatchingList->SetName( aURL.getName() ); + pHatchingList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); + + if( pHatchingList->Save() ) + { + // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( SVX_RES( RID_SVXSTR_TABLE ) ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + + if ( aURL.getBase().getLength() > 18 ) + { + aString += String(aURL.getBase()).Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String(aURL.getBase()); + + // Flag fuer gespeichert setzen + *pnHatchingListState |= CT_SAVED; + // Flag fuer modifiziert entfernen + *pnHatchingListState &= ~CT_MODIFIED; + } + else + { + ErrorBox( DLGWIN, WinBits( WB_OK ), + String( SVX_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute(); + } + } + + return 0L; +} + +//------------------------------------------------------------------------ + +void SvxHatchTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt ) +{ + if( pWindow == &aCtlAngle ) + { + switch( eRcPt ) + { + case RP_LT: aMtrAngle.SetValue( 135 ); break; + case RP_MT: aMtrAngle.SetValue( 90 ); break; + case RP_RT: aMtrAngle.SetValue( 45 ); break; + case RP_LM: aMtrAngle.SetValue( 180 ); break; + case RP_RM: aMtrAngle.SetValue( 0 ); break; + case RP_LB: aMtrAngle.SetValue( 225 ); break; + case RP_MB: aMtrAngle.SetValue( 270 ); break; + case RP_RB: aMtrAngle.SetValue( 315 ); break; + case RP_MM: break; + } + ModifiedHdl_Impl( this ); + } +} + + +void SvxHatchTabPage::DataChanged( const DataChangedEvent& rDCEvt ) +{ + if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) + aCtlPreview.SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + + SvxTabPage::DataChanged( rDCEvt ); +} + diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx new file mode 100644 index 000000000000..47228dcd013c --- /dev/null +++ b/cui/source/tabpages/tpline.cxx @@ -0,0 +1,1926 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tpline.cxx,v $ + * $Revision: 1.45 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- + +#ifndef _SVX_SIZEITEM_HXX //autogen + +#include +#endif +#include +#include +#include +#include + +#define _SVX_TPLINE_CXX + +#include +#include "tabline.hrc" +#include "svx/xattr.hxx" +#include +#include +#include "svx/drawitem.hxx" +#include "cuitabline.hxx" +#include "dlgname.hxx" +#include +#include "svx/dlgutil.hxx" +#include +#include "svx/svxgrahicitem.hxx" +//#include "linectrl.hrc" +#include +#include "svx/ofaitem.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "svx/opengrf.hxx" + +#define MAX_BMP_WIDTH 16 +#define MAX_BMP_HEIGHT 16 +// define ---------------------------------------------------------------- + +#define DLGWIN this->GetParent()->GetParent() + +#define BITMAP_WIDTH 32 +#define BITMAP_HEIGHT 12 +#define XOUT_WIDTH 150 + +// static ---------------------------------------------------------------- + +static USHORT pLineRanges[] = +{ + XATTR_LINETRANSPARENCE, + XATTR_LINETRANSPARENCE, + SID_ATTR_LINE_STYLE, + SID_ATTR_LINE_ENDCENTER, + 0 +}; + +/************************************************************************* +|* +|* Dialog zum Aendern der Linien +|* +\************************************************************************/ + +SvxLineTabPage::SvxLineTabPage +( + Window* pParent, + const SfxItemSet& rInAttrs +) : + SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_LINE ), rInAttrs ), + aFtLineStyle ( this, SVX_RES( FT_LINE_STYLE ) ), + aLbLineStyle ( this, SVX_RES( LB_LINE_STYLE ) ), + aFtColor ( this, SVX_RES( FT_COLOR ) ), + aLbColor ( this, SVX_RES( LB_COLOR ) ), + aFtLineWidth ( this, SVX_RES( FT_LINE_WIDTH ) ), + aMtrLineWidth ( this, SVX_RES( MTR_FLD_LINE_WIDTH ) ), + aFtTransparent ( this, SVX_RES( FT_TRANSPARENT ) ), + aMtrTransparent ( this, SVX_RES( MTR_LINE_TRANSPARENT ) ), + aFlLine ( this, SVX_RES( FL_LINE ) ), + aFtLineEndsStyle ( this, SVX_RES( FT_LINE_ENDS_STYLE ) ), + aLbStartStyle ( this, SVX_RES( LB_START_STYLE ) ), + aFtLineEndsWidth ( this, SVX_RES( FT_LINE_ENDS_WIDTH ) ), + aMtrStartWidth ( this, SVX_RES( MTR_FLD_START_WIDTH ) ), + aTsbCenterStart ( this, SVX_RES( TSB_CENTER_START ) ), + aLbEndStyle ( this, SVX_RES( LB_END_STYLE ) ), + aMtrEndWidth ( this, SVX_RES( MTR_FLD_END_WIDTH ) ), + aTsbCenterEnd ( this, SVX_RES( TSB_CENTER_END ) ), + aCbxSynchronize ( this, SVX_RES( CBX_SYNCHRONIZE ) ), + aFlLineEnds ( this, SVX_RES( FL_LINE_ENDS ) ), + aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ), + aFLSeparator ( this, SVX_RES( FL_SEPARATOR ) ), + + // #116827# + maFLEdgeStyle ( this, SVX_RES( FL_EDGE_STYLE ) ), + maFTEdgeStyle ( this, SVX_RES( FT_EDGE_STYLE ) ), + maLBEdgeStyle ( this, SVX_RES( LB_EDGE_STYLE ) ), + + pSymbolList(NULL), + bNewSize(false), + nNumMenuGalleryItems(0), + nSymbolType(SVX_SYMBOLTYPE_UNKNOWN), //unbekannt bzw. unchanged + pSymbolAttr(NULL), + //#58425# Symbole auf einer Linie (z.B. StarChart) + aFlSymbol ( this, SVX_RES(FL_SYMBOL_FORMAT)), + aSymbolMB ( this, SVX_RES(MB_SYMBOL_BITMAP)), + aSymbolWidthFT ( this, SVX_RES(FT_SYMBOL_WIDTH)), + aSymbolWidthMF ( this, SVX_RES(MF_SYMBOL_WIDTH)), + aSymbolHeightFT ( this, SVX_RES(FT_SYMBOL_HEIGHT)), + aSymbolHeightMF ( this, SVX_RES(MF_SYMBOL_HEIGHT)), + aSymbolRatioCB ( this, SVX_RES(CB_SYMBOL_RATIO)), + + bLastWidthModified(FALSE), + aSymbolLastSize(Size(0,0)), + bSymbols(FALSE), + + rOutAttrs ( rInAttrs ), + bObjSelected( sal_False ), + + pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), + aXLStyle ( XLINE_DASH ), + aXWidth ( 1 ), + aXDash ( String(), XDash( XDASH_RECT, 3, 7, 2, 40, 15 ) ), + aXColor ( String(), COL_LIGHTRED ), + aXLineAttr ( pXPool ), + rXLSet ( aXLineAttr.GetItemSet() ), + pnLineEndListState( 0 ), + pnDashListState( 0 ), + pnColorTableState( 0 ), + nPageType ( 0 )//CHINA001 pPageType ( NULL ), +{ + FreeResource(); + + // diese Page braucht ExchangeSupport + SetExchangeSupport(); + + // Metrik einstellen + FieldUnit eFUnit = GetModuleFieldUnit( &rInAttrs ); + + switch ( eFUnit ) + { + case FUNIT_M: + case FUNIT_KM: + eFUnit = FUNIT_MM; + // no break -> we now have mm + case FUNIT_MM: + aMtrLineWidth.SetSpinSize( 50 ); + aMtrStartWidth.SetSpinSize( 50 ); + aMtrEndWidth.SetSpinSize( 50 ); + break; + + case FUNIT_INCH: + aMtrLineWidth.SetSpinSize( 2 ); + aMtrStartWidth.SetSpinSize( 2 ); + aMtrEndWidth.SetSpinSize( 2 ); + break; + default: ;//prevent warning + } + SetFieldUnit( aMtrLineWidth, eFUnit ); + SetFieldUnit( aMtrStartWidth, eFUnit ); + SetFieldUnit( aMtrEndWidth, eFUnit ); + + // PoolUnit ermitteln + SfxItemPool* pPool = rOutAttrs.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool?" ); + ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH ); + + aLbLineStyle.SetSelectHdl( + LINK( this, SvxLineTabPage, ClickInvisibleHdl_Impl ) ); + aLbColor.SetSelectHdl( + LINK( this, SvxLineTabPage, ChangePreviewHdl_Impl ) ); + aMtrLineWidth.SetModifyHdl( + LINK( this, SvxLineTabPage, ChangePreviewHdl_Impl ) ); + aMtrTransparent.SetModifyHdl( + LINK( this, SvxLineTabPage, ChangeTransparentHdl_Impl ) ); + + Link aStart = LINK( this, SvxLineTabPage, ChangeStartHdl_Impl ); + Link aEnd = LINK( this, SvxLineTabPage, ChangeEndHdl_Impl ); + aLbStartStyle.SetSelectHdl( aStart ); + aLbEndStyle.SetSelectHdl( aEnd ); + aMtrStartWidth.SetModifyHdl( aStart ); + aMtrEndWidth.SetModifyHdl( aEnd ); + aTsbCenterStart.SetClickHdl( aStart ); + aTsbCenterEnd.SetClickHdl( aEnd ); + + pColorTab = NULL; + pDashList = NULL; + pLineEndList = NULL; + + // #116827# + Link aEdgeStyle = LINK( this, SvxLineTabPage, ChangeEdgeStyleHdl_Impl ); + maLBEdgeStyle.SetSelectHdl( aEdgeStyle ); + + //#58425# Symbole auf einer Linie (z.B. StarChart) , MB-Handler setzen + aSymbolMB.SetSelectHdl(LINK(this, SvxLineTabPage, GraphicHdl_Impl)); + aSymbolMB.SetActivateHdl(LINK(this, SvxLineTabPage, MenuCreateHdl_Impl)); + aSymbolWidthMF.SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl)); + aSymbolHeightMF.SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl)); + aSymbolRatioCB.SetClickHdl(LINK(this, SvxLineTabPage, RatioHdl_Impl)); + + aSymbolRatioCB.Check(TRUE); + ShowSymbolControls(FALSE); + + // #63083# + nActLineWidth = -1; +} +//#58425# Symbole auf einer Linie (z.B. StarChart) , Symbol-Controls aktivieren +void SvxLineTabPage::ShowSymbolControls(BOOL bOn) +{ + bSymbols=bOn; + aSymbolWidthFT.Show(bOn); + aSymbolWidthMF.Show(bOn); + aSymbolHeightFT.Show(bOn); + aSymbolHeightMF.Show(bOn); + aFlSymbol.Show(bOn); + aSymbolRatioCB.Show(bOn); + aSymbolMB.Show(bOn); + aCtlPreview.ShowSymbol(bOn); +} +// ----------------------------------------------------------------------- +//#58425# Symbole auf einer Linie (z.B. StarChart) , dtor neu! +SvxLineTabPage::~SvxLineTabPage() +{ + delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY ); + + if(pSymbolList) + delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_SYMBOLS ); + + String* pStr = (String*)aGrfNames.First(); + while( pStr ) + { + delete pStr; + pStr = (String*)aGrfNames.Next(); + } + SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.First(); + while( pInfo ) + { + delete pInfo->pBrushItem; + delete pInfo; + pInfo = (SvxBmpItemInfo*)aGrfBrushItems.Next(); + } +} +void SvxLineTabPage::Construct() +{ + // Farbtabelle + aLbColor.Fill( pColorTab ); + FillListboxes(); +} + +void SvxLineTabPage::FillListboxes() +{ + ResMgr& rMgr = DIALOG_MGR(); + USHORT nOldSelect = aLbLineStyle.GetSelectEntryPos(); + aLbLineStyle.FillStyles(); + aLbLineStyle.Fill( pDashList ); + aLbLineStyle.SelectEntryPos( nOldSelect ); + + // LinienEndenStile + String sNone( ResId( RID_SVXSTR_NONE, rMgr ) ); + nOldSelect = aLbStartStyle.GetSelectEntryPos(); + aLbStartStyle.Clear(); + aLbStartStyle.InsertEntry( sNone ); + aLbStartStyle.Fill( pLineEndList ); + aLbStartStyle.SelectEntryPos( nOldSelect ); + nOldSelect = aLbEndStyle.GetSelectEntryPos(); + aLbEndStyle.Clear(); + aLbEndStyle.InsertEntry( sNone ); + aLbEndStyle.Fill( pLineEndList, FALSE ); + aLbEndStyle.SelectEntryPos( nOldSelect ); +} + +// ----------------------------------------------------------------------- + +void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) +{ + SFX_ITEMSET_ARG (&rSet,pPageTypeItem,CntUInt16Item,SID_PAGE_TYPE,sal_False); //add CHINA001 begin + if (pPageTypeItem) + SetPageType(pPageTypeItem->GetValue()); //add CHINA001 end + if( nDlgType == 0 && pDashList ) //CHINA001 if( *pDlgType == 0 && pDashList ) // Linien-Dialog + { + ResMgr& rMgr = DIALOG_MGR(); + USHORT nPos; + USHORT nCount; + + // Dashliste + if( ( *pnDashListState & CT_MODIFIED ) || + ( *pnDashListState & CT_CHANGED ) ) + { + if( *pnDashListState & CT_CHANGED ) + pDashList = ( (SvxLineTabDialog*) DLGWIN )-> + GetNewDashList(); + *pnDashListState = CT_NONE; + + // Styleliste + nPos = aLbLineStyle.GetSelectEntryPos(); + + aLbLineStyle.Clear(); + aLbLineStyle.InsertEntry( + String( ResId( RID_SVXSTR_INVISIBLE, rMgr ) ) ); + aLbLineStyle.InsertEntry( + String( ResId( RID_SVXSTR_SOLID, rMgr ) ) ); + aLbLineStyle.Fill( pDashList ); + nCount = aLbLineStyle.GetEntryCount(); + + if ( nCount == 0 ) + ; // Dieser Fall sollte nicht auftreten + else if( nCount <= nPos ) + aLbLineStyle.SelectEntryPos( 0 ); + else + aLbLineStyle.SelectEntryPos( nPos ); + // SelectStyleHdl_Impl( this ); + } + + INetURLObject aDashURL( pDashList->GetPath() ); + + aDashURL.Append( pDashList->GetName() ); + DBG_ASSERT( aDashURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); +/* // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( ResId( RID_SVXSTR_TABLE, pMgr ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + + if ( aDashURL.getBase().Len() > 18 ) + { + aString += aDashURL.getBase().Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += aDashURL.getBase(); + + aGrpLine.SetText( aString ); +*/ + // LineEndliste + if( ( *pnLineEndListState & CT_MODIFIED ) || + ( *pnLineEndListState & CT_CHANGED ) ) + { + if( *pnLineEndListState & CT_CHANGED ) + pLineEndList = ( (SvxLineTabDialog*) DLGWIN )-> + GetNewLineEndList(); + *pnLineEndListState = CT_NONE; + + nPos = aLbLineStyle.GetSelectEntryPos(); + String sNone( ResId( RID_SVXSTR_NONE, rMgr ) ); + aLbStartStyle.Clear(); + aLbStartStyle.InsertEntry( sNone ); + + aLbStartStyle.Fill( pLineEndList ); + nCount = aLbStartStyle.GetEntryCount(); + if( nCount == 0 ) + ; // Dieser Fall sollte nicht auftreten + else if( nCount <= nPos ) + aLbStartStyle.SelectEntryPos( 0 ); + else + aLbStartStyle.SelectEntryPos( nPos ); + + aLbEndStyle.Clear(); + aLbEndStyle.InsertEntry( sNone ); + + aLbEndStyle.Fill( pLineEndList, FALSE ); + nCount = aLbEndStyle.GetEntryCount(); + + if( nCount == 0 ) + ; // Dieser Fall sollte nicht auftreten + else if( nCount <= nPos ) + aLbEndStyle.SelectEntryPos( 0 ); + else + aLbEndStyle.SelectEntryPos( nPos ); + } + INetURLObject aLineURL( pLineEndList->GetPath() ); + + aLineURL.Append( pLineEndList->GetName() ); + DBG_ASSERT( aLineURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); +/* // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + aString = String( ResId( RID_SVXSTR_TABLE, pMgr ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + + if ( aLineURL.getBase().Len() > 18 ) + { + aString += aLineURL.getBase().Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += aLineURL.getBase(); + + aGrpLineEnds.SetText( aString ); +*/ + // Auswertung, ob von einer anderen TabPage ein anderer Fuelltyp gesetzt wurde + if( aLbLineStyle.GetSelectEntryPos() != 0 ) + { + if( nPageType == 2 ) // 1//CHINA001 if( *pPageType == 2 ) // 1 + { + aLbLineStyle.SelectEntryPos( *pPosDashLb + 2 ); // +2 wegen SOLID und INVLISIBLE + ChangePreviewHdl_Impl( this ); + } + if( nPageType == 3 )//CHINA001 if( *pPageType == 3 ) + { + aLbStartStyle.SelectEntryPos( *pPosLineEndLb + 1 );// +1 wegen SOLID + aLbEndStyle.SelectEntryPos( *pPosLineEndLb + 1 );// +1 wegen SOLID + ChangePreviewHdl_Impl( this ); + } + } + + // ColorTable + if( *pnColorTableState ) + { + if( *pnColorTableState & CT_CHANGED ) + pColorTab = ( (SvxLineTabDialog*) DLGWIN )-> + GetNewColorTable(); + // aLbColor + sal_uInt16 nColorPos = aLbColor.GetSelectEntryPos(); + aLbColor.Clear(); + aLbColor.Fill( pColorTab ); + nCount = aLbColor.GetEntryCount(); + if( nCount == 0 ) + ; // This case should never occur + else if( nCount <= nColorPos ) + aLbColor.SelectEntryPos( 0 ); + else + aLbColor.SelectEntryPos( nColorPos ); + + ChangePreviewHdl_Impl( this ); + } + + nPageType = 0;//CHINA001 *pPageType = 0; + } + // Seite existiert im Ctor noch nicht, deswegen hier! + + else if ( nDlgType == 1100 || // Chart-Dialog//CHINA001 else if ( *pDlgType == 1100 || // Chart-Dialog + nDlgType == 1101 )//CHINA001 *pDlgType == 1101 ) + { + aFtLineEndsStyle.Hide(); + aFtLineEndsWidth.Hide(); + aLbStartStyle.Hide(); + aMtrStartWidth.Hide(); + aTsbCenterStart.Hide(); + aLbEndStyle.Hide(); + aMtrEndWidth.Hide(); + aTsbCenterEnd.Hide(); + aCbxSynchronize.Hide(); + aFlLineEnds.Hide(); + + // #116827# + maFLEdgeStyle.Hide(); + maFTEdgeStyle.Hide(); + maLBEdgeStyle.Hide(); + } +} + +// ----------------------------------------------------------------------- + +int SvxLineTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if( nDlgType == 0 ) // Linien-Dialog//CHINA001 if( *pDlgType == 0 ) // Linien-Dialog + { + nPageType = 1; // evtl. fuer Erweiterungen//CHINA001 *pPageType = 1; // evtl. fuer Erweiterungen + *pPosDashLb = aLbLineStyle.GetSelectEntryPos() - 2;// erster Eintrag SOLID !!! + USHORT nPos = aLbStartStyle.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + nPos--; + *pPosLineEndLb = nPos; + } + + if( _pSet ) + FillItemSet( *_pSet ); + + return( LEAVE_PAGE ); +} + +// ----------------------------------------------------------------------- + +BOOL SvxLineTabPage::FillItemSet( SfxItemSet& rAttrs ) +{ + const SfxPoolItem* pOld = NULL; + USHORT nPos; + BOOL bModified = FALSE; + + // Um evtl. Modifikationen der Liste vorzubeugen + // werden Items anderer Seiten nicht gesetzt + if( nDlgType != 0 || nPageType != 2 )//CHINA001 if( *pDlgType != 0 || *pPageType != 2 ) + { + nPos = aLbLineStyle.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND && + nPos != aLbLineStyle.GetSavedValue() ) + { + XLineStyleItem* pStyleItem = NULL; + + if( nPos == 0 ) + pStyleItem = new XLineStyleItem( XLINE_NONE ); + else if( nPos == 1 ) + pStyleItem = new XLineStyleItem( XLINE_SOLID ); + else + { + pStyleItem = new XLineStyleItem( XLINE_DASH ); + + // Zusaetzliche Sicherheit + if( pDashList->Count() > (long) ( nPos - 2 ) ) + { + XLineDashItem aDashItem( aLbLineStyle.GetSelectEntry(), + pDashList->GetDash( nPos - 2 )->GetDash() ); + pOld = GetOldItem( rAttrs, XATTR_LINEDASH ); + if ( !pOld || !( *(const XLineDashItem*)pOld == aDashItem ) ) + { + rAttrs.Put( aDashItem ); + bModified = TRUE; + } + } + } + pOld = GetOldItem( rAttrs, XATTR_LINESTYLE ); + if ( !pOld || !( *(const XLineStyleItem*)pOld == *pStyleItem ) ) + { + rAttrs.Put( *pStyleItem ); + bModified = TRUE; + } + delete pStyleItem; + } + } + // Linienbreite + // GetSavedValue() liefert String! + if( aMtrLineWidth.GetText() != aMtrLineWidth.GetSavedValue() ) + { + XLineWidthItem aItem( GetCoreValue( aMtrLineWidth, ePoolUnit ) ); + pOld = GetOldItem( rAttrs, XATTR_LINEWIDTH ); + if ( !pOld || !( *(const XLineWidthItem*)pOld == aItem ) ) + { + rAttrs.Put( aItem ); + bModified = TRUE; + } + } + //Breite Linienanfang + if( aMtrStartWidth.GetText() != aMtrStartWidth.GetSavedValue() ) + { + XLineStartWidthItem aItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) ); + pOld = GetOldItem( rAttrs, XATTR_LINESTARTWIDTH ); + if ( !pOld || !( *(const XLineStartWidthItem*)pOld == aItem ) ) + { + rAttrs.Put( aItem ); + bModified = TRUE; + } + } + //Breite Linienende + if( aMtrEndWidth.GetText() != aMtrEndWidth.GetSavedValue() ) + { + XLineEndWidthItem aItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) ); + pOld = GetOldItem( rAttrs, XATTR_LINEENDWIDTH ); + if ( !pOld || !( *(const XLineEndWidthItem*)pOld == aItem ) ) + { + rAttrs.Put( aItem ); + bModified = TRUE; + } + } + + // Linienfarbe + if( aLbColor.GetSelectEntryPos() != aLbColor.GetSavedValue() ) + { + XLineColorItem aItem( aLbColor.GetSelectEntry(), + aLbColor.GetSelectEntryColor() ); + pOld = GetOldItem( rAttrs, XATTR_LINECOLOR ); + if ( !pOld || !( *(const XLineColorItem*)pOld == aItem ) ) + { + rAttrs.Put( aItem ); + bModified = TRUE; + } + } + + if( nDlgType != 0 || nPageType != 3 )//CHINA001 if( *pDlgType != 0 || *pPageType != 3 ) + { + // Linienanfang + nPos = aLbStartStyle.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND && + nPos != aLbStartStyle.GetSavedValue() ) + { + XLineStartItem* pItem = NULL; + if( nPos == 0 ) + pItem = new XLineStartItem(); + else if( pLineEndList->Count() > (long) ( nPos - 1 ) ) + pItem = new XLineStartItem( aLbStartStyle.GetSelectEntry(), + pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ); + pOld = GetOldItem( rAttrs, XATTR_LINESTART ); + if( pItem && + ( !pOld || !( *(const XLineEndItem*)pOld == *pItem ) ) ) + { + rAttrs.Put( *pItem ); + bModified = TRUE; + } + delete pItem; + } + // Linienende + nPos = aLbEndStyle.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND && + nPos != aLbEndStyle.GetSavedValue() ) + { + XLineEndItem* pItem = NULL; + if( nPos == 0 ) + pItem = new XLineEndItem(); + else if( pLineEndList->Count() > (long) ( nPos - 1 ) ) + pItem = new XLineEndItem( aLbEndStyle.GetSelectEntry(), + pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ); + pOld = GetOldItem( rAttrs, XATTR_LINEEND ); + if( pItem && + ( !pOld || !( *(const XLineEndItem*)pOld == *pItem ) ) ) + { + rAttrs.Put( *pItem ); + bModified = TRUE; + } + delete pItem; + } + } + + // Linienenden zentriert + TriState eState = aTsbCenterStart.GetState(); + if( eState != aTsbCenterStart.GetSavedValue() ) + { + XLineStartCenterItem aItem( sal::static_int_cast< BOOL >( eState ) ); + pOld = GetOldItem( rAttrs, XATTR_LINESTARTCENTER ); + if ( !pOld || !( *(const XLineStartCenterItem*)pOld == aItem ) ) + { + rAttrs.Put( aItem ); + bModified = TRUE; + } + } + eState = aTsbCenterEnd.GetState(); + if( eState != aTsbCenterEnd.GetSavedValue() ) + { + XLineEndCenterItem aItem( sal::static_int_cast< BOOL >( eState ) ); + pOld = GetOldItem( rAttrs, XATTR_LINEENDCENTER ); + if ( !pOld || !( *(const XLineEndCenterItem*)pOld == aItem ) ) + { + rAttrs.Put( aItem ); + bModified = TRUE; + } + } + + //Breite Linienanfang + if( aMtrStartWidth.GetText() != aMtrStartWidth.GetSavedValue() ) + { + XLineStartWidthItem aItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) ); + pOld = GetOldItem( rAttrs, XATTR_LINESTARTWIDTH ); + if ( !pOld || !( *(const XLineStartWidthItem*)pOld == aItem ) ) + { + rAttrs.Put( aItem ); + bModified = TRUE; + } + } + //Breite Linienende + if( aMtrEndWidth.GetText() != aMtrEndWidth.GetSavedValue() ) + { + XLineEndWidthItem aItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) ); + pOld = GetOldItem( rAttrs, XATTR_LINEENDWIDTH ); + if ( !pOld || !( *(const XLineEndWidthItem*)pOld == aItem ) ) + { + rAttrs.Put( aItem ); + bModified = TRUE; + } + } + + // Transparenz + UINT16 nVal = (UINT16)aMtrTransparent.GetValue(); + if( nVal != (UINT16)aMtrTransparent.GetSavedValue().ToInt32() ) + { + XLineTransparenceItem aItem( nVal ); + pOld = GetOldItem( rAttrs, XATTR_LINETRANSPARENCE ); + if ( !pOld || !( *(const XLineTransparenceItem*)pOld == aItem ) ) + { + rAttrs.Put( aItem ); + bModified = TRUE; + } + } + + // #116827# + nPos = maLBEdgeStyle.GetSelectEntryPos(); + if( LISTBOX_ENTRY_NOTFOUND != nPos && nPos != maLBEdgeStyle.GetSavedValue() ) + { + XLineJointItem* pNew = 0L; + + switch(nPos) + { + case 0: // Rounded, default + { + pNew = new XLineJointItem(XLINEJOINT_ROUND); + break; + } + case 1: // - none - + { + pNew = new XLineJointItem(XLINEJOINT_NONE); + break; + } + case 2: // Miter + { + pNew = new XLineJointItem(XLINEJOINT_MITER); + break; + } + case 3: // Bevel + { + pNew = new XLineJointItem(XLINEJOINT_BEVEL); + break; + } + } + + if(pNew) + { + pOld = GetOldItem( rAttrs, XATTR_LINEJOINT ); + + if(!pOld || !(*(const XLineJointItem*)pOld == *pNew)) + { + rAttrs.Put( *pNew ); + bModified = TRUE; + } + + delete pNew; + } + } + + if(nSymbolType!=SVX_SYMBOLTYPE_UNKNOWN || bNewSize) + { + //wurde also per Auswahl gesetzt oder Gr��e ist anders + SvxSizeItem aSItem(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),aSymbolSize); + const SfxPoolItem* pSOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE) ); + bNewSize = pSOld ? *(const SvxSizeItem *)pSOld != aSItem : bNewSize ; + if(bNewSize) + { + rAttrs.Put(aSItem); + bModified=TRUE; + } + + SfxInt32Item aTItem(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),nSymbolType); + const SfxPoolItem* pTOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE) ); + bool bNewType = pTOld == NULL || *(const SfxInt32Item*)pTOld != aTItem; + if(bNewType && nSymbolType==SVX_SYMBOLTYPE_UNKNOWN) + bNewType=false;//kleine Korrektur, Typ wurde garnicht gesetzt -> kein Type-Item erzeugen! + if(bNewType) + { + rAttrs.Put(aTItem); + bModified=TRUE; + } + + if(nSymbolType!=SVX_SYMBOLTYPE_NONE) + { + SvxBrushItem aBItem(aSymbolGraphic,GPOS_MM,rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH)); + const SfxPoolItem* pBOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH) ); + bool bNewBrush = + pBOld == NULL || *(const SvxBrushItem*)pBOld != aBItem; + if(bNewBrush) + { + rAttrs.Put(aBItem); + bModified=TRUE; + } + } + } + rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType));//add CHINA001 + return( bModified ); +} + +// ----------------------------------------------------------------------- + +BOOL SvxLineTabPage::FillXLSet_Impl() +{ + USHORT nPos; + + if( aLbLineStyle.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ) + { + //rXLSet.Put( XLineDashItem ( rOutAttrs.Get( GetWhich( XATTR_LINEDASH ) ) ) ); + rXLSet.Put( XLineStyleItem( XLINE_NONE ) ); + } + else if( aLbLineStyle.IsEntryPosSelected( 0 ) ) + rXLSet.Put( XLineStyleItem( XLINE_NONE ) ); + else if( aLbLineStyle.IsEntryPosSelected( 1 ) ) + rXLSet.Put( XLineStyleItem( XLINE_SOLID ) ); + else + { + rXLSet.Put( XLineStyleItem( XLINE_DASH ) ); + + nPos = aLbLineStyle.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + rXLSet.Put( XLineDashItem( aLbLineStyle.GetSelectEntry(), + pDashList->GetDash( nPos - 2 )->GetDash() ) ); + } + } + + nPos = aLbStartStyle.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + if( nPos == 0 ) + rXLSet.Put( XLineStartItem() ); + else + rXLSet.Put( XLineStartItem( aLbStartStyle.GetSelectEntry(), + pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) ); + } + nPos = aLbEndStyle.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + if( nPos == 0 ) + rXLSet.Put( XLineEndItem() ); + else + rXLSet.Put( XLineEndItem( aLbEndStyle.GetSelectEntry(), + pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) ); + } + + // #116827# + nPos = maLBEdgeStyle.GetSelectEntryPos(); + if(LISTBOX_ENTRY_NOTFOUND != nPos) + { + switch(nPos) + { + case 0: // Rounded, default + { + rXLSet.Put(XLineJointItem(XLINEJOINT_ROUND)); + break; + } + case 1: // - none - + { + rXLSet.Put(XLineJointItem(XLINEJOINT_NONE)); + break; + } + case 2: // Miter + { + rXLSet.Put(XLineJointItem(XLINEJOINT_MITER)); + break; + } + case 3: // Bevel + { + rXLSet.Put(XLineJointItem(XLINEJOINT_BEVEL)); + break; + } + } + } + + rXLSet.Put( XLineStartWidthItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) ) ); + rXLSet.Put( XLineEndWidthItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) ) ); + + rXLSet.Put( XLineWidthItem( GetCoreValue( aMtrLineWidth, ePoolUnit ) ) ); + rXLSet.Put( XLineColorItem( aLbColor.GetSelectEntry(), + aLbColor.GetSelectEntryColor() ) ); + + // Linienenden zentriert + if( aTsbCenterStart.GetState() == STATE_CHECK ) + rXLSet.Put( XLineStartCenterItem( TRUE ) ); + else if( aTsbCenterStart.GetState() == STATE_NOCHECK ) + rXLSet.Put( XLineStartCenterItem( FALSE ) ); + + if( aTsbCenterEnd.GetState() == STATE_CHECK ) + rXLSet.Put( XLineEndCenterItem( TRUE ) ); + else if( aTsbCenterEnd.GetState() == STATE_NOCHECK ) + rXLSet.Put( XLineEndCenterItem( FALSE ) ); + + // Transparenz + UINT16 nVal = (UINT16)aMtrTransparent.GetValue(); + rXLSet.Put( XLineTransparenceItem( nVal ) ); + + // #116827# + aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); + + return( TRUE ); +} + +// ----------------------------------------------------------------------- + +void SvxLineTabPage::Reset( const SfxItemSet& rAttrs ) +{ + String aString; + XLineStyle eXLS; // XLINE_NONE, XLINE_SOLID, XLINE_DASH + + // Linienstil +/* + if( bObjSelected && + rAttrs.GetItemState( GetWhich( XATTR_LINESTYLE ) ) == SFX_ITEM_DEFAULT ) + { + aLbLineStyle.Disable(); + } +*/ + const SfxPoolItem *pPoolItem; + long nSymType=SVX_SYMBOLTYPE_UNKNOWN; + BOOL bPrevSym=FALSE; + BOOL bEnable=TRUE; + BOOL bIgnoreGraphic=FALSE; + BOOL bIgnoreSize=FALSE; + if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),TRUE,&pPoolItem) == SFX_ITEM_SET) + { + nSymType=((const SfxInt32Item *)pPoolItem)->GetValue(); + } + + if(nSymType == SVX_SYMBOLTYPE_AUTO) + { + aSymbolGraphic=aAutoSymbolGraphic; + aSymbolSize=aSymbolLastSize=aAutoSymbolGraphic.GetPrefSize(); + bPrevSym=TRUE; + } + else if(nSymType == SVX_SYMBOLTYPE_NONE) + { + bEnable=FALSE; + bIgnoreGraphic=TRUE; + bIgnoreSize=TRUE; + } + else if(nSymType >= 0) + { + VirtualDevice aVDev; + aVDev.SetMapMode(MapMode(MAP_100TH_MM)); + + SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS); + pModel->GetItemPool().FreezeIdRanges(); + SdrPage* pPage = new SdrPage( *pModel, FALSE ); + pPage->SetSize(Size(1000,1000)); + pModel->InsertPage( pPage, 0 ); + SdrView* pView = new SdrView( pModel, &aVDev ); + pView->hideMarkHandles(); + SdrPageView* pPageView = pView->ShowSdrPage(pPage); +// SdrPageView* pPageView = pView->ShowSdrPage(pPage, Point()); + SdrObject *pObj=NULL; + long nSymTmp=nSymType; + if(pSymbolList) + { + if(pSymbolList->GetObjCount()) + { + nSymTmp=nSymTmp%pSymbolList->GetObjCount(); //Liste wird als cyclisch betrachtet!!! + pObj=pSymbolList->GetObj(nSymTmp); + if(pObj) + { + pObj=pObj->Clone(); + pPage->NbcInsertObject(pObj); + pView->MarkObj(pObj,pPageView); + if(pSymbolAttr) + { + pObj->SetMergedItemSet(*pSymbolAttr); + } + else + { + pObj->SetMergedItemSet(rOutAttrs); + } + GDIMetaFile aMeta(pView->GetAllMarkedMetaFile()); + + aSymbolGraphic=Graphic(aMeta); + aSymbolSize=pObj->GetSnapRect().GetSize(); + aSymbolGraphic.SetPrefSize(aSymbolSize); + aSymbolGraphic.SetPrefMapMode(MAP_100TH_MM); + bPrevSym=TRUE; + bEnable=TRUE; + bIgnoreGraphic=TRUE; + + pView->UnmarkAll(); + pObj=pPage->RemoveObject(0); + SdrObject::Free( pObj ); + } + } + } + delete pView; + delete pModel; + } + if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH),TRUE,&pPoolItem) == SFX_ITEM_SET) + { + const Graphic* pGraphic = ((const SvxBrushItem *)pPoolItem)->GetGraphic(); + if( pGraphic ) + { + if(!bIgnoreGraphic) + { + aSymbolGraphic=*pGraphic; + } + if(!bIgnoreSize) + { + aSymbolSize=OutputDevice::LogicToLogic( pGraphic->GetPrefSize(), + pGraphic->GetPrefMapMode(), + MAP_100TH_MM ); + } + bPrevSym=TRUE; + } + } + if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),TRUE,&pPoolItem) == SFX_ITEM_SET) + { + aSymbolSize = ((const SvxSizeItem *)pPoolItem)->GetSize(); + } + + + aSymbolRatioCB.Enable(bEnable); + aSymbolHeightFT.Enable(bEnable); + aSymbolWidthFT.Enable(bEnable); + aSymbolWidthMF.Enable(bEnable); + aSymbolHeightMF.Enable(bEnable); + if(bPrevSym) + { + SetMetricValue(aSymbolWidthMF, aSymbolSize.Width(), ePoolUnit); + SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(),ePoolUnit); + aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize); + aSymbolLastSize=aSymbolSize; + } + + if( rAttrs.GetItemState( XATTR_LINESTYLE ) != SFX_ITEM_DONTCARE ) + { + eXLS = (XLineStyle) ( ( const XLineStyleItem& ) rAttrs.Get( XATTR_LINESTYLE ) ).GetValue(); + + switch( eXLS ) + { + case XLINE_NONE: + aLbLineStyle.SelectEntryPos( 0 ); + break; + case XLINE_SOLID: + aLbLineStyle.SelectEntryPos( 1 ); + break; + + case XLINE_DASH: + aLbLineStyle.SetNoSelection(); + aLbLineStyle.SelectEntry( ( ( const XLineDashItem& ) rAttrs. + Get( XATTR_LINEDASH ) ).GetName() ); + break; + + default: + break; + } + } + else + { + aLbLineStyle.SetNoSelection(); + } + + // Linienstaerke +/* + if( bObjSelected && + rAttrs.GetItemState( GetWhich( XATTR_LINEWIDTH ) ) == SFX_ITEM_DEFAULT ) + { + aMtrLineWidth.Disable(); + } +*/ + if( rAttrs.GetItemState( XATTR_LINEWIDTH ) != SFX_ITEM_DONTCARE ) + { + SetMetricValue( aMtrLineWidth, ( ( const XLineWidthItem& ) rAttrs. + Get( XATTR_LINEWIDTH ) ).GetValue(), ePoolUnit ); + } + else + aMtrLineWidth.SetText( String() ); + + // Linienfarbe +/* + if( bObjSelected && + rAttrs.GetItemState( GetWhich( XATTR_LINECOLOR ) ) == SFX_ITEM_DEFAULT ) + { + aLbColor.Disable(); + } +*/ + aLbColor.SetNoSelection(); + + if ( rAttrs.GetItemState( XATTR_LINECOLOR ) != SFX_ITEM_DONTCARE ) + { + Color aCol = ( ( const XLineColorItem& ) rAttrs.Get( XATTR_LINECOLOR ) ).GetColorValue(); + aLbColor.SelectEntry( aCol ); + if( aLbColor.GetSelectEntryCount() == 0 ) + { + aLbColor.InsertEntry( aCol, String() ); + aLbColor.SelectEntry( aCol ); + } + } + + // LinienAnfang + if( bObjSelected && + rAttrs.GetItemState( XATTR_LINESTART ) == SFX_ITEM_DEFAULT ) + { + aLbStartStyle.Disable(); + } + else if( rAttrs.GetItemState( XATTR_LINESTART ) != SFX_ITEM_DONTCARE ) + { + // #86265# select entry using list and polygon, not string + sal_Bool bSelected(FALSE); + const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineStartItem&)rAttrs.Get(XATTR_LINESTART)).GetLineStartValue(); + + for(sal_Int32 a(0);!bSelected && a < pLineEndList->Count(); a++) + { + XLineEndEntry* pEntry = pLineEndList->GetLineEnd(a); + const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd(); + + if(rItemPolygon == rEntryPolygon) + { + // select this entry + aLbStartStyle.SelectEntryPos((sal_uInt16)a + 1); + bSelected = TRUE; + } + } + + if(!bSelected) + aLbStartStyle.SelectEntryPos( 0 ); + } + else + { + aLbStartStyle.SetNoSelection(); + } + + // LinienEnde + if( bObjSelected && + rAttrs.GetItemState( XATTR_LINEEND ) == SFX_ITEM_DEFAULT ) + { + aLbEndStyle.Disable(); + } + else if( rAttrs.GetItemState( XATTR_LINEEND ) != SFX_ITEM_DONTCARE ) + { + // #86265# select entry using list and polygon, not string + sal_Bool bSelected(FALSE); + const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineEndItem&)rAttrs.Get(XATTR_LINEEND)).GetLineEndValue(); + + for(sal_Int32 a(0);!bSelected && a < pLineEndList->Count(); a++) + { + XLineEndEntry* pEntry = pLineEndList->GetLineEnd(a); + const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd(); + + if(rItemPolygon == rEntryPolygon) + { + // select this entry + aLbEndStyle.SelectEntryPos((sal_uInt16)a + 1); + bSelected = TRUE; + } + } + + if(!bSelected) + aLbEndStyle.SelectEntryPos( 0 ); + } + else + { + aLbEndStyle.SetNoSelection(); + } + + // LinienAnfang St"arke + if( bObjSelected && + rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) == SFX_ITEM_DEFAULT ) + { + aMtrStartWidth.Disable(); + } + else if( rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) != SFX_ITEM_DONTCARE ) + { + SetMetricValue( aMtrStartWidth, ( ( const XLineStartWidthItem& ) rAttrs. + Get( XATTR_LINESTARTWIDTH ) ).GetValue(), ePoolUnit ); + } + else + aMtrStartWidth.SetText( String() ); + + // LinienEnde St"arke + if( bObjSelected && + rAttrs.GetItemState( XATTR_LINEENDWIDTH ) == SFX_ITEM_DEFAULT ) + { + aMtrEndWidth.Disable(); + } + else if( rAttrs.GetItemState( XATTR_LINEENDWIDTH ) != SFX_ITEM_DONTCARE ) + { + SetMetricValue( aMtrEndWidth, ( ( const XLineEndWidthItem& ) rAttrs. + Get( XATTR_LINEENDWIDTH ) ).GetValue(), ePoolUnit ); + } + else + aMtrEndWidth.SetText( String() ); + + // Linienenden zentriert (Start) + if( bObjSelected && + rAttrs.GetItemState( XATTR_LINESTARTCENTER ) == SFX_ITEM_DEFAULT ) + { + aTsbCenterStart.Disable(); + } + else if( rAttrs.GetItemState( XATTR_LINESTARTCENTER ) != SFX_ITEM_DONTCARE ) + { + aTsbCenterStart.EnableTriState( FALSE ); + + if( ( ( const XLineStartCenterItem& ) rAttrs.Get( XATTR_LINESTARTCENTER ) ).GetValue() ) + aTsbCenterStart.SetState( STATE_CHECK ); + else + aTsbCenterStart.SetState( STATE_NOCHECK ); + } + else + { + aTsbCenterStart.SetState( STATE_DONTKNOW ); + } + + // Linienenden zentriert (Ende) + if( bObjSelected && + rAttrs.GetItemState( XATTR_LINEENDCENTER ) == SFX_ITEM_DEFAULT ) + { + aTsbCenterEnd.Disable(); + } + else if( rAttrs.GetItemState( XATTR_LINEENDCENTER ) != SFX_ITEM_DONTCARE ) + { + aTsbCenterEnd.EnableTriState( FALSE ); + + if( ( ( const XLineEndCenterItem& ) rAttrs.Get( XATTR_LINEENDCENTER ) ).GetValue() ) + aTsbCenterEnd.SetState( STATE_CHECK ); + else + aTsbCenterEnd.SetState( STATE_NOCHECK ); + } + else + { + aTsbCenterEnd.SetState( STATE_DONTKNOW ); + } + + // Transparenz + if( rAttrs.GetItemState( XATTR_LINETRANSPARENCE ) != SFX_ITEM_DONTCARE ) + { + USHORT nTransp = ( ( const XLineTransparenceItem& ) rAttrs. + Get( XATTR_LINETRANSPARENCE ) ).GetValue(); + aMtrTransparent.SetValue( nTransp ); + ChangeTransparentHdl_Impl( NULL ); + } + else + aMtrTransparent.SetText( String() ); + + if( !aLbStartStyle.IsEnabled() && + !aLbEndStyle.IsEnabled() && + !aMtrStartWidth.IsEnabled() && + !aMtrEndWidth.IsEnabled() && + !aTsbCenterStart.IsEnabled()&& + !aTsbCenterEnd.IsEnabled() ) + { + aCbxSynchronize.Disable(); + aFtLineEndsStyle.Disable(); + aFtLineEndsWidth.Disable(); + aFlLineEnds.Disable(); + } + + // Synchronisieren + // Jetzt wird der Wert aus der INI-Datei geholt (#42258#) + String aStr = GetUserData(); + aCbxSynchronize.Check( (BOOL)aStr.ToInt32() ); + + // #116827# + if(bObjSelected && SFX_ITEM_DEFAULT == rAttrs.GetItemState(XATTR_LINEJOINT)) + { + maFTEdgeStyle.Disable(); + maLBEdgeStyle.Disable(); + } + else if(SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_LINEJOINT)) + { + XLineJoint eLineJoint = ((const XLineJointItem&)(rAttrs.Get(XATTR_LINEJOINT))).GetValue(); + + switch(eLineJoint) + { + case XLINEJOINT_ROUND : maLBEdgeStyle.SelectEntryPos(0); break; + case XLINEJOINT_NONE : maLBEdgeStyle.SelectEntryPos(1); break; + case XLINEJOINT_MITER : maLBEdgeStyle.SelectEntryPos(2); break; + case XLINEJOINT_BEVEL : maLBEdgeStyle.SelectEntryPos(3); break; + case XLINEJOINT_MIDDLE : break; + } + } + else + { + maLBEdgeStyle.SetNoSelection(); + } + + /* + if( aLbStartStyle.GetSelectEntryPos() == aLbEndStyle.GetSelectEntryPos() && + aMtrStartWidth.GetValue() == aMtrEndWidth.GetValue() && + aTsbCenterStart.GetState() == aTsbCenterEnd.GetState() ) + { + aCbxSynchronize.Check(); + } + */ + + // Werte sichern + aLbLineStyle.SaveValue(); + aMtrLineWidth.SaveValue(); + aLbColor.SaveValue(); + aLbStartStyle.SaveValue(); + aLbEndStyle.SaveValue(); + aMtrStartWidth.SaveValue(); + aMtrEndWidth.SaveValue(); + aTsbCenterStart.SaveValue(); + aTsbCenterEnd.SaveValue(); + aMtrTransparent.SaveValue(); + + // #116827# + maLBEdgeStyle.SaveValue(); + + ClickInvisibleHdl_Impl( this ); + //ClickMeasuringHdl_Impl( this ); + //aCtlPosition.Reset(); + + ChangePreviewHdl_Impl( NULL ); +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxLineTabPage::Create( Window* pWindow, + const SfxItemSet& rAttrs ) +{ + return( new SvxLineTabPage( pWindow, rAttrs ) ); +} + +//------------------------------------------------------------------------ + +USHORT* SvxLineTabPage::GetRanges() +{ + return( pLineRanges ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineTabPage, ChangePreviewHdl_Impl, void *, pCntrl ) +{ + if(pCntrl == &aMtrLineWidth) + { + // Linienbreite und Start/EndBreite + INT32 nNewLineWidth = GetCoreValue( aMtrLineWidth, ePoolUnit ); + if(nActLineWidth == -1) + { + // Noch nicht initialisiert, hole den Startwert + const SfxPoolItem* pOld = GetOldItem( rXLSet, XATTR_LINEWIDTH ); + INT32 nStartLineWidth = 0; + if(pOld) + nStartLineWidth = (( const XLineWidthItem *)pOld)->GetValue(); + nActLineWidth = nStartLineWidth; + } + + if(nActLineWidth != nNewLineWidth) + { + // Anpassungen Start/EndWidth #63083# + INT32 nValAct = GetCoreValue( aMtrStartWidth, ePoolUnit ); + INT32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10); + if(nValNew < 0) + nValNew = 0; + SetMetricValue( aMtrStartWidth, nValNew, ePoolUnit ); + + nValAct = GetCoreValue( aMtrEndWidth, ePoolUnit ); + nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10); + if(nValNew < 0) + nValNew = 0; + SetMetricValue( aMtrEndWidth, nValNew, ePoolUnit ); + } + + // Aktuellen Wert merken + nActLineWidth = nNewLineWidth; + } + + FillXLSet_Impl(); + aCtlPreview.Invalidate(); + + // Transparenz entspr. zugaenglich machen + if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar + { + aFtTransparent.Disable(); + aMtrTransparent.Disable(); + } + else + { + aFtTransparent.Enable(); + aMtrTransparent.Enable(); + } + + const bool bHasLineStart = aLbStartStyle.GetSelectEntryPos() != 0; + const bool bHasLineEnd = aLbEndStyle.GetSelectEntryPos() != 0; + + aFtLineEndsWidth.Enable( bHasLineStart || bHasLineEnd ); + aMtrStartWidth.Enable( bHasLineStart ); + aTsbCenterStart.Enable( bHasLineStart ); + aMtrEndWidth.Enable( bHasLineEnd ); + aTsbCenterEnd.Enable( bHasLineEnd ); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineTabPage, ChangeStartHdl_Impl, void *, p ) +{ + if( aCbxSynchronize.IsChecked() ) + { + if( p == &aMtrStartWidth ) + aMtrEndWidth.SetValue( aMtrStartWidth.GetValue() ); + if( p == &aLbStartStyle ) + aLbEndStyle.SelectEntryPos( aLbStartStyle.GetSelectEntryPos() ); + if( p == &aTsbCenterStart ) + aTsbCenterEnd.SetState( aTsbCenterStart.GetState() ); + } + + ChangePreviewHdl_Impl( this ); + + return( 0L ); +} + +//------------------------------------------------------------------------ +// #116827# + +IMPL_LINK( SvxLineTabPage, ChangeEdgeStyleHdl_Impl, void *, EMPTYARG ) +{ + ChangePreviewHdl_Impl( this ); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG ) +{ + if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar + { + aFtColor.Disable(); + if(!bSymbols) + aLbColor.Disable(); + aFtLineWidth.Disable(); + aMtrLineWidth.Disable(); + + if( aFlLineEnds.IsEnabled() ) + { + aFtLineEndsStyle.Disable(); + aFtLineEndsWidth.Disable(); + aLbStartStyle.Disable(); + aMtrStartWidth.Disable(); + aTsbCenterStart.Disable(); + aLbEndStyle.Disable(); + aMtrEndWidth.Disable(); + aTsbCenterEnd.Disable(); + aCbxSynchronize.Disable(); + + // #116827# + maFTEdgeStyle.Disable(); + maLBEdgeStyle.Disable(); + } + } + else + { + aFtColor.Enable(); + aLbColor.Enable(); + aFtLineWidth.Enable(); + aMtrLineWidth.Enable(); + + if( aFlLineEnds.IsEnabled() ) + { + aFtLineEndsStyle.Enable(); + aFtLineEndsWidth.Enable(); + aLbStartStyle.Enable(); + aMtrStartWidth.Enable(); + aTsbCenterStart.Enable(); + aLbEndStyle.Enable(); + aMtrEndWidth.Enable(); + aTsbCenterEnd.Enable(); + aCbxSynchronize.Enable(); + + // #116827# + maFTEdgeStyle.Enable(); + maLBEdgeStyle.Enable(); + } + } + ChangePreviewHdl_Impl( NULL ); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineTabPage, ChangeEndHdl_Impl, void *, p ) +{ + if( aCbxSynchronize.IsChecked() ) + { + if( p == &aMtrEndWidth ) + aMtrStartWidth.SetValue( aMtrEndWidth.GetValue() ); + if( p == &aLbEndStyle ) + aLbStartStyle.SelectEntryPos( aLbEndStyle.GetSelectEntryPos() ); + if( p == &aTsbCenterEnd ) + aTsbCenterStart.SetState( aTsbCenterEnd.GetState() ); + } + + ChangePreviewHdl_Impl( this ); + + return( 0L ); +} + +//------------------------------------------------------------------------ +/* + +long SvxLineTabPage::ClickMeasuringHdl_Impl( void* ) +{ + if( aTsbShowMeasuring.GetState() == STATE_NOCHECK ) + { + aFtPosition.Disable(); + aCtlPosition.Disable(); + } + else + { + aFtPosition.Enable(); + aCtlPosition.Enable(); + } + aCtlPosition.Invalidate(); + + return( 0L ); +} +*/ +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineTabPage, ChangeTransparentHdl_Impl, void *, EMPTYARG ) +{ + UINT16 nVal = (UINT16)aMtrTransparent.GetValue(); + XLineTransparenceItem aItem( nVal ); + + rXLSet.Put( XLineTransparenceItem( aItem ) ); + + // #116827# + FillXLSet_Impl(); + + aCtlPreview.Invalidate(); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +void SvxLineTabPage::PointChanged( Window*, RECT_POINT eRcPt ) +{ + eRP = eRcPt; +} + +//------------------------------------------------------------------------ + +void SvxLineTabPage::FillUserData() +{ + // Abgleich wird in der Ini-Datei festgehalten + UniString aStrUserData = UniString::CreateFromInt32( (sal_Int32) aCbxSynchronize.IsChecked() ); + SetUserData( aStrUserData ); +} + + +//#58425# Symbole auf einer Linie (z.B. StarChart) +//Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton) +//der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage +IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton ) +{ + //Popup initialisieren + if(!pButton->GetPopupMenu()->GetPopupMenu( MN_GALLERY )) + { + // Gallery-Eintraege besorgen + GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames); + + PopupMenu* pPopup = new PopupMenu; + String aEmptyStr; + SfxObjectShell *pDocSh = SfxObjectShell::Current(); + + nNumMenuGalleryItems=aGrfNames.Count(); + for(long i = 0; i < nNumMenuGalleryItems; i++) + { + const String* pGrfName = (const String*)aGrfNames.GetObject(i); + const String* pUIName = pGrfName; + + // convert URL encodings to UI characters (eg %20 for spaces) + String aPhysicalName; + if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( *pGrfName, aPhysicalName )) + pUIName = &aPhysicalName; + + SvxBrushItem* pBrushItem = new SvxBrushItem(*pGrfName, aEmptyStr, GPOS_AREA, SID_ATTR_BRUSH); + pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl)); + + SvxBmpItemInfo* pInfo = new SvxBmpItemInfo(); + pInfo->pBrushItem = pBrushItem; + pInfo->nItemId = (UINT16)(MN_GALLERY_ENTRY + i); + aGrfBrushItems.Insert(pInfo, i); + const Graphic* pGraphic = pBrushItem->GetGraphic(pDocSh); + + if(pGraphic) + { + Bitmap aBitmap(pGraphic->GetBitmap()); + Size aSize(aBitmap.GetSizePixel()); + if(aSize.Width() > MAX_BMP_WIDTH || + aSize.Height() > MAX_BMP_HEIGHT) + { + BOOL bWidth = aSize.Width() > aSize.Height(); + double nScale = bWidth ? + (double)MAX_BMP_WIDTH / (double)aSize.Width(): + (double)MAX_BMP_HEIGHT / (double)aSize.Height(); + aBitmap.Scale(nScale, nScale); + + } + Image aImage(aBitmap); + pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage ); + } + else + { + Image aImage; + pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage ); + } + } + aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup ); + if(!aGrfNames.Count()) + aSymbolMB.GetPopupMenu()->EnableItem(MN_GALLERY, FALSE); + } + + if(!pButton->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS ) && pSymbolList) + { + VirtualDevice aVDev; + aVDev.SetMapMode(MapMode(MAP_100TH_MM)); + SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS); + pModel->GetItemPool().FreezeIdRanges(); + // Page + SdrPage* pPage = new SdrPage( *pModel, FALSE ); + pPage->SetSize(Size(1000,1000)); + pModel->InsertPage( pPage, 0 ); + // 3D View + SdrView* pView = new SdrView( pModel, &aVDev ); + pView->hideMarkHandles(); +// SdrPageView* pPageView = pView->ShowSdrPage(pPage, Point()); + SdrPageView* pPageView = pView->ShowSdrPage(pPage); + + PopupMenu* pPopup = new PopupMenu; + String aEmptyStr; + for(long i=0;; ++i) + { + SdrObject *pObj=pSymbolList->GetObj(i); + if(pObj==NULL) + break; + pObj=pObj->Clone(); + //const String* pGrfName = (const String*)aGrfNames.GetObject(i); + String *pStr=new String();//String(i)); + aGrfNames.Insert(pStr,LIST_APPEND); + //Rectangle aRect(pObj->GetLogicRect()); + pPage->NbcInsertObject(pObj); + pView->MarkObj(pObj,pPageView); + if(pSymbolAttr) + { + pObj->SetMergedItemSet(*pSymbolAttr); + } + else + { + pObj->SetMergedItemSet(rOutAttrs); + } + + Bitmap aBitmap(pView->GetAllMarkedBitmap()); + GDIMetaFile aMeta(pView->GetAllMarkedMetaFile()); + pView->UnmarkAll(); + pObj=pPage->RemoveObject(0); + SdrObject::Free(pObj); + + SvxBrushItem* pBrushItem = new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH); + pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl)); + + SvxBmpItemInfo* pInfo = new SvxBmpItemInfo(); + pInfo->pBrushItem = pBrushItem; + pInfo->nItemId = (UINT16)(MN_GALLERY_ENTRY + i + nNumMenuGalleryItems); + aGrfBrushItems.Insert(pInfo, nNumMenuGalleryItems + i); + + Size aSize(aBitmap.GetSizePixel()); + if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT) + { + BOOL bWidth = aSize.Width() > aSize.Height(); + double nScale = bWidth ? + (double)MAX_BMP_WIDTH / (double)aSize.Width(): + (double)MAX_BMP_HEIGHT / (double)aSize.Height(); + aBitmap.Scale(nScale, nScale); + } + Image aImage(aBitmap); + pPopup->InsertItem(pInfo->nItemId,*pStr,aImage); + } + aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_SYMBOLS, pPopup ); + if(!aGrfNames.Count()) + aSymbolMB.GetPopupMenu()->EnableItem(MN_SYMBOLS, FALSE); + + delete pView; + delete pModel; + } + return 0; +} +//#58425# Symbole auf einer Linie (z.B. StarChart) +//Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton) +//der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage: +IMPL_STATIC_LINK(SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem*, pItem) +{ + PopupMenu* pPopup = pThis->aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY ); + + SvxBmpItemInfo* pBmpInfo = 0; + for ( USHORT i = 0; i < pThis->aGrfBrushItems.Count(); i++ ) + { + SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)pThis->aGrfBrushItems.GetObject(i); + if( pInfo->pBrushItem == pItem ) + { + pBmpInfo = pInfo; break; + } + } + if( pBmpInfo ) + { + if( pItem->GetGraphic() ) + { + Bitmap aBitmap(pItem->GetGraphic()->GetBitmap()); + Size aSize(aBitmap.GetSizePixel()); + if(aSize.Width() > MAX_BMP_WIDTH || + aSize.Height() > MAX_BMP_HEIGHT) + { + BOOL bWidth = aSize.Width() > aSize.Height(); + double nScale = bWidth ? + (double)MAX_BMP_WIDTH / (double)aSize.Width(): + (double)MAX_BMP_HEIGHT / (double)aSize.Height(); + aBitmap.Scale(nScale, nScale); + } + Image aImage(aBitmap); + pPopup->SetItemImage( pBmpInfo->nItemId, aImage ); + } + } + + return 0; +} + +//#58425# Symbole auf einer Linie (z.B. StarChart) +//Handler f�r Menuebutton +IMPL_LINK( SvxLineTabPage, GraphicHdl_Impl, MenuButton *, pButton ) +{ + USHORT nItemId = pButton->GetCurItemId(); + const Graphic* pGraphic = 0; + Graphic aGraphic; + String aGrfName; + BOOL bResetSize = FALSE; + BOOL bEnable=TRUE; + long nPreviousSymbolType = nSymbolType; + + if(nItemId >= MN_GALLERY_ENTRY) + { + if( (nItemId-MN_GALLERY_ENTRY) >= nNumMenuGalleryItems) + { + nSymbolType=nItemId-MN_GALLERY_ENTRY-nNumMenuGalleryItems; //Index der Liste + } + else + { + nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM; + bResetSize = TRUE; + } + SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.GetObject(nItemId - MN_GALLERY_ENTRY); + pGraphic = pInfo->pBrushItem->GetGraphic(); + } + else switch(nItemId) + { + case MN_SYMBOLS_AUTO: + { + pGraphic=&aAutoSymbolGraphic; + aAutoSymbolGraphic.SetPrefSize( Size(253,253) ); + nSymbolType=SVX_SYMBOLTYPE_AUTO; + } + break; + + case MN_SYMBOLS_NONE: + { + nSymbolType=SVX_SYMBOLTYPE_NONE; + pGraphic=NULL; + bEnable=FALSE; + } + break; + default: + { + SvxOpenGraphicDialog aGrfDlg(SVX_RES(RID_STR_EDIT_GRAPHIC)); + aGrfDlg.EnableLink(sal_False); + aGrfDlg.AsLink(sal_False); + if( !aGrfDlg.Execute() ) + { + // ausgewaehlten Filter merken + aGrfName = aGrfDlg.GetPath(); + if( !aGrfDlg.GetGraphic(aGraphic) ) + { + nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM; + pGraphic = &aGraphic; + bResetSize = TRUE; + } + } + if( !pGraphic ) + return 0; + } + break; + } + + if(pGraphic) + { + Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic); + aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)ePoolUnit); + aSymbolGraphic=*pGraphic; + if( bResetSize ) + { + aSymbolSize=aSize; + } + else if( nPreviousSymbolType == SVX_SYMBOLTYPE_BRUSHITEM ) + { //#i31097# Data Point Symbol size changes when a different symbol is choosen(maoyg) + if( aSymbolSize.Width() != aSymbolSize.Height() ) + { + aSize.setWidth( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 ); + aSize.setHeight( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 ); + aSymbolSize = aSize; + } + } + aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize); + } + else + { + aSymbolGraphic=Graphic(); + aCtlPreview.SetSymbol(NULL,aSymbolSize); + bEnable=FALSE; + } + aSymbolLastSize=aSymbolSize; + SetMetricValue(aSymbolWidthMF, aSymbolSize.Width(), ePoolUnit); + SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(), ePoolUnit); + aSymbolRatioCB.Enable(bEnable); + aSymbolHeightFT.Enable(bEnable); + aSymbolWidthFT.Enable(bEnable); + aSymbolWidthMF.Enable(bEnable); + aSymbolHeightMF.Enable(bEnable); + aCtlPreview.Invalidate(); + + return 0; +} +IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, MetricField *, pField) +{ + bNewSize=true; + BOOL bWidth = (BOOL)(pField == &aSymbolWidthMF); + bLastWidthModified = bWidth; + BOOL bRatio = aSymbolRatioCB.IsChecked(); + long nWidthVal = static_cast(aSymbolWidthMF.Denormalize(aSymbolWidthMF.GetValue(FUNIT_100TH_MM))); + long nHeightVal= static_cast(aSymbolHeightMF.Denormalize(aSymbolHeightMF.GetValue(FUNIT_100TH_MM))); + nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MAP_100TH_MM,(MapUnit)ePoolUnit ); + nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MAP_100TH_MM,(MapUnit)ePoolUnit); + aSymbolSize=Size(nWidthVal,nHeightVal); + double fSizeRatio = (double)1; + + if(bRatio) + { + if (aSymbolLastSize.Height() && aSymbolLastSize.Width()) + fSizeRatio = (double)aSymbolLastSize.Width() / aSymbolLastSize.Height(); + } + + //Size aSymbolSize(aSymbolLastSize); + + if(bWidth) + { + long nDelta = nWidthVal - aSymbolLastSize.Width(); + aSymbolSize.Width() = nWidthVal; + if (bRatio) + { + aSymbolSize.Height() = aSymbolLastSize.Height() + (long)((double)nDelta / fSizeRatio); + aSymbolSize.Height() = OutputDevice::LogicToLogic( aSymbolSize.Height(),(MapUnit)ePoolUnit, MAP_100TH_MM ); + aSymbolHeightMF.SetUserValue(aSymbolHeightMF.Normalize(aSymbolSize.Height()), FUNIT_100TH_MM); + } + } + else + { + long nDelta = nHeightVal - aSymbolLastSize.Height(); + aSymbolSize.Height() = nHeightVal; + if (bRatio) + { + aSymbolSize.Width() = aSymbolLastSize.Width() + (long)((double)nDelta * fSizeRatio); + aSymbolSize.Width() = OutputDevice::LogicToLogic( aSymbolSize.Width(), + (MapUnit)ePoolUnit, MAP_100TH_MM ); + aSymbolWidthMF.SetUserValue(aSymbolWidthMF.Normalize(aSymbolSize.Width()), FUNIT_100TH_MM); + } + } + aCtlPreview.ResizeSymbol(aSymbolSize); + aSymbolLastSize=aSymbolSize; + return 0; +} +IMPL_LINK( SvxLineTabPage, RatioHdl_Impl, CheckBox *, pBox ) +{ + if (pBox->IsChecked()) + { + if (bLastWidthModified) + SizeHdl_Impl(&aSymbolWidthMF); + else + SizeHdl_Impl(&aSymbolHeightMF); + } + return 0; +} + + +void SvxLineTabPage::DataChanged( const DataChangedEvent& rDCEvt ) +{ + SvxTabPage::DataChanged( rDCEvt ); + + if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + { + FillListboxes(); + } +} + +void SvxLineTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 +{ + SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False); + SFX_ITEMSET_ARG (&aSet,pDashListItem,SvxDashListItem,SID_DASH_LIST,sal_False); + SFX_ITEMSET_ARG (&aSet,pLineEndListItem,SvxLineEndListItem,SID_LINEEND_LIST,sal_False); + SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); + SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False); + SFX_ITEMSET_ARG (&aSet,pSdrObjListItem,OfaPtrItem,SID_OBJECT_LIST,sal_False); + SFX_ITEMSET_ARG (&aSet,pSymbolAttrItem,SfxTabDialogItem,SID_ATTR_SET,sal_False); + SFX_ITEMSET_ARG (&aSet,pGraphicItem,SvxGraphicItem,SID_GRAPHIC,sal_False); + + if (pColorTabItem) + SetColorTable(pColorTabItem->GetColorTable()); + if (pDashListItem) + SetDashList(pDashListItem->GetDashList()); + if (pLineEndListItem) + SetLineEndList(pLineEndListItem->GetLineEndList()); + if (pPageTypeItem) + SetPageType(pPageTypeItem->GetValue()); + if (pDlgTypeItem) + SetDlgType(pDlgTypeItem->GetValue()); + Construct(); + + if(pSdrObjListItem) //symbols + { + ShowSymbolControls(TRUE); + pSymbolList = static_cast(pSdrObjListItem->GetValue()); + if (pSymbolAttrItem) + pSymbolAttr = new SfxItemSet(pSymbolAttrItem->GetItemSet()); + if(pGraphicItem) + aAutoSymbolGraphic = pGraphicItem->GetGraphic(); + } +} diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx new file mode 100644 index 000000000000..776b5184d760 --- /dev/null +++ b/cui/source/tabpages/tplnedef.cxx @@ -0,0 +1,1020 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tplnedef.cxx,v $ + * $Revision: 1.31 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" + +#define _SVX_TPLNEDEF_CXX + +#include +#include "tabline.hrc" +//#include "dlgname.hrc" +#include "helpid.hrc" + +#include "svx/xattr.hxx" +#include +#include + +#include "svx/drawitem.hxx" +#include "cuitabline.hxx" +#include "defdlgname.hxx" //CHINA001 #include "dlgname.hxx" +#include //CHINA001 +#include +#include "svx/dlgutil.hxx" + +#define DLGWIN this->GetParent()->GetParent() + +#define BITMAP_WIDTH 32 +#define BITMAP_HEIGHT 12 +#define XOUT_WIDTH 150 + +/************************************************************************* +|* +|* Dialog zum Definieren von Linienstilen +|* +\************************************************************************/ + +SvxLineDefTabPage::SvxLineDefTabPage +( + Window* pParent, + const SfxItemSet& rInAttrs +) : + + SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_LINE_DEF ), rInAttrs ), + + aFlDefinition ( this, SVX_RES( FL_DEFINITION ) ), + aFTLinestyle ( this, SVX_RES( FT_LINESTYLE ) ), + aLbLineStyles ( this, SVX_RES( LB_LINESTYLES ) ), + aFtType ( this, SVX_RES( FT_TYPE ) ), + aLbType1 ( this, SVX_RES( LB_TYPE_1 ) ), + aLbType2 ( this, SVX_RES( LB_TYPE_2 ) ), + aFtNumber ( this, SVX_RES( FT_NUMBER ) ), + aNumFldNumber1 ( this, SVX_RES( NUM_FLD_1 ) ), + aNumFldNumber2 ( this, SVX_RES( NUM_FLD_2 ) ), + aFtLength ( this, SVX_RES( FT_LENGTH ) ), + aMtrLength1 ( this, SVX_RES( MTR_FLD_LENGTH_1 ) ), + aMtrLength2 ( this, SVX_RES( MTR_FLD_LENGTH_2 ) ), + aFtDistance ( this, SVX_RES( FT_DISTANCE ) ), + aMtrDistance ( this, SVX_RES( MTR_FLD_DISTANCE ) ), + aCbxSynchronize ( this, SVX_RES( CBX_SYNCHRONIZE ) ), + aBtnAdd ( this, SVX_RES( BTN_ADD ) ), + aBtnModify ( this, SVX_RES( BTN_MODIFY ) ), + aBtnDelete ( this, SVX_RES( BTN_DELETE ) ), + aBtnLoad ( this, SVX_RES( BTN_LOAD ) ), + aBtnSave ( this, SVX_RES( BTN_SAVE ) ), + aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ), + + rOutAttrs ( rInAttrs ), + + pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), + aXLStyle ( XLINE_DASH ), + aXWidth ( XOUT_WIDTH ), + aXDash ( String(), XDash( XDASH_RECT, 3, 7, 2, 40, 15 ) ), + aXColor ( String(), COL_BLACK ), + aXLineAttr ( pXPool ), + rXLSet ( aXLineAttr.GetItemSet() ) +{ + aBtnLoad.SetModeImage( Image( SVX_RES( RID_SVXIMG_LOAD_H ) ), BMP_COLOR_HIGHCONTRAST ); + aBtnSave.SetModeImage( Image( SVX_RES( RID_SVXIMG_SAVE_H ) ), BMP_COLOR_HIGHCONTRAST ); + + FreeResource(); + + // diese Page braucht ExchangeSupport + SetExchangeSupport(); + + // Metrik einstellen + eFUnit = GetModuleFieldUnit( &rInAttrs ); + + switch ( eFUnit ) + { + case FUNIT_M: + case FUNIT_KM: + eFUnit = FUNIT_MM; + break; + default: ; //prevent warning + } + SetFieldUnit( aMtrDistance, eFUnit ); + SetFieldUnit( aMtrLength1, eFUnit ); + SetFieldUnit( aMtrLength2, eFUnit ); + + // PoolUnit ermitteln + SfxItemPool* pPool = rOutAttrs.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool?" ); + ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH ); + + rXLSet.Put( aXLStyle ); + rXLSet.Put( aXWidth ); + rXLSet.Put( aXDash ); + rXLSet.Put( aXColor ); + + // #i34740# + aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); + + aBtnAdd.SetClickHdl( LINK( this, SvxLineDefTabPage, ClickAddHdl_Impl ) ); + aBtnModify.SetClickHdl( + LINK( this, SvxLineDefTabPage, ClickModifyHdl_Impl ) ); + aBtnDelete.SetClickHdl( + LINK( this, SvxLineDefTabPage, ClickDeleteHdl_Impl ) ); + aBtnLoad.SetClickHdl( LINK( this, SvxLineDefTabPage, ClickLoadHdl_Impl ) ); + aBtnSave.SetClickHdl( LINK( this, SvxLineDefTabPage, ClickSaveHdl_Impl ) ); + + aNumFldNumber1.SetModifyHdl( + LINK( this, SvxLineDefTabPage, ChangeNumber1Hdl_Impl ) ); + aNumFldNumber2.SetModifyHdl( + LINK( this, SvxLineDefTabPage, ChangeNumber2Hdl_Impl ) ); + aLbLineStyles.SetSelectHdl( + LINK( this, SvxLineDefTabPage, SelectLinestyleHdl_Impl ) ); + + // Absolut (in mm) oder Relativ (in %) + aCbxSynchronize.SetClickHdl( + LINK( this, SvxLineDefTabPage, ChangeMetricHdl_Impl ) ); + + // Wenn sich etwas aendert, muss Preview upgedatet werden werden + Link aLink = LINK( this, SvxLineDefTabPage, SelectTypeHdl_Impl ); + aLbType1.SetSelectHdl( aLink ); + aLbType2.SetSelectHdl( aLink ); + aLink = LINK( this, SvxLineDefTabPage, ChangePreviewHdl_Impl ); + aMtrLength1.SetModifyHdl( aLink ); + aMtrLength2.SetModifyHdl( aLink ); + aMtrDistance.SetModifyHdl( aLink ); + + pDashList = NULL; +} + + +// ----------------------------------------------------------------------- + +void SvxLineDefTabPage::Construct() +{ + // Linienstile + aLbLineStyles.Fill( pDashList ); +} + +// ----------------------------------------------------------------------- + +void SvxLineDefTabPage::ActivatePage( const SfxItemSet& ) +{ + if( *pDlgType == 0 ) // Flaechen-Dialog + { + // ActivatePage() wird aufgerufen bevor der Dialog PageCreated() erhaelt !!! + if( pDashList ) + { + if( *pPageType == 1 && + *pPosDashLb != LISTBOX_ENTRY_NOTFOUND ) + { + aLbLineStyles.SelectEntryPos( *pPosDashLb ); + } + // Damit evtl. vorhandener Linestyle verworfen wird + SelectLinestyleHdl_Impl( this ); + + // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + INetURLObject aURL( pDashList->GetPath() ); + + aURL.Append( pDashList->GetName() ); + DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + +/* if ( aURL.getBase().Len() > 18 ) + { + aString += aURL.getBase().Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += aURL.getBase(); + + aFTLinestyle.SetText( aString ); +*/ + *pPageType = 0; // 2 + *pPosDashLb = LISTBOX_ENTRY_NOTFOUND; + } + } +} + +// ----------------------------------------------------------------------- + +int SvxLineDefTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + CheckChanges_Impl(); + + if( _pSet ) + FillItemSet( *_pSet ); + + return( LEAVE_PAGE ); +} + +// ----------------------------------------------------------------------- + +void SvxLineDefTabPage::CheckChanges_Impl() +{ + // wird hier benutzt, um Aenderungen NICHT zu verlieren + //XDashStyle eXDS; + + if( aNumFldNumber1.GetText() != aNumFldNumber1.GetSavedValue() || + aMtrLength1.GetText() != aMtrLength1.GetSavedValue() || + aLbType1.GetSelectEntryPos() != aLbType1.GetSavedValue() || + aNumFldNumber2.GetText() != aNumFldNumber2.GetSavedValue() || + aMtrLength2.GetText() != aMtrLength2.GetSavedValue() || + aLbType2.GetSelectEntryPos() != aLbType2.GetSavedValue() || + aMtrDistance.GetText() != aMtrDistance.GetSavedValue() ) + { + ResMgr& rMgr = DIALOG_MGR(); + Image aWarningBoxImage = WarningBox::GetStandardImage(); + //CHINA001 SvxMessDialog aMessDlg( DLGWIN, + //CHINA001 String( ResId( RID_SVXSTR_LINESTYLE, rMgr ) ), + //CHINA001 String( ResId( RID_SVXSTR_ASK_CHANGE_LINESTYLE, rMgr ) ), + //CHINA001 &aWarningBoxImage ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX, + String( ResId( RID_SVXSTR_LINESTYLE, rMgr ) ), + String( ResId( RID_SVXSTR_ASK_CHANGE_LINESTYLE, rMgr ) ), + &aWarningBoxImage ); + DBG_ASSERT(aMessDlg, "Dialogdiet fail!");//CHINA001 + aMessDlg->SetButtonText( MESS_BTN_1, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_1, + String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) ); + aMessDlg->SetButtonText( MESS_BTN_2, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_2, + String( ResId( RID_SVXSTR_ADD, rMgr ) ) ); + + short nRet = aMessDlg->Execute(); //CHINA001 short nRet = aMessDlg.Execute(); + + switch( nRet ) + { + case RET_BTN_1: // Aendern + { + ClickModifyHdl_Impl( this ); + //aXDash = pDashList->Get( nPos )->GetDash(); + } + break; + + case RET_BTN_2: // Hinzufuegen + { + ClickAddHdl_Impl( this ); + //nPos = aLbLineStyles.GetSelectEntryPos(); + //aXDash = pDashList->Get( nPos )->GetDash(); + } + break; + + case RET_CANCEL: + break; + // return( TRUE ); // Abbruch + } + delete aMessDlg; //add by CHINA001 + } + + + + USHORT nPos = aLbLineStyles.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + *pPosDashLb = nPos; + } +} + +// ----------------------------------------------------------------------- + +BOOL SvxLineDefTabPage::FillItemSet( SfxItemSet& rAttrs ) +{ + if( *pDlgType == 0 ) // Linien-Dialog + { + if( *pPageType == 2 ) + { + //CheckChanges_Impl(); + + FillDash_Impl(); + + String aString( aLbLineStyles.GetSelectEntry() ); + rAttrs.Put( XLineStyleItem( XLINE_DASH ) ); + rAttrs.Put( XLineDashItem( aString, aDash ) ); + } + } + return( TRUE ); +} + +// ----------------------------------------------------------------------- + +void SvxLineDefTabPage::Reset( const SfxItemSet& rAttrs ) +{ + if( rAttrs.GetItemState( GetWhich( XATTR_LINESTYLE ) ) != SFX_ITEM_DONTCARE ) + { + XLineStyle eXLS = (XLineStyle) ( ( const XLineStyleItem& ) rAttrs.Get( GetWhich( XATTR_LINESTYLE ) ) ).GetValue(); + + switch( eXLS ) + { + case XLINE_NONE: + case XLINE_SOLID: + aLbLineStyles.SelectEntryPos( 0 ); + break; + + case XLINE_DASH: + { + const XLineDashItem& rDashItem = ( const XLineDashItem& ) rAttrs.Get( XATTR_LINEDASH ); + aDash = rDashItem.GetDashValue(); + + aLbLineStyles.SetNoSelection(); + aLbLineStyles.SelectEntry( rDashItem.GetName() ); + } + break; + + default: + break; + } + } + SelectLinestyleHdl_Impl( NULL ); + + // Status der Buttons ermitteln + if( pDashList->Count() ) + { + aBtnModify.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + else + { + aBtnModify.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxLineDefTabPage::Create( Window* pWindow, + const SfxItemSet& rOutAttrs ) +{ + return( new SvxLineDefTabPage( pWindow, rOutAttrs ) ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineDefTabPage, SelectLinestyleHdl_Impl, void *, p ) +{ + if( pDashList->Count() > 0 ) + { + int nTmp = aLbLineStyles.GetSelectEntryPos(); + if( nTmp == LISTBOX_ENTRY_NOTFOUND ) + { + } + else + aDash = pDashList->GetDash( nTmp )->GetDash(); + + FillDialog_Impl(); + + rXLSet.Put( XLineDashItem( String(), aDash ) ); + + // #i34740# + aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); + + aCtlPreview.Invalidate(); + + // Wird erst hier gesetzt, um den Style nur dann zu uebernehmen, + // wenn in der ListBox ein Eintrag ausgewaehlt wurde + // Wenn ueber Reset() gerufen wurde ist p == NULL + if( p ) + *pPageType = 2; + } + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK_INLINE_START( SvxLineDefTabPage, ChangePreviewHdl_Impl, void *, EMPTYARG ) +{ + FillDash_Impl(); + aCtlPreview.Invalidate(); + + return( 0L ); +} +IMPL_LINK_INLINE_END( SvxLineDefTabPage, ChangePreviewHdl_Impl, void *, EMPTYARG ) + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineDefTabPage, ChangeNumber1Hdl_Impl, void *, EMPTYARG ) +{ + if( aNumFldNumber1.GetValue() == 0L ) + { + aNumFldNumber2.SetMin( 1L ); + aNumFldNumber2.SetFirst( 1L ); + } + else + { + aNumFldNumber2.SetMin( 0L ); + aNumFldNumber2.SetFirst( 0L ); + } + + ChangePreviewHdl_Impl( this ); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineDefTabPage, ChangeNumber2Hdl_Impl, void *, EMPTYARG ) +{ + if( aNumFldNumber2.GetValue() == 0L ) + { + aNumFldNumber1.SetMin( 1L ); + aNumFldNumber1.SetFirst( 1L ); + } + else + { + aNumFldNumber1.SetMin( 0L ); + aNumFldNumber1.SetFirst( 0L ); + } + + ChangePreviewHdl_Impl( this ); + + return( 0L ); +} + + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineDefTabPage, ChangeMetricHdl_Impl, void *, p ) +{ + if( !aCbxSynchronize.IsChecked() && aMtrLength1.GetUnit() != eFUnit ) + { + long nTmp1, nTmp2, nTmp3; + + // Wurde ueber Control geaendert + if( p ) + { + nTmp1 = GetCoreValue( aMtrLength1, ePoolUnit ) * XOUT_WIDTH / 100; + nTmp2 = GetCoreValue( aMtrLength2, ePoolUnit ) * XOUT_WIDTH / 100; + nTmp3 = GetCoreValue( aMtrDistance, ePoolUnit ) * XOUT_WIDTH / 100; + } + else + { + nTmp1 = GetCoreValue( aMtrLength1, ePoolUnit ); + nTmp2 = GetCoreValue( aMtrLength2, ePoolUnit ); + nTmp3 = GetCoreValue( aMtrDistance, ePoolUnit ); + } + aMtrLength1.SetDecimalDigits( 2 ); + aMtrLength2.SetDecimalDigits( 2 ); + aMtrDistance.SetDecimalDigits( 2 ); + + // Metrik einstellen + aMtrLength1.SetUnit( eFUnit ); + aMtrLength2.SetUnit( eFUnit ); + aMtrDistance.SetUnit( eFUnit ); + + SetMetricValue( aMtrLength1, nTmp1, ePoolUnit ); + SetMetricValue( aMtrLength2, nTmp2, ePoolUnit ); + SetMetricValue( aMtrDistance, nTmp3, ePoolUnit ); + } + else if( aCbxSynchronize.IsChecked() && aMtrLength1.GetUnit() != FUNIT_CUSTOM ) + { + long nTmp1, nTmp2, nTmp3; + + // Wurde ueber Control geaendert + if( p ) + { + nTmp1 = GetCoreValue( aMtrLength1, ePoolUnit ) * 100 / XOUT_WIDTH; + nTmp2 = GetCoreValue( aMtrLength2, ePoolUnit ) * 100 / XOUT_WIDTH; + nTmp3 = GetCoreValue( aMtrDistance, ePoolUnit ) * 100 / XOUT_WIDTH; + } + else + { + nTmp1 = GetCoreValue( aMtrLength1, ePoolUnit ); + nTmp2 = GetCoreValue( aMtrLength2, ePoolUnit ); + nTmp3 = GetCoreValue( aMtrDistance, ePoolUnit ); + } + + aMtrLength1.SetDecimalDigits( 0 ); + aMtrLength2.SetDecimalDigits( 0 ); + aMtrDistance.SetDecimalDigits( 0 ); + + aMtrLength1.SetUnit( FUNIT_CUSTOM ); + aMtrLength2.SetUnit( FUNIT_CUSTOM ); + aMtrDistance.SetUnit( FUNIT_CUSTOM ); + + + SetMetricValue( aMtrLength1, nTmp1, ePoolUnit ); + SetMetricValue( aMtrLength2, nTmp2, ePoolUnit ); + SetMetricValue( aMtrDistance, nTmp3, ePoolUnit ); + } + SelectTypeHdl_Impl( NULL ); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineDefTabPage, SelectTypeHdl_Impl, void *, p ) +{ + if ( p == &aLbType1 || !p ) + { + if ( aLbType1.GetSelectEntryPos() == 0 ) + { + aMtrLength1.Disable(); + aMtrLength1.SetText( String() ); + } + else if ( !aMtrLength1.IsEnabled() ) + { + aMtrLength1.Enable(); + aMtrLength1.Reformat(); + } + } + + if ( p == &aLbType2 || !p ) + { + if ( aLbType2.GetSelectEntryPos() == 0 ) + { + aMtrLength2.Disable(); + aMtrLength2.SetText( String() ); + } + else if ( !aMtrLength2.IsEnabled() ) + { + aMtrLength2.Enable(); + aMtrLength2.Reformat(); + } + } + ChangePreviewHdl_Impl( p ); + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineDefTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) +{ + ResMgr& rMgr = DIALOG_MGR(); + String aNewName( ResId( RID_SVXSTR_LINESTYLE, rMgr ) ); + String aDesc( ResId( RID_SVXSTR_DESC_LINESTYLE, rMgr ) ); + String aName; + XDashEntry* pEntry; + + long nCount = pDashList->Count(); + long j = 1; + BOOL bDifferent = FALSE; + + while ( !bDifferent ) + { + aName = aNewName; + aName += sal_Unicode(' '); + aName += UniString::CreateFromInt32( j++ ); + bDifferent = TRUE; + + for ( long i = 0; i < nCount && bDifferent; i++ ) + if ( aName == pDashList->GetDash( i )->GetName() ) + bDifferent = FALSE; + } + + //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME ); + DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 + BOOL bLoop = TRUE; + + while ( bLoop && pDlg->Execute() == RET_OK ) + { + pDlg->GetName( aName ); + bDifferent = TRUE; + + for( long i = 0; i < nCount && bDifferent; i++ ) + { + if( aName == pDashList->GetDash( i )->GetName() ) + bDifferent = FALSE; + } + + if( bDifferent ) + { + bLoop = FALSE; + FillDash_Impl(); + + pEntry = new XDashEntry( aDash, aName ); + + long nDashCount = pDashList->Count(); + pDashList->Insert( pEntry, nDashCount ); + Bitmap* pBitmap = pDashList->GetBitmap( nDashCount ); + aLbLineStyles.Append( pEntry, pBitmap ); + + aLbLineStyles.SelectEntryPos( aLbLineStyles.GetEntryCount() - 1 ); + + // Flag fuer modifiziert setzen + *pnDashListState |= CT_MODIFIED; + + *pPageType = 2; + + // Werte sichern fuer Changes-Erkennung ( -> Methode ) + aNumFldNumber1.SaveValue(); + aMtrLength1.SaveValue(); + aLbType1.SaveValue(); + aNumFldNumber2.SaveValue(); + aMtrLength2.SaveValue(); + aLbType2.SaveValue(); + aMtrDistance.SaveValue(); + } + else + { + WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); + aBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); + aBox.Execute(); + } + } + delete( pDlg ); + + // Status der Buttons ermitteln + if ( pDashList->Count() ) + { + aBtnModify.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineDefTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) +{ + USHORT nPos = aLbLineStyles.GetSelectEntryPos(); + + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + ResMgr& rMgr = DIALOG_MGR(); + String aNewName( ResId( RID_SVXSTR_LINESTYLE, rMgr ) ); + String aDesc( ResId( RID_SVXSTR_DESC_LINESTYLE, rMgr ) ); + String aName( pDashList->GetDash( nPos )->GetName() ); + String aOldName = aName; + + //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME ); + DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 + + long nCount = pDashList->Count(); + BOOL bDifferent = FALSE; + BOOL bLoop = TRUE; + + while ( bLoop && pDlg->Execute() == RET_OK ) + { + pDlg->GetName( aName ); + bDifferent = TRUE; + + for( long i = 0; i < nCount && bDifferent; i++ ) + { + if( aName == pDashList->GetDash( i )->GetName() && + aName != aOldName ) + bDifferent = FALSE; + } + + if ( bDifferent ) + { + bLoop = FALSE; + FillDash_Impl(); + + XDashEntry* pEntry = new XDashEntry( aDash, aName ); + + delete pDashList->Replace( pEntry, nPos ); + Bitmap* pBitmap = pDashList->GetBitmap( nPos ); + aLbLineStyles.Modify( pEntry, nPos, pBitmap ); + + aLbLineStyles.SelectEntryPos( nPos ); + + // Flag fuer modifiziert setzen + *pnDashListState |= CT_MODIFIED; + + *pPageType = 2; + + // Werte sichern fuer Changes-Erkennung ( -> Methode ) + aNumFldNumber1.SaveValue(); + aMtrLength1.SaveValue(); + aLbType1.SaveValue(); + aNumFldNumber2.SaveValue(); + aMtrLength2.SaveValue(); + aLbType2.SaveValue(); + aMtrDistance.SaveValue(); + } + else + { + WarningBox aBox( DLGWIN, WinBits( WB_OK ), String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); + aBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); + aBox.Execute(); + } + } + delete( pDlg ); + } + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineDefTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) +{ + USHORT nPos = aLbLineStyles.GetSelectEntryPos(); + + if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ), +//! SVX_RES( RID_SVXSTR_DEL_LINESTYLE ), + String( SVX_RES( RID_SVXSTR_ASK_DEL_LINESTYLE ) ) ); + + if ( aQueryBox.Execute() == RET_YES ) + { + delete pDashList->Remove( nPos ); + aLbLineStyles.RemoveEntry( nPos ); + aLbLineStyles.SelectEntryPos( 0 ); + + SelectLinestyleHdl_Impl( this ); + *pPageType = 0; // Style soll nicht uebernommen werden + + // Flag fuer modifiziert setzen + *pnDashListState |= CT_MODIFIED; + + ChangePreviewHdl_Impl( this ); + } + } + + // Status der Buttons ermitteln + if ( !pDashList->Count() ) + { + aBtnModify.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } + return( 0L ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxLineDefTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) +{ + ResMgr& rMgr = DIALOG_MGR(); + USHORT nReturn = RET_YES; + + if ( *pnDashListState & CT_MODIFIED ) + { + nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ), + String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute(); + + if ( nReturn == RET_YES ) + pDashList->Save(); + } + + if ( nReturn != RET_CANCEL ) + { + ::sfx2::FileDialogHelper aDlg( + com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, + 0 ); + String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sod" ) ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + + if( aDlg.Execute() == ERRCODE_NONE ) + { + INetURLObject aURL( aDlg.GetPath() ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + // Liste speichern + XDashList* pDshLst = new XDashList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); + pDshLst->SetName( aURL.getName() ); + + if( pDshLst->Load() ) + { + if( pDshLst ) + { + // Pruefen, ob Tabelle geloescht werden darf: + if( pDashList != ( (SvxLineTabDialog*) DLGWIN )->GetDashList() ) + delete pDashList; + + pDashList = pDshLst; + ( (SvxLineTabDialog*) DLGWIN )->SetNewDashList( pDashList ); + + aLbLineStyles.Clear(); + aLbLineStyles.Fill( pDashList ); + Reset( rOutAttrs ); + + pDashList->SetName( aURL.getName() ); + +/* // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( ResId( RID_SVXSTR_TABLE, rMgr ) ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + + if ( aURL.getBase().Len() > 18 ) + { + aString += aURL.getBase().Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += aURL.getBase(); + + aGrpLinestyles.SetText( aString ); +*/ + // Flag fuer gewechselt setzen + *pnDashListState |= CT_CHANGED; + // Flag fuer modifiziert entfernen + *pnDashListState &= ~CT_MODIFIED; + } + } + else + //aIStream.Close(); + ErrorBox( DLGWIN, WinBits( WB_OK ), + String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute(); + } + } + + // Status der Buttons ermitteln + if ( pDashList->Count() ) + { + aBtnModify.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + else + { + aBtnModify.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } + return( 0L ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxLineDefTabPage, ClickSaveHdl_Impl, void *, EMPTYARG ) +{ + ::sfx2::FileDialogHelper aDlg( + com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 ); + String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sod" ) ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + if( pDashList->GetName().Len() ) + { + aFile.Append( pDashList->GetName() ); + + if( !aFile.getExtension().getLength() ) + aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "sod" ) ) ); + } + + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + if ( aDlg.Execute() == ERRCODE_NONE ) + { + INetURLObject aURL( aDlg.GetPath() ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + pDashList->SetName( aURL.getName() ); + pDashList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); + + if( pDashList->Save() ) + { +/* // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( SVX_RES( RID_SVXSTR_TABLE ) ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + + if ( aURL.getBase().Len() > 18 ) + { + aString += aURL.getBase().Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += aURL.getBase(); + + aGrpLinestyles.SetText( aString ); +*/ + // Flag fuer gespeichert setzen + *pnDashListState |= CT_SAVED; + // Flag fuer modifiziert entfernen + *pnDashListState &= ~CT_MODIFIED; + } + else + { + ErrorBox( DLGWIN, WinBits( WB_OK ), + String( SVX_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute(); + } + } + + return( 0L ); +} + +//------------------------------------------------------------------------ + +void SvxLineDefTabPage::FillDash_Impl() +{ + XDashStyle eXDS; + +/* Alle Stile werden z.Z. nicht benutzt + if( aRbtEnds1.IsChecked() ) + eXDS = XDASH_ROUND; + else if( aRbtEnds2.IsChecked() ) + eXDS = XDASH_RECT; + else + eXDS = XDASH_RECT; +*/ + if( aCbxSynchronize.IsChecked() ) + eXDS = XDASH_RECTRELATIVE; + else + eXDS = XDASH_RECT; + + aDash.SetDashStyle( eXDS ); + aDash.SetDots( (BYTE) aNumFldNumber1.GetValue() ); + aDash.SetDotLen( aLbType1.GetSelectEntryPos() == 0 ? 0 : + GetCoreValue( aMtrLength1, ePoolUnit ) ); + aDash.SetDashes( (BYTE) aNumFldNumber2.GetValue() ); + aDash.SetDashLen( aLbType2.GetSelectEntryPos() == 0 ? 0 : + GetCoreValue( aMtrLength2, ePoolUnit ) ); + aDash.SetDistance( GetCoreValue( aMtrDistance, ePoolUnit ) ); + + rXLSet.Put( XLineDashItem( String(), aDash ) ); + + // #i34740# + aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); +} + +//------------------------------------------------------------------------ + +void SvxLineDefTabPage::FillDialog_Impl() +{ + XDashStyle eXDS = aDash.GetDashStyle(); // XDASH_RECT, XDASH_ROUND + if( eXDS == XDASH_RECTRELATIVE ) + aCbxSynchronize.Check(); + else + aCbxSynchronize.Check( FALSE ); + + aNumFldNumber1.SetValue( aDash.GetDots() ); + //aMtrLength1.SetValue( aDash.GetDotLen() ); + SetMetricValue( aMtrLength1, aDash.GetDotLen(), ePoolUnit ); + aLbType1.SelectEntryPos( aDash.GetDotLen() == 0 ? 0 : 1 ); + aNumFldNumber2.SetValue( aDash.GetDashes() ); + //aMtrLength2.SetValue( aDash.GetDashLen() ); + SetMetricValue( aMtrLength2, aDash.GetDashLen(), ePoolUnit ); + aLbType2.SelectEntryPos( aDash.GetDashLen() == 0 ? 0 : 1 ); + //aMtrDistance.SetValue( aDash.GetDistance() ); + SetMetricValue( aMtrDistance, aDash.GetDistance(), ePoolUnit ); + + ChangeMetricHdl_Impl( NULL ); + + // Werte sichern fuer Changes-Erkennung ( -> Methode ) + aNumFldNumber1.SaveValue(); + aMtrLength1.SaveValue(); + aLbType1.SaveValue(); + aNumFldNumber2.SaveValue(); + aMtrLength2.SaveValue(); + aLbType2.SaveValue(); + aMtrDistance.SaveValue(); +} + + +void SvxLineDefTabPage::DataChanged( const DataChangedEvent& rDCEvt ) +{ + SfxTabPage::DataChanged( rDCEvt ); + + if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + { + USHORT nOldSelect = aLbLineStyles.GetSelectEntryPos(); + aLbLineStyles.Clear(); + aLbLineStyles.Fill( pDashList ); + aLbLineStyles.SelectEntryPos( nOldSelect ); + } +} + diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx new file mode 100644 index 000000000000..a01ee39d19a3 --- /dev/null +++ b/cui/source/tabpages/tplneend.cxx @@ -0,0 +1,753 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tplneend.cxx,v $ + * $Revision: 1.31 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" + +#define _SVX_TPLNEEND_CXX + +#include +#include "tabline.hrc" +#include "helpid.hrc" + +#include +#include +#include "svx/drawitem.hxx" +#include +#include +#include "cuitabline.hxx" +#include //CHINA001 +#include +#include "svx/dlgutil.hxx" +#include +#include +#include +#include +#include + +#define DLGWIN this->GetParent()->GetParent() + +#define BITMAP_WIDTH 32 +#define BITMAP_HEIGHT 12 +#define XOUT_WIDTH 150 + +/************************************************************************* +|* +|* Dialog zum Definieren von Linienenden-Stilen +|* +\************************************************************************/ + +SvxLineEndDefTabPage::SvxLineEndDefTabPage +( + Window* pParent, + const SfxItemSet& rInAttrs +) : + + SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_LINEEND_DEF ), rInAttrs ), + + aFlTip ( this, SVX_RES( FL_TIP ) ), + aFTTitle ( this, SVX_RES( FT_TITLE ) ), + aEdtName ( this, SVX_RES( EDT_NAME ) ), + aFTLineEndStyle ( this, SVX_RES( FT_LINE_END_STYLE ) ), + aLbLineEnds ( this, SVX_RES( LB_LINEENDS ) ), + aBtnAdd ( this, SVX_RES( BTN_ADD ) ), + aBtnModify ( this, SVX_RES( BTN_MODIFY ) ), + aBtnDelete ( this, SVX_RES( BTN_DELETE ) ), + aBtnLoad ( this, SVX_RES( BTN_LOAD ) ), + aBtnSave ( this, SVX_RES( BTN_SAVE ) ), + aFiTip ( this, SVX_RES( FI_TIP ) ), + aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ), + + rOutAttrs ( rInAttrs ), + pPolyObj( NULL ), + + pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), + aXLStyle ( XLINE_SOLID ), + aXWidth ( XOUT_WIDTH ), + aXColor ( String(), COL_BLACK ), + aXLineAttr ( pXPool ), + rXLSet ( aXLineAttr.GetItemSet() ), + pLineEndList( NULL ) +{ + aBtnLoad.SetModeImage( Image( SVX_RES( RID_SVXIMG_LOAD_H ) ), BMP_COLOR_HIGHCONTRAST ); + aBtnSave.SetModeImage( Image( SVX_RES( RID_SVXIMG_SAVE_H ) ), BMP_COLOR_HIGHCONTRAST ); + + FreeResource(); + + // diese Page braucht ExchangeSupport + SetExchangeSupport(); + + rXLSet.Put( aXLStyle ); + rXLSet.Put( aXWidth ); + rXLSet.Put( aXColor ); + rXLSet.Put( XLineStartWidthItem( aCtlPreview.GetOutputSize().Height() / 2 ) ); + rXLSet.Put( XLineEndWidthItem( aCtlPreview.GetOutputSize().Height() / 2 ) ); + + // #i34740# + aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); + + aBtnAdd.SetClickHdl( + LINK( this, SvxLineEndDefTabPage, ClickAddHdl_Impl ) ); + aBtnModify.SetClickHdl( + LINK( this, SvxLineEndDefTabPage, ClickModifyHdl_Impl ) ); + aBtnDelete.SetClickHdl( + LINK( this, SvxLineEndDefTabPage, ClickDeleteHdl_Impl ) ); + aBtnLoad.SetClickHdl( + LINK( this, SvxLineEndDefTabPage, ClickLoadHdl_Impl ) ); + aBtnSave.SetClickHdl( + LINK( this, SvxLineEndDefTabPage, ClickSaveHdl_Impl ) ); + + aLbLineEnds.SetSelectHdl( + LINK( this, SvxLineEndDefTabPage, SelectLineEndHdl_Impl ) ); + +} + +//------------------------------------------------------------------------ + +SvxLineEndDefTabPage::~SvxLineEndDefTabPage() +{ +} + +// ----------------------------------------------------------------------- + +void SvxLineEndDefTabPage::Construct() +{ + aLbLineEnds.Fill( pLineEndList ); + + bool bCreateArrowPossible = true; + + if( !pPolyObj ) + { + bCreateArrowPossible = false; + } + else if( !pPolyObj->ISA( SdrPathObj ) ) + { + SdrObjTransformInfoRec aInfoRec; + pPolyObj->TakeObjInfo( aInfoRec ); + SdrObject* pNewObj = 0; + if( aInfoRec.bCanConvToPath ) + pNewObj = pPolyObj->ConvertToPolyObj( TRUE, FALSE ); + + bCreateArrowPossible = pNewObj && pNewObj->ISA( SdrPathObj ); + SdrObject::Free( pNewObj ); + } + + if( !bCreateArrowPossible ) + aBtnAdd.Disable(); +} + +// ----------------------------------------------------------------------- + +void SvxLineEndDefTabPage::ActivatePage( const SfxItemSet& ) +{ + if( *pDlgType == 0 ) // Flaechen-Dialog + { + // ActivatePage() wird aufgerufen bevor der Dialog PageCreated() erhaelt !!! + if( pLineEndList ) + { + if( *pPosLineEndLb != LISTBOX_ENTRY_NOTFOUND ) + { + aLbLineEnds.SelectEntryPos( *pPosLineEndLb ); + SelectLineEndHdl_Impl( this ); + } + INetURLObject aURL( pLineEndList->GetPath() ); + + aURL.Append( pLineEndList->GetName() ); + DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); +/* // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + + if ( aURL.getBase().Len() > 18 ) + { + aString += aURL.getBase().Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += aURL.getBase(); + + aGrpLineEnds.SetText( aString ); +*/ + *pPageType = 0; // 3 + *pPosLineEndLb = LISTBOX_ENTRY_NOTFOUND; + } + } +} + +// ----------------------------------------------------------------------- + +int SvxLineEndDefTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + CheckChanges_Impl(); + + if( _pSet ) + FillItemSet( *_pSet ); + + return( LEAVE_PAGE ); +} + +// ----------------------------------------------------------------------- + +void SvxLineEndDefTabPage::CheckChanges_Impl() +{ + USHORT nPos = aLbLineEnds.GetSelectEntryPos(); + + if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + String aString = aEdtName.GetText(); + + if( aString != aLbLineEnds.GetSelectEntry() ) + { + QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ), +//! SVX_RES( RID_SVXSTR_LINEEND ), + String( SVX_RES( RID_SVXSTR_ASK_CHANGE_LINEEND ) ) ); + + if ( aQueryBox.Execute() == RET_YES ) + ClickModifyHdl_Impl( this ); + } + } + nPos = aLbLineEnds.GetSelectEntryPos(); + + if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + *pPosLineEndLb = nPos; +} + +// ----------------------------------------------------------------------- + +BOOL SvxLineEndDefTabPage::FillItemSet( SfxItemSet& rSet ) +{ + if( *pDlgType == 0 ) // Linien-Dialog + { + if( *pPageType == 3 ) + { + CheckChanges_Impl(); + + long nPos = aLbLineEnds.GetSelectEntryPos(); + XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos ); + + rSet.Put( XLineStartItem( pEntry->GetName(), pEntry->GetLineEnd() ) ); + rSet.Put( XLineEndItem( pEntry->GetName(), pEntry->GetLineEnd() ) ); + } + } + return( TRUE ); +} + +// ----------------------------------------------------------------------- + +void SvxLineEndDefTabPage::Reset( const SfxItemSet& ) +{ + aLbLineEnds.SelectEntryPos( 0 ); + + // Update lineend + if( pLineEndList->Count() > 0 ) + { + int nPos = aLbLineEnds.GetSelectEntryPos(); + + XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos ); + + aEdtName.SetText( aLbLineEnds.GetSelectEntry() ); + + rXLSet.Put( XLineStartItem( String(), pEntry->GetLineEnd() ) ); + rXLSet.Put( XLineEndItem( String(), pEntry->GetLineEnd() ) ); + + // #i34740# + aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); + + aCtlPreview.Invalidate(); + } + + // Status der Buttons ermitteln + if( pLineEndList->Count() ) + { + aBtnModify.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + else + { + aBtnModify.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxLineEndDefTabPage::Create( Window* pWindow, + const SfxItemSet& rSet ) +{ + return( new SvxLineEndDefTabPage( pWindow, rSet ) ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineEndDefTabPage, SelectLineEndHdl_Impl, void *, EMPTYARG ) +{ + if( pLineEndList->Count() > 0 ) + { + int nPos = aLbLineEnds.GetSelectEntryPos(); + + XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos ); + + aEdtName.SetText( aLbLineEnds.GetSelectEntry() ); + + rXLSet.Put( XLineStartItem( String(), pEntry->GetLineEnd() ) ); + rXLSet.Put( XLineEndItem( String(), pEntry->GetLineEnd() ) ); + + // #i34740# + aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); + + aCtlPreview.Invalidate(); + + // Wird erst hier gesetzt, um den Style nur dann zu uebernehmen, + // wenn in der ListBox ein Eintrag ausgewaehlt wurde + *pPageType = 3; + } + return( 0L ); +} + +//------------------------------------------------------------------------ + +long SvxLineEndDefTabPage::ChangePreviewHdl_Impl( void* ) +{ + aCtlPreview.Invalidate(); + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineEndDefTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) +{ + USHORT nPos = aLbLineEnds.GetSelectEntryPos(); + + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + ResMgr& rMgr = DIALOG_MGR(); + String aDesc( ResId( RID_SVXSTR_DESC_LINEEND, rMgr ) ); + String aName( aEdtName.GetText() ); + long nCount = pLineEndList->Count(); + BOOL bDifferent = TRUE; + + // Pruefen, ob Name schon vorhanden ist + for ( long i = 0; i < nCount && bDifferent; i++ ) + if ( aName == pLineEndList->GetLineEnd( i )->GetName() ) + bDifferent = FALSE; + + // Wenn ja, wird wiederholt ein neuer Name angefordert + if ( !bDifferent ) + { + WarningBox aWarningBox( DLGWIN, WinBits( WB_OK ), + String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); + aWarningBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); + aWarningBox.Execute(); + + //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME ); + DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 + BOOL bLoop = TRUE; + + while( !bDifferent && bLoop && pDlg->Execute() == RET_OK ) + { + pDlg->GetName( aName ); + bDifferent = TRUE; + + for( long i = 0; i < nCount && bDifferent; i++ ) + { + if( aName == pLineEndList->GetLineEnd( i )->GetName() ) + bDifferent = FALSE; + } + + if( bDifferent ) + bLoop = FALSE; + else + aWarningBox.Execute(); + } + delete( pDlg ); + } + + // Wenn nicht vorhanden, wird Eintrag aufgenommen + if( bDifferent ) + { + XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos ); + + pEntry->SetName( aName ); + aEdtName.SetText( aName ); + + aLbLineEnds.Modify( pEntry, nPos, pLineEndList->GetBitmap( nPos ) ); + aLbLineEnds.SelectEntryPos( nPos ); + + // Flag fuer modifiziert setzen + *pnLineEndListState |= CT_MODIFIED; + + *pPageType = 3; + } + } + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineEndDefTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) +{ + if( pPolyObj ) + { + const SdrObject* pNewObj; + SdrObject* pConvPolyObj = NULL; + + if( pPolyObj->ISA( SdrPathObj ) ) + { + pNewObj = pPolyObj; + } + else + { + SdrObjTransformInfoRec aInfoRec; + pPolyObj->TakeObjInfo( aInfoRec ); + + if( aInfoRec.bCanConvToPath ) + { + pNewObj = pConvPolyObj = pPolyObj->ConvertToPolyObj( TRUE, FALSE ); + + if( !pNewObj || !pNewObj->ISA( SdrPathObj ) ) + return( 0L ); // Abbruch, zusaetzliche Sicherheit, die bei + // Gruppenobjekten aber nichts bringt. + } + else return( 0L ); // Abbruch + } + + basegfx::B2DPolyPolygon aNewPolyPolygon(((SdrPathObj*)pNewObj)->GetPathPoly()); + basegfx::B2DRange aNewRange(basegfx::tools::getRange(aNewPolyPolygon)); + + // Normalisieren + basegfx::B2DHomMatrix aMatrix; + aMatrix.translate(-aNewRange.getMinX(), -aNewRange.getMinY()); + aNewPolyPolygon.transform(aMatrix); + + // Loeschen des angelegten PolyObjektes + SdrObject::Free( pConvPolyObj ); + + XLineEndEntry* pEntry; + + ResMgr& rMgr = DIALOG_MGR(); + String aNewName( ResId( RID_SVXSTR_LINEEND, rMgr ) ); + String aDesc( ResId( RID_SVXSTR_DESC_LINEEND, rMgr ) ); + String aName; + + long nCount = pLineEndList->Count(); + long j = 1; + BOOL bDifferent = FALSE; + + while ( !bDifferent ) + { + aName = aNewName; + aName += sal_Unicode(' '); + aName += UniString::CreateFromInt32( j++ ); + bDifferent = TRUE; + + for( long i = 0; i < nCount && bDifferent; i++ ) + if ( aName == pLineEndList->GetLineEnd( i )->GetName() ) + bDifferent = FALSE; + } + + //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 + AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME ); + DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 + BOOL bLoop = TRUE; + + while ( bLoop && pDlg->Execute() == RET_OK ) + { + pDlg->GetName( aName ); + bDifferent = TRUE; + + for( long i = 0; i < nCount && bDifferent; i++ ) + { + if( aName == pLineEndList->GetLineEnd( i )->GetName() ) + bDifferent = FALSE; + } + + if( bDifferent ) + { + bLoop = FALSE; + pEntry = new XLineEndEntry( aNewPolyPolygon, aName ); + + long nLineEndCount = pLineEndList->Count(); + pLineEndList->Insert( pEntry, nLineEndCount ); + Bitmap* pBitmap = pLineEndList->GetBitmap( nLineEndCount ); + + // Zur ListBox hinzufuegen + aLbLineEnds.Append( pEntry, pBitmap ); + aLbLineEnds.SelectEntryPos( aLbLineEnds.GetEntryCount() - 1 ); + + // Flag fuer modifiziert setzen + *pnLineEndListState |= CT_MODIFIED; + + SelectLineEndHdl_Impl( this ); + } + else + { + WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); + aBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); + aBox.Execute(); + } + } + delete pDlg; + } + else + aBtnAdd.Disable(); + + // Status der Buttons ermitteln + if ( pLineEndList->Count() ) + { + aBtnModify.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineEndDefTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) +{ + USHORT nPos = aLbLineEnds.GetSelectEntryPos(); + + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ), +//! SVX_RES( RID_SVXSTR_DEL_LINEEND ), + String( SVX_RES( RID_SVXSTR_ASK_DEL_LINEEND ) ) ); + + if ( aQueryBox.Execute() == RET_YES ) + { + delete pLineEndList->Remove( nPos ); + aLbLineEnds.RemoveEntry( nPos ); + aLbLineEnds.SelectEntryPos( 0 ); + + SelectLineEndHdl_Impl( this ); + *pPageType = 0; // LineEnd soll nicht uebernommen werden + + // Flag fuer modifiziert setzen + *pnLineEndListState |= CT_MODIFIED; + + ChangePreviewHdl_Impl( this ); + } + } + // Status der Buttons ermitteln + if( !pLineEndList->Count() ) + { + aBtnModify.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineEndDefTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) +{ + ResMgr& rMgr = DIALOG_MGR(); + USHORT nReturn = RET_YES; + + if ( *pnLineEndListState & CT_MODIFIED ) + { + nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ), + String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute(); + + if ( nReturn == RET_YES ) + pLineEndList->Save(); + } + + if ( nReturn != RET_CANCEL ) + { + ::sfx2::FileDialogHelper aDlg( + com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, + 0 ); + String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soe" ) ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + + if( aDlg.Execute() == ERRCODE_NONE ) + { + INetURLObject aURL( aDlg.GetPath() ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + // Liste speichern + XLineEndList* pLeList = new XLineEndList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); + pLeList->SetName( aURL.getName() ); + if( pLeList->Load() ) + { + if( pLeList ) + { + // Pruefen, ob Tabelle geloescht werden darf: + if( pLineEndList != ( (SvxLineTabDialog*) DLGWIN )->GetLineEndList() ) + delete pLineEndList; + + pLineEndList = pLeList; + ( (SvxLineTabDialog*) DLGWIN )->SetNewLineEndList( pLineEndList ); + aLbLineEnds.Clear(); + aLbLineEnds.Fill( pLineEndList ); + Reset( rOutAttrs ); + + pLineEndList->SetName( aURL.getName() ); + +/* // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( ResId( RID_SVXSTR_TABLE, rMgr ) ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + if( aURL.getBase().Len() > 18 ) + { + aString += aURL.getBase().Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += aURL.getBase(); + + aGrpLineEnds.SetText( aString ); +*/ + // Flag fuer gewechselt setzen + *pnLineEndListState |= CT_CHANGED; + // Flag fuer modifiziert entfernen + *pnLineEndListState &= ~CT_MODIFIED; + } + } + else + ErrorBox( DLGWIN, WinBits( WB_OK ), + String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute(); + } + } + + // Status der Buttons ermitteln + if ( pLineEndList->Count() ) + { + aBtnModify.Enable(); + aBtnDelete.Enable(); + aBtnSave.Enable(); + } + else + { + aBtnModify.Disable(); + aBtnDelete.Disable(); + aBtnSave.Disable(); + } + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxLineEndDefTabPage, ClickSaveHdl_Impl, void *, EMPTYARG ) +{ + ::sfx2::FileDialogHelper aDlg( + com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 ); + String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soe" ) ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + if( pLineEndList->GetName().Len() ) + { + aFile.Append( pLineEndList->GetName() ); + + if( !aFile.getExtension().getLength() ) + aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "soe" ) ) ); + } + + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + if ( aDlg.Execute() == ERRCODE_NONE ) + { + INetURLObject aURL( aDlg.GetPath() ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + pLineEndList->SetName( aURL.getName() ); + pLineEndList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); + + if( pLineEndList->Save() ) + { +/* // Ermitteln (evtl. abschneiden) des Namens und in + // der GroupBox darstellen + String aString( SVX_RES( RID_SVXSTR_TABLE ) ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + + if ( aURL.getBase().Len() > 18 ) + { + aString += aURL.getBase().Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += aURL.getBase(); + aGrpLineEnds.SetText( aString ); +*/ + // Flag fuer gespeichert setzen + *pnLineEndListState |= CT_SAVED; + // Flag fuer modifiziert entfernen + *pnLineEndListState &= ~CT_MODIFIED; + } + else + { + ErrorBox( DLGWIN, WinBits( WB_OK ), + String( SVX_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute(); + } + } + return( 0L ); +} + +void SvxLineEndDefTabPage::DataChanged( const DataChangedEvent& rDCEvt ) +{ + SfxTabPage::DataChanged( rDCEvt ); + + if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + { + USHORT nOldSelect = aLbLineEnds.GetSelectEntryPos(); + aLbLineEnds.Clear(); + aLbLineEnds.Fill( pLineEndList ); + aLbLineEnds.SelectEntryPos( nOldSelect ); + } +} + diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx new file mode 100644 index 000000000000..09f8eb4a805b --- /dev/null +++ b/cui/source/tabpages/tpshadow.cxx @@ -0,0 +1,612 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tpshadow.cxx,v $ + * $Revision: 1.20 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include +#include +#include + +#define _SVX_TPSHADOW_CXX + +#include "svx/xattr.hxx" +#include +#include +#include "tabarea.hrc" +#include +#include "svx/drawitem.hxx" +#include "cuitabarea.hxx" +#include +#include "svx/dlgutil.hxx" +#include + +#include +#include //add CHINA001 + +#define DLGWIN this->GetParent()->GetParent() + +// static ---------------------------------------------------------------- + +static USHORT pShadowRanges[] = +{ + SDRATTR_SHADOWCOLOR, + SDRATTR_SHADOWTRANSPARENCE, + SID_ATTR_FILL_SHADOW, + SID_ATTR_FILL_SHADOW, + 0 +}; + +/************************************************************************* +|* +|* Dialog zum Aendern des Schattens +|* +\************************************************************************/ + +SvxShadowTabPage::SvxShadowTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : + + SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_SHADOW ), rInAttrs ), + + aFlProp ( this, SVX_RES( FL_PROP ) ), + aTsbShowShadow ( this, SVX_RES( TSB_SHOW_SHADOW ) ), + aFtPosition ( this, SVX_RES( FT_POSITION ) ), + aCtlPosition ( this, SVX_RES( CTL_POSITION ) ), + aFtDistance ( this, SVX_RES( FT_DISTANCE ) ), + aMtrDistance ( this, SVX_RES( MTR_FLD_DISTANCE ) ), + aFtShadowColor ( this, SVX_RES( FT_SHADOW_COLOR ) ), + aLbShadowColor ( this, SVX_RES( LB_SHADOW_COLOR ) ), + aFtTransparent ( this, SVX_RES( FT_TRANSPARENT ) ), + aMtrTransparent ( this, SVX_RES( MTR_SHADOW_TRANSPARENT ) ), + aCtlXRectPreview ( this, SVX_RES( CTL_COLOR_PREVIEW ) ), + rOutAttrs ( rInAttrs ), + pColorTab( NULL ), + bDisable ( FALSE ), + pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), + aXFillAttr ( pXPool ), + rXFSet ( aXFillAttr.GetItemSet() ) +{ + FreeResource(); + + // diese Page braucht ExchangeSupport + SetExchangeSupport(); + + // Metrik einstellen + FieldUnit eFUnit = GetModuleFieldUnit( &rInAttrs ); + + switch ( eFUnit ) + { + case FUNIT_M: + case FUNIT_KM: + eFUnit = FUNIT_MM; + break; + default: ;//prevent warning + } + SetFieldUnit( aMtrDistance, eFUnit ); + + // PoolUnit ermitteln + SfxItemPool* pPool = rOutAttrs.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool?" ); + ePoolUnit = pPool->GetMetric( SDRATTR_SHADOWXDIST ); + + // Setzen des Output-Devices + XFillStyle eXFS = XFILL_SOLID; + if( rOutAttrs.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DONTCARE ) + { + eXFS = (XFillStyle) ( ( ( const XFillStyleItem& ) rOutAttrs. + Get( GetWhich( XATTR_FILLSTYLE ) ) ).GetValue() ); + switch( eXFS ) + { + //case XFILL_NONE: --> NICHTS + + case XFILL_SOLID: + if( SFX_ITEM_DONTCARE != rOutAttrs.GetItemState( XATTR_FILLCOLOR ) ) + { + XFillColorItem aColorItem( ( const XFillColorItem& ) + rOutAttrs.Get( XATTR_FILLCOLOR ) ); + rXFSet.Put( aColorItem ); + } + break; + + case XFILL_GRADIENT: + if( SFX_ITEM_DONTCARE != rOutAttrs.GetItemState( XATTR_FILLGRADIENT ) ) + { + XFillGradientItem aGradientItem( ( ( const XFillGradientItem& ) + rOutAttrs.Get( XATTR_FILLGRADIENT ) ) ); + rXFSet.Put( aGradientItem ); + } + break; + + case XFILL_HATCH: + if( SFX_ITEM_DONTCARE != rOutAttrs.GetItemState( XATTR_FILLHATCH ) ) + { + XFillHatchItem aHatchItem( ( ( const XFillHatchItem& ) + rOutAttrs.Get( XATTR_FILLHATCH ) ) ); + rXFSet.Put( aHatchItem ); + } + break; + + case XFILL_BITMAP: + { + if( SFX_ITEM_DONTCARE != rOutAttrs.GetItemState( XATTR_FILLBITMAP ) ) + { + XFillBitmapItem aBitmapItem( ( const XFillBitmapItem& ) + rOutAttrs.Get( XATTR_FILLBITMAP ) ); + rXFSet.Put( aBitmapItem ); + } + } + break; + case XFILL_NONE : break; + } + } + else + { + rXFSet.Put( XFillColorItem( String(), COL_LIGHTRED ) ); + } + + if(XFILL_NONE == eXFS) + { + // #i96350# + // fallback to solid fillmode when no fill mode is provided to have + // a reasonable shadow preview. The used color will be a set one or + // the default (currently blue8) + eXFS = XFILL_SOLID; + } + + rXFSet.Put( XFillStyleItem( eXFS ) ); + aCtlXRectPreview.SetRectangleAttributes(aXFillAttr.GetItemSet()); + //aCtlXRectPreview.SetFillAttr( aXFillAttr ); + + aTsbShowShadow.SetClickHdl( LINK( this, SvxShadowTabPage, ClickShadowHdl_Impl ) ); + Link aLink = LINK( this, SvxShadowTabPage, ModifyShadowHdl_Impl ); + aLbShadowColor.SetSelectHdl( aLink ); + aMtrTransparent.SetModifyHdl( aLink ); + aMtrDistance.SetModifyHdl( aLink ); + +} + +// ----------------------------------------------------------------------- + +void SvxShadowTabPage::Construct() +{ + // Farbtabelle fuellen + aLbShadowColor.Fill( pColorTab ); + + if( bDisable ) + { + aTsbShowShadow.Disable(); + aFtPosition.Disable(); + aCtlPosition.Disable(); + aFtDistance.Disable(); + aMtrDistance.Disable(); + aFtShadowColor.Disable(); + aLbShadowColor.Disable(); + aFtTransparent.Disable(); + aMtrTransparent.Disable(); + } +} + +// ----------------------------------------------------------------------- + +void SvxShadowTabPage::ActivatePage( const SfxItemSet& rSet ) +{ + USHORT nPos; + USHORT nCount; + //add CHINA001 Begin + SFX_ITEMSET_ARG (&rSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); + if (pPageTypeItem) + SetPageType(pPageTypeItem->GetValue()); + //add CHINA001 end + if( nDlgType == 0 ) //CHINA001 // Flaechen-Dialogif( *pDlgType == 0 ) // Flaechen-Dialog + { + if( pColorTab ) + { + // ColorTable + if( *pnColorTableState & CT_CHANGED || + *pnColorTableState & CT_MODIFIED ) + { + if( *pnColorTableState & CT_CHANGED ) + { + SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( DLGWIN ); + if( pArea ) + { + pColorTab = pArea->GetNewColorTable(); + } + else + { + SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( DLGWIN ); + if( pLine ) + pColorTab = pLine->GetNewColorTable(); + } + } + + // aLbShadowColor + nPos = aLbShadowColor.GetSelectEntryPos(); + aLbShadowColor.Clear(); + aLbShadowColor.Fill( pColorTab ); + nCount = aLbShadowColor.GetEntryCount(); + if( nCount == 0 ) + ; // Dieser Fall sollte nicht auftreten + else if( nCount <= nPos ) + aLbShadowColor.SelectEntryPos( 0 ); + else + aLbShadowColor.SelectEntryPos( nPos ); + + ModifyShadowHdl_Impl( this ); + } + nPageType = PT_SHADOW;//CHINA001 *pPageType = PT_SHADOW; + } + } +} + +// ----------------------------------------------------------------------- + +int SvxShadowTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if( _pSet ) + FillItemSet( *_pSet ); + + return( LEAVE_PAGE ); +} + +// ----------------------------------------------------------------------- + +BOOL SvxShadowTabPage::FillItemSet( SfxItemSet& rAttrs ) +{ + const SfxPoolItem* pOld = NULL; + BOOL bModified = FALSE; + + if( !bDisable ) + { + // Schatten + TriState eState = aTsbShowShadow.GetState(); + if( eState != aTsbShowShadow.GetSavedValue() ) + { + SdrShadowItem aItem( sal::static_int_cast< BOOL >( eState ) ); + pOld = GetOldItem( rAttrs, SDRATTR_SHADOW ); + if ( !pOld || !( *(const SdrShadowItem*)pOld == aItem ) ) + { + rAttrs.Put( aItem ); + bModified = TRUE; + } + } + + // Schatten-Entfernung + // Etwas umstaendliche Abfrage, ob etwas geaendert wurde, + // da Items nicht direkt auf Controls abbildbar sind + INT32 nX = 0L, nY = 0L; + INT32 nXY = GetCoreValue( aMtrDistance, ePoolUnit ); + + switch( aCtlPosition.GetActualRP() ) + { + case RP_LT: nX = nY = -nXY; break; + case RP_MT: nY = -nXY; break; + case RP_RT: nX = nXY; nY = -nXY; break; + case RP_LM: nX = -nXY; break; + case RP_RM: nX = nXY; break; + case RP_LB: nX = -nXY; nY = nXY; break; + case RP_MB: nY = nXY; break; + case RP_RB: nX = nY = nXY; break; + case RP_MM: break; + } + + // Wenn die Werte des Schattenabstanden==SFX_ITEM_DONTCARE und der angezeigte + // String im entspr. MetricField=="", dann w�rde der Vergleich zw. alten und + // neuen Distance-Werte ein falsches Ergebnis liefern, da in so einem Fall die + // neuen Distance-Werte den Default-Werten des MetricField entspr�chen !!!! + if ( !aMtrDistance.IsEmptyFieldValue() || + rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SFX_ITEM_DONTCARE || + rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SFX_ITEM_DONTCARE ) + { + INT32 nOldX = 9876543; // Unmoeglicher Wert, entspr. DontCare + INT32 nOldY = 9876543; + if( rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SFX_ITEM_DONTCARE && + rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SFX_ITEM_DONTCARE ) + { + nOldX = ( ( const SdrShadowXDistItem& ) rOutAttrs. + Get( SDRATTR_SHADOWXDIST ) ).GetValue(); + nOldY = ( ( const SdrShadowYDistItem& ) rOutAttrs. + Get( SDRATTR_SHADOWYDIST ) ).GetValue(); + } + SdrShadowXDistItem aXItem( nX ); + pOld = GetOldItem( rAttrs, SDRATTR_SHADOWXDIST ); + if ( nX != nOldX && + ( !pOld || !( *(const SdrShadowXDistItem*)pOld == aXItem ) ) ) + { + rAttrs.Put( aXItem ); + bModified = TRUE; + } + SdrShadowYDistItem aYItem( nY ); + pOld = GetOldItem( rAttrs, SDRATTR_SHADOWYDIST ); + if ( nY != nOldY && + ( !pOld || !( *(const SdrShadowYDistItem*)pOld == aYItem ) ) ) + { + rAttrs.Put( aYItem ); + bModified = TRUE; + } + } + + // ShadowColor + USHORT nPos = aLbShadowColor.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND && + nPos != aLbShadowColor.GetSavedValue() ) + { + SdrShadowColorItem aItem( aLbShadowColor.GetSelectEntry(), + aLbShadowColor.GetSelectEntryColor() ); + pOld = GetOldItem( rAttrs, SDRATTR_SHADOWCOLOR ); + if ( !pOld || !( *(const SdrShadowColorItem*)pOld == aItem ) ) + { + rAttrs.Put( aItem ); + bModified = TRUE; + } + } + + // Transparenz + UINT16 nVal = (UINT16)aMtrTransparent.GetValue(); + if( nVal != (UINT16)aMtrTransparent.GetSavedValue().ToInt32() ) + { + SdrShadowTransparenceItem aItem( nVal ); + pOld = GetOldItem( rAttrs, SDRATTR_SHADOWTRANSPARENCE ); + if ( !pOld || !( *(const SdrShadowTransparenceItem*)pOld == aItem ) ) + { + rAttrs.Put( aItem ); + bModified = TRUE; + } + } + } + //add CHINA001 begin + rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType)); + //add CHINA001 end + return( bModified ); +} + +// ----------------------------------------------------------------------- + +void SvxShadowTabPage::Reset( const SfxItemSet& rAttrs ) +{ + if( !bDisable ) + { + // Alle Objekte koennen einen Schatten besitzen + // z.Z. gibt es nur 8 m�gliche Positionen den Schatten zu setzen + + // Ist Schatten gesetzt? + if( rAttrs.GetItemState( SDRATTR_SHADOW ) != SFX_ITEM_DONTCARE ) + { + aTsbShowShadow.EnableTriState( FALSE ); + + if( ( ( const SdrShadowItem& ) rAttrs.Get( SDRATTR_SHADOW ) ).GetValue() ) + aTsbShowShadow.SetState( STATE_CHECK ); + else + { + aTsbShowShadow.SetState( STATE_NOCHECK ); + } + } + else + aTsbShowShadow.SetState( STATE_DONTKNOW ); + + // Entfernung (nur 8 moegliche Positionen), deshalb + // wird nur ein Item ausgewertet + + if( rAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SFX_ITEM_DONTCARE && + rAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SFX_ITEM_DONTCARE ) + { + INT32 nX = ( ( const SdrShadowXDistItem& ) rAttrs.Get( SDRATTR_SHADOWXDIST ) ).GetValue(); + INT32 nY = ( ( const SdrShadowYDistItem& ) rAttrs.Get( SDRATTR_SHADOWYDIST ) ).GetValue(); + + if( nX != 0 ) + SetMetricValue( aMtrDistance, nX < 0L ? -nX : nX, ePoolUnit ); + else + SetMetricValue( aMtrDistance, nY < 0L ? -nY : nY, ePoolUnit ); + + // Setzen des Schatten-Controls + if ( nX < 0L && nY < 0L ) aCtlPosition.SetActualRP( RP_LT ); + else if( nX == 0L && nY < 0L ) aCtlPosition.SetActualRP( RP_MT ); + else if( nX > 0L && nY < 0L ) aCtlPosition.SetActualRP( RP_RT ); + else if( nX < 0L && nY == 0L ) aCtlPosition.SetActualRP( RP_LM ); + // Mittelpunkt gibt es nicht mehr + else if( nX == 0L && nY == 0L ) aCtlPosition.SetActualRP( RP_RB ); + else if( nX > 0L && nY == 0L ) aCtlPosition.SetActualRP( RP_RM ); + else if( nX < 0L && nY > 0L ) aCtlPosition.SetActualRP( RP_LB ); + else if( nX == 0L && nY > 0L ) aCtlPosition.SetActualRP( RP_MB ); + else if( nX > 0L && nY > 0L ) aCtlPosition.SetActualRP( RP_RB ); + } + else + { + // determine default-distance + SfxItemPool* pPool = rOutAttrs.GetPool(); + SdrShadowXDistItem* pXDistItem = (SdrShadowXDistItem*)&pPool->GetDefaultItem (SDRATTR_SHADOWXDIST); + SdrShadowYDistItem* pYDistItem = (SdrShadowYDistItem*)&pPool->GetDefaultItem (SDRATTR_SHADOWYDIST); + if (pXDistItem && pYDistItem) + { + INT32 nX = pXDistItem->GetValue(); + INT32 nY = pYDistItem->GetValue(); + if( nX != 0 ) + SetMetricValue( aMtrDistance, nX < 0L ? -nX : nX, ePoolUnit ); + else + SetMetricValue( aMtrDistance, nY < 0L ? -nY : nY, ePoolUnit ); + } + + // Tristate, z.B. mehrer Objekte wurden markiert, wovon einige einen Schatten besitzen, einige nicht. + // Der anzuzeigende Text des MetricFields wird auf "" gesetzt und dient in der Methode FillItemSet + // als Erkennungszeichen daf�r, das der Distance-Wert NICHT ver�ndert wurde !!!! + aMtrDistance.SetText( String() ); + aCtlPosition.SetActualRP( RP_MM ); + } + + // SchattenFarbe: + if( rAttrs.GetItemState( SDRATTR_SHADOWCOLOR ) != SFX_ITEM_DONTCARE ) + { + aLbShadowColor.SelectEntry( ( ( const SdrShadowColorItem& ) rAttrs.Get( SDRATTR_SHADOWCOLOR ) ).GetColorValue() ); + } + else + aLbShadowColor.SetNoSelection(); + + // Transparenz + if( rAttrs.GetItemState( SDRATTR_SHADOWTRANSPARENCE ) != SFX_ITEM_DONTCARE ) + { + USHORT nTransp = ( ( const SdrShadowTransparenceItem& ) rAttrs.Get( SDRATTR_SHADOWTRANSPARENCE ) ).GetValue(); + aMtrTransparent.SetValue( nTransp ); + } + else + aMtrTransparent.SetText( String() ); + + // Werte sichern + //aCtlPosition + aMtrDistance.SaveValue(); + aLbShadowColor.SaveValue(); + aTsbShowShadow.SaveValue(); + + // #66832# This field was not saved, but used to determine changes. + // Why? Seems to be the error. + // It IS the error. + aMtrTransparent.SaveValue(); + + ClickShadowHdl_Impl( NULL ); + ModifyShadowHdl_Impl( NULL ); + } +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxShadowTabPage::Create( Window* pWindow, + const SfxItemSet& rAttrs ) +{ + return( new SvxShadowTabPage( pWindow, rAttrs ) ); +} + +//------------------------------------------------------------------------ + +USHORT* SvxShadowTabPage::GetRanges() +{ + return( pShadowRanges ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxShadowTabPage, ClickShadowHdl_Impl, void *, EMPTYARG ) +{ + if( aTsbShowShadow.GetState() == STATE_NOCHECK ) + { + aFtPosition.Disable(); + aCtlPosition.Disable(); + aFtDistance.Disable(); + aMtrDistance.Disable(); + aFtShadowColor.Disable(); + aLbShadowColor.Disable(); + aFtTransparent.Disable(); + aMtrTransparent.Disable(); + } + else + { + aFtPosition.Enable(); + aCtlPosition.Enable(); + aFtDistance.Enable(); + aMtrDistance.Enable(); + aFtShadowColor.Enable(); + aLbShadowColor.Enable(); + aFtTransparent.Enable(); + aMtrTransparent.Enable(); + } + aCtlPosition.Invalidate(); + + ModifyShadowHdl_Impl( NULL ); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxShadowTabPage, ModifyShadowHdl_Impl, void *, EMPTYARG ) +{ + if( aTsbShowShadow.GetState() == STATE_CHECK ) + rXFSet.Put( XFillStyleItem( XFILL_SOLID ) ); + else + rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); + + USHORT nPos = aLbShadowColor.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + rXFSet.Put( XFillColorItem( String(), + aLbShadowColor.GetSelectEntryColor() ) ); + } + UINT16 nVal = (UINT16)aMtrTransparent.GetValue(); + XFillTransparenceItem aItem( nVal ); + rXFSet.Put( XFillTransparenceItem( aItem ) ); + + // Schatten-Entfernung + INT32 nX = 0L, nY = 0L; + INT32 nXY = GetCoreValue( aMtrDistance, ePoolUnit ); + switch( aCtlPosition.GetActualRP() ) + { + case RP_LT: nX = nY = -nXY; break; + case RP_MT: nY = -nXY; break; + case RP_RT: nX = nXY; nY = -nXY; break; + case RP_LM: nX = -nXY; break; + case RP_RM: nX = nXY; break; + case RP_LB: nX = -nXY; nY = nXY; break; + case RP_MB: nY = nXY; break; + case RP_RB: nX = nY = nXY; break; + case RP_MM: break; + } + + aCtlXRectPreview.SetShadowPosition(Point(nX, nY)); + + aCtlXRectPreview.SetShadowAttributes(aXFillAttr.GetItemSet()); + //aCtlXRectPreview.SetFillAttr( aXFillAttr ); + aCtlXRectPreview.Invalidate(); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +void SvxShadowTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt ) +{ + eRP = eRcPt; + + // Schatten neu zeichnen + ModifyShadowHdl_Impl( pWindow ); +} + +void SvxShadowTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 +{ + SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False); + SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); + SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False); + + + if (pColorTabItem) + SetColorTable(pColorTabItem->GetColorTable()); + if (pPageTypeItem) + SetPageType(pPageTypeItem->GetValue()); + if (pDlgTypeItem) + SetDlgType(pDlgTypeItem->GetValue()); + Construct(); +} diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx new file mode 100644 index 000000000000..63f9491b7379 --- /dev/null +++ b/cui/source/tabpages/transfrm.cxx @@ -0,0 +1,1701 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: transfrm.cxx,v $ + * $Revision: 1.33 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "transfrm.hrc" +#include + +#include "transfrm.hxx" +#include +#include "svx/dlgutil.hxx" +#include +#include "svx/anchorid.hxx" +#include +#include +#include +#include + +// Toleranz fuer WorkingArea +#define DIFF 1000 + +// static ---------------------------------------------------------------- + +static USHORT pPosSizeRanges[] = +{ + SID_ATTR_TRANSFORM_POS_X, + SID_ATTR_TRANSFORM_POS_Y, + SID_ATTR_TRANSFORM_PROTECT_POS, + SID_ATTR_TRANSFORM_PROTECT_POS, + SID_ATTR_TRANSFORM_INTERN, + SID_ATTR_TRANSFORM_INTERN, + SID_ATTR_TRANSFORM_ANCHOR, + SID_ATTR_TRANSFORM_VERT_ORIENT, + SID_ATTR_TRANSFORM_WIDTH, + SID_ATTR_TRANSFORM_SIZE_POINT, + SID_ATTR_TRANSFORM_PROTECT_POS, + SID_ATTR_TRANSFORM_INTERN, + SID_ATTR_TRANSFORM_AUTOWIDTH, + SID_ATTR_TRANSFORM_AUTOHEIGHT, + 0 +}; + +static USHORT pAngleRanges[] = +{ + SID_ATTR_TRANSFORM_ROT_X, + SID_ATTR_TRANSFORM_ANGLE, + SID_ATTR_TRANSFORM_INTERN, + SID_ATTR_TRANSFORM_INTERN, + 0 +}; + +static USHORT pSlantRanges[] = +{ + SDRATTR_ECKENRADIUS, + SDRATTR_ECKENRADIUS, + SID_ATTR_TRANSFORM_SHEAR, + SID_ATTR_TRANSFORM_SHEAR_VERTICAL, + SID_ATTR_TRANSFORM_INTERN, + SID_ATTR_TRANSFORM_INTERN, + 0 +}; + +void lcl_ConvertRect(basegfx::B2DRange& rRange, const sal_uInt16 nDigits, const MapUnit ePoolUnit, const FieldUnit eDlgUnit) +{ + const basegfx::B2DPoint aTopLeft( + (double)MetricField::ConvertValue(basegfx::fround(rRange.getMinX()), nDigits, ePoolUnit, eDlgUnit), + (double)MetricField::ConvertValue(basegfx::fround(rRange.getMinY()), nDigits, ePoolUnit, eDlgUnit)); + const basegfx::B2DPoint aBottomRight( + (double)MetricField::ConvertValue(basegfx::fround(rRange.getMaxX()), nDigits, ePoolUnit, eDlgUnit), + (double)MetricField::ConvertValue(basegfx::fround(rRange.getMaxY()), nDigits, ePoolUnit, eDlgUnit)); + + rRange = basegfx::B2DRange(aTopLeft, aBottomRight); +} + +void lcl_ScaleRect(basegfx::B2DRange& rRange, const Fraction aUIScale) +{ + const double fFactor(1.0 / double(aUIScale)); + rRange = basegfx::B2DRange(rRange.getMinimum() * fFactor, rRange.getMaximum() * fFactor); +} + +/************************************************************************* +|* +|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu +|* +\************************************************************************/ + +SvxTransformTabDialog::SvxTransformTabDialog( Window* pParent, const SfxItemSet* pAttr, + const SdrView* pSdrView, USHORT nAnchorTypes ) : + SfxTabDialog( pParent, SVX_RES( RID_SVXDLG_TRANSFORM ), pAttr ), + pView ( pSdrView ), + nAnchorCtrls(nAnchorTypes) +{ + DBG_ASSERT(pView, "no valid view (!)"); + FreeResource(); + + //different positioning page in Writer + if(nAnchorCtrls & 0x00ff) + { + AddTabPage(RID_SVXPAGE_SWPOSSIZE, SvxSwPosSizeTabPage::Create, SvxSwPosSizeTabPage::GetRanges); + RemoveTabPage(RID_SVXPAGE_POSITION_SIZE); + } + else + { + AddTabPage(RID_SVXPAGE_POSITION_SIZE, SvxPositionSizeTabPage::Create, SvxPositionSizeTabPage::GetRanges); + RemoveTabPage(RID_SVXPAGE_SWPOSSIZE); + } + + AddTabPage(RID_SVXPAGE_ANGLE, SvxAngleTabPage::Create, SvxAngleTabPage::GetRanges); + AddTabPage(RID_SVXPAGE_SLANT, SvxSlantTabPage::Create, SvxSlantTabPage::GetRanges); +} + +// ----------------------------------------------------------------------- + +SvxTransformTabDialog::~SvxTransformTabDialog() +{ +} + +// ----------------------------------------------------------------------- + +void SvxTransformTabDialog::PageCreated(USHORT nId, SfxTabPage &rPage) +{ + switch(nId) + { + case RID_SVXPAGE_POSITION_SIZE: + { + SvxPositionSizeTabPage& rSvxPos = static_cast(rPage); + rSvxPos.SetView(pView); + rSvxPos.Construct(); + + if(nAnchorCtrls & SVX_OBJ_NORESIZE) + { + rSvxPos.DisableResize(); + } + + if(nAnchorCtrls & SVX_OBJ_NOPROTECT) + { + rSvxPos.DisableProtect(); + rSvxPos.UpdateControlStates(); + } + + break; + } + case RID_SVXPAGE_SWPOSSIZE : + { + SvxSwPosSizeTabPage& rSwPos = static_cast(rPage); + + rSwPos.EnableAnchorTypes(nAnchorCtrls); + rSwPos.SetValidateFramePosLink(aValidateLink); + rSwPos.SetView(pView); + + break; + } + + case RID_SVXPAGE_ANGLE: + { + SvxAngleTabPage& rSvxAng = static_cast(rPage); + + rSvxAng.SetView( pView ); + rSvxAng.Construct(); + + break; + } + + case RID_SVXPAGE_SLANT: + { + SvxSlantTabPage& rSvxSlnt = static_cast(rPage); + + rSvxSlnt.SetView( pView ); + rSvxSlnt.Construct(); + + break; + } + } +} + +// ----------------------------------------------------------------------- + +void SvxTransformTabDialog::SetValidateFramePosLink(const Link& rLink) +{ + aValidateLink = rLink; +} + +/************************************************************************* +|* +|* Dialog zum Aendern der Position des Drehwinkels und des Drehwinkels +|* der Grafikobjekte +|* +\************************************************************************/ + +SvxAngleTabPage::SvxAngleTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : + SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_ANGLE ), rInAttrs ), + aFlPosition ( this, SVX_RES( FL_POSITION ) ), + aFtPosX ( this, SVX_RES( FT_POS_X ) ), + aMtrPosX ( this, SVX_RES( MTR_FLD_POS_X ) ), + aFtPosY ( this, SVX_RES( FT_POS_Y ) ), + aMtrPosY ( this, SVX_RES( MTR_FLD_POS_Y ) ), + aFtPosPresets ( this, SVX_RES(FT_POSPRESETS) ), + aCtlRect ( this, SVX_RES( CTL_RECT ) ), + + aFlAngle ( this, SVX_RES( FL_ANGLE ) ), + aFtAngle ( this, SVX_RES( FT_ANGLE ) ), + aMtrAngle ( this, SVX_RES( MTR_FLD_ANGLE ) ), + aFtAnglePresets ( this, SVX_RES(FT_ANGLEPRESETS) ), + aCtlAngle ( this, SVX_RES( CTL_ANGLE ), + RP_RB, 200, 80, CS_ANGLE ), + rOutAttrs ( rInAttrs ) +{ + FreeResource(); + + // calculate PoolUnit + SfxItemPool* pPool = rOutAttrs.GetPool(); + DBG_ASSERT( pPool, "no pool (!)" ); + ePoolUnit = pPool->GetMetric(SID_ATTR_TRANSFORM_POS_X); + + aMtrAngle.SetModifyHdl(LINK( this, SvxAngleTabPage, ModifiedHdl)); +} + +// ----------------------------------------------------------------------- + +void SvxAngleTabPage::Construct() +{ + DBG_ASSERT(pView, "No valid view (!)"); + eDlgUnit = GetModuleFieldUnit(&GetItemSet()); + SetFieldUnit(aMtrPosX, eDlgUnit, TRUE); + SetFieldUnit(aMtrPosY, eDlgUnit, TRUE); + + if(FUNIT_MILE == eDlgUnit || FUNIT_KM == eDlgUnit) + { + aMtrPosX.SetDecimalDigits( 3 ); + aMtrPosY.SetDecimalDigits( 3 ); + } + + { // #i75273# + Rectangle aTempRect(pView->GetAllMarkedRect()); + pView->GetSdrPageView()->LogicToPagePos(aTempRect); + maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); + } + + // Take anchor into account (Writer) + const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); + + if(rMarkList.GetMarkCount()) + { + const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + maAnchor = basegfx::B2DPoint(pObj->GetAnchorPos().X(), pObj->GetAnchorPos().Y()); + + if(!maAnchor.equalZero()) // -> Writer + { + maRange = basegfx::B2DRange(maRange.getMinimum() - maAnchor, maRange.getMaximum() - maAnchor); + } + } + + // take scale into account + const Fraction aUIScale(pView->GetModel()->GetUIScale()); + lcl_ScaleRect(maRange, aUIScale); + + // take UI units into account + sal_uInt16 nDigits(aMtrPosX.GetDecimalDigits()); + lcl_ConvertRect(maRange, nDigits, (MapUnit)ePoolUnit, eDlgUnit); + + if(!pView->IsRotateAllowed()) + { + aFlPosition.Disable(); + aFtPosX.Disable(); + aMtrPosX.Disable(); + aFtPosY.Disable(); + aMtrPosY.Disable(); + aFtPosPresets.Disable(); + aCtlRect.Disable(); + aFlAngle.Disable(); + aFtAngle.Disable(); + aMtrAngle.Disable(); + aFtAnglePresets.Disable(); + aCtlAngle.Disable(); + } +} + +// ----------------------------------------------------------------------- + +BOOL SvxAngleTabPage::FillItemSet(SfxItemSet& rSet) +{ + BOOL bModified = FALSE; + + if(aMtrAngle.IsValueModified() || aMtrPosX.IsValueModified() || aMtrPosY.IsValueModified()) + { + const double fUIScale(double(pView->GetModel()->GetUIScale())); + const double fTmpX((GetCoreValue(aMtrPosX, ePoolUnit) + maAnchor.getX()) * fUIScale); + const double fTmpY((GetCoreValue(aMtrPosY, ePoolUnit) + maAnchor.getY()) * fUIScale); + + rSet.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ANGLE), static_cast(aMtrAngle.GetValue()))); + rSet.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_X), basegfx::fround(fTmpX))); + rSet.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_Y), basegfx::fround(fTmpY))); + + bModified |= TRUE; + } + + return bModified; +} + +// ----------------------------------------------------------------------- + +void SvxAngleTabPage::Reset(const SfxItemSet& rAttrs) +{ + const double fUIScale(double(pView->GetModel()->GetUIScale())); + + const SfxPoolItem* pItem = GetItem( rAttrs, SID_ATTR_TRANSFORM_ROT_X ); + if(pItem) + { + const double fTmp(((double)((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getX()) / fUIScale); + SetMetricValue(aMtrPosX, basegfx::fround(fTmp), ePoolUnit); + } + else + { + aMtrPosX.SetText( String() ); + } + + pItem = GetItem(rAttrs, SID_ATTR_TRANSFORM_ROT_Y); + if(pItem) + { + const double fTmp(((double)((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getY()) / fUIScale); + SetMetricValue(aMtrPosY, basegfx::fround(fTmp), ePoolUnit); + } + else + { + aMtrPosX.SetText( String() ); + } + + pItem = GetItem( rAttrs, SID_ATTR_TRANSFORM_ANGLE ); + if(pItem) + { + aMtrAngle.SetValue(((const SfxInt32Item*)pItem)->GetValue()); + } + else + { + aMtrAngle.SetText( String() ); + } + + aMtrAngle.SaveValue(); + ModifiedHdl(this); +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxAngleTabPage::Create( Window* pWindow, const SfxItemSet& rSet) +{ + return(new SvxAngleTabPage(pWindow, rSet)); +} + +//------------------------------------------------------------------------ + +USHORT* SvxAngleTabPage::GetRanges() +{ + return(pAngleRanges); +} + +// ----------------------------------------------------------------------- + +void SvxAngleTabPage::ActivatePage(const SfxItemSet& /*rSet*/) +{ +} + +// ----------------------------------------------------------------------- + +int SvxAngleTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if(_pSet) + { + FillItemSet(*_pSet); + } + + return LEAVE_PAGE; +} + +//------------------------------------------------------------------------ + +void SvxAngleTabPage::PointChanged(Window* pWindow, RECT_POINT eRP) +{ + if(pWindow == &aCtlRect) + { + switch(eRP) + { + case RP_LT: + { + aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMinX()), FUNIT_NONE ); + aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMinY()), FUNIT_NONE ); + break; + } + case RP_MT: + { + aMtrPosX.SetUserValue( basegfx::fround64(maRange.getCenter().getX()), FUNIT_NONE ); + aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMinY()), FUNIT_NONE ); + break; + } + case RP_RT: + { + aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMaxX()), FUNIT_NONE ); + aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMinY()), FUNIT_NONE ); + break; + } + case RP_LM: + { + aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMinX()), FUNIT_NONE ); + aMtrPosY.SetUserValue( basegfx::fround64(maRange.getCenter().getY()), FUNIT_NONE ); + break; + } + case RP_MM: + { + aMtrPosX.SetUserValue( basegfx::fround64(maRange.getCenter().getX()), FUNIT_NONE ); + aMtrPosY.SetUserValue( basegfx::fround64(maRange.getCenter().getY()), FUNIT_NONE ); + break; + } + case RP_RM: + { + aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMaxX()), FUNIT_NONE ); + aMtrPosY.SetUserValue( basegfx::fround64(maRange.getCenter().getY()), FUNIT_NONE ); + break; + } + case RP_LB: + { + aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMinX()), FUNIT_NONE ); + aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMaxY()), FUNIT_NONE ); + break; + } + case RP_MB: + { + aMtrPosX.SetUserValue( basegfx::fround64(maRange.getCenter().getX()), FUNIT_NONE ); + aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMaxY()), FUNIT_NONE ); + break; + } + case RP_RB: + { + aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMaxX()), FUNIT_NONE ); + aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMaxY()), FUNIT_NONE ); + break; + } + } + } + else if(pWindow == &aCtlAngle) + { + switch( eRP ) + { + case RP_LT: aMtrAngle.SetUserValue( 13500, FUNIT_NONE ); break; + case RP_MT: aMtrAngle.SetUserValue( 9000, FUNIT_NONE ); break; + case RP_RT: aMtrAngle.SetUserValue( 4500, FUNIT_NONE ); break; + case RP_LM: aMtrAngle.SetUserValue( 18000, FUNIT_NONE ); break; + case RP_RM: aMtrAngle.SetUserValue( 0, FUNIT_NONE ); break; + case RP_LB: aMtrAngle.SetUserValue( 22500, FUNIT_NONE ); break; + case RP_MB: aMtrAngle.SetUserValue( 27000, FUNIT_NONE ); break; + case RP_RB: aMtrAngle.SetUserValue( 31500, FUNIT_NONE ); break; + case RP_MM: break; + } + } +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxAngleTabPage, ModifiedHdl, void *, EMPTYARG ) +{ + switch(aMtrAngle.GetValue()) + { + case 13500: aCtlAngle.SetActualRP( RP_LT ); break; + case 9000: aCtlAngle.SetActualRP( RP_MT ); break; + case 4500: aCtlAngle.SetActualRP( RP_RT ); break; + case 18000: aCtlAngle.SetActualRP( RP_LM ); break; + case 0: aCtlAngle.SetActualRP( RP_RM ); break; + case 22500: aCtlAngle.SetActualRP( RP_LB ); break; + case 27000: aCtlAngle.SetActualRP( RP_MB ); break; + case 31500: aCtlAngle.SetActualRP( RP_RB ); break; + default: aCtlAngle.SetActualRP( RP_MM ); break; + } + + return( 0L ); +} + +/************************************************************************* +|* +|* Dialog zum Aendern des Eckenradius und zum Schraegstellen +|* +\************************************************************************/ + +SvxSlantTabPage::SvxSlantTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : + SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_SLANT ), rInAttrs ), + + aFlRadius ( this, SVX_RES( FL_RADIUS ) ), + aFtRadius ( this, SVX_RES( FT_RADIUS ) ), + aMtrRadius ( this, SVX_RES( MTR_FLD_RADIUS ) ), + aFlAngle ( this, SVX_RES( FL_SLANT ) ), + aFtAngle ( this, SVX_RES( FT_ANGLE ) ), + aMtrAngle ( this, SVX_RES( MTR_FLD_ANGLE ) ), + rOutAttrs ( rInAttrs ) +{ + FreeResource(); + + // this page needs ExchangeSupport + SetExchangeSupport(); + + // evaluate PoolUnit + SfxItemPool* pPool = rOutAttrs.GetPool(); + DBG_ASSERT( pPool, "no pool (!)" ); + ePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X ); +} + +// ----------------------------------------------------------------------- + +void SvxSlantTabPage::Construct() +{ + // get the range + DBG_ASSERT(pView, "no valid view (!)"); + eDlgUnit = GetModuleFieldUnit(&GetItemSet()); + SetFieldUnit(aMtrRadius, eDlgUnit, TRUE); + + { // #i75273# + Rectangle aTempRect(pView->GetAllMarkedRect()); + pView->GetSdrPageView()->LogicToPagePos(aTempRect); + maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); + } +} + +// ----------------------------------------------------------------------- + +BOOL SvxSlantTabPage::FillItemSet(SfxItemSet& rAttrs) +{ + BOOL bModified = FALSE; + INT32 nValue = 0L; + String aStr = aMtrRadius.GetText(); + + if( aStr != aMtrRadius.GetSavedValue() ) + { + Fraction aUIScale = pView->GetModel()->GetUIScale(); + long nTmp = GetCoreValue( aMtrRadius, ePoolUnit ); + nTmp = Fraction( nTmp ) * aUIScale; + + rAttrs.Put( SdrEckenradiusItem( nTmp ) ); + bModified = TRUE; + } + + aStr = aMtrAngle.GetText(); + + if( aStr != aMtrAngle.GetSavedValue() ) + { + nValue = static_cast(aMtrAngle.GetValue()); + rAttrs.Put( SfxInt32Item( SID_ATTR_TRANSFORM_SHEAR, nValue ) ); + bModified = TRUE; + } + + if( bModified ) + { + // Referenzpunkt setzen + // #75897# + Rectangle aObjectRect(pView->GetAllMarkedRect()); + pView->GetSdrPageView()->LogicToPagePos(aObjectRect); + Point aPt = aObjectRect.Center(); + + rAttrs.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_X, aPt.X())); + rAttrs.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_Y, aPt.Y())); + rAttrs.Put( SfxBoolItem( SID_ATTR_TRANSFORM_SHEAR_VERTICAL, FALSE ) ); + } + + return( bModified ); +} + +// ----------------------------------------------------------------------- + +void SvxSlantTabPage::Reset(const SfxItemSet& rAttrs) +{ + // if the view has selected objects, items with SFX_ITEM_DEFAULT need to be disabled + const SfxPoolItem* pItem; + + // Eckenradius + if(!pView->IsEdgeRadiusAllowed()) + { + aFlRadius.Disable(); + aFtRadius.Disable(); + aMtrRadius.Disable(); + aMtrRadius.SetText( String() ); + } + else + { + pItem = GetItem( rAttrs, SDRATTR_ECKENRADIUS ); + + if( pItem ) + { + const double fUIScale(double(pView->GetModel()->GetUIScale())); + const double fTmp((double)((const SdrEckenradiusItem*)pItem)->GetValue() / fUIScale); + SetMetricValue(aMtrRadius, basegfx::fround(fTmp), ePoolUnit); + } + else + { + aMtrRadius.SetText( String() ); + } + } + + aMtrRadius.SaveValue(); + + // Schraegstellen: Winkel + if( !pView->IsShearAllowed() ) + { + aFlAngle.Disable(); + aFtAngle.Disable(); + aMtrAngle.Disable(); + aMtrAngle.SetText( String() ); + } + else + { + pItem = GetItem( rAttrs, SID_ATTR_TRANSFORM_SHEAR ); + + if( pItem ) + { + aMtrAngle.SetValue( ( (const SfxInt32Item*)pItem )->GetValue() ); + } + else + { + aMtrAngle.SetText( String() ); + } + } + + aMtrAngle.SaveValue(); +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxSlantTabPage::Create( Window* pWindow, const SfxItemSet& rOutAttrs ) +{ + return( new SvxSlantTabPage( pWindow, rOutAttrs ) ); +} + +//------------------------------------------------------------------------ + +USHORT* SvxSlantTabPage::GetRanges() +{ + return( pSlantRanges ); +} + +// ----------------------------------------------------------------------- + +void SvxSlantTabPage::ActivatePage( const SfxItemSet& rSet ) +{ + SfxRectangleItem* pRectItem = NULL; + + if( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_TRANSFORM_INTERN ) , FALSE, (const SfxPoolItem**) &pRectItem ) ) + { + const Rectangle aTempRect(pRectItem->GetValue()); + maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); + } +} + +// ----------------------------------------------------------------------- + +int SvxSlantTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if(_pSet) + { + FillItemSet(*_pSet); + } + + return LEAVE_PAGE; +} + +//------------------------------------------------------------------------ + +void SvxSlantTabPage::PointChanged( Window* , RECT_POINT ) +{ +} + +/************************************************************************* +|* +|* Dialog for changing position and size of graphic objects +|* +\************************************************************************/ + +SvxPositionSizeTabPage::SvxPositionSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : + SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_POSITION_SIZE ), rInAttrs ), + maFlPosition ( this, SVX_RES( FL_POSITION ) ), + maFtPosX ( this, SVX_RES( FT_POS_X ) ), + maMtrPosX ( this, SVX_RES( MTR_FLD_POS_X ) ), + maFtPosY ( this, SVX_RES( FT_POS_Y ) ), + maMtrPosY ( this, SVX_RES( MTR_FLD_POS_Y ) ), + maFtPosReference ( this, SVX_RES( FT_POSREFERENCE ) ), + maCtlPos ( this, SVX_RES( CTL_POSRECT ), RP_LT ), + + maFlSize ( this, SVX_RES( FL_SIZE ) ), + maFtWidth ( this, SVX_RES( FT_WIDTH ) ), + maMtrWidth ( this, SVX_RES( MTR_FLD_WIDTH ) ), + maFtHeight ( this, SVX_RES( FT_HEIGHT ) ), + maMtrHeight ( this, SVX_RES( MTR_FLD_HEIGHT ) ), + maCbxScale ( this, SVX_RES( CBX_SCALE ) ), + maFtSizeReference ( this, SVX_RES( FT_SIZEREFERENCE) ), + maCtlSize ( this, SVX_RES( CTL_SIZERECT ), RP_LT ), + + maFlProtect ( this, SVX_RES( FL_PROTECT) ), + maTsbPosProtect ( this, SVX_RES( TSB_POSPROTECT ) ), + maTsbSizeProtect ( this, SVX_RES( TSB_SIZEPROTECT ) ), + + + maFlAdjust ( this, SVX_RES( FL_ADJUST ) ), + maTsbAutoGrowWidth ( this, SVX_RES( TSB_AUTOGROW_WIDTH ) ), + maTsbAutoGrowHeight ( this, SVX_RES( TSB_AUTOGROW_HEIGHT ) ), + + maFlDivider (this, SVX_RES( FL_DIVIDER ) ), + + mrOutAttrs ( rInAttrs ), + mnProtectSizeState( STATE_NOCHECK ), + mbPageDisabled ( FALSE ), + mbProtectDisabled( false ), + mbSizeDisabled( false ), + mbAdjustDisabled( true ) +{ + FreeResource(); + + // this pege needs ExchangeSupport + SetExchangeSupport(); + + // evaluate PoolUnit + SfxItemPool* pPool = mrOutAttrs.GetPool(); + DBG_ASSERT( pPool, "no pool (!)" ); + mePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X ); + + meRP = RP_LT; // s.o. + + maMtrWidth.SetModifyHdl( LINK( this, SvxPositionSizeTabPage, ChangeWidthHdl ) ); + maMtrHeight.SetModifyHdl( LINK( this, SvxPositionSizeTabPage, ChangeHeightHdl ) ); + maCbxScale.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ClickAutoHdl ) ); + + maTsbAutoGrowWidth.Disable(); + maTsbAutoGrowHeight.Disable(); + maFlAdjust.Disable(); + + // #i2379# disable controls when protected + maTsbPosProtect.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ChangePosProtectHdl ) ); + maTsbSizeProtect.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ChangeSizeProtectHdl ) ); + +} + +// ----------------------------------------------------------------------- + +void SvxPositionSizeTabPage::Construct() +{ + // get range and work area + DBG_ASSERT( mpView, "no valid view (!)" ); + meDlgUnit = GetModuleFieldUnit( &GetItemSet() ); + SetFieldUnit( maMtrPosX, meDlgUnit, TRUE ); + SetFieldUnit( maMtrPosY, meDlgUnit, TRUE ); + SetFieldUnit( maMtrWidth, meDlgUnit, TRUE ); + SetFieldUnit( maMtrHeight, meDlgUnit, TRUE ); + + if(FUNIT_MILE == meDlgUnit || FUNIT_KM == meDlgUnit) + { + maMtrPosX.SetDecimalDigits( 3 ); + maMtrPosY.SetDecimalDigits( 3 ); + maMtrWidth.SetDecimalDigits( 3 ); + maMtrHeight.SetDecimalDigits( 3 ); + } + + { // #i75273# + Rectangle aTempRect(mpView->GetAllMarkedRect()); + mpView->GetSdrPageView()->LogicToPagePos(aTempRect); + maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); + } + + { // #i75273# + Rectangle aTempRect(mpView->GetWorkArea()); + mpView->GetSdrPageView()->LogicToPagePos(aTempRect); + maWorkRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); + } + + // take anchor into account (Writer) + const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); + + if(rMarkList.GetMarkCount()) + { + const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + maAnchor = basegfx::B2DPoint(pObj->GetAnchorPos().X(), pObj->GetAnchorPos().Y()); + + if(!maAnchor.equalZero()) // -> Writer + { + for(sal_uInt16 i(1); i < rMarkList.GetMarkCount(); i++) + { + pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); + + if(maAnchor != basegfx::B2DPoint(pObj->GetAnchorPos().X(), pObj->GetAnchorPos().Y())) + { + // diferent anchor positions + maMtrPosX.SetText( String() ); + maMtrPosY.SetText( String() ); + mbPageDisabled = TRUE; + return; + } + } + + // translate ranges about anchor + maRange = basegfx::B2DRange(maRange.getMinimum() - maAnchor, maRange.getMaximum() - maAnchor); + maWorkRange = basegfx::B2DRange(maWorkRange.getMinimum() - maAnchor, maWorkRange.getMaximum() - maAnchor); + } + } + + // this should happen via SID_ATTR_TRANSFORM_AUTOSIZE + if(1 == rMarkList.GetMarkCount()) + { + const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier()); + + if((pObj->GetObjInventor() == SdrInventor) && (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) && ((SdrTextObj*)pObj)->HasText()) + { + mbAdjustDisabled = false; + maFlAdjust.Enable(); + maTsbAutoGrowWidth.Enable(); + maTsbAutoGrowHeight.Enable(); + maTsbAutoGrowWidth.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ClickSizeProtectHdl ) ); + maTsbAutoGrowHeight.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ClickSizeProtectHdl ) ); + + // is used as flag to evaluate if its selectable + maTsbAutoGrowWidth.EnableTriState( FALSE ); + maTsbAutoGrowHeight.EnableTriState( FALSE ); + } + } + + // take scale into account + const Fraction aUIScale(mpView->GetModel()->GetUIScale()); + lcl_ScaleRect( maWorkRange, aUIScale ); + lcl_ScaleRect( maRange, aUIScale ); + + // take UI units into account + const sal_uInt16 nDigits(maMtrPosX.GetDecimalDigits()); + lcl_ConvertRect( maWorkRange, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); + lcl_ConvertRect( maRange, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); + + SetMinMaxPosition(); +} + +// ----------------------------------------------------------------------- + +BOOL SvxPositionSizeTabPage::FillItemSet( SfxItemSet& rOutAttrs ) +{ + BOOL bModified(FALSE); + + if ( maMtrWidth.HasFocus() ) + { + ChangeWidthHdl( this ); + } + + if ( maMtrHeight.HasFocus() ) + { + ChangeHeightHdl( this ); + } + + if( !mbPageDisabled ) + { + if ( maMtrPosX.IsValueModified() || maMtrPosY.IsValueModified() ) + { + const double fUIScale(double(mpView->GetModel()->GetUIScale())); + double fX((GetCoreValue( maMtrPosX, mePoolUnit ) + maAnchor.getX()) * fUIScale); + double fY((GetCoreValue( maMtrPosY, mePoolUnit ) + maAnchor.getY()) * fUIScale); + + { // #i75273# + Rectangle aTempRect(mpView->GetAllMarkedRect()); + mpView->GetSdrPageView()->LogicToPagePos(aTempRect); + maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); + } + + // #101581# GetTopLeftPosition(...) needs coordinates after UI scaling, in real PagePositions + GetTopLeftPosition(fX, fY, maRange); + + rOutAttrs.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_POS_X), basegfx::fround(fX))); + rOutAttrs.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_POS_Y), basegfx::fround(fY))); + + bModified |= TRUE; + } + + if ( maTsbPosProtect.GetState() != maTsbPosProtect.GetSavedValue() ) + { + if( maTsbPosProtect.GetState() == STATE_DONTKNOW ) + { + rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_POS ); + } + else + { + rOutAttrs.Put( + SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_POS ), + maTsbPosProtect.GetState() == STATE_CHECK ? TRUE : FALSE ) ); + } + + bModified |= TRUE; + } + } + + if ( maMtrWidth.IsValueModified() || maMtrHeight.IsValueModified() ) + { + Fraction aUIScale = mpView->GetModel()->GetUIScale(); + + // get Width + double nWidth = static_cast(maMtrWidth.GetValue( meDlgUnit )); + nWidth = MetricField::ConvertDoubleValue( nWidth, maMtrWidth.GetBaseValue(), maMtrWidth.GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); + long lWidth = long(nWidth * (double)aUIScale); + lWidth = OutputDevice::LogicToLogic( lWidth, MAP_100TH_MM, (MapUnit)mePoolUnit ); + lWidth = static_cast(maMtrWidth.Denormalize( lWidth )); + + // get Height + double nHeight = static_cast(maMtrHeight.GetValue( meDlgUnit )); + nHeight = MetricField::ConvertDoubleValue( nHeight, maMtrHeight.GetBaseValue(), maMtrHeight.GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); + long lHeight = long(nHeight * (double)aUIScale); + lHeight = OutputDevice::LogicToLogic( lHeight, MAP_100TH_MM, (MapUnit)mePoolUnit ); + lHeight = static_cast(maMtrWidth.Denormalize( lHeight )); + + // put Width & Height to itemset + rOutAttrs.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_WIDTH ), + (UINT32) lWidth ) ); + rOutAttrs.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_HEIGHT ), + (UINT32) lHeight ) ); + rOutAttrs.Put( SfxAllEnumItem( GetWhich( SID_ATTR_TRANSFORM_SIZE_POINT ), sal::static_int_cast< USHORT >( meRP ) ) ); + bModified |= TRUE; + } + + if ( maTsbSizeProtect.GetState() != maTsbSizeProtect.GetSavedValue() ) + { + if ( maTsbSizeProtect.GetState() == STATE_DONTKNOW ) + rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_SIZE ); + else + rOutAttrs.Put( + SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_SIZE ), + maTsbSizeProtect.GetState() == STATE_CHECK ? TRUE : FALSE ) ); + bModified |= TRUE; + } + + if ( maTsbAutoGrowWidth.GetState() != maTsbAutoGrowWidth.GetSavedValue() ) + { + if ( !maTsbAutoGrowWidth.IsTriStateEnabled() ) + { + if( maTsbAutoGrowWidth.GetState() == STATE_DONTKNOW ) + rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_AUTOWIDTH ); + else + rOutAttrs.Put( + SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_AUTOWIDTH ), + maTsbAutoGrowWidth.GetState() == STATE_CHECK ? TRUE : FALSE ) ); + } + bModified |= TRUE; + } + + if ( maTsbAutoGrowHeight.GetState() != maTsbAutoGrowHeight.GetSavedValue() ) + { + if ( !maTsbAutoGrowHeight.IsTriStateEnabled() ) + { + if( maTsbAutoGrowHeight.GetState() == STATE_DONTKNOW ) + rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_AUTOHEIGHT ); + else + rOutAttrs.Put( + SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_AUTOHEIGHT ), + maTsbAutoGrowHeight.GetState() == STATE_CHECK ? TRUE : FALSE ) ); + } + bModified |= TRUE; + } + + + return bModified; +} + +// ----------------------------------------------------------------------- + +void SvxPositionSizeTabPage::Reset( const SfxItemSet& ) +{ + const SfxPoolItem* pItem; + const double fUIScale(double(mpView->GetModel()->GetUIScale())); + + if ( !mbPageDisabled ) + { + pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_POS_X ); + if ( pItem ) + { + const double fTmp((((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getX()) / fUIScale); + SetMetricValue(maMtrPosX, basegfx::fround(fTmp), mePoolUnit); + } + + pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_POS_Y ); + if ( pItem ) + { + const double fTmp((((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getY()) / fUIScale); + SetMetricValue(maMtrPosY, basegfx::fround(fTmp), mePoolUnit); + } + + pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_PROTECT_POS ); + if ( pItem ) + { + sal_Bool bProtected = ( ( const SfxBoolItem* )pItem )->GetValue(); + maTsbPosProtect.SetState( bProtected ? STATE_CHECK : STATE_NOCHECK ); + maTsbPosProtect.EnableTriState( FALSE ); + } + else + { + maTsbPosProtect.SetState( STATE_DONTKNOW ); + } + + maTsbPosProtect.SaveValue(); + maCtlPos.Reset(); + + // #i2379# Disable controls for protected objects + ChangePosProtectHdl( this ); + } + + { // #i75273# set width + pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_WIDTH ); + mfOldWidth = std::max( pItem ? (double)((const SfxUInt32Item*)pItem)->GetValue() : 0.0, 1.0 ); + double fTmpWidth((OutputDevice::LogicToLogic(static_cast(mfOldWidth), (MapUnit)mePoolUnit, MAP_100TH_MM)) / fUIScale); + + if(maMtrWidth.GetDecimalDigits()) + fTmpWidth *= pow(10.0, maMtrWidth.GetDecimalDigits()); + + fTmpWidth = MetricField::ConvertDoubleValue(fTmpWidth, maMtrWidth.GetBaseValue(), maMtrWidth.GetDecimalDigits(), FUNIT_100TH_MM, meDlgUnit); + maMtrWidth.SetValue(static_cast(fTmpWidth), meDlgUnit); + } + + { // #i75273# set height + pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_HEIGHT ); + mfOldHeight = std::max( pItem ? (double)((const SfxUInt32Item*)pItem)->GetValue() : 0.0, 1.0 ); + double fTmpHeight((OutputDevice::LogicToLogic(static_cast(mfOldHeight), (MapUnit)mePoolUnit, MAP_100TH_MM)) / fUIScale); + + if(maMtrHeight.GetDecimalDigits()) + fTmpHeight *= pow(10.0, maMtrHeight.GetDecimalDigits()); + + fTmpHeight = MetricField::ConvertDoubleValue(fTmpHeight, maMtrHeight.GetBaseValue(), maMtrHeight.GetDecimalDigits(), FUNIT_100TH_MM, meDlgUnit); + maMtrHeight.SetValue(static_cast(fTmpHeight), meDlgUnit); + } + + pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_PROTECT_SIZE ); + if ( pItem ) + { + maTsbSizeProtect.SetState( ( (const SfxBoolItem*)pItem )->GetValue() + ? STATE_CHECK : STATE_NOCHECK ); + maTsbSizeProtect.EnableTriState( FALSE ); + } + else + maTsbSizeProtect.SetState( STATE_DONTKNOW ); + + pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_AUTOWIDTH ); + if ( pItem ) + { + maTsbAutoGrowWidth.SetState( ( ( const SfxBoolItem* )pItem )->GetValue() + ? STATE_CHECK : STATE_NOCHECK ); + } + else + maTsbAutoGrowWidth.SetState( STATE_DONTKNOW ); + + pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_AUTOHEIGHT ); + if ( pItem ) + { + maTsbAutoGrowHeight.SetState( ( ( const SfxBoolItem* )pItem )->GetValue() + ? STATE_CHECK : STATE_NOCHECK ); + } + else + maTsbAutoGrowHeight.SetState( STATE_DONTKNOW ); + + // Ist Abgleich gesetzt? + String aStr = GetUserData(); + maCbxScale.Check( (BOOL)aStr.ToInt32() ); + + maTsbSizeProtect.SaveValue(); + maTsbAutoGrowWidth.SaveValue(); + maTsbAutoGrowHeight.SaveValue(); + ClickSizeProtectHdl( NULL ); + + // #i2379# Disable controls for protected objects + ChangeSizeProtectHdl( this ); +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SvxPositionSizeTabPage::Create( Window* pWindow, const SfxItemSet& rOutAttrs ) +{ + return( new SvxPositionSizeTabPage( pWindow, rOutAttrs ) ); +} + +//------------------------------------------------------------------------ + +USHORT* SvxPositionSizeTabPage::GetRanges() +{ + return( pPosSizeRanges ); +} + +// ----------------------------------------------------------------------- + +void SvxPositionSizeTabPage::ActivatePage( const SfxItemSet& rSet ) +{ + SfxRectangleItem* pRectItem = NULL; + + if( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_TRANSFORM_INTERN ) , FALSE, (const SfxPoolItem**) &pRectItem ) ) + { + { // #i75273# + const Rectangle aTempRect(pRectItem->GetValue()); + maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); + } + + SetMinMaxPosition(); + } +} + +// ----------------------------------------------------------------------- + +int SvxPositionSizeTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if( _pSet ) + { + double fX((double)maMtrPosX.GetValue()); + double fY((double)maMtrPosY.GetValue()); + + GetTopLeftPosition(fX, fY, maRange); + const Rectangle aOutRectangle( + basegfx::fround(fX), basegfx::fround(fY), + basegfx::fround(fX + maRange.getWidth()), basegfx::fround(fY + maRange.getHeight())); + _pSet->Put(SfxRectangleItem(SID_ATTR_TRANSFORM_INTERN, aOutRectangle)); + + FillItemSet(*_pSet); + } + + return LEAVE_PAGE; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxPositionSizeTabPage, ChangePosProtectHdl, void *, EMPTYARG ) +{ + // #106572# Remember user's last choice + maTsbSizeProtect.SetState( maTsbPosProtect.GetState() == STATE_CHECK ? STATE_CHECK : mnProtectSizeState ); + UpdateControlStates(); + return( 0L ); +} + +//------------------------------------------------------------------------ + +void SvxPositionSizeTabPage::UpdateControlStates() +{ + const bool bPosProtect = maTsbPosProtect.GetState() == STATE_CHECK; + const bool bSizeProtect = maTsbSizeProtect.GetState() == STATE_CHECK; + const bool bHeightChecked = !maTsbAutoGrowHeight.IsTriStateEnabled() && (maTsbAutoGrowHeight.GetState() == STATE_CHECK); + const bool bWidthChecked = !maTsbAutoGrowWidth.IsTriStateEnabled() && (maTsbAutoGrowWidth.GetState() == STATE_CHECK); + + maFlPosition.Enable( !bPosProtect && !mbPageDisabled ); + maFtPosX.Enable( !bPosProtect && !mbPageDisabled ); + maMtrPosX.Enable( !bPosProtect && !mbPageDisabled ); + maFtPosY.Enable( !bPosProtect && !mbPageDisabled ); + maMtrPosY.Enable( !bPosProtect && !mbPageDisabled ); + maFtPosReference.Enable( !bPosProtect && !mbPageDisabled ); + maCtlPos.Enable( !bPosProtect ); + maTsbPosProtect.Enable( !mbProtectDisabled && !mbPageDisabled ); + + maFlSize.Enable( !mbSizeDisabled && !bSizeProtect ); + maCtlSize.Enable( !mbSizeDisabled && !bSizeProtect && (!bHeightChecked || !bWidthChecked) ); + maFtWidth.Enable( !mbSizeDisabled && !bSizeProtect && !bWidthChecked ); + maMtrWidth.Enable( !mbSizeDisabled && !bSizeProtect && !bWidthChecked ); + maFtHeight.Enable( !mbSizeDisabled && !bSizeProtect && !bHeightChecked ); + maMtrHeight.Enable( !mbSizeDisabled && !bSizeProtect && !bHeightChecked ); + maCbxScale.Enable( !mbSizeDisabled && !bSizeProtect && !bHeightChecked && !bWidthChecked ); + maFtSizeReference.Enable( !mbSizeDisabled && !bSizeProtect ); + maFlProtect.Enable( !mbProtectDisabled ); + maTsbSizeProtect.Enable( !mbProtectDisabled && !bPosProtect ); + + maFlAdjust.Enable( !mbSizeDisabled && !bSizeProtect && !mbAdjustDisabled ); + maTsbAutoGrowWidth.Enable( !mbSizeDisabled && !bSizeProtect && !mbAdjustDisabled ); + maTsbAutoGrowHeight.Enable( !mbSizeDisabled && !bSizeProtect && !mbAdjustDisabled ); + + maCtlSize.Invalidate(); + maCtlPos.Invalidate(); + +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxPositionSizeTabPage, ChangeSizeProtectHdl, void *, EMPTYARG ) +{ + if( maTsbSizeProtect.IsEnabled() ) + { + // #106572# Remember user's last choice + + // Note: this works only as long as the dialog is open. When + // the user closes the dialog, there is no way to remember + // whether size was enabled or disabled befor pos protect was + // clicked. Thus, if pos protect is selected, the dialog is + // closed and reopened again, unchecking pos protect will + // always uncheck size protect, too. That's life. + mnProtectSizeState = maTsbSizeProtect.GetState(); + } + + UpdateControlStates(); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK_INLINE_START( SvxPositionSizeTabPage, ChangePosXHdl, void *, EMPTYARG ) +{ + return( 0L ); +} +IMPL_LINK_INLINE_END( SvxPositionSizeTabPage, ChangePosXHdl, void *, EMPTYARG ) + +//------------------------------------------------------------------------ + +IMPL_LINK_INLINE_START( SvxPositionSizeTabPage, ChangePosYHdl, void *, EMPTYARG ) +{ + return( 0L ); +} +IMPL_LINK_INLINE_END( SvxPositionSizeTabPage, ChangePosYHdl, void *, EMPTYARG ) + +//------------------------------------------------------------------------ + +void SvxPositionSizeTabPage::SetMinMaxPosition() +{ + // position + double fLeft(maWorkRange.getMinX()); + double fTop(maWorkRange.getMinY()); + double fRight(maWorkRange.getMaxX()); + double fBottom(maWorkRange.getMaxY()); + + switch ( maCtlPos.GetActualRP() ) + { + case RP_LT: + { + fRight -= maRange.getWidth(); + fBottom -= maRange.getHeight(); + break; + } + case RP_MT: + { + fLeft += maRange.getWidth() / 2.0; + fRight -= maRange.getWidth() / 2.0; + fBottom -= maRange.getHeight(); + break; + } + case RP_RT: + { + fLeft += maRange.getWidth(); + fBottom -= maRange.getHeight(); + break; + } + case RP_LM: + { + fRight -= maRange.getWidth(); + fTop += maRange.getHeight() / 2.0; + fBottom -= maRange.getHeight() / 2.0; + break; + } + case RP_MM: + { + fLeft += maRange.getWidth() / 2.0; + fRight -= maRange.getWidth() / 2.0; + fTop += maRange.getHeight() / 2.0; + fBottom -= maRange.getHeight() / 2.0; + break; + } + case RP_RM: + { + fLeft += maRange.getWidth(); + fTop += maRange.getHeight() / 2.0; + fBottom -= maRange.getHeight() / 2.0; + break; + } + case RP_LB: + { + fRight -= maRange.getWidth(); + fTop += maRange.getHeight(); + break; + } + case RP_MB: + { + fLeft += maRange.getWidth() / 2.0; + fRight -= maRange.getWidth() / 2.0; + fTop += maRange.getHeight(); + break; + } + case RP_RB: + { + fLeft += maRange.getWidth(); + fTop += maRange.getHeight(); + break; + } + } + + const double fMaxLong((double)(MetricField::ConvertValue( LONG_MAX, 0, MAP_100TH_MM, meDlgUnit ) - 1L)); + fLeft = (fLeft > fMaxLong) ? fMaxLong : (fLeft < -fMaxLong) ? -fMaxLong : fLeft; + fRight = (fRight > fMaxLong) ? fMaxLong : (fRight < -fMaxLong) ? -fMaxLong : fRight; + fTop = (fTop > fMaxLong) ? fMaxLong : (fTop < -fMaxLong) ? -fMaxLong : fTop; + fBottom = (fBottom > fMaxLong) ? fMaxLong : (fBottom < -fMaxLong) ? -fMaxLong : fBottom; + + // #i75273# normalizing when setting the min/max values was wrong, removed + maMtrPosX.SetMin(basegfx::fround64(fLeft)); + maMtrPosX.SetFirst(basegfx::fround64(fLeft)); + maMtrPosX.SetMax(basegfx::fround64(fRight)); + maMtrPosX.SetLast(basegfx::fround64(fRight)); + maMtrPosY.SetMin(basegfx::fround64(fTop)); + maMtrPosY.SetFirst(basegfx::fround64(fTop)); + maMtrPosY.SetMax(basegfx::fround64(fBottom)); + maMtrPosY.SetLast(basegfx::fround64(fBottom)); + + // size + fLeft = maWorkRange.getMinX(); + fTop = maWorkRange.getMinY(); + fRight = maWorkRange.getMaxX(); + fBottom = maWorkRange.getMaxY(); + double fNewX(0); + double fNewY(0); + + switch ( maCtlSize.GetActualRP() ) + { + case RP_LT: + { + fNewX = maWorkRange.getWidth() - ( maRange.getMinX() - fLeft ); + fNewY = maWorkRange.getHeight() - ( maRange.getMinY() - fTop ); + break; + } + case RP_MT: + { + fNewX = std::min( maRange.getCenter().getX() - fLeft, fRight - maRange.getCenter().getX() ) * 2.0; + fNewY = maWorkRange.getHeight() - ( maRange.getMinY() - fTop ); + break; + } + case RP_RT: + { + fNewX = maWorkRange.getWidth() - ( fRight - maRange.getMaxX() ); + fNewY = maWorkRange.getHeight() - ( maRange.getMinY() - fTop ); + break; + } + case RP_LM: + { + fNewX = maWorkRange.getWidth() - ( maRange.getMinX() - fLeft ); + fNewY = std::min( maRange.getCenter().getY() - fTop, fBottom - maRange.getCenter().getY() ) * 2.0; + break; + } + case RP_MM: + { + const double f1(maRange.getCenter().getX() - fLeft); + const double f2(fRight - maRange.getCenter().getX()); + const double f3(std::min(f1, f2)); + const double f4(maRange.getCenter().getY() - fTop); + const double f5(fBottom - maRange.getCenter().getY()); + const double f6(std::min(f4, f5)); + + fNewX = f3 * 2.0; + fNewY = f6 * 3.0; + + break; + } + case RP_RM: + { + fNewX = maWorkRange.getWidth() - ( fRight - maRange.getMaxX() ); + fNewY = std::min( maRange.getCenter().getY() - fTop, fBottom - maRange.getCenter().getY() ) * 2.0; + break; + } + case RP_LB: + { + fNewX = maWorkRange.getWidth() - ( maRange.getMinX() - fLeft ); + fNewY = maWorkRange.getHeight() - ( fBottom - maRange.getMaxY() ); + break; + } + case RP_MB: + { + fNewX = std::min( maRange.getCenter().getX() - fLeft, fRight - maRange.getCenter().getX() ) * 2.0; + fNewY = maWorkRange.getHeight() - ( maRange.getMaxY() - fBottom ); + break; + } + case RP_RB: + { + fNewX = maWorkRange.getWidth() - ( fRight - maRange.getMaxX() ); + fNewY = maWorkRange.getHeight() - ( fBottom - maRange.getMaxY() ); + break; + } + } + + // #i75273# normalizing when setting the min/max values was wrong, removed + maMtrWidth.SetMax(basegfx::fround64(fNewX)); + maMtrWidth.SetLast(basegfx::fround64(fNewX)); + maMtrHeight.SetMax(basegfx::fround64(fNewY)); + maMtrHeight.SetLast(basegfx::fround64(fNewY)); +} + +//------------------------------------------------------------------------ + +void SvxPositionSizeTabPage::GetTopLeftPosition(double& rfX, double& rfY, const basegfx::B2DRange& rRange) +{ + switch (maCtlPos.GetActualRP()) + { + case RP_LT: + { + break; + } + case RP_MT: + { + rfX -= rRange.getCenter().getX() - rRange.getMinX(); + break; + } + case RP_RT: + { + rfX -= rRange.getWidth(); + break; + } + case RP_LM: + { + rfY -= rRange.getCenter().getY() - rRange.getMinY(); + break; + } + case RP_MM: + { + rfX -= rRange.getCenter().getX() - rRange.getMinX(); + rfY -= rRange.getCenter().getY() - rRange.getMinY(); + break; + } + case RP_RM: + { + rfX -= rRange.getWidth(); + rfY -= rRange.getCenter().getY() - rRange.getMinY(); + break; + } + case RP_LB: + { + rfY -= rRange.getHeight(); + break; + } + case RP_MB: + { + rfX -= rRange.getCenter().getX() - rRange.getMinX(); + rfY -= rRange.getHeight(); + break; + } + case RP_RB: + { + rfX -= rRange.getWidth(); + rfY -= rRange.getHeight(); + break; + } + } +} + +//------------------------------------------------------------------------ + +void SvxPositionSizeTabPage::PointChanged( Window* pWindow, RECT_POINT eRP ) +{ + if( pWindow == &maCtlPos ) + { + SetMinMaxPosition(); + switch( eRP ) + { + case RP_LT: + { + maMtrPosX.SetValue( basegfx::fround64(maRange.getMinX()) ); + maMtrPosY.SetValue( basegfx::fround64(maRange.getMinY()) ); + break; + } + case RP_MT: + { + maMtrPosX.SetValue( basegfx::fround64(maRange.getCenter().getX()) ); + maMtrPosY.SetValue( basegfx::fround64(maRange.getMinY()) ); + break; + } + case RP_RT: + { + maMtrPosX.SetValue( basegfx::fround64(maRange.getMaxX()) ); + maMtrPosY.SetValue( basegfx::fround64(maRange.getMinY()) ); + break; + } + case RP_LM: + { + maMtrPosX.SetValue( basegfx::fround64(maRange.getMinX()) ); + maMtrPosY.SetValue( basegfx::fround64(maRange.getCenter().getY()) ); + break; + } + case RP_MM: + { + maMtrPosX.SetValue( basegfx::fround64(maRange.getCenter().getX()) ); + maMtrPosY.SetValue( basegfx::fround64(maRange.getCenter().getY()) ); + break; + } + case RP_RM: + { + maMtrPosX.SetValue( basegfx::fround64(maRange.getMaxX()) ); + maMtrPosY.SetValue( basegfx::fround64(maRange.getCenter().getY()) ); + break; + } + case RP_LB: + { + maMtrPosX.SetValue( basegfx::fround64(maRange.getMinX()) ); + maMtrPosY.SetValue( basegfx::fround64(maRange.getMaxY()) ); + break; + } + case RP_MB: + { + maMtrPosX.SetValue( basegfx::fround64(maRange.getCenter().getX()) ); + maMtrPosY.SetValue( basegfx::fround64(maRange.getMaxY()) ); + break; + } + case RP_RB: + { + maMtrPosX.SetValue( basegfx::fround64(maRange.getMaxX()) ); + maMtrPosY.SetValue( basegfx::fround64(maRange.getMaxY()) ); + break; + } + } + } + else + { + meRP = eRP; + + Rectangle aTmpRect( GetRect() ); + SetMinMaxPosition(); + } +} + +//------------------------------------------------------------------------ + +void SvxPositionSizeTabPage::DisableResize() +{ + mbSizeDisabled = true; +} + +//------------------------------------------------------------------------ + +void SvxPositionSizeTabPage::DisableProtect() +{ + mbProtectDisabled = true; +} + +//------------------------------------------------------------------------ + +Rectangle SvxPositionSizeTabPage::GetRect() +{ + double fLeft(maRange.getMinX()); + double fTop(maRange.getMinY()); + double fRight(fLeft + (double)maMtrWidth.GetValue()); + double fBottom(fTop + (double)maMtrHeight.GetValue()); + + switch ( maCtlSize.GetActualRP() ) + { + case RP_LT: + { + break; + } + case RP_MT: + { + fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ) / 2.0; + break; + } + case RP_RT: + { + fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ); + break; + } + case RP_LM: + { + fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ) / 2.0; + break; + } + case RP_MM: + { + fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ) / 2.0; + fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ) / 2.0; + break; + } + case RP_RM: + { + fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ); + fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ) / 2.0; + break; + } + case RP_LB: + { + fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ); + break; + } + case RP_MB: + { + fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ) / 2.0; + fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ); + break; + } + case RP_RB: + { + fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ); + fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ); + break; + } + } + + return Rectangle(basegfx::fround(fLeft), basegfx::fround(fTop), basegfx::fround(fRight), basegfx::fround(fBottom)); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxPositionSizeTabPage, ChangeWidthHdl, void *, EMPTYARG ) +{ + if( maCbxScale.IsChecked() && maCbxScale.IsEnabled() ) + { + sal_Int64 nHeight(basegfx::fround64((mfOldHeight * (double)maMtrWidth.GetValue()) / mfOldWidth)); + + if(nHeight <= maMtrHeight.GetMax(FUNIT_NONE)) + { + maMtrHeight.SetUserValue(nHeight, FUNIT_NONE); + } + else + { + nHeight = maMtrHeight.GetMax(FUNIT_NONE); + maMtrHeight.SetUserValue(nHeight); + + const sal_Int64 nWidth(basegfx::fround64((mfOldWidth * (double)nHeight) / mfOldHeight)); + maMtrWidth.SetUserValue(nWidth, FUNIT_NONE); + } + } + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxPositionSizeTabPage, ChangeHeightHdl, void *, EMPTYARG ) +{ + if( maCbxScale.IsChecked() && maCbxScale.IsEnabled() ) + { + sal_Int64 nWidth(basegfx::fround64((mfOldWidth * (double)maMtrHeight.GetValue()) / mfOldHeight)); + + if(nWidth <= maMtrWidth.GetMax(FUNIT_NONE)) + { + maMtrWidth.SetUserValue(nWidth, FUNIT_NONE); + } + else + { + nWidth = maMtrWidth.GetMax(FUNIT_NONE); + maMtrWidth.SetUserValue(nWidth); + + const sal_Int64 nHeight(basegfx::fround64((mfOldHeight * (double)nWidth) / mfOldWidth)); + maMtrHeight.SetUserValue(nHeight, FUNIT_NONE); + } + } + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxPositionSizeTabPage, ClickSizeProtectHdl, void *, EMPTYARG ) +{ + UpdateControlStates(); + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SvxPositionSizeTabPage, ClickAutoHdl, void *, EMPTYARG ) +{ + if( maCbxScale.IsChecked() ) + { + mfOldWidth = std::max( (double)GetCoreValue( maMtrWidth, mePoolUnit ), 1.0 ); + mfOldHeight = std::max( (double)GetCoreValue( maMtrHeight, mePoolUnit ), 1.0 ); + } + + return( 0L ); +} + +//------------------------------------------------------------------------ + +void SvxPositionSizeTabPage::FillUserData() +{ + // Abgleich wird in der Ini-Datei festgehalten + UniString aStr = UniString::CreateFromInt32( (sal_Int32) maCbxScale.IsChecked() ); + SetUserData( aStr ); +} + +// eof diff --git a/cui/source/tabpages/transfrm.hrc b/cui/source/tabpages/transfrm.hrc new file mode 100644 index 000000000000..a49a8c3f3985 --- /dev/null +++ b/cui/source/tabpages/transfrm.hrc @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: transfrm.hrc,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define TAB_CONTROL 1 +#define BTN_OK 2 +#define BTN_CANCEL 3 +#define BTN_HELP 4 +#define FT_POS_X 5 +#define FT_POS_Y 6 +#define MTR_FLD_POS_X 7 +#define MTR_FLD_POS_Y 8 +#define CBX_COPY 9 +#define TSB_PROTECT 10 +#define TSB_AUTO 11 +#define TSB_AUTOGROW_HEIGHT 12 +#define TSB_AUTOGROW_WIDTH 13 +#define BTN_RESET 14 +#define FT_WIDTH 15 +#define FT_HEIGHT 16 +#define MTR_FLD_WIDTH 17 +#define MTR_FLD_HEIGHT 18 +#define MTR_FLD_ANGLE 19 +#define CTL_RECT 20 +#define CTL_ANGLE 21 +#define CBX_SCALE 22 +#define FL_ADJUST 23 +#define FL_POSITION 24 +#define FL_SIZE 25 +#define FL_SLANT 26 +#define FL_RADIUS 27 +#define FT_RADIUS 28 +#define MTR_FLD_RADIUS 29 +#define FL_ANGLE 30 +#define FT_ANGLE 31 +#define TSB_VERTICAL 32 +#define FL_ANCHOR 33 +#define FT_ANCHOR 34 +#define LB_ANCHOR 35 +#define FT_ORIENT 36 +#define FT_REFERENCE 37 +#define FT_POSPRESETS 38 +#define FT_ANGLEPRESETS 39 +#define LB_ORIENT 40 +#define FT_SIZEREFERENCE 41 +#define CTL_SIZERECT 42 +#define FT_POSREFERENCE 43 +#define CTL_POSRECT 44 +#define TSB_POSPROTECT 45 +#define TSB_SIZEPROTECT 46 +#define FL_PROTECT 47 +#define FL_DIVIDER 48 + +// diff --git a/cui/source/tabpages/transfrm.src b/cui/source/tabpages/transfrm.src new file mode 100644 index 000000000000..1a64d5962f85 --- /dev/null +++ b/cui/source/tabpages/transfrm.src @@ -0,0 +1,612 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: transfrm.src,v $ + * $Revision: 1.57 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include ------------------------------------------------------------------ +#include +#include "helpid.hrc" +#include +#include "transfrm.hrc" + // pragma ------------------------------------------------------------------- + +#define MA_TABPAGE_HEIGHT 185 + + // RID_SVXPAGE_POSITION_SIZE ------------------------------------------------ +TabPage RID_SVXPAGE_POSITION_SIZE +{ + HelpId = HID_TRANS_POSITION_SIZE ; + Hide = TRUE ; + Text [ en-US ] = "Position and Size" ; + Size = MAP_APPFONT ( 260 , MA_TABPAGE_HEIGHT ) ; + + FixedLine FL_POSITION + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Position" ; + }; + FixedText FT_POS_X + { + Pos = MAP_APPFONT ( 12 , 16 + 8 ) ; + Size = MAP_APPFONT ( 40 , 10 ) ; + Text [ en-US ] = "Position ~X" ; + }; + FixedText FT_POS_Y + { + Pos = MAP_APPFONT ( 12 , 32 + 8 ) ; + Size = MAP_APPFONT ( 40 , 10 ) ; + Text [ en-US ] = "Position ~Y" ; + }; + MetricField MTR_FLD_POS_X + { + Border = TRUE ; + Pos = MAP_APPFONT ( 56 , 14 + 8 ) ; + Size = MAP_APPFONT ( 54 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -120000 ; + Maximum = 240000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + SpinSize = 10 ; + }; + MetricField MTR_FLD_POS_Y + { + Border = TRUE ; + Pos = MAP_APPFONT ( 56 , 30 + 8 ) ; + Size = MAP_APPFONT ( 54 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -120000 ; + Maximum = 240000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + SpinSize = 10 ; + }; + FixedText FT_POSREFERENCE + { + Pos = MAP_APPFONT ( 178 , 2 + 8 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "Base point"; + }; + Control CTL_POSRECT + { + HelpId = HID_TPPOSITION_CTRL ; + Border = TRUE ; + Pos = MAP_APPFONT ( 178 , 12 + 8 ) ; + Size = MAP_APPFONT ( 48 , 34 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Base point" ; + }; + + // size + + FixedLine FL_SIZE + { + Pos = MAP_APPFONT ( 6 , 56 ) ; + Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Size" ; + }; + FixedText FT_WIDTH + { + Pos = MAP_APPFONT ( 12 , 16 + 61 ) ; + Size = MAP_APPFONT ( 40 , 10 ) ; + Text [ en-US ] = "Wi~dth" ; + }; + FixedText FT_HEIGHT + { + Pos = MAP_APPFONT ( 12 , 32 + 61 ) ; + Size = MAP_APPFONT ( 40 , 10 ) ; + Text [ en-US ] = "H~eight" ; + }; + MetricField MTR_FLD_WIDTH + { + Border = TRUE ; + Pos = MAP_APPFONT ( 56 , 14 + 61 ) ; + Size = MAP_APPFONT ( 54 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 120000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + SpinSize = 10 ; + }; + MetricField MTR_FLD_HEIGHT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 56 , 30 + 61 ) ; + Size = MAP_APPFONT ( 54 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 120000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + SpinSize = 10 ; + }; + FixedText FT_SIZEREFERENCE + { + Pos = MAP_APPFONT ( 178 , 2 + 61 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "Base point"; + }; + Control CTL_SIZERECT + { + HelpId = HID_TPSIZE_CTRL ; + Border = TRUE ; + Pos = MAP_APPFONT ( 178 , 12 + 61 ) ; + Size = MAP_APPFONT ( 48 , 34 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Base point" ; + }; + CheckBox CBX_SCALE + { + Pos = MAP_APPFONT ( 12 , 47 + 61 ) ; + Size = MAP_APPFONT ( 162 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Keep ratio" ; + }; + + // Protect + + FixedLine FL_PROTECT + { + Pos = MAP_APPFONT ( 6 , 120 ) ; + Size = MAP_APPFONT ( 119 , RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Protect" ; + }; + + TriStateBox TSB_POSPROTECT + { + Pos = MAP_APPFONT ( 12 , 10 + 120 ) ; + Size = MAP_APPFONT ( 113 , 10 ) ; + Text [ en-US ] = "Position" ; + TabStop = TRUE ; + }; + + TriStateBox TSB_SIZEPROTECT + { + Pos = MAP_APPFONT ( 12 , 24 + 120 ) ; + Size = MAP_APPFONT ( 113 , 10 ) ; + Text [ en-US ] = "~Size" ; + TabStop = TRUE ; + }; + + // Adjust + + FixedLine FL_ADJUST + { + Pos = MAP_APPFONT ( 6 + 123 + 6 , 120 ) ; + Size = MAP_APPFONT ( 119 , RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Adapt" ; + }; + TriStateBox TSB_AUTOGROW_WIDTH + { + Pos = MAP_APPFONT ( 12 + 121 + 8, 10 + 120 ) ; + Size = MAP_APPFONT ( 113 , 10 ) ; + Text [ en-US ] = "~Fit width to text" ; + TabStop = TRUE ; + }; + TriStateBox TSB_AUTOGROW_HEIGHT + { + Pos = MAP_APPFONT ( 12 + 121 + 8, 24 + 120 ) ; + Size = MAP_APPFONT ( 113 , 10 ) ; + Text [ en-US ] = "Fit ~height to text" ; + TabStop = TRUE ; + }; + + FixedLine FL_DIVIDER + { + Pos = MAP_APPFONT( 6 + 119 + 5, 128 ); + Size = MAP_APPFONT( RSC_CD_FIXEDLINE_WIDTH, 26 ); + Vert = True; + }; + + // Anchor + + FixedLine FL_ANCHOR + { + Pos = MAP_APPFONT ( 6 + 123 + 6 , 120 ) ; + Size = MAP_APPFONT ( 119 , RSC_CD_FIXEDLINE_HEIGHT ) ; + Hide = TRUE ; + Text [ en-US ] = "Anchor" ; + }; + FixedText FT_ANCHOR + { + Pos = MAP_APPFONT ( 12 + 121 + 8, 10 + 120 ) ; + Size = MAP_APPFONT ( 37 , 10 ) ; + Hide = TRUE ; + Text [ en-US ] = "~Anchor" ; + }; + ListBox LB_ANCHOR + { + Pos = MAP_APPFONT ( 46 + 121 + 16 , 8 + 120 ) ; + Size = MAP_APPFONT ( 54 , 60 ) ; + Hide = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "To paragraph" ; > ; + < "As character" ; > ; + < "To page" ; > ; + < "To frame" ; > ; + }; + }; + FixedText FT_ORIENT + { + Pos = MAP_APPFONT ( 12 + 121 + 8, 24 + 120 ) ; + Size = MAP_APPFONT ( 37 , 10 ) ; + Hide = TRUE ; + Text [ en-US ] = "P~osition"; + }; + ListBox LB_ORIENT + { + Pos = MAP_APPFONT ( 46 + 121 + 16 , 22 + 120 ); + Size = MAP_APPFONT ( 54 , 60 ) ; + Hide = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "From top" ; > ; + < "Above" ; > ; + < "Centered" ; > ; + < "Below" ; > ; + < "Top of character" ; > ; + < "Center of character" ; > ; + < "Bottom of character" ; > ; + < "Top of line" ; > ; + < "Center of line" ; > ; + < "Bottom of line" ; > ; + }; + }; +}; + + // RID_SVXPAGE_ANGLE -------------------------------------------------------- +TabPage RID_SVXPAGE_ANGLE +{ + HelpId = HID_TRANS_ANGLE ; + Hide = TRUE ; + Text [ en-US ] = "Angle" ; + Size = MAP_APPFONT ( 260 , MA_TABPAGE_HEIGHT ) ; + FixedLine FL_POSITION + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Pivot point" ; + }; + FixedText FT_POS_X + { + Pos = MAP_APPFONT ( 12 , 16 + 11 ) ; + Size = MAP_APPFONT ( 40 , 10 ) ; + Text [ en-US ] = "Position ~X" ; + }; + FixedText FT_POS_Y + { + Pos = MAP_APPFONT ( 12 , 32 + 11 ) ; + Size = MAP_APPFONT ( 40 , 10 ) ; + Text [ en-US ] = "Position ~Y" ; + }; + MetricField MTR_FLD_POS_X + { + Border = TRUE ; + Pos = MAP_APPFONT ( 56 , 14 + 11 ) ; + Size = MAP_APPFONT ( 54 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -500000 ; + Maximum = 500000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + SpinSize = 10 ; + }; + MetricField MTR_FLD_POS_Y + { + Border = TRUE ; + Pos = MAP_APPFONT ( 56 , 30 + 11 ) ; + Size = MAP_APPFONT ( 54 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -500000 ; + Maximum = 500000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + SpinSize = 10 ; + }; + FixedText FT_POSPRESETS + { + Pos = MAP_APPFONT ( 178 , 14 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Default settings"; + }; + Control CTL_RECT + { + HelpId = HID_TPROTATION_CTRL1 ; + Border = TRUE ; + Pos = MAP_APPFONT ( 178 , 14 + 11 ) ; + Size = MAP_APPFONT ( 70 , 48 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Rotation point" ; + }; + FixedLine FL_ANGLE + { + Pos = MAP_APPFONT ( 6 , 71 + 11 ) ; + Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Rotation angle" ; + }; + FixedText FT_ANGLE + { + Pos = MAP_APPFONT ( 12 , 84 + 22 ) ; + Size = MAP_APPFONT ( 40 , 10 ) ; + Text [ en-US ] = "~Angle" ; + }; + MetricField MTR_FLD_ANGLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 56 , 82 + 22 ) ; + Size = MAP_APPFONT ( 54 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -500000 ; + Maximum = 500000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText [ en-US ] = " degrees" ; + SpinSize = 500 ; + }; + FixedText FT_ANGLEPRESETS + { + Pos = MAP_APPFONT ( 178 , 82 + 11 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Default settings"; + }; + Control CTL_ANGLE + { + HelpId = HID_TPROTATION_CTRL2 ; + Border = TRUE ; + Pos = MAP_APPFONT ( 178 , 82 + 22 ) ; + Size = MAP_APPFONT ( 70 , 48 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Rotation Angle"; + }; +}; + // RID_SVXPAGE_SLANT ----------------------------------------------------- +TabPage RID_SVXPAGE_SLANT +{ + HelpId = HID_TRANS_SLANT ; + Hide = TRUE ; + Size = MAP_APPFONT ( 260 , MA_TABPAGE_HEIGHT ) ; + Text [ en-US ] = "Slant & Corner Radius" ; + FixedLine FL_RADIUS + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Corner radius" ; + }; + FixedText FT_RADIUS + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 40 , 10 ) ; + Text [ en-US ] = "~Radius" ; + }; + MetricField MTR_FLD_RADIUS + { + Border = TRUE ; + Pos = MAP_APPFONT ( 56 , 14 ) ; + Size = MAP_APPFONT ( 54 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 500000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + SpinSize = 10 ; + }; + FixedLine FL_SLANT + { + Pos = MAP_APPFONT ( 6 , 35 ) ; + Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Slant" ; + }; + FixedText FT_ANGLE + { + Pos = MAP_APPFONT ( 12 , 48 ) ; + Size = MAP_APPFONT ( 40 , 10 ) ; + Text [ en-US ] = "~Angle" ; + }; + MetricField MTR_FLD_ANGLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 56 , 46 ) ; + Size = MAP_APPFONT ( 54 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -8900 ; + First = -8900 ; + Maximum = 8900 ; + Last = 8900 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CUSTOM ; + SpinSize = 500 ; + CustomUnitText [ en-US ] = " degrees" ; + }; +}; + // RID_SVXDLG_TRANSFORM ----------------------------------------------------- + +#define _POS_SIZE_TEXT \ + Text [ en-US ] = "Position and Size" ; \ + + +TabDialog RID_SVXDLG_TRANSFORM\ +{ + OutputSize = TRUE ; + SvLook = TRUE ; + Size = MAP_APPFONT ( 289 , MA_TABPAGE_HEIGHT + 41 ) ; + Text [ en-US ] = "Position and Size" ;\ + Moveable = TRUE ; + TabControl TAB_CONTROL\ + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 3 , 3 ) ; + Size = MAP_APPFONT ( 260 , MA_TABPAGE_HEIGHT ) ; + PageList = + { + PageItem\ + { + Identifier = RID_SVXPAGE_POSITION_SIZE ; + PageResID = RID_SVXPAGE_POSITION_SIZE ; + _POS_SIZE_TEXT + }; + PageItem + { + Identifier = RID_SVXPAGE_SWPOSSIZE; + PageResID = RID_SVXPAGE_SWPOSSIZE; + _POS_SIZE_TEXT + }; + PageItem + { + Identifier = RID_SVXPAGE_ANGLE ; + Text [ en-US ] = "Rotation" ; + PageResID = RID_SVXPAGE_ANGLE ; + }; + PageItem + { + Identifier = RID_SVXPAGE_SLANT ; + PageResID = RID_SVXPAGE_SLANT ; + Text [ en-US ] = "Slant & Corner Radius" ; + }; + }; + }; +}; + // ********************************************************************** EOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit