1*2a97ec55SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2a97ec55SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2a97ec55SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2a97ec55SAndrew Rist  * distributed with this work for additional information
6*2a97ec55SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2a97ec55SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2a97ec55SAndrew Rist  * "License"); you may not use this file except in compliance
9*2a97ec55SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2a97ec55SAndrew Rist  *
11*2a97ec55SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2a97ec55SAndrew Rist  *
13*2a97ec55SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2a97ec55SAndrew Rist  * software distributed under the License is distributed on an
15*2a97ec55SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2a97ec55SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2a97ec55SAndrew Rist  * specific language governing permissions and limitations
18*2a97ec55SAndrew Rist  * under the License.
19*2a97ec55SAndrew Rist  *
20*2a97ec55SAndrew Rist  *************************************************************/
21*2a97ec55SAndrew Rist 
22*2a97ec55SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_extensions.hxx"
26cdf0e10cSrcweir #include <sfx2/sfxsids.hrc>
27cdf0e10cSrcweir #include "fontdialog.hxx"
28cdf0e10cSrcweir #ifndef EXTENSIONS_PROPRESID_HRC
29cdf0e10cSrcweir #include "formresid.hrc"
30cdf0e10cSrcweir #endif
31cdf0e10cSrcweir #ifndef _EXTENSIONS_PROPCTRLR_MODULEPRC_HXX_
32cdf0e10cSrcweir #include "modulepcr.hxx"
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir #ifndef _EXTENSIONS_PROPCTRLR_FORMLOCALID_HRC_
35cdf0e10cSrcweir #include "formlocalid.hrc"
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir #include <vcl/svapp.hxx>
38cdf0e10cSrcweir #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
39cdf0e10cSrcweir #include <toolkit/unohlp.hxx>
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir #include <comphelper/types.hxx>
42cdf0e10cSrcweir #include <comphelper/extract.hxx>
43cdf0e10cSrcweir #include <com/sun/star/awt/FontDescriptor.hpp>
44cdf0e10cSrcweir #include <com/sun/star/awt/FontWeight.hpp>
45cdf0e10cSrcweir #include <com/sun/star/awt/FontSlant.hpp>
46cdf0e10cSrcweir #include <com/sun/star/awt/FontUnderline.hpp>
47cdf0e10cSrcweir #include <com/sun/star/awt/FontStrikeout.hpp>
48cdf0e10cSrcweir #include "formstrings.hxx"
49cdf0e10cSrcweir #include "fontitemids.hxx"
50cdf0e10cSrcweir #include <editeng/charreliefitem.hxx>
51cdf0e10cSrcweir #ifndef _SVX_EMPHITEM_HXX
52cdf0e10cSrcweir #include <editeng/emphitem.hxx>
53cdf0e10cSrcweir #endif
54cdf0e10cSrcweir #include <editeng/fontitem.hxx>
55cdf0e10cSrcweir #include <editeng/fhgtitem.hxx>
56cdf0e10cSrcweir #include <editeng/postitem.hxx>
57cdf0e10cSrcweir #include <editeng/wghtitem.hxx>
58cdf0e10cSrcweir #include <editeng/udlnitem.hxx>
59cdf0e10cSrcweir #include <editeng/crsditem.hxx>
60cdf0e10cSrcweir #include <editeng/colritem.hxx>
61cdf0e10cSrcweir #include <editeng/flstitem.hxx>
62cdf0e10cSrcweir #include <editeng/langitem.hxx>
63cdf0e10cSrcweir #include <editeng/wrlmitem.hxx>
64cdf0e10cSrcweir #include <editeng/cmapitem.hxx>
65cdf0e10cSrcweir #include <editeng/cntritem.hxx>
66cdf0e10cSrcweir #include <editeng/shdditem.hxx>
67cdf0e10cSrcweir #include <editeng/flstitem.hxx>
68cdf0e10cSrcweir #include <svtools/ctrltool.hxx>
69cdf0e10cSrcweir #include <tools/diagnose_ex.h>
70cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp>
71cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC
72cdf0e10cSrcweir #include <svx/svxids.hrc> //CHINA001
73cdf0e10cSrcweir #endif
74cdf0e10cSrcweir #include <svx/svxdlg.hxx> //CHINA001
75cdf0e10cSrcweir #include <svx/dialogs.hrc> //CHINA001
76cdf0e10cSrcweir #include <svx/flagsdef.hxx>
77cdf0e10cSrcweir //............................................................................
78cdf0e10cSrcweir namespace pcr
79cdf0e10cSrcweir {
80cdf0e10cSrcweir //............................................................................
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
83cdf0e10cSrcweir 	using namespace ::com::sun::star::beans;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	//========================================================================
86cdf0e10cSrcweir 	//= OFontPropertyExtractor
87cdf0e10cSrcweir 	//========================================================================
88cdf0e10cSrcweir 	class OFontPropertyExtractor
89cdf0e10cSrcweir 	{
90cdf0e10cSrcweir 	protected:
91cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
92cdf0e10cSrcweir 					m_xPropValueAccess;
93cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >
94cdf0e10cSrcweir 					m_xPropStateAccess;
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	public:
97cdf0e10cSrcweir 		OFontPropertyExtractor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >&
98cdf0e10cSrcweir 			_rxProps );
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	public:
101cdf0e10cSrcweir 		sal_Bool		getCheckFontProperty(const ::rtl::OUString& _rPropName, ::com::sun::star::uno::Any& _rValue);
102cdf0e10cSrcweir 		::rtl::OUString	getStringFontProperty(const ::rtl::OUString& _rPropName, const ::rtl::OUString& _rDefault);
103cdf0e10cSrcweir 		sal_Int16		getInt16FontProperty(const ::rtl::OUString& _rPropName, const sal_Int16 _nDefault);
104cdf0e10cSrcweir 		sal_Int32		getInt32FontProperty(const ::rtl::OUString& _rPropName, const sal_Int32 _nDefault);
105cdf0e10cSrcweir 		float			getFloatFontProperty(const ::rtl::OUString& _rPropName, const float _nDefault);
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 		void			invalidateItem(
108cdf0e10cSrcweir 							const ::rtl::OUString& _rPropName,
109cdf0e10cSrcweir 							sal_uInt16 _nItemId,
110cdf0e10cSrcweir 							SfxItemSet& _rSet,
111cdf0e10cSrcweir 							sal_Bool _bForceInvalidation = sal_False);
112cdf0e10cSrcweir 	};
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 	//------------------------------------------------------------------------
OFontPropertyExtractor(const Reference<XPropertySet> & _rxProps)115cdf0e10cSrcweir 	OFontPropertyExtractor::OFontPropertyExtractor(const Reference< XPropertySet >& _rxProps)
116cdf0e10cSrcweir 		:m_xPropValueAccess(_rxProps)
117cdf0e10cSrcweir 		,m_xPropStateAccess(_rxProps, UNO_QUERY)
118cdf0e10cSrcweir 	{
119cdf0e10cSrcweir 		OSL_ENSURE(m_xPropValueAccess.is(), "OFontPropertyExtractor::OFontPropertyExtractor: invalid property set!");
120cdf0e10cSrcweir 	}
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	//------------------------------------------------------------------------
getCheckFontProperty(const::rtl::OUString & _rPropName,Any & _rValue)123cdf0e10cSrcweir 	sal_Bool OFontPropertyExtractor::getCheckFontProperty(const ::rtl::OUString& _rPropName, Any& _rValue)
124cdf0e10cSrcweir 	{
125cdf0e10cSrcweir 		_rValue = m_xPropValueAccess->getPropertyValue(_rPropName);
126cdf0e10cSrcweir 		if (m_xPropStateAccess.is())
127cdf0e10cSrcweir 			return PropertyState_DEFAULT_VALUE == m_xPropStateAccess->getPropertyState(_rPropName);
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 		return sal_False;
130cdf0e10cSrcweir 	}
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	//------------------------------------------------------------------------
getStringFontProperty(const::rtl::OUString & _rPropName,const::rtl::OUString & _rDefault)133cdf0e10cSrcweir 	::rtl::OUString	OFontPropertyExtractor::getStringFontProperty(const ::rtl::OUString& _rPropName, const ::rtl::OUString& _rDefault)
134cdf0e10cSrcweir 	{
135cdf0e10cSrcweir 		Any aValue;
136cdf0e10cSrcweir 		if (getCheckFontProperty(_rPropName, aValue))
137cdf0e10cSrcweir 			return _rDefault;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 		return ::comphelper::getString(aValue);
140cdf0e10cSrcweir 	}
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 	//------------------------------------------------------------------------
getInt16FontProperty(const::rtl::OUString & _rPropName,const sal_Int16 _nDefault)143cdf0e10cSrcweir 	sal_Int16 OFontPropertyExtractor::getInt16FontProperty(const ::rtl::OUString& _rPropName, const sal_Int16 _nDefault)
144cdf0e10cSrcweir 	{
145cdf0e10cSrcweir 		Any aValue;
146cdf0e10cSrcweir 		if (getCheckFontProperty(_rPropName, aValue))
147cdf0e10cSrcweir 			return _nDefault;
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 		sal_Int32 nValue(_nDefault);
150cdf0e10cSrcweir 		::cppu::enum2int(nValue, aValue);
151cdf0e10cSrcweir 		return (sal_Int16)nValue;
152cdf0e10cSrcweir 	}
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 	//------------------------------------------------------------------------
getInt32FontProperty(const::rtl::OUString & _rPropName,const sal_Int32 _nDefault)155cdf0e10cSrcweir 	sal_Int32 OFontPropertyExtractor::getInt32FontProperty(const ::rtl::OUString& _rPropName, const sal_Int32 _nDefault)
156cdf0e10cSrcweir 	{
157cdf0e10cSrcweir 		Any aValue;
158cdf0e10cSrcweir 		if (getCheckFontProperty(_rPropName, aValue))
159cdf0e10cSrcweir 			return _nDefault;
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 		sal_Int32 nValue(_nDefault);
162cdf0e10cSrcweir 		::cppu::enum2int(nValue, aValue);
163cdf0e10cSrcweir 		return nValue;
164cdf0e10cSrcweir 	}
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 	//------------------------------------------------------------------------
getFloatFontProperty(const::rtl::OUString & _rPropName,const float _nDefault)167cdf0e10cSrcweir 	float OFontPropertyExtractor::getFloatFontProperty(const ::rtl::OUString& _rPropName, const float _nDefault)
168cdf0e10cSrcweir 	{
169cdf0e10cSrcweir 		Any aValue;
170cdf0e10cSrcweir 		if (getCheckFontProperty(_rPropName, aValue))
171cdf0e10cSrcweir 			return _nDefault;
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 		return ::comphelper::getFloat(aValue);
174cdf0e10cSrcweir 	}
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 	//------------------------------------------------------------------------
invalidateItem(const::rtl::OUString & _rPropName,sal_uInt16 _nItemId,SfxItemSet & _rSet,sal_Bool _bForceInvalidation)177cdf0e10cSrcweir 	void OFontPropertyExtractor::invalidateItem(const ::rtl::OUString& _rPropName, sal_uInt16 _nItemId, SfxItemSet& _rSet, sal_Bool _bForceInvalidation)
178cdf0e10cSrcweir 	{
179cdf0e10cSrcweir 		if	(	_bForceInvalidation
180cdf0e10cSrcweir 			||	(	m_xPropStateAccess.is()
181cdf0e10cSrcweir 				&& (PropertyState_AMBIGUOUS_VALUE == m_xPropStateAccess->getPropertyState(_rPropName))
182cdf0e10cSrcweir 				)
183cdf0e10cSrcweir 			)
184cdf0e10cSrcweir 			_rSet.InvalidateItem(_nItemId);
185cdf0e10cSrcweir 	}
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 	//========================================================================
188cdf0e10cSrcweir 	//= ControlCharacterDialog
189cdf0e10cSrcweir 	//========================================================================
190cdf0e10cSrcweir 	//------------------------------------------------------------------------
ControlCharacterDialog(Window * _pParent,const SfxItemSet & _rCoreSet)191cdf0e10cSrcweir 	ControlCharacterDialog::ControlCharacterDialog(Window* _pParent, const SfxItemSet& _rCoreSet)
192cdf0e10cSrcweir 		:SfxTabDialog(_pParent, PcrRes(RID_TABDLG_FONTDIALOG), &_rCoreSet)
193cdf0e10cSrcweir 	{
194cdf0e10cSrcweir 		FreeResource();
195cdf0e10cSrcweir 		SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
196cdf0e10cSrcweir 		DBG_ASSERT(pFact, "CreateFactory fail!");
197cdf0e10cSrcweir 		AddTabPage(TABPAGE_CHARACTERS, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_NAME), 0 );
198cdf0e10cSrcweir 		AddTabPage(TABPAGE_CHARACTERS_EXT, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_EFFECTS), 0 );
199cdf0e10cSrcweir 	}
200cdf0e10cSrcweir 
201cdf0e10cSrcweir 	//------------------------------------------------------------------------
~ControlCharacterDialog()202cdf0e10cSrcweir 	ControlCharacterDialog::~ControlCharacterDialog()
203cdf0e10cSrcweir 	{
204cdf0e10cSrcweir 	}
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 	//------------------------------------------------------------------------
translatePropertiesToItems(const Reference<XPropertySet> & _rxModel,SfxItemSet * _pSet)207cdf0e10cSrcweir 	void ControlCharacterDialog::translatePropertiesToItems(const Reference< XPropertySet >& _rxModel, SfxItemSet* _pSet)
208cdf0e10cSrcweir 	{
209cdf0e10cSrcweir 		OSL_ENSURE(_pSet && _rxModel.is(), "ControlCharacterDialog::translatePropertiesToItems: invalid arguments!");
210cdf0e10cSrcweir 		if (!_pSet || !_rxModel.is())
211cdf0e10cSrcweir 			return;
212cdf0e10cSrcweir 
213cdf0e10cSrcweir 		try
214cdf0e10cSrcweir 		{
215cdf0e10cSrcweir 			OFontPropertyExtractor aPropExtractor(_rxModel);
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 			// some items, which may be in default state, have to be filled with non-void information
218cdf0e10cSrcweir 			Font aDefaultVCLFont = Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont();
219cdf0e10cSrcweir 			::com::sun::star::awt::FontDescriptor aDefaultFont = VCLUnoHelper::CreateFontDescriptor(aDefaultVCLFont);
220cdf0e10cSrcweir 
221cdf0e10cSrcweir 			// get the current properties
222cdf0e10cSrcweir 			::rtl::OUString aFontName		= aPropExtractor.getStringFontProperty(PROPERTY_FONT_NAME, aDefaultFont.Name);
223cdf0e10cSrcweir 			::rtl::OUString aFontStyleName	= aPropExtractor.getStringFontProperty(PROPERTY_FONT_STYLENAME, aDefaultFont.StyleName);
224cdf0e10cSrcweir 			sal_Int16	nFontFamily			= aPropExtractor.getInt16FontProperty(PROPERTY_FONT_FAMILY, aDefaultFont.Family);
225cdf0e10cSrcweir 			sal_Int16	nFontCharset		= aPropExtractor.getInt16FontProperty(PROPERTY_FONT_CHARSET, aDefaultFont.CharSet);
226cdf0e10cSrcweir 			float	nFontHeight				= aPropExtractor.getFloatFontProperty(PROPERTY_FONT_HEIGHT, (float)aDefaultFont.Height);
227cdf0e10cSrcweir 			float	nFontWeight				= aPropExtractor.getFloatFontProperty(PROPERTY_FONT_WEIGHT, aDefaultFont.Weight);
228cdf0e10cSrcweir 			sal_Int16 nFontSlant			= aPropExtractor.getInt16FontProperty(PROPERTY_FONT_SLANT, (sal_Int16)aDefaultFont.Slant);
229cdf0e10cSrcweir 			sal_Int16 nFontUnderline		= aPropExtractor.getInt16FontProperty(PROPERTY_FONT_UNDERLINE, aDefaultFont.Underline);
230cdf0e10cSrcweir 			sal_Int16 nFontStrikeout		= aPropExtractor.getInt16FontProperty(PROPERTY_FONT_STRIKEOUT, aDefaultFont.Strikeout);
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 			sal_Int32 nTextLineColor		= aPropExtractor.getInt32FontProperty(PROPERTY_TEXTLINECOLOR, COL_AUTO);
233cdf0e10cSrcweir 			sal_Int16 nFontRelief			= aPropExtractor.getInt16FontProperty(PROPERTY_FONT_RELIEF, (sal_Int16)aDefaultVCLFont.GetRelief());
234cdf0e10cSrcweir 			sal_Int16 nFontEmphasisMark		= aPropExtractor.getInt16FontProperty(PROPERTY_FONT_EMPHASIS_MARK, aDefaultVCLFont.GetEmphasisMark());
235cdf0e10cSrcweir 
236cdf0e10cSrcweir 			Any aValue;
237cdf0e10cSrcweir 			sal_Bool bWordLineMode			= aPropExtractor.getCheckFontProperty(PROPERTY_WORDLINEMODE, aValue) ? aDefaultFont.WordLineMode : ::cppu::any2bool(aValue);
238cdf0e10cSrcweir 			sal_Int32 nColor32				= aPropExtractor.getInt32FontProperty(PROPERTY_TEXTCOLOR, 0);
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 			// build SfxItems with the values
241cdf0e10cSrcweir 			SvxFontItem aFontItem((FontFamily)nFontFamily, aFontName, aFontStyleName, PITCH_DONTKNOW, nFontCharset, CFID_FONT);
242cdf0e10cSrcweir 
243cdf0e10cSrcweir 			nFontHeight = (float)OutputDevice::LogicToLogic(Size(0, (sal_Int32)nFontHeight), MAP_POINT, MAP_TWIP).Height();
244cdf0e10cSrcweir 			SvxFontHeightItem aSvxFontHeightItem((sal_uInt32)nFontHeight,100,CFID_HEIGHT);
245cdf0e10cSrcweir 
246cdf0e10cSrcweir 			FontWeight		eWeight=VCLUnoHelper::ConvertFontWeight(nFontWeight);
247cdf0e10cSrcweir 			FontItalic		eItalic=(FontItalic)nFontSlant;
248cdf0e10cSrcweir 			FontUnderline	eUnderline=(FontUnderline)nFontUnderline;
249cdf0e10cSrcweir 			FontStrikeout	eStrikeout=(FontStrikeout)nFontStrikeout;
250cdf0e10cSrcweir 
251cdf0e10cSrcweir 			SvxWeightItem		aWeightItem(eWeight,CFID_WEIGHT);
252cdf0e10cSrcweir 			SvxPostureItem		aPostureItem(eItalic,CFID_POSTURE);
253cdf0e10cSrcweir 
254cdf0e10cSrcweir 			SvxCrossedOutItem	aCrossedOutItem(eStrikeout,CFID_STRIKEOUT);
255cdf0e10cSrcweir 			SvxWordLineModeItem aWordLineModeItem(bWordLineMode, CFID_WORDLINEMODE);
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 			SvxUnderlineItem 	aUnderlineItem(eUnderline,CFID_UNDERLINE);
258cdf0e10cSrcweir 			aUnderlineItem.SetColor(Color(nTextLineColor));
259cdf0e10cSrcweir 
260cdf0e10cSrcweir 			SvxColorItem aSvxColorItem(nColor32,CFID_CHARCOLOR);
261cdf0e10cSrcweir 			SvxLanguageItem aLanguageItem(Application::GetSettings().GetUILanguage(), CFID_LANGUAGE);
262cdf0e10cSrcweir 
263cdf0e10cSrcweir 			// the 2 CJK props
264cdf0e10cSrcweir             SvxCharReliefItem aFontReliefItem((FontRelief)nFontRelief, CFID_RELIEF);
265cdf0e10cSrcweir             SvxEmphasisMarkItem aEmphasisMarkitem((FontEmphasisMark)nFontEmphasisMark, CFID_EMPHASIS);
266cdf0e10cSrcweir 
267cdf0e10cSrcweir 			_pSet->Put(aFontItem, CFID_FONT);
268cdf0e10cSrcweir 			_pSet->Put(aSvxFontHeightItem,CFID_HEIGHT);
269cdf0e10cSrcweir 			_pSet->Put(aWeightItem, CFID_WEIGHT);
270cdf0e10cSrcweir 			_pSet->Put(aPostureItem, CFID_POSTURE);
271cdf0e10cSrcweir 			_pSet->Put(aLanguageItem, CFID_LANGUAGE);
272cdf0e10cSrcweir 			_pSet->Put(aUnderlineItem,CFID_UNDERLINE);
273cdf0e10cSrcweir 			_pSet->Put(aCrossedOutItem,CFID_STRIKEOUT);
274cdf0e10cSrcweir 			_pSet->Put(aWordLineModeItem, CFID_WORDLINEMODE);
275cdf0e10cSrcweir 			_pSet->Put(aSvxColorItem, CFID_CHARCOLOR);
276cdf0e10cSrcweir 			_pSet->Put(aFontReliefItem, CFID_RELIEF);
277cdf0e10cSrcweir 			_pSet->Put(aEmphasisMarkitem, CFID_EMPHASIS);
278cdf0e10cSrcweir 
279cdf0e10cSrcweir 			aPropExtractor.invalidateItem(PROPERTY_FONT_NAME, CFID_FONT, *_pSet);
280cdf0e10cSrcweir 			aPropExtractor.invalidateItem(PROPERTY_FONT_HEIGHT, CFID_HEIGHT, *_pSet);
281cdf0e10cSrcweir 			aPropExtractor.invalidateItem(PROPERTY_FONT_WEIGHT, CFID_WEIGHT, *_pSet, ::com::sun::star::awt::FontWeight::DONTKNOW == nFontWeight);
282cdf0e10cSrcweir 			aPropExtractor.invalidateItem(PROPERTY_FONT_SLANT, CFID_POSTURE, *_pSet, ::com::sun::star::awt::FontSlant_DONTKNOW == nFontSlant);
283cdf0e10cSrcweir 			aPropExtractor.invalidateItem(PROPERTY_FONT_UNDERLINE, CFID_UNDERLINE, *_pSet, ::com::sun::star::awt::FontUnderline::DONTKNOW == nFontUnderline);
284cdf0e10cSrcweir 			aPropExtractor.invalidateItem(PROPERTY_FONT_STRIKEOUT, CFID_STRIKEOUT, *_pSet, ::com::sun::star::awt::FontStrikeout::DONTKNOW == nFontStrikeout);
285cdf0e10cSrcweir 			aPropExtractor.invalidateItem(PROPERTY_WORDLINEMODE, CFID_WORDLINEMODE, *_pSet);
286cdf0e10cSrcweir 			aPropExtractor.invalidateItem(PROPERTY_TEXTCOLOR, CFID_CHARCOLOR, *_pSet);
287cdf0e10cSrcweir 			aPropExtractor.invalidateItem(PROPERTY_FONT_RELIEF, CFID_RELIEF, *_pSet);
288cdf0e10cSrcweir 			aPropExtractor.invalidateItem(PROPERTY_FONT_EMPHASIS_MARK, CFID_EMPHASIS, *_pSet);
289cdf0e10cSrcweir 		}
290cdf0e10cSrcweir 		catch (Exception&)
291cdf0e10cSrcweir 		{
292cdf0e10cSrcweir 			DBG_ERROR("ControlCharacterDialog::translatePropertiesToItems: caught an exception!");
293cdf0e10cSrcweir 		}
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 		_pSet->DisableItem(SID_ATTR_CHAR_CJK_FONT);
296cdf0e10cSrcweir 		_pSet->DisableItem(SID_ATTR_CHAR_CJK_FONTHEIGHT);
297cdf0e10cSrcweir 		_pSet->DisableItem(SID_ATTR_CHAR_CJK_LANGUAGE);
298cdf0e10cSrcweir 		_pSet->DisableItem(SID_ATTR_CHAR_CJK_POSTURE);
299cdf0e10cSrcweir 		_pSet->DisableItem(SID_ATTR_CHAR_CJK_WEIGHT);
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 		_pSet->DisableItem(SID_ATTR_CHAR_CASEMAP);
302cdf0e10cSrcweir 		_pSet->DisableItem(SID_ATTR_CHAR_CONTOUR);
303cdf0e10cSrcweir 		_pSet->DisableItem(SID_ATTR_CHAR_SHADOWED);
304cdf0e10cSrcweir 
305cdf0e10cSrcweir 	}
306cdf0e10cSrcweir 
307cdf0e10cSrcweir 	//------------------------------------------------------------------------
308cdf0e10cSrcweir     namespace
309cdf0e10cSrcweir     {
lcl_pushBackPropertyValue(Sequence<NamedValue> & _out_properties,const::rtl::OUString & _name,const Any & _value)310cdf0e10cSrcweir         void lcl_pushBackPropertyValue( Sequence< NamedValue >& _out_properties, const ::rtl::OUString& _name, const Any& _value )
311cdf0e10cSrcweir         {
312cdf0e10cSrcweir             _out_properties.realloc( _out_properties.getLength() + 1 );
313cdf0e10cSrcweir             _out_properties[ _out_properties.getLength() - 1 ] = NamedValue( _name, _value );
314cdf0e10cSrcweir         }
315cdf0e10cSrcweir     }
316cdf0e10cSrcweir 
317cdf0e10cSrcweir 	//------------------------------------------------------------------------
translateItemsToProperties(const SfxItemSet & _rSet,Sequence<NamedValue> & _out_properties)318cdf0e10cSrcweir     void ControlCharacterDialog::translateItemsToProperties( const SfxItemSet& _rSet, Sequence< NamedValue >& _out_properties )
319cdf0e10cSrcweir     {
320cdf0e10cSrcweir         _out_properties.realloc( 0 );
321cdf0e10cSrcweir 
322cdf0e10cSrcweir 		try
323cdf0e10cSrcweir 		{
324cdf0e10cSrcweir 			// --------------------------
325cdf0e10cSrcweir 			// font name
326cdf0e10cSrcweir 			SfxItemState eState = _rSet.GetItemState(CFID_FONT);
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 			if ( eState == SFX_ITEM_SET )
329cdf0e10cSrcweir 			{
330cdf0e10cSrcweir 				const SvxFontItem& rFontItem =
331cdf0e10cSrcweir 					static_cast<const SvxFontItem&>(_rSet.Get(CFID_FONT));
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 				lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_NAME     , makeAny(::rtl::OUString(rFontItem.GetFamilyName())));
334cdf0e10cSrcweir 				lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_STYLENAME, makeAny(::rtl::OUString(rFontItem.GetStyleName())));
335cdf0e10cSrcweir 				lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_FAMILY   , makeAny((sal_Int16)rFontItem.GetFamily()));
336cdf0e10cSrcweir 				lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_CHARSET  , makeAny((sal_Int16)rFontItem.GetCharSet()));
337cdf0e10cSrcweir 			}
338cdf0e10cSrcweir 
339cdf0e10cSrcweir 			// --------------------------
340cdf0e10cSrcweir 			// font height
341cdf0e10cSrcweir 			eState = _rSet.GetItemState(CFID_HEIGHT);
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 			if ( eState == SFX_ITEM_SET )
344cdf0e10cSrcweir 			{
345cdf0e10cSrcweir 				const SvxFontHeightItem& rSvxFontHeightItem =
346cdf0e10cSrcweir 					static_cast<const SvxFontHeightItem&>(_rSet.Get(CFID_HEIGHT));
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 				float nHeight = (float)OutputDevice::LogicToLogic(Size(0, rSvxFontHeightItem.GetHeight()), MAP_TWIP, MAP_POINT).Height();
349cdf0e10cSrcweir 				lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_HEIGHT,makeAny(nHeight));
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 			}
352cdf0e10cSrcweir 
353cdf0e10cSrcweir 			// --------------------------
354cdf0e10cSrcweir 			// font weight
355cdf0e10cSrcweir 			eState = _rSet.GetItemState(CFID_WEIGHT);
356cdf0e10cSrcweir 
357cdf0e10cSrcweir 			if ( eState == SFX_ITEM_SET )
358cdf0e10cSrcweir 			{
359cdf0e10cSrcweir 				const SvxWeightItem& rWeightItem =
360cdf0e10cSrcweir 					static_cast<const SvxWeightItem&>(_rSet.Get(CFID_WEIGHT));
361cdf0e10cSrcweir 
362cdf0e10cSrcweir 				float nWeight = VCLUnoHelper::ConvertFontWeight( rWeightItem.GetWeight());
363cdf0e10cSrcweir 				lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_WEIGHT,makeAny(nWeight));
364cdf0e10cSrcweir 			}
365cdf0e10cSrcweir 
366cdf0e10cSrcweir 			// --------------------------
367cdf0e10cSrcweir 			// font slant
368cdf0e10cSrcweir 			eState = _rSet.GetItemState(CFID_POSTURE);
369cdf0e10cSrcweir 
370cdf0e10cSrcweir 			if ( eState == SFX_ITEM_SET )
371cdf0e10cSrcweir 			{
372cdf0e10cSrcweir 				const SvxPostureItem& rPostureItem =
373cdf0e10cSrcweir 					static_cast<const SvxPostureItem&>(_rSet.Get(CFID_POSTURE));
374cdf0e10cSrcweir 
375cdf0e10cSrcweir 				::com::sun::star::awt::FontSlant eSlant = (::com::sun::star::awt::FontSlant)rPostureItem.GetPosture();
376cdf0e10cSrcweir 				lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_SLANT, makeAny((sal_Int16)eSlant));
377cdf0e10cSrcweir 			}
378cdf0e10cSrcweir 
379cdf0e10cSrcweir 			// --------------------------
380cdf0e10cSrcweir 			// font underline
381cdf0e10cSrcweir 			eState = _rSet.GetItemState(CFID_UNDERLINE);
382cdf0e10cSrcweir 
383cdf0e10cSrcweir 			if ( eState == SFX_ITEM_SET )
384cdf0e10cSrcweir 			{
385cdf0e10cSrcweir 				const SvxUnderlineItem& rUnderlineItem =
386cdf0e10cSrcweir 					static_cast<const SvxUnderlineItem&>(_rSet.Get(CFID_UNDERLINE));
387cdf0e10cSrcweir 
388cdf0e10cSrcweir 				sal_Int16 nUnderline = (sal_Int16)rUnderlineItem.GetLineStyle();
389cdf0e10cSrcweir 				lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_UNDERLINE,makeAny(nUnderline));
390cdf0e10cSrcweir 
391cdf0e10cSrcweir 				// the text line color is transported in this item, too
392cdf0e10cSrcweir 				sal_Int32 nColor = rUnderlineItem.GetColor().GetColor();
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 				Any aUnoColor;
395cdf0e10cSrcweir 				if (COL_AUTO != (sal_uInt32)nColor)
396cdf0e10cSrcweir 					aUnoColor <<= nColor;
397cdf0e10cSrcweir 
398cdf0e10cSrcweir 				lcl_pushBackPropertyValue( _out_properties, PROPERTY_TEXTLINECOLOR, aUnoColor );
399cdf0e10cSrcweir 			}
400cdf0e10cSrcweir 
401cdf0e10cSrcweir 			// --------------------------
402cdf0e10cSrcweir 			// font strikeout
403cdf0e10cSrcweir 			eState = _rSet.GetItemState(CFID_STRIKEOUT);
404cdf0e10cSrcweir 
405cdf0e10cSrcweir 			if ( eState == SFX_ITEM_SET )
406cdf0e10cSrcweir 			{
407cdf0e10cSrcweir 				const SvxCrossedOutItem& rCrossedOutItem =
408cdf0e10cSrcweir 					static_cast<const SvxCrossedOutItem&>(_rSet.Get(CFID_STRIKEOUT));
409cdf0e10cSrcweir 
410cdf0e10cSrcweir 				sal_Int16 nStrikeout = (sal_Int16)rCrossedOutItem.GetStrikeout();
411cdf0e10cSrcweir 				lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_STRIKEOUT,makeAny(nStrikeout));
412cdf0e10cSrcweir 			}
413cdf0e10cSrcweir 
414cdf0e10cSrcweir 
415cdf0e10cSrcweir 			// --------------------------
416cdf0e10cSrcweir 			// font wordline mode
417cdf0e10cSrcweir 			eState = _rSet.GetItemState(CFID_WORDLINEMODE);
418cdf0e10cSrcweir 
419cdf0e10cSrcweir 			if ( eState == SFX_ITEM_SET )
420cdf0e10cSrcweir 			{
421cdf0e10cSrcweir 				const SvxWordLineModeItem& rWordLineModeItem =
422cdf0e10cSrcweir 					static_cast<const SvxWordLineModeItem&>(_rSet.Get(CFID_WORDLINEMODE));
423cdf0e10cSrcweir 
424cdf0e10cSrcweir 				lcl_pushBackPropertyValue( _out_properties, PROPERTY_WORDLINEMODE, ::cppu::bool2any(rWordLineModeItem.GetValue()));
425cdf0e10cSrcweir 			}
426cdf0e10cSrcweir 
427cdf0e10cSrcweir 
428cdf0e10cSrcweir 			// --------------------------
429cdf0e10cSrcweir 			// text color
430cdf0e10cSrcweir 			eState = _rSet.GetItemState(CFID_CHARCOLOR);
431cdf0e10cSrcweir 
432cdf0e10cSrcweir 			if ( eState == SFX_ITEM_SET )
433cdf0e10cSrcweir 			{
434cdf0e10cSrcweir 				const SvxColorItem& rColorItem =
435cdf0e10cSrcweir 					static_cast<const SvxColorItem&>(_rSet.Get(CFID_CHARCOLOR));
436cdf0e10cSrcweir 
437cdf0e10cSrcweir 				sal_Int32 nColor = rColorItem.GetValue().GetColor();
438cdf0e10cSrcweir 
439cdf0e10cSrcweir 				Any aUnoColor;
440cdf0e10cSrcweir 				if (COL_AUTO != (sal_uInt32)nColor)
441cdf0e10cSrcweir 					aUnoColor <<= nColor;
442cdf0e10cSrcweir 
443cdf0e10cSrcweir 				lcl_pushBackPropertyValue( _out_properties, PROPERTY_TEXTCOLOR, aUnoColor );
444cdf0e10cSrcweir 			}
445cdf0e10cSrcweir 
446cdf0e10cSrcweir 			// --------------------------
447cdf0e10cSrcweir 			// font relief
448cdf0e10cSrcweir 			eState = _rSet.GetItemState(CFID_RELIEF);
449cdf0e10cSrcweir 
450cdf0e10cSrcweir 			if ( eState == SFX_ITEM_SET )
451cdf0e10cSrcweir 			{
452cdf0e10cSrcweir 				const SvxCharReliefItem& rReliefItem =
453cdf0e10cSrcweir 					static_cast<const SvxCharReliefItem&>(_rSet.Get(CFID_RELIEF));
454cdf0e10cSrcweir 
455cdf0e10cSrcweir 				lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_RELIEF, makeAny((sal_Int16)rReliefItem.GetValue()) );
456cdf0e10cSrcweir 			}
457cdf0e10cSrcweir 
458cdf0e10cSrcweir 			// --------------------------
459cdf0e10cSrcweir 			// font emphasis mark
460cdf0e10cSrcweir 			eState = _rSet.GetItemState(CFID_EMPHASIS);
461cdf0e10cSrcweir 
462cdf0e10cSrcweir 			if ( eState == SFX_ITEM_SET )
463cdf0e10cSrcweir 			{
464cdf0e10cSrcweir 				const SvxEmphasisMarkItem& rEmphMarkItem =
465cdf0e10cSrcweir 					static_cast<const SvxEmphasisMarkItem&>(_rSet.Get(CFID_EMPHASIS));
466cdf0e10cSrcweir 
467cdf0e10cSrcweir 				lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_EMPHASIS_MARK, makeAny((sal_Int16)rEmphMarkItem.GetEmphasisMark()) );
468cdf0e10cSrcweir 			}
469cdf0e10cSrcweir 		}
470cdf0e10cSrcweir 		catch (const Exception& )
471cdf0e10cSrcweir 		{
472cdf0e10cSrcweir         	DBG_UNHANDLED_EXCEPTION();
473cdf0e10cSrcweir 		}
474cdf0e10cSrcweir     }
475cdf0e10cSrcweir 
476cdf0e10cSrcweir 	//------------------------------------------------------------------------
translateItemsToProperties(const SfxItemSet & _rSet,const Reference<XPropertySet> & _rxModel)477cdf0e10cSrcweir 	void ControlCharacterDialog::translateItemsToProperties( const SfxItemSet& _rSet, const Reference< XPropertySet >& _rxModel)
478cdf0e10cSrcweir 	{
479cdf0e10cSrcweir 		OSL_ENSURE( _rxModel.is(), "ControlCharacterDialog::translateItemsToProperties: invalid arguments!" );
480cdf0e10cSrcweir 		if ( !_rxModel.is())
481cdf0e10cSrcweir 			return;
482cdf0e10cSrcweir 
483cdf0e10cSrcweir         Sequence< NamedValue > aPropertyValues;
484cdf0e10cSrcweir         translateItemsToProperties( _rSet, aPropertyValues );
485cdf0e10cSrcweir         try
486cdf0e10cSrcweir         {
487cdf0e10cSrcweir             const NamedValue* propertyValue = aPropertyValues.getConstArray();
488cdf0e10cSrcweir             const NamedValue* propertyValueEnd = propertyValue + aPropertyValues.getLength();
489cdf0e10cSrcweir             for ( ; propertyValue != propertyValueEnd; ++propertyValue )
490cdf0e10cSrcweir                 _rxModel->setPropertyValue( propertyValue->Name, propertyValue->Value );
491cdf0e10cSrcweir         }
492cdf0e10cSrcweir         catch( const Exception& )
493cdf0e10cSrcweir         {
494cdf0e10cSrcweir         	DBG_UNHANDLED_EXCEPTION();
495cdf0e10cSrcweir         }
496cdf0e10cSrcweir 	}
497cdf0e10cSrcweir 
498cdf0e10cSrcweir 	//------------------------------------------------------------------------
createItemSet(SfxItemSet * & _rpSet,SfxItemPool * & _rpPool,SfxPoolItem ** & _rppDefaults)499cdf0e10cSrcweir 	SfxItemSet*	ControlCharacterDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults)
500cdf0e10cSrcweir 	{
501cdf0e10cSrcweir 		// just to be sure ....
502cdf0e10cSrcweir 		_rpSet = NULL;
503cdf0e10cSrcweir 		_rpPool = NULL;
504cdf0e10cSrcweir 		_rppDefaults = NULL;
505cdf0e10cSrcweir 
506cdf0e10cSrcweir 		// create and initialize the defaults
507cdf0e10cSrcweir 		_rppDefaults = new SfxPoolItem*[CFID_LAST_ITEM_ID - CFID_FIRST_ITEM_ID + 1];
508cdf0e10cSrcweir 
509cdf0e10cSrcweir 		Font aDefaultVCLFont = Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont();
510cdf0e10cSrcweir 
511cdf0e10cSrcweir 		SfxPoolItem** pCounter = _rppDefaults;	// want to modify this without affecting the out param _rppDefaults
512cdf0e10cSrcweir 		*pCounter++ = new SvxFontItem(aDefaultVCLFont.GetFamily(), aDefaultVCLFont.GetName(), aDefaultVCLFont.GetStyleName(), aDefaultVCLFont.GetPitch(), aDefaultVCLFont.GetCharSet(), CFID_FONT);
513cdf0e10cSrcweir 		*pCounter++ = new SvxFontHeightItem(aDefaultVCLFont.GetHeight(), 100, CFID_HEIGHT);
514cdf0e10cSrcweir 		*pCounter++ = new SvxWeightItem(aDefaultVCLFont.GetWeight(), CFID_WEIGHT);
515cdf0e10cSrcweir 		*pCounter++ = new SvxPostureItem(aDefaultVCLFont.GetItalic(), CFID_POSTURE);
516cdf0e10cSrcweir 		*pCounter++ = new SvxLanguageItem(Application::GetSettings().GetUILanguage(), CFID_LANGUAGE);
517cdf0e10cSrcweir 		*pCounter++ = new SvxUnderlineItem(aDefaultVCLFont.GetUnderline(), CFID_UNDERLINE);
518cdf0e10cSrcweir 		*pCounter++ = new SvxCrossedOutItem(aDefaultVCLFont.GetStrikeout(), CFID_STRIKEOUT);
519cdf0e10cSrcweir 		*pCounter++ = new SvxWordLineModeItem(aDefaultVCLFont.IsWordLineMode(), CFID_WORDLINEMODE);
520cdf0e10cSrcweir 		*pCounter++ = new SvxColorItem(aDefaultVCLFont.GetColor(), CFID_CHARCOLOR);
521cdf0e10cSrcweir 		*pCounter++ = new SvxCharReliefItem(aDefaultVCLFont.GetRelief(), CFID_RELIEF);
522cdf0e10cSrcweir 		*pCounter++ = new SvxEmphasisMarkItem(aDefaultVCLFont.GetEmphasisMark(), CFID_EMPHASIS);
523cdf0e10cSrcweir 
524cdf0e10cSrcweir 		*pCounter++ = new SvxFontItem(aDefaultVCLFont.GetFamily(), aDefaultVCLFont.GetName(), aDefaultVCLFont.GetStyleName(), aDefaultVCLFont.GetPitch(), aDefaultVCLFont.GetCharSet(), CFID_CJK_FONT);
525cdf0e10cSrcweir 		*pCounter++ = new SvxFontHeightItem(aDefaultVCLFont.GetHeight(), 100, CFID_CJK_HEIGHT);
526cdf0e10cSrcweir 		*pCounter++ = new SvxWeightItem(aDefaultVCLFont.GetWeight(), CFID_CJK_WEIGHT);
527cdf0e10cSrcweir 		*pCounter++ = new SvxPostureItem(aDefaultVCLFont.GetItalic(), CFID_CJK_POSTURE);
528cdf0e10cSrcweir 		*pCounter++ = new SvxLanguageItem(Application::GetSettings().GetUILanguage(), CFID_CJK_LANGUAGE);
529cdf0e10cSrcweir 
530cdf0e10cSrcweir 		*pCounter++ = new SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, CFID_CASEMAP);
531cdf0e10cSrcweir 		*pCounter++ = new SvxContourItem(sal_False, CFID_CONTOUR);
532cdf0e10cSrcweir 		*pCounter++ = new SvxShadowedItem(sal_False, CFID_SHADOWED);
533cdf0e10cSrcweir 
534cdf0e10cSrcweir 		*pCounter++ = new SvxFontListItem (new FontList(Application::GetDefaultDevice()), CFID_FONTLIST);
535cdf0e10cSrcweir 
536cdf0e10cSrcweir 		// create the pool
537cdf0e10cSrcweir 		static SfxItemInfo __READONLY_DATA aItemInfos[CFID_LAST_ITEM_ID - CFID_FIRST_ITEM_ID + 1] =
538cdf0e10cSrcweir 		{
539cdf0e10cSrcweir 			{ SID_ATTR_CHAR_FONT,				0 },
540cdf0e10cSrcweir 			{ SID_ATTR_CHAR_FONTHEIGHT,			0 },
541cdf0e10cSrcweir 			{ SID_ATTR_CHAR_WEIGHT,				0 },
542cdf0e10cSrcweir 			{ SID_ATTR_CHAR_POSTURE,			0 },
543cdf0e10cSrcweir 			{ SID_ATTR_CHAR_LANGUAGE,			0 },
544cdf0e10cSrcweir 			{ SID_ATTR_CHAR_UNDERLINE,			0 },
545cdf0e10cSrcweir 			{ SID_ATTR_CHAR_STRIKEOUT,			0 },
546cdf0e10cSrcweir 			{ SID_ATTR_CHAR_WORDLINEMODE,		0 },
547cdf0e10cSrcweir 			{ SID_ATTR_CHAR_COLOR,				0 },
548cdf0e10cSrcweir 			{ SID_ATTR_CHAR_RELIEF,				0 },
549cdf0e10cSrcweir 			{ SID_ATTR_CHAR_EMPHASISMARK,		0 },
550cdf0e10cSrcweir 			{ 0,								0 },
551cdf0e10cSrcweir 			{ 0,								0 },
552cdf0e10cSrcweir 			{ 0,								0 },
553cdf0e10cSrcweir 			{ 0,								0 },
554cdf0e10cSrcweir 			{ 0,								0 },
555cdf0e10cSrcweir 			{ 0,								0 },
556cdf0e10cSrcweir 			{ 0,								0 },
557cdf0e10cSrcweir 			{ 0,								0 },
558cdf0e10cSrcweir 			{ SID_ATTR_CHAR_FONTLIST,			0 }
559cdf0e10cSrcweir 		};
560cdf0e10cSrcweir 
561cdf0e10cSrcweir 		_rpPool = new SfxItemPool(String::CreateFromAscii("PCRControlFontItemPool"), CFID_FIRST_ITEM_ID, CFID_LAST_ITEM_ID,
562cdf0e10cSrcweir 			aItemInfos, _rppDefaults);
563cdf0e10cSrcweir 		_rpPool->FreezeIdRanges();
564cdf0e10cSrcweir 
565cdf0e10cSrcweir 		// and, finally, the set
566cdf0e10cSrcweir 		_rpSet = new SfxItemSet(*_rpPool, sal_True);
567cdf0e10cSrcweir 
568cdf0e10cSrcweir 		return _rpSet;
569cdf0e10cSrcweir 	}
570cdf0e10cSrcweir 
571cdf0e10cSrcweir 	//-------------------------------------------------------------------------
destroyItemSet(SfxItemSet * & _rpSet,SfxItemPool * & _rpPool,SfxPoolItem ** & _rppDefaults)572cdf0e10cSrcweir 	void ControlCharacterDialog::destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults)
573cdf0e10cSrcweir 	{
574cdf0e10cSrcweir 		// from the pool, get and remember the font list (needs to be deleted)
575cdf0e10cSrcweir 		const SvxFontListItem& rFontListItem = static_cast<const SvxFontListItem&>(_rpPool->GetDefaultItem(CFID_FONTLIST));
576cdf0e10cSrcweir 		const FontList* pFontList = rFontListItem.GetFontList();
577cdf0e10cSrcweir 
578cdf0e10cSrcweir 		// _first_ delete the set (refering the pool)
579cdf0e10cSrcweir 		if (_rpSet)
580cdf0e10cSrcweir 		{
581cdf0e10cSrcweir 			delete _rpSet;
582cdf0e10cSrcweir 			_rpSet = NULL;
583cdf0e10cSrcweir 		}
584cdf0e10cSrcweir 
585cdf0e10cSrcweir 		// delete the pool
586cdf0e10cSrcweir 		if (_rpPool)
587cdf0e10cSrcweir 		{
588cdf0e10cSrcweir 			_rpPool->ReleaseDefaults(sal_True);
589cdf0e10cSrcweir 				// the "true" means delete the items, too
590cdf0e10cSrcweir             SfxItemPool::Free(_rpPool);
591cdf0e10cSrcweir 			_rpPool = NULL;
592cdf0e10cSrcweir 		}
593cdf0e10cSrcweir 
594cdf0e10cSrcweir 		// reset the defaults ptr
595cdf0e10cSrcweir 		_rppDefaults = NULL;
596cdf0e10cSrcweir 			// no need to explicitly delete the defaults, this has been done by the ReleaseDefaults
597cdf0e10cSrcweir 
598cdf0e10cSrcweir 		delete pFontList;
599cdf0e10cSrcweir 	}
600cdf0e10cSrcweir 
601cdf0e10cSrcweir 	//------------------------------------------------------------------------
PageCreated(sal_uInt16 _nId,SfxTabPage & _rPage)602cdf0e10cSrcweir 	void ControlCharacterDialog::PageCreated( sal_uInt16 _nId, SfxTabPage& _rPage )
603cdf0e10cSrcweir 	{
604cdf0e10cSrcweir 		SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
605cdf0e10cSrcweir 		switch ( _nId )
606cdf0e10cSrcweir 		{
607cdf0e10cSrcweir 			case TABPAGE_CHARACTERS:
608cdf0e10cSrcweir //CHINA001				static_cast<SvxCharNamePage&>(_rPage).SetFontList(
609cdf0e10cSrcweir //CHINA001				static_cast<const SvxFontListItem&>(GetInputSetImpl()->Get(CFID_FONTLIST))
610cdf0e10cSrcweir //CHINA001				);
611cdf0e10cSrcweir //CHINA001				static_cast<SvxCharNamePage&>(_rPage).DisableControls( DISABLE_HIDE_LANGUAGE );
612cdf0e10cSrcweir 
613cdf0e10cSrcweir //CHINA001 				SvxFontListItem aFontListItem( static_cast<const SvxFontListItem&>(GetInputSetImpl()->Get(CFID_FONTLIST) ));
614cdf0e10cSrcweir //CHINA001 				aSet.Put ( SvxFontListItem( aFontListItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
615cdf0e10cSrcweir 
616cdf0e10cSrcweir //				aSet.Put (SfxUInt16Item(SID_CFID_FONTLIST,CFID_FONTLIST));
617cdf0e10cSrcweir 				aSet.Put (SvxFontListItem(static_cast<const SvxFontListItem&>(GetInputSetImpl()->Get(CFID_FONTLIST))));
618cdf0e10cSrcweir 				aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_HIDE_LANGUAGE));
619cdf0e10cSrcweir 				_rPage.PageCreated(aSet);
620cdf0e10cSrcweir 				break;
621cdf0e10cSrcweir 		}
622cdf0e10cSrcweir 	}
623cdf0e10cSrcweir 
624cdf0e10cSrcweir //............................................................................
625cdf0e10cSrcweir }	// namespace pcr
626cdf0e10cSrcweir //............................................................................
627cdf0e10cSrcweir 
628