diff options
Diffstat (limited to 'cui/source/tabpages')
83 files changed, 56558 insertions, 0 deletions
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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- + +#include <svx/svxenum.hxx> + +#include <svx/dialogs.hrc> +#include "align.hrc" +#include <svx/rotmodit.hxx> + +#include <svx/algitem.hxx> +#include <svx/frmdiritem.hxx> +#include "align.hxx" +#include <svx/dialmgr.hxx> +#include <svx/dlgutil.hxx> +#include <tools/shl.hxx> +#include <sfx2/app.hxx> +#include <sfx2/module.hxx> +#include <sfx2/itemconnect.hxx> +#include <svl/cjkoptions.hxx> +#include <svl/languageoptions.hxx> +#include <svtools/localresaccess.hxx> +#include <svx/svxids.hrc> //CHINA001 +#include <svx/flagsdef.hxx> //CHINA001 +#include <svl/intitem.hxx> //CHINA001 +#include <sfx2/request.hxx> //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 + * <http://www.openoffice.org/license.html> + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include <svx/dialogs.hrc> +#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 + * <http://www.openoffice.org/license.html> + * 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 <svl/svstdarr.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/field.hxx> +#include <vcl/keycodes.hxx> +#include <sot/exchange.hxx> +#include <svtools/transfer.hxx> +#include <unotools/syslocale.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/viewsh.hxx> +#include <unotools/charclass.hxx> +#include <unotools/collatorwrapper.hxx> +#include <com/sun/star/i18n/CollatorOptions.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <comphelper/processfactory.hxx> +#include <vcl/svapp.hxx> +#include <sfx2/module.hxx> +#include <sfx2/request.hxx> +#include <sfx2/sfxsids.hrc> +#include <svl/eitem.hxx> +#include <svl/languageoptions.hxx> +#include <svx/SmartTagMgr.hxx> +#include <com/sun/star/smarttags/XSmartTagRecognizer.hpp> +#include <com/sun/star/smarttags/XSmartTagAction.hpp> + +#define _OFA_AUTOCDLG_CXX +#include "autocdlg.hxx" +#include "autocdlg.hrc" +#include "helpid.hrc" +#include <svx/acorrcfg.hxx> +#include <svx/svxacorr.hxx> +#include "cuicharmap.hxx" +#include <svx/unolingu.hxx> +#include <svx/dialmgr.hxx> + +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<sal_Unicode>(cStartQuote); //TODO + pAutoCorrect->SetStartDoubleQuote(cUCS2); + } + if(cEndQuote != pAutoCorrect->GetEndDoubleQuote()) + { + bReturn = TRUE; + sal_Unicode cUCS2 = static_cast<sal_Unicode>(cEndQuote); //TODO + pAutoCorrect->SetEndDoubleQuote(cUCS2); + } + if(cSglStartQuote != pAutoCorrect->GetStartSingleQuote()) + { + bReturn = TRUE; + sal_Unicode cUCS2 = static_cast<sal_Unicode>(cSglStartQuote); //TODO + pAutoCorrect->SetStartSingleQuote(cUCS2); + } + if(cSglEndQuote != pAutoCorrect->GetEndSingleQuote()) + { + bReturn = TRUE; + sal_Unicode cUCS2 = static_cast<sal_Unicode>(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<void*>(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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_AUTOCDLG_HRC +#define _SVX_AUTOCDLG_HRC + +#include <svx/dialogs.hrc> + +// 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include ------------------------------------------------------------------ +#include <svx/svxids.hrc> +#include "autocdlg.hrc" +#include <svx/dialogs.hrc> +#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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include <unotools/pathoptions.hxx> +#include <svl/intitem.hxx> +#include <vcl/msgbox.hxx> +#include <tools/urlobj.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/docfile.hxx> +#include <svtools/wallitem.hxx> +#include <svl/cntwall.hxx> +#include <sfx2/cntids.hrc> + +#define _SVX_BACKGRND_CXX + +#include <svx/dialogs.hrc> +#include "backgrnd.hrc" +#include <svx/svxitems.hrc> + +// Tabellenhintergrund +#define TBL_DEST_CELL 0 +#define TBL_DEST_ROW 1 +#define TBL_DEST_TBL 2 + +#include <svx/brshitem.hxx> +#include "backgrnd.hxx" + +#include <svx/xtable.hxx> +#include <svx/opengrf.hxx> +#include <svx/impgrf.hxx> +#include <svx/svxerr.hxx> +#include <svx/drawitem.hxx> +#include <svx/dialmgr.hxx> +#include <svx/htmlmode.hxx> +#include <svtools/controldims.hrc> +#include <svx/svxids.hrc> //CHINA001 +#include <svx/flagsdef.hxx> //CHINA001 +#include <svl/intitem.hxx> //CHINA001 +#include <sfx2/request.hxx> //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<long>(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<long>(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<long>(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 + * <http://www.openoffice.org/license.html> + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include <svtools/controldims.hrc> +#include "helpid.hrc" +#include <svx/dialogs.hrc> +#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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include <tools/shl.hxx> + +#include <svx/dialogs.hrc> +#include "page.hrc" + +#include "bbdlg.hxx" +#include "border.hxx" +#include "backgrnd.hxx" +#include <svx/dialmgr.hxx> + +// 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include <svx/dialogs.hrc> + // 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include <sfx2/app.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/module.hxx> + +#define _SVX_BORDER_CXX + +#include <svx/dialogs.hrc> +#include <svx/svxitems.hrc> +#include "border.hrc" +#include "helpid.hrc" + +#define LINESTYLE_HTML_MAX 5 + +#include <svx/xtable.hxx> // XColorTable +#include <svx/drawitem.hxx> +#include <svx/boxitem.hxx> +#include <svx/shaditem.hxx> +#include "border.hxx" +#include <svx/dlgutil.hxx> +#include <svx/dialmgr.hxx> +#include "svx/htmlmode.hxx" +#include <vcl/msgbox.hxx> +#include <svx/svxids.hrc> //CHINA001 +#include "svx/flagsdef.hxx" //CHINA001 +#include <sfx2/request.hxx> +#include <svl/intitem.hxx> //CHINA001 +#include <sfx2/itemconnect.hxx> +#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<long>(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<svx::FrameBorderType,USHORT> 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 <aMergeWithNextCB> for format.paragraph + if ( nSWMode == SW_BORDER_MODE_PARA ) + { + aMergeWithNextCB.Show(); + aPropertiesFL.Show(); + } + // show checkbox <aMergeAdjacentBordersCB> 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 + * <http://www.openoffice.org/license.html> + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include "helpid.hrc" +#include <svx/dialogs.hrc> +#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 + * <http://www.openoffice.org/license.html> + * 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 <svx/frmsel.hxx> +#include "svx/bolnitem.hxx" +#include <svx/boxitem.hxx> +#include <svx/algitem.hxx> +#include <svx/shaditem.hxx> + +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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVX_BORDERCONN_HXX +#define SVX_BORDERCONN_HXX + +#include <sfx2/itemconnect.hxx> +#include <svx/framebordertype.hxx> + +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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include <svx/unolingu.hxx> +#include <vcl/svapp.hxx> +#include <unotools/pathoptions.hxx> +#include <svtools/ctrltool.hxx> +#include <svl/sfontitm.hxx> +#include <sfx2/printer.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/viewsh.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/viewfrm.hxx> +#include <vcl/msgbox.hxx> + +#define _SVX_CHARDLG_CXX +#include <svl/languageoptions.hxx> + +#include <svx/dialogs.hrc> +#include <svx/svxitems.hrc> +#include "chardlg.hrc" + +//Erstmal definieren, damit die Klassendeklarionen angezogen werden. + +#include <svx/xtable.hxx> // XColorTable +#include "chardlg.hxx" +#include "svx/fontitem.hxx" +#include <svx/postitem.hxx> +#include <svx/udlnitem.hxx> +#include <svx/crsditem.hxx> +#include <svx/cntritem.hxx> +#include <svx/langitem.hxx> +#include <svx/wghtitem.hxx> +#include <svx/fhgtitem.hxx> +#include <svx/shdditem.hxx> +#include <svx/escpitem.hxx> +#include <svx/prszitem.hxx> +#include <svx/wrlmitem.hxx> +#include <svx/cmapitem.hxx> +#include <svx/kernitem.hxx> +#include <svx/blnkitem.hxx> +#include "svx/flstitem.hxx" +#include <svx/akrnitem.hxx> +#include <svx/brshitem.hxx> +#include <svx/colritem.hxx> +#include "svx/drawitem.hxx" +#include "svx/dlgutil.hxx" +#include <svx/dialmgr.hxx> +#include "svx/htmlmode.hxx" +#include "cuicharmap.hxx" +#include "chardlg.h" +#include <svx/emphitem.hxx> +#include <svx/charreliefitem.hxx> +#include <svx/twolinesitem.hxx> +#include <svx/charhiddenitem.hxx> +#include <svl/stritem.hxx> +#include <svx/charscaleitem.hxx> +#include <svx/charrotateitem.hxx> +#include <svx/svxdlg.hxx> //CHINA001 +#include <svx/dialogs.hrc> //CHINA001 +#include <svl/intitem.hxx> //CHINA001 +#include <sfx2/request.hxx> //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<const SvxFontListItem*>(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<long>(_pFontSizeLB->GetValue() / 10) ); + else + nHeight = static_cast<long>(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<long>(_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<long>(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<SvxCaseMap>( 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<long>(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<long>(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<long>(m_aKerningEdit.Normalize( static_cast<long>(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<long>(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<long>(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 + * <http://www.openoffice.org/license.html> + * 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 + * <http://www.openoffice.org/license.html> + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // include --------------------------------------------------------------- +#include "helpid.hrc" +#include <svx/dialogs.hrc> +#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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- +#include <sfx2/app.hxx> +#include <sfx2/module.hxx> +#include <tools/shl.hxx> +#include "svx/ofaitem.hxx" // add CHINA001 +#include <sfx2/request.hxx> // add CHINA001 +#define _SVX_CONNECT_CXX + +#include <svx/svdoedge.hxx> +#include <svx/svdattr.hxx> +#include <svx/svdattrx.hxx> +#include <svx/svdview.hxx> + +#include "svx/connctrl.hxx" +#include "connect.hxx" +#include "connect.hrc" +#include <svx/dialmgr.hxx> +#include "svx/dlgutil.hxx" + +#include <svx/dialogs.hrc> + +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<SdrView *>(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 + * <http://www.openoffice.org/license.html> + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // pragma ---------------------------------------------------------------- + + // include --------------------------------------------------------------- +#include <svtools/controldims.hrc> +#include "connect.hrc" +#include <svx/dialogs.hrc> +#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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +#include <sfx2/basedlgs.hxx> +#include <svx/dialogs.hrc> +#include "dstribut.hxx" +#include "dstribut.hrc" + +#include <svx/svddef.hxx> +#include <svx/dialmgr.hxx> +#include <tools/shl.hxx> + +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 + * <http://www.openoffice.org/license.html> + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// include --------------------------------------------------------------- +#include <svx/dialogs.hrc> +#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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +#include <tools/shl.hxx> +#include <svl/eitem.hxx> +#include <sfx2/app.hxx> +#include <sfx2/module.hxx> +#include <sfx2/sfxsids.hrc> +#include <svx/dialmgr.hxx> +#include <svx/dlgutil.hxx> +#include <svx/sizeitem.hxx> +#include <svx/brshitem.hxx> +#include <grfpage.hxx> +#include <svx/grfcrop.hxx> +#include <grfpage.hrc> +#include <svx/dialogs.hrc> +#include <svx/svxids.hrc> + +#define CM_1_TO_TWIP 567 + + +inline long lcl_GetValue( MetricField& rMetric, FieldUnit eUnit ) +{ + return static_cast<long>(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<long>(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<long>(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; |