Files
libreoffice/extensions/source/propctrlr/fontdialog.cxx

607 lines
28 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* 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 <sfx2/sfxsids.hrc>
#include "fontdialog.hxx"
#include "formresid.hrc"
#include "modulepcr.hxx"
#include "formlocalid.hrc"
#include <vcl/svapp.hxx>
#include <toolkit/unohlp.hxx>
#include <comphelper/types.hxx>
#include <comphelper/extract.hxx>
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <com/sun/star/awt/FontWeight.hpp>
#include <com/sun/star/awt/FontSlant.hpp>
#include <com/sun/star/awt/FontUnderline.hpp>
#include <com/sun/star/awt/FontStrikeout.hpp>
#include "formstrings.hxx"
#include "fontitemids.hxx"
#include <editeng/charreliefitem.hxx>
#include <editeng/emphitem.hxx>
#include <editeng/fontitem.hxx>
#include <editeng/fhgtitem.hxx>
#include <editeng/postitem.hxx>
#include <editeng/wghtitem.hxx>
#include <editeng/udlnitem.hxx>
#include <editeng/crsditem.hxx>
#include <editeng/colritem.hxx>
#include <editeng/langitem.hxx>
#include <editeng/wrlmitem.hxx>
#include <editeng/cmapitem.hxx>
#include <editeng/cntritem.hxx>
#include <editeng/shdditem.hxx>
#include <editeng/flstitem.hxx>
#include <svtools/ctrltool.hxx>
#include <tools/diagnose_ex.h>
#include <com/sun/star/beans/XPropertyState.hpp>
2010-10-04 09:41:50 +02:00
#include <svx/svxids.hrc>
#include <svx/svxdlg.hxx>
#include <svx/dialogs.hrc>
2004-05-12 14:24:22 +00:00
#include <svx/flagsdef.hxx>
//............................................................................
namespace pcr
{
//............................................................................
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
//========================================================================
//= OFontPropertyExtractor
//========================================================================
class OFontPropertyExtractor
{
protected:
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
m_xPropValueAccess;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >
m_xPropStateAccess;
public:
OFontPropertyExtractor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >&
_rxProps );
public:
sal_Bool getCheckFontProperty(const ::rtl::OUString& _rPropName, ::com::sun::star::uno::Any& _rValue);
::rtl::OUString getStringFontProperty(const ::rtl::OUString& _rPropName, const ::rtl::OUString& _rDefault);
sal_Int16 getInt16FontProperty(const ::rtl::OUString& _rPropName, const sal_Int16 _nDefault);
sal_Int32 getInt32FontProperty(const ::rtl::OUString& _rPropName, const sal_Int32 _nDefault);
float getFloatFontProperty(const ::rtl::OUString& _rPropName, const float _nDefault);
void invalidateItem(
const ::rtl::OUString& _rPropName,
sal_uInt16 _nItemId,
SfxItemSet& _rSet,
sal_Bool _bForceInvalidation = sal_False);
};
//------------------------------------------------------------------------
OFontPropertyExtractor::OFontPropertyExtractor(const Reference< XPropertySet >& _rxProps)
:m_xPropValueAccess(_rxProps)
,m_xPropStateAccess(_rxProps, UNO_QUERY)
{
OSL_ENSURE(m_xPropValueAccess.is(), "OFontPropertyExtractor::OFontPropertyExtractor: invalid property set!");
}
//------------------------------------------------------------------------
sal_Bool OFontPropertyExtractor::getCheckFontProperty(const ::rtl::OUString& _rPropName, Any& _rValue)
{
_rValue = m_xPropValueAccess->getPropertyValue(_rPropName);
if (m_xPropStateAccess.is())
return PropertyState_DEFAULT_VALUE == m_xPropStateAccess->getPropertyState(_rPropName);
return sal_False;
}
//------------------------------------------------------------------------
::rtl::OUString OFontPropertyExtractor::getStringFontProperty(const ::rtl::OUString& _rPropName, const ::rtl::OUString& _rDefault)
{
Any aValue;
if (getCheckFontProperty(_rPropName, aValue))
return _rDefault;
return ::comphelper::getString(aValue);
}
//------------------------------------------------------------------------
sal_Int16 OFontPropertyExtractor::getInt16FontProperty(const ::rtl::OUString& _rPropName, const sal_Int16 _nDefault)
{
Any aValue;
if (getCheckFontProperty(_rPropName, aValue))
return _nDefault;
sal_Int32 nValue(_nDefault);
::cppu::enum2int(nValue, aValue);
return (sal_Int16)nValue;
}
//------------------------------------------------------------------------
sal_Int32 OFontPropertyExtractor::getInt32FontProperty(const ::rtl::OUString& _rPropName, const sal_Int32 _nDefault)
{
Any aValue;
if (getCheckFontProperty(_rPropName, aValue))
return _nDefault;
sal_Int32 nValue(_nDefault);
::cppu::enum2int(nValue, aValue);
return nValue;
}
//------------------------------------------------------------------------
float OFontPropertyExtractor::getFloatFontProperty(const ::rtl::OUString& _rPropName, const float _nDefault)
{
Any aValue;
if (getCheckFontProperty(_rPropName, aValue))
return _nDefault;
return ::comphelper::getFloat(aValue);
}
//------------------------------------------------------------------------
void OFontPropertyExtractor::invalidateItem(const ::rtl::OUString& _rPropName, sal_uInt16 _nItemId, SfxItemSet& _rSet, sal_Bool _bForceInvalidation)
{
if ( _bForceInvalidation
|| ( m_xPropStateAccess.is()
&& (PropertyState_AMBIGUOUS_VALUE == m_xPropStateAccess->getPropertyState(_rPropName))
)
)
_rSet.InvalidateItem(_nItemId);
}
//========================================================================
//= ControlCharacterDialog
//========================================================================
//------------------------------------------------------------------------
ControlCharacterDialog::ControlCharacterDialog(Window* _pParent, const SfxItemSet& _rCoreSet)
:SfxTabDialog(_pParent, PcrRes(RID_TABDLG_FONTDIALOG), &_rCoreSet)
{
FreeResource();
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
DBG_ASSERT(pFact, "CreateFactory fail!");
AddTabPage(TABPAGE_CHARACTERS, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_NAME), 0 );
AddTabPage(TABPAGE_CHARACTERS_EXT, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_EFFECTS), 0 );
}
//------------------------------------------------------------------------
ControlCharacterDialog::~ControlCharacterDialog()
{
}
//------------------------------------------------------------------------
void ControlCharacterDialog::translatePropertiesToItems(const Reference< XPropertySet >& _rxModel, SfxItemSet* _pSet)
{
OSL_ENSURE(_pSet && _rxModel.is(), "ControlCharacterDialog::translatePropertiesToItems: invalid arguments!");
if (!_pSet || !_rxModel.is())
return;
try
{
OFontPropertyExtractor aPropExtractor(_rxModel);
// some items, which may be in default state, have to be filled with non-void information
Font aDefaultVCLFont = Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont();
::com::sun::star::awt::FontDescriptor aDefaultFont = VCLUnoHelper::CreateFontDescriptor(aDefaultVCLFont);
// get the current properties
::rtl::OUString aFontName = aPropExtractor.getStringFontProperty(PROPERTY_FONT_NAME, aDefaultFont.Name);
::rtl::OUString aFontStyleName = aPropExtractor.getStringFontProperty(PROPERTY_FONT_STYLENAME, aDefaultFont.StyleName);
sal_Int16 nFontFamily = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_FAMILY, aDefaultFont.Family);
sal_Int16 nFontCharset = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_CHARSET, aDefaultFont.CharSet);
float nFontHeight = aPropExtractor.getFloatFontProperty(PROPERTY_FONT_HEIGHT, (float)aDefaultFont.Height);
float nFontWeight = aPropExtractor.getFloatFontProperty(PROPERTY_FONT_WEIGHT, aDefaultFont.Weight);
sal_Int16 nFontSlant = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_SLANT, (sal_Int16)aDefaultFont.Slant);
sal_Int16 nFontUnderline = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_UNDERLINE, aDefaultFont.Underline);
sal_Int16 nFontStrikeout = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_STRIKEOUT, aDefaultFont.Strikeout);
sal_Int32 nTextLineColor = aPropExtractor.getInt32FontProperty(PROPERTY_TEXTLINECOLOR, COL_AUTO);
sal_Int16 nFontRelief = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_RELIEF, (sal_Int16)aDefaultVCLFont.GetRelief());
sal_Int16 nFontEmphasisMark = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_EMPHASIS_MARK, aDefaultVCLFont.GetEmphasisMark());
Any aValue;
sal_Bool bWordLineMode = aPropExtractor.getCheckFontProperty(PROPERTY_WORDLINEMODE, aValue) ? aDefaultFont.WordLineMode : ::cppu::any2bool(aValue);
sal_Int32 nColor32 = aPropExtractor.getInt32FontProperty(PROPERTY_TEXTCOLOR, 0);
// build SfxItems with the values
SvxFontItem aFontItem((FontFamily)nFontFamily, aFontName, aFontStyleName, PITCH_DONTKNOW, nFontCharset, CFID_FONT);
nFontHeight = (float)OutputDevice::LogicToLogic(Size(0, (sal_Int32)nFontHeight), MAP_POINT, MAP_TWIP).Height();
SvxFontHeightItem aSvxFontHeightItem((sal_uInt32)nFontHeight,100,CFID_HEIGHT);
FontWeight eWeight=VCLUnoHelper::ConvertFontWeight(nFontWeight);
FontItalic eItalic=(FontItalic)nFontSlant;
FontUnderline eUnderline=(FontUnderline)nFontUnderline;
FontStrikeout eStrikeout=(FontStrikeout)nFontStrikeout;
SvxWeightItem aWeightItem(eWeight,CFID_WEIGHT);
SvxPostureItem aPostureItem(eItalic,CFID_POSTURE);
SvxCrossedOutItem aCrossedOutItem(eStrikeout,CFID_STRIKEOUT);
SvxWordLineModeItem aWordLineModeItem(bWordLineMode, CFID_WORDLINEMODE);
SvxUnderlineItem aUnderlineItem(eUnderline,CFID_UNDERLINE);
aUnderlineItem.SetColor(Color(nTextLineColor));
SvxColorItem aSvxColorItem(nColor32,CFID_CHARCOLOR);
SvxLanguageItem aLanguageItem(Application::GetSettings().GetUILanguage(), CFID_LANGUAGE);
// the 2 CJK props
SvxCharReliefItem aFontReliefItem((FontRelief)nFontRelief, CFID_RELIEF);
SvxEmphasisMarkItem aEmphasisMarkitem((FontEmphasisMark)nFontEmphasisMark, CFID_EMPHASIS);
_pSet->Put(aFontItem, CFID_FONT);
_pSet->Put(aSvxFontHeightItem,CFID_HEIGHT);
_pSet->Put(aWeightItem, CFID_WEIGHT);
_pSet->Put(aPostureItem, CFID_POSTURE);
_pSet->Put(aLanguageItem, CFID_LANGUAGE);
_pSet->Put(aUnderlineItem,CFID_UNDERLINE);
_pSet->Put(aCrossedOutItem,CFID_STRIKEOUT);
_pSet->Put(aWordLineModeItem, CFID_WORDLINEMODE);
_pSet->Put(aSvxColorItem, CFID_CHARCOLOR);
_pSet->Put(aFontReliefItem, CFID_RELIEF);
_pSet->Put(aEmphasisMarkitem, CFID_EMPHASIS);
aPropExtractor.invalidateItem(PROPERTY_FONT_NAME, CFID_FONT, *_pSet);
aPropExtractor.invalidateItem(PROPERTY_FONT_HEIGHT, CFID_HEIGHT, *_pSet);
aPropExtractor.invalidateItem(PROPERTY_FONT_WEIGHT, CFID_WEIGHT, *_pSet, ::com::sun::star::awt::FontWeight::DONTKNOW == nFontWeight);
aPropExtractor.invalidateItem(PROPERTY_FONT_SLANT, CFID_POSTURE, *_pSet, ::com::sun::star::awt::FontSlant_DONTKNOW == nFontSlant);
aPropExtractor.invalidateItem(PROPERTY_FONT_UNDERLINE, CFID_UNDERLINE, *_pSet, ::com::sun::star::awt::FontUnderline::DONTKNOW == nFontUnderline);
aPropExtractor.invalidateItem(PROPERTY_FONT_STRIKEOUT, CFID_STRIKEOUT, *_pSet, ::com::sun::star::awt::FontStrikeout::DONTKNOW == nFontStrikeout);
aPropExtractor.invalidateItem(PROPERTY_WORDLINEMODE, CFID_WORDLINEMODE, *_pSet);
aPropExtractor.invalidateItem(PROPERTY_TEXTCOLOR, CFID_CHARCOLOR, *_pSet);
aPropExtractor.invalidateItem(PROPERTY_FONT_RELIEF, CFID_RELIEF, *_pSet);
aPropExtractor.invalidateItem(PROPERTY_FONT_EMPHASIS_MARK, CFID_EMPHASIS, *_pSet);
}
2011-12-10 22:14:57 +09:00
catch (const Exception&)
{
2011-03-01 17:55:09 +01:00
OSL_FAIL("ControlCharacterDialog::translatePropertiesToItems: caught an exception!");
}
_pSet->DisableItem(SID_ATTR_CHAR_CJK_FONT);
_pSet->DisableItem(SID_ATTR_CHAR_CJK_FONTHEIGHT);
_pSet->DisableItem(SID_ATTR_CHAR_CJK_LANGUAGE);
_pSet->DisableItem(SID_ATTR_CHAR_CJK_POSTURE);
_pSet->DisableItem(SID_ATTR_CHAR_CJK_WEIGHT);
_pSet->DisableItem(SID_ATTR_CHAR_CASEMAP);
_pSet->DisableItem(SID_ATTR_CHAR_CONTOUR);
_pSet->DisableItem(SID_ATTR_CHAR_SHADOWED);
}
//------------------------------------------------------------------------
namespace
{
void lcl_pushBackPropertyValue( Sequence< NamedValue >& _out_properties, const ::rtl::OUString& _name, const Any& _value )
{
_out_properties.realloc( _out_properties.getLength() + 1 );
_out_properties[ _out_properties.getLength() - 1 ] = NamedValue( _name, _value );
}
}
//------------------------------------------------------------------------
void ControlCharacterDialog::translateItemsToProperties( const SfxItemSet& _rSet, Sequence< NamedValue >& _out_properties )
{
_out_properties.realloc( 0 );
try
{
// --------------------------
// font name
SfxItemState eState = _rSet.GetItemState(CFID_FONT);
if ( eState == SFX_ITEM_SET )
{
const SvxFontItem& rFontItem =
static_cast<const SvxFontItem&>(_rSet.Get(CFID_FONT));
lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_NAME , makeAny(::rtl::OUString(rFontItem.GetFamilyName())));
lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_STYLENAME, makeAny(::rtl::OUString(rFontItem.GetStyleName())));
lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_FAMILY , makeAny((sal_Int16)rFontItem.GetFamily()));
lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_CHARSET , makeAny((sal_Int16)rFontItem.GetCharSet()));
}
// --------------------------
// font height
eState = _rSet.GetItemState(CFID_HEIGHT);
if ( eState == SFX_ITEM_SET )
{
const SvxFontHeightItem& rSvxFontHeightItem =
static_cast<const SvxFontHeightItem&>(_rSet.Get(CFID_HEIGHT));
float nHeight = (float)OutputDevice::LogicToLogic(Size(0, rSvxFontHeightItem.GetHeight()), MAP_TWIP, MAP_POINT).Height();
lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_HEIGHT,makeAny(nHeight));
}
// --------------------------
// font weight
eState = _rSet.GetItemState(CFID_WEIGHT);
if ( eState == SFX_ITEM_SET )
{
const SvxWeightItem& rWeightItem =
static_cast<const SvxWeightItem&>(_rSet.Get(CFID_WEIGHT));
float nWeight = VCLUnoHelper::ConvertFontWeight( rWeightItem.GetWeight());
lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_WEIGHT,makeAny(nWeight));
}
// --------------------------
// font slant
eState = _rSet.GetItemState(CFID_POSTURE);
if ( eState == SFX_ITEM_SET )
{
const SvxPostureItem& rPostureItem =
static_cast<const SvxPostureItem&>(_rSet.Get(CFID_POSTURE));
::com::sun::star::awt::FontSlant eSlant = (::com::sun::star::awt::FontSlant)rPostureItem.GetPosture();
lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_SLANT, makeAny((sal_Int16)eSlant));
}
// --------------------------
// font underline
eState = _rSet.GetItemState(CFID_UNDERLINE);
if ( eState == SFX_ITEM_SET )
{
const SvxUnderlineItem& rUnderlineItem =
static_cast<const SvxUnderlineItem&>(_rSet.Get(CFID_UNDERLINE));
sal_Int16 nUnderline = (sal_Int16)rUnderlineItem.GetLineStyle();
lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_UNDERLINE,makeAny(nUnderline));
// the text line color is transported in this item, too
sal_Int32 nColor = rUnderlineItem.GetColor().GetColor();
Any aUnoColor;
if (COL_AUTO != (sal_uInt32)nColor)
aUnoColor <<= nColor;
lcl_pushBackPropertyValue( _out_properties, PROPERTY_TEXTLINECOLOR, aUnoColor );
}
// --------------------------
// font strikeout
eState = _rSet.GetItemState(CFID_STRIKEOUT);
if ( eState == SFX_ITEM_SET )
{
const SvxCrossedOutItem& rCrossedOutItem =
static_cast<const SvxCrossedOutItem&>(_rSet.Get(CFID_STRIKEOUT));
sal_Int16 nStrikeout = (sal_Int16)rCrossedOutItem.GetStrikeout();
lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_STRIKEOUT,makeAny(nStrikeout));
}
// --------------------------
// font wordline mode
eState = _rSet.GetItemState(CFID_WORDLINEMODE);
if ( eState == SFX_ITEM_SET )
{
const SvxWordLineModeItem& rWordLineModeItem =
static_cast<const SvxWordLineModeItem&>(_rSet.Get(CFID_WORDLINEMODE));
lcl_pushBackPropertyValue( _out_properties, PROPERTY_WORDLINEMODE, ::cppu::bool2any(rWordLineModeItem.GetValue()));
}
// --------------------------
// text color
eState = _rSet.GetItemState(CFID_CHARCOLOR);
if ( eState == SFX_ITEM_SET )
{
const SvxColorItem& rColorItem =
static_cast<const SvxColorItem&>(_rSet.Get(CFID_CHARCOLOR));
sal_Int32 nColor = rColorItem.GetValue().GetColor();
Any aUnoColor;
if (COL_AUTO != (sal_uInt32)nColor)
aUnoColor <<= nColor;
lcl_pushBackPropertyValue( _out_properties, PROPERTY_TEXTCOLOR, aUnoColor );
}
// --------------------------
// font relief
eState = _rSet.GetItemState(CFID_RELIEF);
if ( eState == SFX_ITEM_SET )
{
const SvxCharReliefItem& rReliefItem =
static_cast<const SvxCharReliefItem&>(_rSet.Get(CFID_RELIEF));
lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_RELIEF, makeAny((sal_Int16)rReliefItem.GetValue()) );
}
// --------------------------
// font emphasis mark
eState = _rSet.GetItemState(CFID_EMPHASIS);
if ( eState == SFX_ITEM_SET )
{
const SvxEmphasisMarkItem& rEmphMarkItem =
static_cast<const SvxEmphasisMarkItem&>(_rSet.Get(CFID_EMPHASIS));
lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_EMPHASIS_MARK, makeAny((sal_Int16)rEmphMarkItem.GetEmphasisMark()) );
}
}
catch (const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
}
//------------------------------------------------------------------------
void ControlCharacterDialog::translateItemsToProperties( const SfxItemSet& _rSet, const Reference< XPropertySet >& _rxModel)
{
OSL_ENSURE( _rxModel.is(), "ControlCharacterDialog::translateItemsToProperties: invalid arguments!" );
if ( !_rxModel.is())
return;
Sequence< NamedValue > aPropertyValues;
translateItemsToProperties( _rSet, aPropertyValues );
try
{
const NamedValue* propertyValue = aPropertyValues.getConstArray();
const NamedValue* propertyValueEnd = propertyValue + aPropertyValues.getLength();
for ( ; propertyValue != propertyValueEnd; ++propertyValue )
_rxModel->setPropertyValue( propertyValue->Name, propertyValue->Value );
}
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
}
//------------------------------------------------------------------------
SfxItemSet* ControlCharacterDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults)
{
// just to be sure ....
_rpSet = NULL;
_rpPool = NULL;
_rppDefaults = NULL;
// create and initialize the defaults
_rppDefaults = new SfxPoolItem*[CFID_LAST_ITEM_ID - CFID_FIRST_ITEM_ID + 1];
Font aDefaultVCLFont = Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont();
SfxPoolItem** pCounter = _rppDefaults; // want to modify this without affecting the out param _rppDefaults
*pCounter++ = new SvxFontItem(aDefaultVCLFont.GetFamily(), aDefaultVCLFont.GetName(), aDefaultVCLFont.GetStyleName(), aDefaultVCLFont.GetPitch(), aDefaultVCLFont.GetCharSet(), CFID_FONT);
*pCounter++ = new SvxFontHeightItem(aDefaultVCLFont.GetHeight(), 100, CFID_HEIGHT);
*pCounter++ = new SvxWeightItem(aDefaultVCLFont.GetWeight(), CFID_WEIGHT);
*pCounter++ = new SvxPostureItem(aDefaultVCLFont.GetItalic(), CFID_POSTURE);
*pCounter++ = new SvxLanguageItem(Application::GetSettings().GetUILanguage(), CFID_LANGUAGE);
*pCounter++ = new SvxUnderlineItem(aDefaultVCLFont.GetUnderline(), CFID_UNDERLINE);
*pCounter++ = new SvxCrossedOutItem(aDefaultVCLFont.GetStrikeout(), CFID_STRIKEOUT);
*pCounter++ = new SvxWordLineModeItem(aDefaultVCLFont.IsWordLineMode(), CFID_WORDLINEMODE);
*pCounter++ = new SvxColorItem(aDefaultVCLFont.GetColor(), CFID_CHARCOLOR);
*pCounter++ = new SvxCharReliefItem(aDefaultVCLFont.GetRelief(), CFID_RELIEF);
*pCounter++ = new SvxEmphasisMarkItem(aDefaultVCLFont.GetEmphasisMark(), CFID_EMPHASIS);
*pCounter++ = new SvxFontItem(aDefaultVCLFont.GetFamily(), aDefaultVCLFont.GetName(), aDefaultVCLFont.GetStyleName(), aDefaultVCLFont.GetPitch(), aDefaultVCLFont.GetCharSet(), CFID_CJK_FONT);
*pCounter++ = new SvxFontHeightItem(aDefaultVCLFont.GetHeight(), 100, CFID_CJK_HEIGHT);
*pCounter++ = new SvxWeightItem(aDefaultVCLFont.GetWeight(), CFID_CJK_WEIGHT);
*pCounter++ = new SvxPostureItem(aDefaultVCLFont.GetItalic(), CFID_CJK_POSTURE);
*pCounter++ = new SvxLanguageItem(Application::GetSettings().GetUILanguage(), CFID_CJK_LANGUAGE);
*pCounter++ = new SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, CFID_CASEMAP);
*pCounter++ = new SvxContourItem(sal_False, CFID_CONTOUR);
*pCounter++ = new SvxShadowedItem(sal_False, CFID_SHADOWED);
*pCounter++ = new SvxFontListItem (new FontList(Application::GetDefaultDevice()), CFID_FONTLIST);
// create the pool
static SfxItemInfo const aItemInfos[CFID_LAST_ITEM_ID - CFID_FIRST_ITEM_ID + 1] =
{
{ SID_ATTR_CHAR_FONT, 0 },
{ SID_ATTR_CHAR_FONTHEIGHT, 0 },
{ SID_ATTR_CHAR_WEIGHT, 0 },
{ SID_ATTR_CHAR_POSTURE, 0 },
{ SID_ATTR_CHAR_LANGUAGE, 0 },
{ SID_ATTR_CHAR_UNDERLINE, 0 },
{ SID_ATTR_CHAR_STRIKEOUT, 0 },
{ SID_ATTR_CHAR_WORDLINEMODE, 0 },
{ SID_ATTR_CHAR_COLOR, 0 },
{ SID_ATTR_CHAR_RELIEF, 0 },
{ SID_ATTR_CHAR_EMPHASISMARK, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ SID_ATTR_CHAR_FONTLIST, 0 }
};
_rpPool = new SfxItemPool(rtl::OUString("PCRControlFontItemPool"), CFID_FIRST_ITEM_ID, CFID_LAST_ITEM_ID,
aItemInfos, _rppDefaults);
_rpPool->FreezeIdRanges();
// and, finally, the set
_rpSet = new SfxItemSet(*_rpPool, sal_True);
return _rpSet;
}
//-------------------------------------------------------------------------
void ControlCharacterDialog::destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults)
{
// from the pool, get and remember the font list (needs to be deleted)
const SvxFontListItem& rFontListItem = static_cast<const SvxFontListItem&>(_rpPool->GetDefaultItem(CFID_FONTLIST));
const FontList* pFontList = rFontListItem.GetFontList();
// _first_ delete the set (refering the pool)
if (_rpSet)
{
delete _rpSet;
_rpSet = NULL;
}
// delete the pool
if (_rpPool)
{
_rpPool->ReleaseDefaults(sal_True);
// the "true" means delete the items, too
CWS-TOOLING: integrate CWS aw063 2009-02-12 13:10:24 +0100 aw r267649 : #i99123# when a primitive is invisible, it is not sufficient to produce no output when decomposing, but to add invisible data using HitTestPrimitive2D. This is needed for the slideshow which relies on geometry data in MetaFiles when painting invisible objects 2009-02-12 13:08:39 +0100 aw r267648 : #i99123# do not ignore HitTestPrimitive2D, but draw empty rectangles instead. This is needed since Slideshow is based on getting MetaFile content when painting invisible objects 2009-02-11 16:04:28 +0100 aw r267620 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:04:10 +0100 aw r267619 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:03:56 +0100 aw r267618 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:03:39 +0100 aw r267617 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:03:21 +0100 aw r267615 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:02:48 +0100 aw r267614 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:02:24 +0100 aw r267613 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:02:01 +0100 aw r267612 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:01:32 +0100 aw r267611 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:01:05 +0100 aw r267610 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:00:15 +0100 aw r267608 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 11:27:33 +0100 aw r267585 : #i98788# added missing include for STL 2009-02-10 17:46:50 +0100 aw r267570 : #i98788# added reaction on pool destruction 2009-02-10 17:11:58 +0100 aw r267562 : #i98788# added messaging mechanism to register for pool destruction 2009-02-10 13:35:35 +0100 aw r267549 : #i98788# removing changes, too complicated and risky for 3.1 2009-02-10 12:13:48 +0100 aw r267546 : #i98788# 4th round 2009-02-10 12:13:37 +0100 aw r267545 : #i98788# 4th round 2009-02-10 12:13:26 +0100 aw r267544 : #i98788# 4th round 2009-02-10 12:13:14 +0100 aw r267543 : #i98788# 4th round 2009-02-10 12:13:03 +0100 aw r267542 : #i98788# 4th round 2009-02-10 12:12:50 +0100 aw r267541 : #i98788# 4th round 2009-02-10 12:12:37 +0100 aw r267540 : #i98788# 4th round 2009-02-08 14:38:22 +0100 aw r267495 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:38:06 +0100 aw r267494 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:37:48 +0100 aw r267493 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:37:17 +0100 aw r267492 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:56 +0100 aw r267491 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:44 +0100 aw r267490 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:29 +0100 aw r267489 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:16 +0100 aw r267488 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:02 +0100 aw r267487 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:35:46 +0100 aw r267486 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-05 12:20:39 +0100 aw r267415 : #i98788# 2nd batch of adaptions for SfxItemPoolHolder addition 2009-02-04 15:12:54 +0100 aw r267385 : #i98788# added newline at EOF 2009-02-04 13:26:04 +0100 aw r267379 : #i98788# make SfxItemPool holdable 2009-02-04 13:25:40 +0100 aw r267378 : #i98788# make SfxItemPool holdable 2009-02-04 13:25:08 +0100 aw r267377 : #i98788# make SfxItemPool holdable 2009-02-04 13:24:42 +0100 aw r267376 : #i98788# make SfxItemPool holdable 2009-02-04 13:23:14 +0100 aw r267375 : #i98788# make SfxItemPool holdable 2009-02-04 13:23:02 +0100 aw r267374 : #i98788# make SfxItemPool holdable 2009-01-29 17:08:31 +0100 aw r267159 : #i97628# completed the fix 2009-01-29 17:08:15 +0100 aw r267158 : #i97628# completed the fix 2009-01-29 14:09:07 +0100 aw r267132 : #i97628# Corrected usage of ParagraphData in headers 2009-01-29 14:06:58 +0100 iha r267131 : #i98344# incorrect font size in charts 2009-01-29 12:13:46 +0100 aw r267115 : #i97628# back to old state; triggers too many errors in other modules 2009-01-29 12:03:51 +0100 aw r267114 : #i97628# enabled exceptions due to STL vector include 2009-01-29 11:21:37 +0100 aw r267107 : #i97628# added needed include 2009-01-28 17:58:29 +0100 aw r267077 : #i97628# first version of newly implemented OutlinerParaObject and adaptions 2009-01-28 17:58:12 +0100 aw r267076 : #i97628# first version of newly implemented OutlinerParaObject and adaptions 2009-01-28 17:57:51 +0100 aw r267074 : #i97628# first version of newly implemented OutlinerParaObject and adaptions 2009-01-28 17:57:21 +0100 aw r267073 : #i97628# first version of newly implemented OutlinerParaObject and adaptions 2009-01-27 17:07:33 +0100 aw r267011 : #i98402# added support for ViewRange when exporting MetaFiles in ObjectContactOfPageView::DoProcessDisplay to avoid to paint too much 2009-01-27 11:45:48 +0100 aw r266973 : #i98404# Added a warning to a place where a conversion to rectangle should not be copied from 2009-01-26 21:44:36 +0100 iha r266949 : #i98497# 3D charts are rendered with wrong size 2009-01-26 20:47:07 +0100 aw r266947 : #i98404# handle BackgroundColorPrimitive2D directly in PixelRenderers and avoid AA under all circumstances 2009-01-26 14:50:36 +0100 aw r266926 : #i98386# secured cloning of SdrObject in IMapUserData by boost::shared_prt usage 2009-01-26 12:51:30 +0100 aw r266916 : #i96581# added separated FontStretching and fallback for small X!=Y scale differences 2009-01-23 16:14:55 +0100 aw r266834 : #i96475# added missing implementation of TextDecoratedPortionPrimitive2D::getB2DRange 2009-01-23 15:24:34 +0100 aw r266826 : #i98405# fixed fallback to DrawAlphaRect to use the correctly sized rectangle 2009-01-23 13:34:43 +0100 aw r266813 : #i96474# fixed impSplitSingleWords for an unexpected case 2009-01-23 10:47:31 +0100 aw r266786 : #i98289#,#i96474# tooling and new flags for tasks 2009-01-23 10:47:20 +0100 aw r266785 : #i98289#,#i96474# tooling and new flags for tasks 2009-01-23 10:47:09 +0100 aw r266783 : #i98289#,#i96474# tooling and new flags for tasks 2009-01-23 10:46:58 +0100 aw r266782 : #i98289#,#i96474# tooling and new flags for tasks 2009-01-23 10:46:48 +0100 aw r266781 : #i98289#,#i96474# tooling and new flags for tasks
2009-03-04 14:16:02 +00:00
SfxItemPool::Free(_rpPool);
_rpPool = NULL;
}
// reset the defaults ptr
_rppDefaults = NULL;
// no need to explicitly delete the defaults, this has been done by the ReleaseDefaults
delete pFontList;
}
//------------------------------------------------------------------------
void ControlCharacterDialog::PageCreated( sal_uInt16 _nId, SfxTabPage& _rPage )
{
SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
if ( _nId == TABPAGE_CHARACTERS ) {
aSet.Put (SvxFontListItem(static_cast<const SvxFontListItem&>(GetInputSetImpl()->Get(CFID_FONTLIST))));
aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_HIDE_LANGUAGE));
_rPage.PageCreated(aSet);
}
}
//............................................................................
} // namespace pcr
//............................................................................
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */