2007-07-09 10:56:41 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 18:11:23 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:11:23 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:11:23 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:11:23 +00:00
|
|
|
* $RCSfile: UITools.cxx,v $
|
2008-10-01 12:28:29 +00:00
|
|
|
* $Revision: 1.7.28.2 $
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:11:23 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:11:23 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:11:23 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
2008-04-10 18:11:23 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2007-07-09 10:56:41 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#include "precompiled_reportdesign.hxx"
|
|
|
|
|
2008-08-19 09:15:04 +00:00
|
|
|
|
2008-01-29 12:50:20 +00:00
|
|
|
#include <toolkit/helper/convert.hxx>
|
2008-08-19 09:15:04 +00:00
|
|
|
#include <toolkit/helper/vclunohelper.hxx>
|
2008-01-29 12:50:20 +00:00
|
|
|
#include "SectionView.hxx"
|
2007-07-09 10:56:41 +00:00
|
|
|
#include "UITools.hxx"
|
2008-08-19 09:15:04 +00:00
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
#include <tools/diagnose_ex.h>
|
2008-08-19 09:15:04 +00:00
|
|
|
#include <tools/string.hxx>
|
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#include <vcl/window.hxx>
|
|
|
|
#include <com/sun/star/lang/NullPointerException.hpp>
|
|
|
|
#include <com/sun/star/beans/NamedValue.hpp>
|
2008-08-19 09:15:04 +00:00
|
|
|
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
|
|
|
|
|
|
|
#include <svx/charscaleitem.hxx>
|
|
|
|
#include <svx/algitem.hxx>
|
|
|
|
#include <svx/svdpagv.hxx>
|
2007-07-09 10:56:41 +00:00
|
|
|
#include <svx/xtable.hxx> // XColorTable
|
|
|
|
#include <svx/brshitem.hxx>
|
|
|
|
#include <svx/fontitem.hxx>
|
|
|
|
#include <svx/emphitem.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/colritem.hxx>
|
|
|
|
#include <svx/drawitem.hxx>
|
|
|
|
#include <svx/twolinesitem.hxx>
|
|
|
|
#include <svx/charreliefitem.hxx>
|
|
|
|
#include <svx/charrotateitem.hxx>
|
|
|
|
#include <svx/charhiddenitem.hxx>
|
2008-08-19 09:15:04 +00:00
|
|
|
#include <svx/xgrscit.hxx>
|
2007-07-09 10:56:41 +00:00
|
|
|
#include <svx/svditer.hxx>
|
|
|
|
#include <svx/xtable.hxx>
|
2008-08-19 09:15:04 +00:00
|
|
|
#include <svx/dialogs.hrc>
|
2007-07-09 10:56:41 +00:00
|
|
|
#include <svx/svdview.hxx>
|
|
|
|
#include <svx/svdpage.hxx>
|
2008-08-19 09:15:04 +00:00
|
|
|
#include <svx/svxdlg.hxx>
|
|
|
|
#include <svx/unoprov.hxx>
|
|
|
|
|
|
|
|
#include <svtools/pathoptions.hxx>
|
|
|
|
#include <svtools/ctrltool.hxx>
|
2007-07-09 10:56:41 +00:00
|
|
|
#include <svtools/itempool.hxx>
|
|
|
|
#include <svtools/itemset.hxx>
|
2008-08-19 09:15:04 +00:00
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
#include <comphelper/propmultiplex.hxx>
|
|
|
|
#include <comphelper/namedvaluecollection.hxx>
|
2008-08-19 09:15:04 +00:00
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
#include <com/sun/star/report/XGroups.hpp>
|
|
|
|
#include <com/sun/star/awt/TextAlign.hpp>
|
|
|
|
#include <com/sun/star/text/ParagraphVertAlign.hpp>
|
|
|
|
#include <com/sun/star/report/XShape.hpp>
|
|
|
|
#include <com/sun/star/sdb/XParametersSupplier.hpp>
|
|
|
|
#include <i18npool/mslangid.hxx>
|
|
|
|
#include "dlgpage.hxx"
|
|
|
|
#include <vcl/msgbox.hxx>
|
2008-08-19 09:15:04 +00:00
|
|
|
#include "rptui_slotid.hrc"
|
|
|
|
#include "uistrings.hrc"
|
|
|
|
#include "RptObject.hxx"
|
2007-07-09 10:56:41 +00:00
|
|
|
#include "ModuleHelper.hxx"
|
|
|
|
#include "RptDef.hxx"
|
|
|
|
#include "RptResId.hrc"
|
2008-08-19 09:15:04 +00:00
|
|
|
#include "ReportDefinition.hxx"
|
|
|
|
#include "RptModel.hxx"
|
|
|
|
|
2008-06-16 12:44:40 +00:00
|
|
|
#define ITEMID_FONT 10
|
|
|
|
#define ITEMID_FONTHEIGHT 11
|
|
|
|
#define ITEMID_LANGUAGE 12
|
|
|
|
|
|
|
|
#define ITEMID_POSTURE 13
|
|
|
|
#define ITEMID_WEIGHT 14
|
|
|
|
#define ITEMID_SHADOWED 15
|
|
|
|
#define ITEMID_WORDLINEMODE 16
|
|
|
|
#define ITEMID_CONTOUR 17
|
|
|
|
#define ITEMID_CROSSEDOUT 18
|
|
|
|
#define ITEMID_UNDERLINE 19
|
|
|
|
|
|
|
|
#define ITEMID_COLOR 20
|
|
|
|
#define ITEMID_KERNING 21
|
|
|
|
#define ITEMID_CASEMAP 22
|
|
|
|
|
|
|
|
#define ITEMID_ESCAPEMENT 23
|
|
|
|
#define ITEMID_FONTLIST 24
|
|
|
|
#define ITEMID_AUTOKERN 25
|
|
|
|
#define ITEMID_COLOR_TABLE 26
|
|
|
|
#define ITEMID_BLINK 27
|
|
|
|
#define ITEMID_EMPHASISMARK 28
|
|
|
|
#define ITEMID_TWOLINES 29
|
|
|
|
#define ITEMID_CHARROTATE 30
|
|
|
|
#define ITEMID_CHARSCALE_W 31
|
|
|
|
#define ITEMID_CHARRELIEF 32
|
|
|
|
#define ITEMID_CHARHIDDEN 33
|
|
|
|
#define ITEMID_BRUSH 34
|
|
|
|
#define ITEMID_HORJUSTIFY 35
|
|
|
|
#define ITEMID_VERJUSTIFY 36
|
|
|
|
#define ITEMID_FONT_ASIAN 37
|
|
|
|
#define ITEMID_FONTHEIGHT_ASIAN 38
|
|
|
|
#define ITEMID_LANGUAGE_ASIAN 39
|
|
|
|
#define ITEMID_POSTURE_ASIAN 40
|
|
|
|
#define ITEMID_WEIGHT_ASIAN 41
|
|
|
|
#define ITEMID_FONT_COMPLEX 42
|
|
|
|
#define ITEMID_FONTHEIGHT_COMPLEX 43
|
|
|
|
#define ITEMID_LANGUAGE_COMPLEX 44
|
|
|
|
#define ITEMID_POSTURE_COMPLEX 45
|
|
|
|
#define ITEMID_WEIGHT_COMPLEX 46
|
|
|
|
|
|
|
|
#define WESTERN 0
|
|
|
|
#define ASIAN 1
|
|
|
|
#define COMPLEX 2
|
2007-07-09 10:56:41 +00:00
|
|
|
|
|
|
|
namespace rptui
|
|
|
|
{
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
SvxCellHorJustify lcl_MapHorizontalAlignment(const sal_Int16 _nAlign)
|
|
|
|
{
|
|
|
|
SvxCellHorJustify eRet = SVX_HOR_JUSTIFY_STANDARD;
|
|
|
|
switch(_nAlign)
|
|
|
|
{
|
|
|
|
case awt::TextAlign::LEFT:
|
|
|
|
eRet = SVX_HOR_JUSTIFY_LEFT;
|
|
|
|
break;
|
|
|
|
case awt::TextAlign::CENTER:
|
|
|
|
eRet = SVX_HOR_JUSTIFY_CENTER;
|
|
|
|
break;
|
|
|
|
case awt::TextAlign::RIGHT:
|
|
|
|
eRet = SVX_HOR_JUSTIFY_RIGHT;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
OSL_ENSURE(0,"Illegal text alignment value!");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return eRet;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
sal_Int16 lcl_MapHorizontalAlignment(const SvxCellHorJustify _eAlign)
|
|
|
|
{
|
|
|
|
sal_Int16 nRet = awt::TextAlign::LEFT;
|
|
|
|
switch(_eAlign)
|
|
|
|
{
|
|
|
|
case SVX_HOR_JUSTIFY_LEFT:
|
|
|
|
nRet = awt::TextAlign::LEFT;
|
|
|
|
break;
|
|
|
|
case SVX_HOR_JUSTIFY_CENTER:
|
|
|
|
nRet = awt::TextAlign::CENTER;
|
|
|
|
break;
|
|
|
|
case SVX_HOR_JUSTIFY_RIGHT:
|
|
|
|
nRet = awt::TextAlign::RIGHT;
|
|
|
|
break;
|
|
|
|
case SVX_HOR_JUSTIFY_BLOCK:
|
|
|
|
case SVX_HOR_JUSTIFY_REPEAT:
|
|
|
|
nRet = awt::TextAlign::CENTER;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
OSL_ENSURE(0,"Illegal text alignment value!");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
SvxCellVerJustify lcl_MapVerticalAlignment(const sal_Int16 _nAlign)
|
|
|
|
{
|
|
|
|
SvxCellVerJustify eRet = SVX_VER_JUSTIFY_STANDARD;
|
|
|
|
switch(_nAlign)
|
|
|
|
{
|
|
|
|
case text::ParagraphVertAlign::AUTOMATIC:
|
|
|
|
case text::ParagraphVertAlign::BASELINE:
|
|
|
|
eRet = SVX_VER_JUSTIFY_STANDARD;
|
|
|
|
break;
|
|
|
|
case text::ParagraphVertAlign::TOP:
|
|
|
|
eRet = SVX_VER_JUSTIFY_TOP;
|
|
|
|
break;
|
|
|
|
case text::ParagraphVertAlign::CENTER:
|
|
|
|
eRet = SVX_VER_JUSTIFY_CENTER;
|
|
|
|
break;
|
|
|
|
case text::ParagraphVertAlign::BOTTOM:
|
|
|
|
eRet = SVX_VER_JUSTIFY_BOTTOM;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
OSL_ENSURE(0,"Illegal text alignment value!");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return eRet;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
sal_Int16 lcl_MapVerticalAlignment(const SvxCellVerJustify _eAlign)
|
|
|
|
{
|
|
|
|
sal_Int16 nRet = text::ParagraphVertAlign::TOP;
|
|
|
|
switch(_eAlign)
|
|
|
|
{
|
|
|
|
case SVX_VER_JUSTIFY_STANDARD:
|
|
|
|
nRet = text::ParagraphVertAlign::AUTOMATIC;
|
|
|
|
break;
|
|
|
|
case SVX_VER_JUSTIFY_TOP:
|
|
|
|
nRet = text::ParagraphVertAlign::TOP;
|
|
|
|
break;
|
|
|
|
case SVX_VER_JUSTIFY_CENTER:
|
|
|
|
nRet = text::ParagraphVertAlign::CENTER;
|
|
|
|
break;
|
|
|
|
case SVX_VER_JUSTIFY_BOTTOM:
|
|
|
|
nRet = text::ParagraphVertAlign::BOTTOM;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
OSL_ENSURE(0,"Illegal text alignment value!");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void adjustSectionName(const uno::Reference< report::XGroup >& _xGroup,sal_Int32 _nPos)
|
|
|
|
{
|
|
|
|
OSL_ENSURE(_xGroup.is(),"Group is NULL -> GPF");
|
|
|
|
if ( _xGroup->getHeaderOn() && !_xGroup->getHeader()->getName().getLength() )
|
|
|
|
{
|
|
|
|
::rtl::OUString sName = String(ModuleRes(RID_STR_GROUPHEADER));
|
|
|
|
sName += ::rtl::OUString::valueOf(_nPos);
|
|
|
|
_xGroup->getHeader()->setName(sName);
|
|
|
|
} // if ( _xGroup->getHeaderOn() )
|
|
|
|
|
|
|
|
if ( _xGroup->getFooterOn() && !_xGroup->getFooter()->getName().getLength() )
|
|
|
|
{
|
|
|
|
::rtl::OUString sName = String(ModuleRes(RID_STR_GROUPFOOTER));
|
|
|
|
sName += ::rtl::OUString::valueOf(_nPos);
|
|
|
|
_xGroup->getFooter()->setName(sName);
|
|
|
|
} // if ( _xGroup->getHeaderOn() )
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
::rtl::Reference< comphelper::OPropertyChangeMultiplexer> addStyleListener(const uno::Reference< report::XReportDefinition >& _xReportDefinition,::comphelper::OPropertyChangeListener* _pListener)
|
|
|
|
{
|
|
|
|
::rtl::Reference< comphelper::OPropertyChangeMultiplexer> pRet = NULL;
|
|
|
|
if ( _xReportDefinition.is() )
|
|
|
|
{
|
|
|
|
uno::Reference<beans::XPropertySet> xPageStyle(getUsedStyle(_xReportDefinition),uno::UNO_QUERY);
|
|
|
|
if ( xPageStyle.is() )
|
|
|
|
{
|
|
|
|
pRet = new comphelper::OPropertyChangeMultiplexer(_pListener,xPageStyle);
|
|
|
|
pRet->addProperty(PROPERTY_LEFTMARGIN);
|
|
|
|
pRet->addProperty(PROPERTY_RIGHTMARGIN);
|
|
|
|
pRet->addProperty(PROPERTY_PAPERSIZE);
|
2008-10-01 12:28:29 +00:00
|
|
|
pRet->addProperty(PROPERTY_BACKCOLOR);
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
// -------------------------------------------------------------------------
|
2008-06-16 12:44:40 +00:00
|
|
|
Font lcl_getReportControlFont( const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat, awt::FontDescriptor& _out_rControlFont ,USHORT _nWichFont)
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
if ( !_rxReportControlFormat.is() )
|
|
|
|
throw uno::RuntimeException();
|
|
|
|
|
2008-06-16 12:44:40 +00:00
|
|
|
switch(_nWichFont)
|
|
|
|
{
|
|
|
|
case WESTERN:
|
|
|
|
_out_rControlFont = _rxReportControlFormat->getFontDescriptor();
|
|
|
|
break;
|
|
|
|
case ASIAN:
|
|
|
|
_out_rControlFont = _rxReportControlFormat->getFontDescriptorAsian();
|
|
|
|
break;
|
|
|
|
case COMPLEX:
|
|
|
|
_out_rControlFont = _rxReportControlFormat->getFontDescriptorComplex();
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
Font aDefaultFont = Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont();
|
|
|
|
return VCLUnoHelper::CreateFont( _out_rControlFont, aDefaultFont );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
2008-06-16 12:44:40 +00:00
|
|
|
Font lcl_getReportControlFont( const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,USHORT _nWhich )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
awt::FontDescriptor aAwtFont;
|
2008-06-16 12:44:40 +00:00
|
|
|
return lcl_getReportControlFont( _rxReportControlFormat, aAwtFont, _nWhich );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
2008-06-16 12:44:40 +00:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
const Font lcl_setFont(const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
|
|
|
|
SfxItemSet& _rItemSet,USHORT _nWhich,USHORT _nFont, USHORT _nFontHeight,USHORT _nLanguage,USHORT _nPosture, USHORT _nWeight)
|
|
|
|
{
|
|
|
|
// fill it
|
|
|
|
awt::FontDescriptor aControlFont;
|
|
|
|
const Font aFont( lcl_getReportControlFont( _rxReportControlFormat, aControlFont,_nWhich ) );
|
|
|
|
|
|
|
|
SvxFontItem aFontItem(_nFont);
|
|
|
|
aFontItem.PutValue( uno::makeAny( aControlFont ) );
|
|
|
|
_rItemSet.Put(aFontItem);
|
2007-07-09 10:56:41 +00:00
|
|
|
|
2008-06-16 12:44:40 +00:00
|
|
|
_rItemSet.Put(SvxFontHeightItem(OutputDevice::LogicToLogic(Size(0, (sal_Int32)aFont.GetHeight()), MAP_POINT, MAP_TWIP).Height(),100,_nFontHeight));
|
|
|
|
lang::Locale aLocale;
|
|
|
|
switch(_nWhich)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
aLocale = _rxReportControlFormat->getCharLocale();
|
|
|
|
break;
|
|
|
|
case ASIAN:
|
|
|
|
aLocale = _rxReportControlFormat->getCharLocaleAsian();
|
|
|
|
break;
|
|
|
|
case COMPLEX:
|
|
|
|
aLocale = _rxReportControlFormat->getCharLocaleComplex();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
_rItemSet.Put(SvxLanguageItem(MsLangId::convertLocaleToLanguage(aLocale),_nLanguage));
|
|
|
|
|
|
|
|
_rItemSet.Put(SvxPostureItem(aFont.GetItalic(),_nPosture));
|
|
|
|
_rItemSet.Put(SvxWeightItem(aFont.GetWeight(),_nWeight));
|
|
|
|
return aFont;
|
|
|
|
}
|
2008-08-19 09:15:04 +00:00
|
|
|
|
|
|
|
void lcl_fillShapeToItems( const uno::Reference<report::XShape >& _xShape,SfxItemSet& _rItemSet )
|
|
|
|
{
|
|
|
|
uno::Reference< beans::XPropertySetInfo> xInfo = _xShape->getPropertySetInfo();
|
|
|
|
SvxUnoPropertyMapProvider aMap;
|
|
|
|
SfxItemPropertyMap* pPropertyMap = aMap.GetMap(SVXMAP_CUSTOMSHAPE);
|
|
|
|
while ( pPropertyMap->pName )
|
|
|
|
{
|
|
|
|
const ::rtl::OUString sPropertyName = ::rtl::OUString::createFromAscii(pPropertyMap->pName);
|
|
|
|
if ( xInfo->hasPropertyByName(sPropertyName) )
|
|
|
|
{
|
|
|
|
const SfxPoolItem* pItem = _rItemSet.GetItem(pPropertyMap->nWID);
|
|
|
|
if ( pItem )
|
|
|
|
{
|
|
|
|
::std::auto_ptr<SfxPoolItem> pClone(pItem->Clone());
|
|
|
|
pClone->PutValue(_xShape->getPropertyValue(sPropertyName),pPropertyMap->nMemberId);
|
|
|
|
_rItemSet.Put(*pClone,pPropertyMap->nWID);
|
|
|
|
}
|
|
|
|
} // if ( xInfo->hasPropertyByName(sPropertyName) )
|
|
|
|
++pPropertyMap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcl_fillItemsToShape( const uno::Reference<report::XShape >& _xShape,const SfxItemSet& _rItemSet )
|
|
|
|
{
|
|
|
|
const uno::Reference< beans::XPropertySetInfo> xInfo = _xShape->getPropertySetInfo();
|
|
|
|
SvxUnoPropertyMapProvider aMap;
|
|
|
|
const SfxItemPropertyMap* pPropertyMap = aMap.GetMap(SVXMAP_CUSTOMSHAPE);
|
|
|
|
while ( pPropertyMap->pName )
|
|
|
|
{
|
|
|
|
const ::rtl::OUString sPropertyName = ::rtl::OUString::createFromAscii(pPropertyMap->pName);
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState(pPropertyMap->nWID) && xInfo->hasPropertyByName(sPropertyName) )
|
|
|
|
{
|
|
|
|
const beans::Property aProp = xInfo->getPropertyByName( sPropertyName );
|
|
|
|
if ( ( aProp.Attributes & beans::PropertyAttribute::READONLY ) != beans::PropertyAttribute::READONLY )
|
|
|
|
{
|
|
|
|
const SfxPoolItem* pItem = _rItemSet.GetItem(pPropertyMap->nWID);
|
|
|
|
if ( pItem )
|
|
|
|
{
|
|
|
|
uno::Any aValue;
|
|
|
|
pItem->QueryValue(aValue,pPropertyMap->nMemberId);
|
|
|
|
try
|
|
|
|
{
|
|
|
|
_xShape->setPropertyValue(sPropertyName,aValue);
|
|
|
|
}
|
|
|
|
catch(uno::Exception&)
|
|
|
|
{ // shapes have a bug so we ignore this one.
|
|
|
|
}
|
|
|
|
} // if ( pItem )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
++pPropertyMap;
|
|
|
|
} // while ( pPropertyMap->pName )
|
|
|
|
}
|
2007-07-09 10:56:41 +00:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void lcl_CharPropertiesToItems( const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
|
|
|
|
SfxItemSet& _rItemSet )
|
|
|
|
{
|
|
|
|
if ( !_rxReportControlFormat.is() )
|
|
|
|
throw lang::NullPointerException();
|
|
|
|
|
|
|
|
// fill it
|
2008-06-16 12:44:40 +00:00
|
|
|
const Font aFont( lcl_setFont(_rxReportControlFormat, _rItemSet,WESTERN,ITEMID_FONT,ITEMID_FONTHEIGHT,ITEMID_LANGUAGE,ITEMID_POSTURE,ITEMID_WEIGHT ) );
|
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
_rItemSet.Put(SvxShadowedItem(_rxReportControlFormat->getCharShadowed(),ITEMID_SHADOWED));
|
|
|
|
_rItemSet.Put(SvxWordLineModeItem(aFont.IsWordLineMode(),ITEMID_WORDLINEMODE));
|
|
|
|
_rItemSet.Put(SvxContourItem(_rxReportControlFormat->getCharContoured(),ITEMID_CONTOUR));
|
|
|
|
_rItemSet.Put(SvxAutoKernItem(_rxReportControlFormat->getCharAutoKerning(),ITEMID_AUTOKERN));
|
|
|
|
_rItemSet.Put(SvxCrossedOutItem(aFont.GetStrikeout(),ITEMID_CROSSEDOUT));
|
|
|
|
_rItemSet.Put(SvxCaseMapItem(static_cast<SvxCaseMap>(_rxReportControlFormat->getCharCaseMap()),ITEMID_CASEMAP));
|
2008-06-16 12:44:40 +00:00
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
_rItemSet.Put(SvxEscapementItem(_rxReportControlFormat->getCharEscapement(),_rxReportControlFormat->getCharEscapementHeight(),ITEMID_ESCAPEMENT));
|
|
|
|
_rItemSet.Put(SvxBlinkItem(_rxReportControlFormat->getCharFlash(),ITEMID_BLINK));
|
|
|
|
_rItemSet.Put(SvxCharHiddenItem(_rxReportControlFormat->getCharHidden(),ITEMID_CHARHIDDEN));
|
|
|
|
_rItemSet.Put(SvxTwoLinesItem(_rxReportControlFormat->getCharCombineIsOn(),_rxReportControlFormat->getCharCombinePrefix().toChar(),_rxReportControlFormat->getCharCombineSuffix().toChar(),ITEMID_TWOLINES));
|
|
|
|
SvxUnderlineItem aUnderLineItem(aFont.GetUnderline(),ITEMID_UNDERLINE);
|
|
|
|
aUnderLineItem.SetColor(_rxReportControlFormat->getCharUnderlineColor());
|
|
|
|
_rItemSet.Put(aUnderLineItem);
|
|
|
|
_rItemSet.Put(SvxKerningItem(_rxReportControlFormat->getCharKerning(),ITEMID_KERNING));
|
|
|
|
_rItemSet.Put(SvxEmphasisMarkItem(static_cast<FontEmphasisMark>(_rxReportControlFormat->getCharEmphasis()),ITEMID_EMPHASISMARK));
|
|
|
|
//_rItemSet.Put(SvxTwoLinesItem());
|
|
|
|
_rItemSet.Put(SvxCharReliefItem(static_cast<FontRelief>(_rxReportControlFormat->getCharRelief()),ITEMID_CHARRELIEF));
|
|
|
|
_rItemSet.Put(SvxColorItem(::Color(_rxReportControlFormat->getCharColor()),ITEMID_COLOR));
|
|
|
|
_rItemSet.Put(SvxCharRotateItem(_rxReportControlFormat->getCharRotation(),sal_False,ITEMID_CHARROTATE));
|
|
|
|
_rItemSet.Put(SvxCharScaleWidthItem(_rxReportControlFormat->getCharScaleWidth(),ITEMID_CHARSCALE_W));
|
|
|
|
|
|
|
|
_rItemSet.Put(SvxHorJustifyItem(lcl_MapHorizontalAlignment(_rxReportControlFormat->getParaAdjust()),ITEMID_HORJUSTIFY));
|
|
|
|
//_rItemSet.Put(SfxInt32Item(ITEMID_DEGREES,_rxReportControlFormat->getCharRotation()));
|
|
|
|
_rItemSet.Put(SvxVerJustifyItem(lcl_MapVerticalAlignment(_rxReportControlFormat->getParaVertAlignment()),ITEMID_VERJUSTIFY));
|
|
|
|
//_rItemSet.Put(SfxInt32Item(ITEMID_IDENT,_rxReportControlFormat->getCharRotation()));
|
|
|
|
|
|
|
|
uno::Reference< report::XShape> xShape(_rxReportControlFormat,uno::UNO_QUERY);
|
|
|
|
if ( !xShape.is() )
|
|
|
|
_rItemSet.Put(SvxBrushItem(::Color(_rxReportControlFormat->getControlBackground()),ITEMID_BRUSH));
|
2008-06-16 12:44:40 +00:00
|
|
|
|
|
|
|
lcl_setFont(_rxReportControlFormat, _rItemSet,ASIAN,ITEMID_FONT_ASIAN,ITEMID_FONTHEIGHT_ASIAN,ITEMID_LANGUAGE_ASIAN,ITEMID_POSTURE_ASIAN,ITEMID_WEIGHT_ASIAN );
|
|
|
|
lcl_setFont(_rxReportControlFormat, _rItemSet,COMPLEX,ITEMID_FONT_COMPLEX,ITEMID_FONTHEIGHT_COMPLEX,ITEMID_LANGUAGE_COMPLEX,ITEMID_POSTURE_COMPLEX,ITEMID_WEIGHT_COMPLEX );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
2008-06-16 12:44:40 +00:00
|
|
|
void lcl_pushBack( uno::Sequence< beans::NamedValue >& _out_rProperties, const ::rtl::OUString& _sName, const uno::Any& _rValue )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
sal_Int32 nLen( _out_rProperties.getLength() );
|
|
|
|
_out_rProperties.realloc( nLen + 1 );
|
2008-06-16 12:44:40 +00:00
|
|
|
_out_rProperties[ nLen ] = beans::NamedValue( _sName, _rValue );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
2008-06-16 12:44:40 +00:00
|
|
|
void lcl_initAwtFont( const Font& _rOriginalFont, const SfxItemSet& _rItemSet, awt::FontDescriptor& _out_rAwtFont,
|
|
|
|
USHORT _nFont, USHORT _nFontHeight,USHORT _nPosture, USHORT _nWeight)
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
Font aNewFont( _rOriginalFont );
|
|
|
|
const SfxPoolItem* pItem( NULL );
|
2008-06-16 12:44:40 +00:00
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( _nFont,sal_True,&pItem) && pItem->ISA(SvxFontItem))
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
const SvxFontItem* pFontItem = static_cast<const SvxFontItem*>(pItem);
|
|
|
|
aNewFont.SetName( pFontItem->GetFamilyName());
|
|
|
|
aNewFont.SetStyleName(pFontItem->GetStyleName());
|
|
|
|
aNewFont.SetFamily(pFontItem->GetFamily());
|
|
|
|
aNewFont.SetPitch(pFontItem->GetPitch());
|
|
|
|
aNewFont.SetCharSet(pFontItem->GetCharSet());
|
2008-06-16 12:44:40 +00:00
|
|
|
} // if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_FONT,sal_True,&pItem) && pItem->ISA(SvxFontItem))
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( _nFontHeight,sal_True,&pItem) && pItem->ISA(SvxFontHeightItem))
|
|
|
|
{
|
|
|
|
const SvxFontHeightItem* pFontItem = static_cast<const SvxFontHeightItem*>(pItem);
|
|
|
|
aNewFont.SetHeight(OutputDevice::LogicToLogic(Size(0, pFontItem->GetHeight()), MAP_TWIP, MAP_POINT).Height());
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
2008-06-16 12:44:40 +00:00
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( _nPosture,sal_True,&pItem) && pItem->ISA(SvxPostureItem))
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
const SvxPostureItem* pFontItem = static_cast<const SvxPostureItem*>(pItem);
|
|
|
|
aNewFont.SetItalic(pFontItem->GetPosture());
|
|
|
|
}
|
2008-06-16 12:44:40 +00:00
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( _nWeight,sal_True,&pItem) && pItem->ISA(SvxWeightItem))
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
const SvxWeightItem* pFontItem = static_cast<const SvxWeightItem*>(pItem);
|
|
|
|
aNewFont.SetWeight(pFontItem->GetWeight());
|
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_WORDLINEMODE,sal_True,&pItem) && pItem->ISA(SvxWordLineModeItem))
|
|
|
|
{
|
|
|
|
const SvxWordLineModeItem* pFontItem = static_cast<const SvxWordLineModeItem*>(pItem);
|
|
|
|
aNewFont.SetWordLineMode(pFontItem->GetValue());
|
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CROSSEDOUT,sal_True,&pItem) && pItem->ISA(SvxCrossedOutItem))
|
|
|
|
{
|
|
|
|
const SvxCrossedOutItem* pFontItem = static_cast<const SvxCrossedOutItem*>(pItem);
|
|
|
|
aNewFont.SetStrikeout(pFontItem->GetStrikeout());
|
|
|
|
}
|
2008-06-16 12:44:40 +00:00
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARROTATE,sal_True,&pItem) && pItem->ISA(SvxCharRotateItem))
|
|
|
|
{
|
|
|
|
const SvxCharRotateItem* pRotateItem = static_cast<const SvxCharRotateItem*>(pItem);
|
|
|
|
aNewFont.SetOrientation(pRotateItem->GetValue());
|
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARSCALE_W,sal_True,&pItem) && pItem->ISA(SvxCharScaleWidthItem))
|
|
|
|
{
|
|
|
|
const SvxCharScaleWidthItem* pCharItem = static_cast<const SvxCharScaleWidthItem*>(pItem);
|
|
|
|
aNewFont.SetWidthType(VCLUnoHelper::ConvertFontWidth(pCharItem->GetValue()));
|
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_UNDERLINE,sal_True,&pItem) && pItem->ISA(SvxUnderlineItem))
|
|
|
|
{
|
|
|
|
const SvxUnderlineItem* pFontItem = static_cast<const SvxUnderlineItem*>(pItem);
|
|
|
|
aNewFont.SetUnderline(pFontItem->GetUnderline());
|
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_COLOR,sal_True,&pItem) && pItem->ISA(SvxColorItem))
|
|
|
|
{
|
|
|
|
const SvxColorItem* pFontItem = static_cast<const SvxColorItem*>(pItem);
|
|
|
|
aNewFont.SetColor(pFontItem->GetValue().GetColor());
|
|
|
|
}
|
|
|
|
|
|
|
|
_out_rAwtFont = VCLUnoHelper::CreateFontDescriptor( aNewFont );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
2008-06-16 12:44:40 +00:00
|
|
|
void lcl_itemsToCharProperties( const Font& _rOriginalControlFont,const Font& _rOriginalControlFontAsian,const Font& _rOriginalControlFontComplex, const SfxItemSet& _rItemSet, uno::Sequence< beans::NamedValue >& _out_rProperties )
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
|
|
|
const SfxPoolItem* pItem( NULL );
|
|
|
|
|
|
|
|
// create an AWT font
|
|
|
|
awt::FontDescriptor aAwtFont;
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_initAwtFont( _rOriginalControlFont, _rItemSet, aAwtFont,ITEMID_FONT,ITEMID_FONTHEIGHT,ITEMID_POSTURE, ITEMID_WEIGHT);
|
|
|
|
lcl_pushBack( _out_rProperties, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Font")), uno::makeAny( aAwtFont ) );
|
|
|
|
lcl_initAwtFont( _rOriginalControlFontAsian, _rItemSet, aAwtFont,ITEMID_FONT_ASIAN,ITEMID_FONTHEIGHT_ASIAN,ITEMID_POSTURE_ASIAN, ITEMID_WEIGHT_ASIAN);
|
|
|
|
lcl_pushBack( _out_rProperties, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FontAsian")), uno::makeAny( aAwtFont ) );
|
|
|
|
lcl_initAwtFont( _rOriginalControlFontComplex, _rItemSet, aAwtFont,ITEMID_FONT_COMPLEX,ITEMID_FONTHEIGHT_COMPLEX,ITEMID_POSTURE_COMPLEX, ITEMID_WEIGHT_COMPLEX);
|
|
|
|
lcl_pushBack( _out_rProperties, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FontComplex")), uno::makeAny( aAwtFont ) );
|
2007-07-09 10:56:41 +00:00
|
|
|
|
|
|
|
// properties which cannot be represented in an AWT font need to be preserved directly
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_SHADOWED,sal_True,&pItem) && pItem->ISA(SvxShadowedItem))
|
|
|
|
{
|
|
|
|
const SvxShadowedItem* pFontItem = static_cast<const SvxShadowedItem*>(pItem);
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CHARSHADOWED, uno::makeAny( pFontItem->GetValue() ) );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CONTOUR,sal_True,&pItem) && pItem->ISA(SvxContourItem))
|
|
|
|
{
|
|
|
|
const SvxContourItem* pFontItem = static_cast<const SvxContourItem*>(pItem);
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CHARCONTOURED, uno::makeAny( pFontItem->GetValue() ) );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_UNDERLINE,sal_True,&pItem) && pItem->ISA(SvxUnderlineItem))
|
|
|
|
{
|
|
|
|
const SvxUnderlineItem* pFontItem = static_cast<const SvxUnderlineItem*>(pItem);
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CHARUNDERLINECOLOR, uno::makeAny( pFontItem->GetColor().GetColor() ) );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_HORJUSTIFY,sal_True,&pItem) && pItem->ISA(SvxHorJustifyItem))
|
|
|
|
{
|
|
|
|
const SvxHorJustifyItem* pJustifyItem = static_cast<const SvxHorJustifyItem*>(pItem);
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_PARAADJUST, uno::makeAny( lcl_MapHorizontalAlignment( static_cast< SvxCellHorJustify >( pJustifyItem->GetEnumValue() ) ) ) );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_VERJUSTIFY,sal_True,&pItem) && pItem->ISA(SvxVerJustifyItem))
|
|
|
|
{
|
|
|
|
const SvxVerJustifyItem* pJustifyItem = static_cast<const SvxVerJustifyItem*>(pItem);
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_VERTICALALIGN, uno::makeAny( lcl_MapVerticalAlignment( static_cast< SvxCellVerJustify >( pJustifyItem->GetEnumValue() ) ) ) );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARRELIEF,sal_True,&pItem) && pItem->ISA(SvxCharReliefItem))
|
|
|
|
{
|
|
|
|
const SvxCharReliefItem* pFontItem = static_cast<const SvxCharReliefItem*>(pItem);
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CHARRELIEF, uno::makeAny( static_cast< sal_Int16 >( pFontItem->GetEnumValue() ) ) );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARHIDDEN,sal_True,&pItem) && pItem->ISA(SvxCharHiddenItem))
|
|
|
|
{
|
|
|
|
const SvxCharHiddenItem* pFontItem = static_cast<const SvxCharHiddenItem*>(pItem);
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CHARHIDDEN, uno::makeAny( pFontItem->GetValue() ) );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_AUTOKERN,sal_True,&pItem) && pItem->ISA(SvxAutoKernItem))
|
|
|
|
{
|
|
|
|
const SvxAutoKernItem* pFontItem = static_cast<const SvxAutoKernItem*>(pItem);
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CHARAUTOKERNING, uno::makeAny( pFontItem->GetValue() ) );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_BRUSH,sal_True,&pItem) && pItem->ISA(SvxBrushItem))
|
|
|
|
{
|
|
|
|
const SvxBrushItem* pFontItem = static_cast<const SvxBrushItem*>(pItem);
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CONTROLBACKGROUND, uno::makeAny( pFontItem->GetColor().GetColor() ) );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_BLINK,sal_True,&pItem) && pItem->ISA(SvxBlinkItem))
|
|
|
|
{
|
|
|
|
const SvxBlinkItem* pFontItem = static_cast<const SvxBlinkItem*>(pItem);
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CHARFLASH, uno::makeAny( pFontItem->GetValue() ) );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_EMPHASISMARK,sal_True,&pItem) && pItem->ISA(SvxEmphasisMarkItem))
|
|
|
|
{
|
|
|
|
const SvxEmphasisMarkItem* pFontItem = static_cast<const SvxEmphasisMarkItem*>(pItem);
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CHAREMPHASIS, uno::makeAny( static_cast< sal_Int16 >( pFontItem->GetEmphasisMark() ) ) );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_TWOLINES,sal_True,&pItem) && pItem->ISA(SvxTwoLinesItem))
|
|
|
|
{
|
|
|
|
const SvxTwoLinesItem* pFontItem = static_cast<const SvxTwoLinesItem*>(pItem);
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CHARCOMBINEISON, uno::makeAny( pFontItem->GetValue() ) );
|
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CHARCOMBINEPREFIX, uno::makeAny( ::rtl::OUString( pFontItem->GetStartBracket() ) ) );
|
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CHARCOMBINESUFFIX, uno::makeAny( ::rtl::OUString( pFontItem->GetEndBracket() ) ) );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_COLOR,sal_True,&pItem) && pItem->ISA(SvxColorItem))
|
|
|
|
{
|
|
|
|
const SvxColorItem* pFontItem = static_cast<const SvxColorItem*>(pItem);
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CHARCOLOR, uno::makeAny( pFontItem->GetValue().GetColor() ) );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_KERNING,sal_True,&pItem) && pItem->ISA(SvxKerningItem))
|
|
|
|
{
|
|
|
|
const SvxKerningItem* pFontItem = static_cast<const SvxKerningItem*>(pItem);
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CHARKERNING, uno::makeAny( pFontItem->GetValue() ) );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CASEMAP,sal_True,&pItem) && pItem->ISA(SvxCaseMapItem))
|
|
|
|
{
|
|
|
|
const SvxCaseMapItem* pFontItem = static_cast<const SvxCaseMapItem*>(pItem);
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CHARCASEMAP, uno::makeAny( pFontItem->GetValue() ) );
|
|
|
|
} // if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CASEMAP,sal_True,&pItem) && pItem->ISA(SvxCaseMapItem))
|
|
|
|
struct Items {
|
|
|
|
USHORT nWhich;
|
|
|
|
::rtl::OUString sPropertyName;
|
|
|
|
};
|
|
|
|
const Items pItems[] = { {ITEMID_LANGUAGE,PROPERTY_CHARLOCALE}
|
|
|
|
,{ITEMID_LANGUAGE_ASIAN,PROPERTY_CHARLOCALEASIAN}
|
|
|
|
,{ITEMID_LANGUAGE_COMPLEX,PROPERTY_CHARLOCALECOMPLEX}
|
|
|
|
};
|
|
|
|
for(size_t k = 0; k < sizeof(pItems)/sizeof(pItems[0]);++k)
|
2007-07-09 10:56:41 +00:00
|
|
|
{
|
2008-06-16 12:44:40 +00:00
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( pItems[k].nWhich,sal_True,&pItem) && pItem->ISA(SvxLanguageItem))
|
|
|
|
{
|
|
|
|
const SvxLanguageItem* pFontItem = static_cast<const SvxLanguageItem*>(pItem);
|
|
|
|
lang::Locale aCharLocale;
|
|
|
|
MsLangId::convertLanguageToLocale( pFontItem->GetLanguage(), aCharLocale );
|
|
|
|
lcl_pushBack( _out_rProperties, pItems[k].sPropertyName, uno::makeAny( aCharLocale ) );
|
|
|
|
} // if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_LANGUAGE,sal_True,&pItem) && pItem->ISA(SvxLanguageItem))
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_ESCAPEMENT,sal_True,&pItem) && pItem->ISA(SvxEscapementItem))
|
|
|
|
{
|
|
|
|
const SvxEscapementItem* pFontItem = static_cast<const SvxEscapementItem*>(pItem);
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CHARESCAPEMENT, uno::makeAny( pFontItem->GetEsc() ) );
|
|
|
|
lcl_pushBack( _out_rProperties, PROPERTY_CHARESCAPEMENTHEIGHT, uno::makeAny( (sal_Int8)pFontItem->GetProp() ) );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
template< class ATTRIBUTE_TYPE >
|
|
|
|
void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const sal_Char* _pAttributeName,
|
|
|
|
const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
|
|
|
|
void (SAL_CALL report::XReportControlFormat::*pSetter)( ATTRIBUTE_TYPE ) )
|
|
|
|
{
|
|
|
|
ATTRIBUTE_TYPE aAttributeValue = ATTRIBUTE_TYPE();
|
|
|
|
if ( _rAttrValues.get_ensureType( _pAttributeName, aAttributeValue ) )
|
|
|
|
(_rxReportControlFormat.get()->*pSetter)( aAttributeValue );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const sal_Char* _pAttributeName,
|
|
|
|
const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
|
|
|
|
void (SAL_CALL report::XReportControlFormat::*pSetter)( const ::rtl::OUString& ) )
|
|
|
|
{
|
|
|
|
::rtl::OUString aAttributeValue;
|
|
|
|
if ( _rAttrValues.get_ensureType( _pAttributeName, aAttributeValue ) )
|
|
|
|
(_rxReportControlFormat.get()->*pSetter)( aAttributeValue );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const sal_Char* _pAttributeName,
|
|
|
|
const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
|
|
|
|
void (SAL_CALL report::XReportControlFormat::*pSetter)( const lang::Locale& ) )
|
|
|
|
{
|
|
|
|
lang::Locale aAttributeValue;
|
|
|
|
if ( _rAttrValues.get_ensureType( _pAttributeName, aAttributeValue ) )
|
|
|
|
(_rxReportControlFormat.get()->*pSetter)( aAttributeValue );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
|
|
|
|
const uno::Reference< awt::XWindow>& _rxParentWindow, uno::Sequence< beans::NamedValue >& _out_rNewValues )
|
|
|
|
{
|
|
|
|
OSL_PRECOND( _rxReportControlFormat.is() && _rxParentWindow.is(), "openCharDialog: invalid parameters!" );
|
|
|
|
if ( !_rxReportControlFormat.is() || !_rxParentWindow.is() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
_out_rNewValues = uno::Sequence< beans::NamedValue >();
|
|
|
|
|
|
|
|
// ------------
|
|
|
|
// UNO->ItemSet
|
|
|
|
static SfxItemInfo aItemInfos[] =
|
|
|
|
{
|
|
|
|
{ SID_ATTR_CHAR_FONT, SFX_ITEM_POOLABLE },
|
2008-06-16 12:44:40 +00:00
|
|
|
{ SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_LANGUAGE, SFX_ITEM_POOLABLE },
|
2007-07-09 10:56:41 +00:00
|
|
|
{ SID_ATTR_CHAR_POSTURE, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_WEIGHT, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_SHADOWED, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_CONTOUR, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_STRIKEOUT, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_UNDERLINE, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_COLOR, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_KERNING, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_CASEMAP, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_ESCAPEMENT, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_FONTLIST, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_AUTOKERN, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_COLOR_TABLE, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_FLASH, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_TWO_LINES, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_ROTATED, SFX_ITEM_POOLABLE },
|
2008-06-16 12:44:40 +00:00
|
|
|
{ SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEM_POOLABLE },
|
2007-07-09 10:56:41 +00:00
|
|
|
{ SID_ATTR_CHAR_RELIEF, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_HIDDEN, SFX_ITEM_POOLABLE },
|
2008-06-16 12:44:40 +00:00
|
|
|
{ SID_ATTR_BRUSH_CHAR, SFX_ITEM_POOLABLE },
|
2007-07-09 10:56:41 +00:00
|
|
|
{ SID_ATTR_ALIGN_HOR_JUSTIFY, SFX_ITEM_POOLABLE },
|
2008-06-16 12:44:40 +00:00
|
|
|
{ SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEM_POOLABLE },
|
|
|
|
|
|
|
|
// Asian
|
|
|
|
{ SID_ATTR_CHAR_CJK_FONT, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_CJK_FONTHEIGHT, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_CJK_LANGUAGE, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_CJK_POSTURE, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_CJK_WEIGHT, SFX_ITEM_POOLABLE },
|
|
|
|
// Complex
|
|
|
|
{ SID_ATTR_CHAR_CTL_FONT, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_CTL_FONTHEIGHT, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_CTL_LANGUAGE, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEM_POOLABLE },
|
|
|
|
{ SID_ATTR_CHAR_CTL_WEIGHT, SFX_ITEM_POOLABLE }
|
2007-07-09 10:56:41 +00:00
|
|
|
};
|
|
|
|
Window* pParent = VCLUnoHelper::GetWindow( _rxParentWindow );
|
|
|
|
::std::auto_ptr<FontList> pFontList(new FontList( pParent ));
|
|
|
|
::std::auto_ptr<XColorTable> pColorTable( new XColorTable( SvtPathOptions().GetPalettePath() ));
|
|
|
|
SfxPoolItem* pDefaults[] =
|
|
|
|
{
|
|
|
|
new SvxFontItem(ITEMID_FONT),
|
2008-06-16 12:44:40 +00:00
|
|
|
new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT),
|
|
|
|
new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE),
|
2007-07-09 10:56:41 +00:00
|
|
|
new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE),
|
|
|
|
new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT),
|
2008-06-16 12:44:40 +00:00
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
new SvxShadowedItem(FALSE,ITEMID_SHADOWED),
|
|
|
|
new SvxWordLineModeItem(FALSE,ITEMID_WORDLINEMODE),
|
|
|
|
new SvxContourItem(FALSE,ITEMID_CONTOUR),
|
|
|
|
new SvxCrossedOutItem(STRIKEOUT_NONE,ITEMID_CROSSEDOUT),
|
|
|
|
new SvxUnderlineItem(UNDERLINE_NONE,ITEMID_UNDERLINE),
|
2008-06-16 12:44:40 +00:00
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
new SvxColorItem(ITEMID_COLOR),
|
|
|
|
new SvxKerningItem(0,ITEMID_KERNING),
|
|
|
|
new SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED,ITEMID_CASEMAP),
|
|
|
|
new SvxEscapementItem(ITEMID_ESCAPEMENT),
|
|
|
|
new SvxFontListItem(pFontList.get(),ITEMID_FONTLIST),
|
|
|
|
new SvxAutoKernItem(FALSE,ITEMID_AUTOKERN),
|
|
|
|
new SvxColorTableItem(pColorTable.get(),ITEMID_COLOR_TABLE),
|
|
|
|
new SvxBlinkItem(FALSE,ITEMID_BLINK),
|
|
|
|
new SvxEmphasisMarkItem(EMPHASISMARK_NONE,ITEMID_EMPHASISMARK),
|
|
|
|
new SvxTwoLinesItem(TRUE,0,0,ITEMID_TWOLINES),
|
|
|
|
new SvxCharRotateItem(0,sal_False,ITEMID_CHARROTATE),
|
2008-06-16 12:44:40 +00:00
|
|
|
new SvxCharScaleWidthItem(100,ITEMID_CHARSCALE_W),
|
2007-07-09 10:56:41 +00:00
|
|
|
new SvxCharReliefItem(RELIEF_NONE,ITEMID_CHARRELIEF),
|
|
|
|
new SvxCharHiddenItem(FALSE,ITEMID_CHARHIDDEN),
|
|
|
|
new SvxBrushItem(ITEMID_BRUSH),
|
|
|
|
new SvxHorJustifyItem(ITEMID_HORJUSTIFY),
|
2008-06-16 12:44:40 +00:00
|
|
|
new SvxVerJustifyItem(ITEMID_VERJUSTIFY),
|
|
|
|
// Asian
|
|
|
|
new SvxFontItem(ITEMID_FONT_ASIAN),
|
|
|
|
new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT_ASIAN),
|
|
|
|
new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE_ASIAN),
|
|
|
|
new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE_ASIAN),
|
|
|
|
new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT_ASIAN),
|
|
|
|
// Complex
|
|
|
|
new SvxFontItem(ITEMID_FONT_COMPLEX),
|
|
|
|
new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT_COMPLEX),
|
|
|
|
new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE_COMPLEX),
|
|
|
|
new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE_COMPLEX),
|
|
|
|
new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT_COMPLEX)
|
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
};
|
|
|
|
|
2008-06-16 12:44:40 +00:00
|
|
|
OSL_ASSERT((sizeof(pDefaults)/sizeof(pDefaults[0])) == (sizeof(aItemInfos)/sizeof(aItemInfos[0])));
|
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
static USHORT pRanges[] =
|
|
|
|
{
|
2008-06-16 12:44:40 +00:00
|
|
|
ITEMID_FONT,ITEMID_WEIGHT_COMPLEX,
|
2008-02-12 12:10:54 +00:00
|
|
|
0
|
2007-07-09 10:56:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
bool bSuccess = false;
|
|
|
|
try
|
|
|
|
{
|
2008-06-16 12:44:40 +00:00
|
|
|
::std::auto_ptr<SfxItemPool> pPool( new SfxItemPool(String::CreateFromAscii("ReportCharProperties"), ITEMID_FONT,ITEMID_WEIGHT_COMPLEX, aItemInfos, pDefaults) );
|
2007-07-09 10:56:41 +00:00
|
|
|
// not needed for font height pPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); // ripped, don't understand why
|
|
|
|
pPool->FreezeIdRanges(); // the same
|
|
|
|
|
|
|
|
::std::auto_ptr<SfxItemSet> pDescriptor( new SfxItemSet( *pPool, pRanges ) );
|
|
|
|
lcl_CharPropertiesToItems( _rxReportControlFormat, *pDescriptor );
|
|
|
|
|
|
|
|
{ // want the dialog to be destroyed before our set
|
|
|
|
ORptPageDialog aDlg(pParent, pDescriptor.get(),RID_PAGEDIALOG_CHAR);
|
|
|
|
uno::Reference< report::XShape > xShape( _rxReportControlFormat, uno::UNO_QUERY );
|
|
|
|
if ( xShape.is() )
|
|
|
|
aDlg.RemoveTabPage( RID_PAGE_BACKGROUND );
|
|
|
|
bSuccess = ( RET_OK == aDlg.Execute() );
|
|
|
|
if ( bSuccess )
|
|
|
|
{
|
2008-06-16 12:44:40 +00:00
|
|
|
lcl_itemsToCharProperties( lcl_getReportControlFont( _rxReportControlFormat,WESTERN ),
|
|
|
|
lcl_getReportControlFont( _rxReportControlFormat,ASIAN ),
|
|
|
|
lcl_getReportControlFont( _rxReportControlFormat,COMPLEX ), *aDlg.GetOutputItemSet(), _out_rNewValues );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(uno::Exception&)
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
|
|
|
|
for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i)
|
|
|
|
delete pDefaults[i];
|
|
|
|
|
|
|
|
return bSuccess;
|
|
|
|
}
|
2008-08-19 09:15:04 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
bool openAreaDialog( const uno::Reference<report::XShape >& _xShape,const uno::Reference< awt::XWindow>& _rxParentWindow )
|
|
|
|
{
|
|
|
|
OSL_PRECOND( _xShape.is() && _rxParentWindow.is(), "openCharDialog: invalid parameters!" );
|
|
|
|
if ( !_xShape.is() || !_rxParentWindow.is() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
::boost::shared_ptr<rptui::OReportModel> pModel = ::reportdesign::OReportDefinition::getSdrModel(_xShape->getSection()->getReportDefinition());
|
|
|
|
|
|
|
|
Window* pParent = VCLUnoHelper::GetWindow( _rxParentWindow );
|
|
|
|
|
|
|
|
//static USHORT pRanges[] =
|
|
|
|
//{
|
|
|
|
// XATTR_START,XATTR_END,
|
|
|
|
// 0
|
|
|
|
//};
|
|
|
|
|
|
|
|
bool bSuccess = false;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
SfxItemPool& rItemPool = pModel->GetItemPool();
|
|
|
|
::std::auto_ptr<SfxItemSet> pDescriptor( new SfxItemSet( rItemPool, rItemPool.GetFirstWhich(),rItemPool.GetLastWhich() ) );
|
|
|
|
|
|
|
|
lcl_fillShapeToItems(_xShape,*pDescriptor);
|
|
|
|
|
|
|
|
{ // want the dialog to be destroyed before our set
|
|
|
|
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
|
|
|
|
::std::auto_ptr<AbstractSvxAreaTabDialog> pDialog(pFact->CreateSvxAreaTabDialog( pParent,pDescriptor.get(),pModel.get(),RID_SVXDLG_AREA ));
|
|
|
|
// #i74099# by default, the dialog deletes the current color table if a different one is loaded
|
|
|
|
// (see SwDrawShell::ExecDrawDlg)
|
|
|
|
const SvxColorTableItem* pColorItem = static_cast<const SvxColorTableItem*>( pDescriptor->GetItem(SID_COLOR_TABLE) );
|
|
|
|
if (pColorItem && pColorItem->GetColorTable() == XColorTable::GetStdColorTable())
|
|
|
|
pDialog->DontDeleteColorTable();
|
|
|
|
bSuccess = ( RET_OK == pDialog->Execute() );
|
|
|
|
if ( bSuccess )
|
|
|
|
{
|
|
|
|
lcl_fillItemsToShape(_xShape,*pDialog->GetOutputItemSet());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(uno::Exception&)
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
|
|
|
|
return bSuccess;
|
|
|
|
}
|
2007-07-09 10:56:41 +00:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void applyCharacterSettings( const uno::Reference< report::XReportControlFormat >& _rxReportControlFormat, const uno::Sequence< beans::NamedValue >& _rSettings )
|
|
|
|
{
|
|
|
|
::comphelper::NamedValueCollection aSettings( _rSettings );
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
awt::FontDescriptor aAwtFont;
|
|
|
|
if ( aSettings.get( "Font" ) >>= aAwtFont )
|
|
|
|
{
|
|
|
|
::rtl::OUString sTemp = aAwtFont.Name;
|
|
|
|
aAwtFont.Name = ::rtl::OUString(); // hack to
|
|
|
|
_rxReportControlFormat->setFontDescriptor( aAwtFont );
|
|
|
|
_rxReportControlFormat->setCharFontName( sTemp );
|
2008-06-16 12:44:40 +00:00
|
|
|
} // if ( aSettings.get( "Font" ) >>= aAwtFont )
|
|
|
|
if ( aSettings.get( "FontAsian" ) >>= aAwtFont )
|
|
|
|
{
|
|
|
|
::rtl::OUString sTemp = aAwtFont.Name;
|
|
|
|
aAwtFont.Name = ::rtl::OUString(); // hack to
|
|
|
|
_rxReportControlFormat->setFontDescriptorAsian( aAwtFont );
|
|
|
|
_rxReportControlFormat->setCharFontNameAsian( sTemp );
|
|
|
|
} // if ( aSettings.get( "Font" ) >>= aAwtFont )
|
|
|
|
if ( aSettings.get( "FontComplex" ) >>= aAwtFont )
|
|
|
|
{
|
|
|
|
::rtl::OUString sTemp = aAwtFont.Name;
|
|
|
|
aAwtFont.Name = ::rtl::OUString(); // hack to
|
|
|
|
_rxReportControlFormat->setFontDescriptorComplex( aAwtFont );
|
|
|
|
_rxReportControlFormat->setCharFontNameComplex( sTemp );
|
|
|
|
}
|
|
|
|
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARSHADOWED, _rxReportControlFormat, &report::XReportControlFormat::setCharShadowed );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARCONTOURED, _rxReportControlFormat, &report::XReportControlFormat::setCharContoured );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARUNDERLINECOLOR, _rxReportControlFormat, &report::XReportControlFormat::setCharUnderlineColor );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_PARAADJUST, _rxReportControlFormat, &report::XReportControlFormat::setParaAdjust );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_VERTICALALIGN, _rxReportControlFormat, &report::XReportControlFormat::setParaVertAlignment );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARRELIEF, _rxReportControlFormat, &report::XReportControlFormat::setCharRelief );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARHIDDEN, _rxReportControlFormat, &report::XReportControlFormat::setCharHidden );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARAUTOKERNING, _rxReportControlFormat, &report::XReportControlFormat::setCharAutoKerning );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CONTROLBACKGROUND, _rxReportControlFormat, &report::XReportControlFormat::setControlBackground );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARFLASH, _rxReportControlFormat, &report::XReportControlFormat::setCharFlash );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHAREMPHASIS, _rxReportControlFormat, &report::XReportControlFormat::setCharEmphasis );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINEISON, _rxReportControlFormat, &report::XReportControlFormat::setCharCombineIsOn );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINEPREFIX, _rxReportControlFormat, &report::XReportControlFormat::setCharCombinePrefix );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINESUFFIX, _rxReportControlFormat, &report::XReportControlFormat::setCharCombineSuffix );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOLOR, _rxReportControlFormat, &report::XReportControlFormat::setCharColor );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARKERNING, _rxReportControlFormat, &report::XReportControlFormat::setCharKerning );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARCASEMAP, _rxReportControlFormat, &report::XReportControlFormat::setCharCaseMap );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALE, _rxReportControlFormat, &report::XReportControlFormat::setCharLocale );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARESCAPEMENT, _rxReportControlFormat, &report::XReportControlFormat::setCharEscapement );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARESCAPEMENTHEIGHT, _rxReportControlFormat, &report::XReportControlFormat::setCharEscapementHeight );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALEASIAN, _rxReportControlFormat, &report::XReportControlFormat::setCharLocaleAsian );
|
|
|
|
lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALECOMPLEX, _rxReportControlFormat, &report::XReportControlFormat::setCharLocaleComplex );
|
2007-07-09 10:56:41 +00:00
|
|
|
}
|
|
|
|
catch( const uno::Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void notifySystemWindow(Window* _pWindow,Window* _pToRegister, ::comphelper::mem_fun1_t<TaskPaneList,Window*> _rMemFunc)
|
|
|
|
{
|
|
|
|
OSL_ENSURE(_pWindow,"Window can not be null!");
|
|
|
|
SystemWindow* pSystemWindow = _pWindow ? _pWindow->GetSystemWindow() : NULL;
|
|
|
|
if ( pSystemWindow )
|
|
|
|
{
|
|
|
|
_rMemFunc( pSystemWindow->GetTaskPaneList(), _pToRegister );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects,SdrObject* _pIgnore)
|
|
|
|
{
|
|
|
|
SdrObject* pOverlappedObj = NULL;
|
|
|
|
SdrObjListIter aIter(_rPage,IM_DEEPNOGROUPS);
|
|
|
|
SdrObject* pObjIter = NULL;
|
|
|
|
|
|
|
|
while( !pOverlappedObj && (pObjIter = aIter.Next()) != NULL )
|
|
|
|
{
|
|
|
|
if ( _pIgnore != pObjIter
|
|
|
|
&& (_bAllObjects || !_rView.IsObjMarked(pObjIter))
|
|
|
|
&& dynamic_cast<OUnoObject*>(pObjIter) != NULL )
|
|
|
|
{
|
|
|
|
Rectangle aRect = _rRect.GetIntersection(pObjIter->GetLastBoundRect());
|
|
|
|
if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) )
|
|
|
|
pOverlappedObj = pObjIter;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pOverlappedObj;
|
|
|
|
}
|
2008-02-12 12:19:16 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
bool checkArrayForOccurance(SdrObject* _pObjToCheck, SdrUnoObj* _pIgnore[], int _nListLength)
|
|
|
|
{
|
|
|
|
for(int i=0;i<_nListLength;i++)
|
|
|
|
{
|
|
|
|
SdrObject *pIgnore = _pIgnore[i];
|
|
|
|
if (pIgnore == _pObjToCheck)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects, SdrUnoObj * _pIgnoreList[], int _nIgnoreListLength)
|
|
|
|
{
|
|
|
|
SdrObject* pOverlappedObj = NULL;
|
|
|
|
SdrObjListIter aIter(_rPage,IM_DEEPNOGROUPS);
|
|
|
|
SdrObject* pObjIter = NULL;
|
|
|
|
|
|
|
|
while( !pOverlappedObj && (pObjIter = aIter.Next()) != NULL )
|
|
|
|
{
|
|
|
|
if (checkArrayForOccurance(pObjIter, _pIgnoreList, _nIgnoreListLength))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( (_bAllObjects || !_rView.IsObjMarked(pObjIter))
|
|
|
|
&& dynamic_cast<OUnoObject*>(pObjIter) != NULL )
|
|
|
|
{
|
|
|
|
Rectangle aRect = _rRect.GetIntersection(pObjIter->GetLastBoundRect());
|
|
|
|
if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) )
|
|
|
|
pOverlappedObj = pObjIter;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pOverlappedObj;
|
|
|
|
}
|
|
|
|
|
2007-07-09 10:56:41 +00:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
SdrObject* isOver(SdrObject* _pObj,SdrPage& _rPage,SdrView& _rView,bool _bUnMarkedObjects)
|
|
|
|
{
|
|
|
|
SdrObject* pOverlappedObj = NULL;
|
|
|
|
OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(_pObj);
|
|
|
|
if ( pUnoObj ) // this doesn't need to be done for shapes
|
|
|
|
{
|
|
|
|
Rectangle aRect = pUnoObj->GetCurrentBoundRect();
|
|
|
|
pOverlappedObj = isOver(aRect,_rPage,_rView,_bUnMarkedObjects,_pObj);
|
|
|
|
}
|
|
|
|
return pOverlappedObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
uno::Sequence< ::rtl::OUString > getParameterNames( const uno::Reference< sdbc::XRowSet >& _rxRowSet )
|
|
|
|
{
|
|
|
|
uno::Sequence< ::rtl::OUString > aNames;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
uno::Reference< sdb::XParametersSupplier > xSuppParams( _rxRowSet, uno::UNO_QUERY_THROW );
|
|
|
|
uno::Reference< container::XIndexAccess > xParams( xSuppParams->getParameters() );
|
|
|
|
if ( xParams.is() )
|
|
|
|
{
|
|
|
|
sal_Int32 count( xParams->getCount() );
|
|
|
|
aNames.realloc( count );
|
|
|
|
|
|
|
|
uno::Reference< beans::XPropertySet > xParam;
|
|
|
|
::rtl::OUString sParamName;
|
|
|
|
for ( sal_Int32 i=0; i<count; ++i )
|
|
|
|
{
|
|
|
|
xParam.set( xParams->getByIndex(i), uno::UNO_QUERY_THROW );
|
|
|
|
OSL_VERIFY( xParam->getPropertyValue( PROPERTY_NAME ) >>= sParamName );
|
|
|
|
aNames[i] = sParamName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch( const uno::Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
|
|
|
|
return aNames;
|
|
|
|
}
|
2008-01-29 12:50:20 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
2008-02-12 12:19:16 +00:00
|
|
|
Rectangle getRectangleFromControl(SdrObject* _pControl)
|
|
|
|
{
|
|
|
|
if (_pControl)
|
|
|
|
{
|
|
|
|
uno::Reference< report::XReportComponent > xComponent( _pControl->getUnoShape(), uno::UNO_QUERY);
|
|
|
|
if (xComponent.is())
|
|
|
|
{
|
|
|
|
Rectangle aRect(VCLPoint(xComponent->getPosition()),VCLSize(xComponent->getSize()));
|
|
|
|
aRect.setHeight(aRect.getHeight() + 1);
|
|
|
|
aRect.setWidth(aRect.getWidth() + 1);
|
|
|
|
return aRect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Rectangle();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2008-01-29 12:50:20 +00:00
|
|
|
// check overlapping
|
2008-08-19 09:15:04 +00:00
|
|
|
void correctOverlapping(SdrObject* _pControl,OReportSection& _aReportSection,bool _bInsert)
|
2008-01-29 12:50:20 +00:00
|
|
|
{
|
2008-08-19 09:15:04 +00:00
|
|
|
OSectionView& rSectionView = _aReportSection.getSectionView();
|
2008-02-12 12:19:16 +00:00
|
|
|
uno::Reference< report::XReportComponent> xComponent(_pControl->getUnoShape(),uno::UNO_QUERY);
|
|
|
|
// Rectangle aRet(VCLPoint(xComponent->getPosition()),VCLSize(xComponent->getSize()));
|
|
|
|
// aRet.setHeight(aRet.getHeight() + 1);
|
|
|
|
// aRet.setWidth(aRet.getWidth() + 1);
|
|
|
|
Rectangle aRect = getRectangleFromControl(_pControl);
|
|
|
|
|
2008-01-29 12:50:20 +00:00
|
|
|
bool bOverlapping = true;
|
|
|
|
while ( bOverlapping )
|
|
|
|
{
|
2008-08-19 09:15:04 +00:00
|
|
|
SdrObject* pOverlappedObj = isOver(aRect,*_aReportSection.getPage(),rSectionView,true, _pControl);
|
2008-01-29 12:50:20 +00:00
|
|
|
bOverlapping = pOverlappedObj != NULL;
|
|
|
|
if ( bOverlapping )
|
|
|
|
{
|
|
|
|
const Rectangle& aLogicRect = pOverlappedObj->GetLogicRect();
|
2008-02-12 12:19:16 +00:00
|
|
|
aRect.Move(0,aLogicRect.Top() + aLogicRect.getHeight() - aRect.Top());
|
|
|
|
xComponent->setPositionY(aRect.Top());
|
2008-01-29 12:50:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( !bOverlapping && _bInsert ) // now insert objects
|
2008-08-19 09:15:04 +00:00
|
|
|
rSectionView.InsertObjectAtView(_pControl,*rSectionView.GetSdrPageView(),SDRINSERT_ADDMARK);
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void setZoomFactor(const sal_Int16 _nZoom,Window& _rWindow)
|
|
|
|
{
|
|
|
|
Fraction aZoom(_nZoom,100);
|
|
|
|
MapMode aMapMode( _rWindow.GetMapMode() );
|
|
|
|
aMapMode.SetScaleX(aZoom);
|
|
|
|
aMapMode.SetScaleY(aZoom);
|
|
|
|
_rWindow.SetMapMode(aMapMode);
|
2008-01-29 12:50:20 +00:00
|
|
|
}
|
2007-07-09 10:56:41 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
} // namespace rptui
|
|
|
|
// -----------------------------------------------------------------------------
|