diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-12-11 15:16:51 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-12-11 15:16:51 +0100 |
commit | 90f91088d238469b4a2262c91de3117ba40f5bde (patch) | |
tree | bad912690be028b4242744eed6755b36bb1bcefa /reportdesign | |
parent | 2fa2d39bf3eb2f216e13f6dd2c6c5c35fd19627c (diff) |
Don't hold css::uno::Type instances by pointer
...in comphelper::PropertyMapEntry and SfxItemPropertyMapEntry. And as the
arrays of such need to be initialized dynamically anyway, also change their name
members to proper OUStrings while at it. Plus some const clean-up.
Change-Id: I67d4d7b5773fb020605f369daf39528bec930606
Diffstat (limited to 'reportdesign')
-rw-r--r-- | reportdesign/source/core/api/ReportDefinition.cxx | 13 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlColumn.cxx | 8 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlHelper.cxx | 48 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlfilter.cxx | 17 |
4 files changed, 41 insertions, 45 deletions
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 1afdeb6b805d..595119468041 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -122,7 +122,6 @@ #include <boost/mem_fn.hpp> #include <boost/utility.hpp> -#define MAP_LEN(x) x, sizeof(x) - 1 // page styles #define SC_UNO_PAGE_LEFTBORDER "LeftBorder" #define SC_UNO_PAGE_RIGHTBORDER "RightBorder" @@ -1464,13 +1463,13 @@ void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XS } /** property map for export info set */ - comphelper::PropertyMapEntry aExportInfoMap[] = + comphelper::PropertyMapEntry const aExportInfoMap[] = { - { MAP_LEN( "UsePrettyPrinting" ), 0, &::getCppuType((sal_Bool*)0), beans::PropertyAttribute::MAYBEVOID, 0 }, - { MAP_LEN( "StreamName") , 0,&::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, - { MAP_LEN( "StreamRelPath") , 0,&::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, - { MAP_LEN( "BaseURI") , 0,&::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, - { NULL, 0, 0, NULL, 0, 0 } + { "UsePrettyPrinting" , 0, ::getCppuType((sal_Bool*)0), beans::PropertyAttribute::MAYBEVOID, 0 }, + { "StreamName" , 0, ::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, + { "StreamRelPath" , 0, ::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, + { "BaseURI" , 0, ::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, + {} }; uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) ); diff --git a/reportdesign/source/filter/xml/xmlColumn.cxx b/reportdesign/source/filter/xml/xmlColumn.cxx index c2ca586864e1..37547bb5588a 100644 --- a/reportdesign/source/filter/xml/xmlColumn.cxx +++ b/reportdesign/source/filter/xml/xmlColumn.cxx @@ -131,11 +131,11 @@ void OXMLRowColumn::fillStyle(const OUString& _sStyleName) if ( pAutoStyles ) { PropertySetInfo* pInfo = new PropertySetInfo(); - static PropertyMapEntry pMap[] = + static PropertyMapEntry const pMap[] = { - {PROPERTY_WIDTH, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_WIDTH)-1), PROPERTY_ID_WIDTH, &::getCppuType(static_cast< sal_Int32* >( NULL )) ,PropertyAttribute::BOUND,0}, - {PROPERTY_HEIGHT, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_HEIGHT)-1), PROPERTY_ID_HEIGHT, &::getCppuType(static_cast< sal_Int32* >( NULL )) ,PropertyAttribute::BOUND,0}, - { NULL, 0, 0, NULL, 0, 0 } + {PROPERTY_WIDTH, PROPERTY_ID_WIDTH, ::getCppuType(static_cast< sal_Int32* >( NULL )) ,PropertyAttribute::BOUND,0}, + {PROPERTY_HEIGHT, PROPERTY_ID_HEIGHT, ::getCppuType(static_cast< sal_Int32* >( NULL )) ,PropertyAttribute::BOUND,0}, + {} }; pInfo->add(pMap); Reference<XPropertySet> xProp = GenericPropertySet_CreateInstance(pInfo); diff --git a/reportdesign/source/filter/xml/xmlHelper.cxx b/reportdesign/source/filter/xml/xmlHelper.cxx index b11bd0f85fc6..df6da6794958 100644 --- a/reportdesign/source/filter/xml/xmlHelper.cxx +++ b/reportdesign/source/filter/xml/xmlHelper.cxx @@ -257,25 +257,25 @@ void OXMLHelper::copyStyleElements(const bool _bOld,const OUString& _sStyleName, if ( pAutoStyle ) { ::com::sun::star::awt::FontDescriptor aFont; - static comphelper::PropertyMapEntry pMap[] = + static comphelper::PropertyMapEntry const pMap[] = { - {PROPERTY_FONTNAME, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_FONTNAME)-1), PROPERTY_ID_FONTNAME, &::getCppuType(&aFont.Name) ,PropertyAttribute::BOUND,0}, - {PROPERTY_CHARFONTHEIGHT, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_CHARFONTHEIGHT)-1), PROPERTY_ID_FONTHEIGHT, &::getCppuType(&aFont.Height) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTWIDTH, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_FONTWIDTH)-1), PROPERTY_ID_FONTWIDTH, &::getCppuType(&aFont.Width) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTSTYLENAME, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_FONTSTYLENAME)-1), PROPERTY_ID_FONTSTYLENAME, &::getCppuType(&aFont.StyleName) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTFAMILY, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_FONTFAMILY)-1), PROPERTY_ID_FONTFAMILY, &::getCppuType(&aFont.Family) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTCHARSET, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_FONTCHARSET)-1), PROPERTY_ID_FONTCHARSET, &::getCppuType(&aFont.CharSet) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTPITCH, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_FONTPITCH)-1), PROPERTY_ID_FONTPITCH, &::getCppuType(&aFont.Pitch) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTCHARWIDTH, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_FONTCHARWIDTH)-1), PROPERTY_ID_FONTCHARWIDTH, &::getCppuType(&aFont.CharacterWidth),PropertyAttribute::BOUND,0}, - {PROPERTY_FONTWEIGHT, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_FONTWEIGHT)-1), PROPERTY_ID_FONTWEIGHT, &::getCppuType(&aFont.Weight) ,PropertyAttribute::BOUND,0}, - {PROPERTY_CHARPOSTURE, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_CHARPOSTURE)-1), PROPERTY_ID_FONTSLANT, &::getCppuType(&aFont.Slant) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTUNDERLINE, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_FONTUNDERLINE)-1), PROPERTY_ID_FONTUNDERLINE, &::getCppuType(&aFont.Underline) ,PropertyAttribute::BOUND,0}, - {PROPERTY_CHARSTRIKEOUT, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_CHARSTRIKEOUT)-1), PROPERTY_ID_FONTSTRIKEOUT, &::getCppuType(&aFont.Strikeout) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTORIENTATION, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_FONTORIENTATION)-1), PROPERTY_ID_FONTORIENTATION, &::getCppuType(&aFont.Orientation) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTKERNING, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_FONTKERNING)-1), PROPERTY_ID_FONTKERNING, &::getCppuType(&aFont.Kerning) ,PropertyAttribute::BOUND,0}, - {PROPERTY_CHARWORDMODE, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_CHARWORDMODE)-1), PROPERTY_ID_FONTWORDLINEMODE, &::getCppuType(&aFont.WordLineMode) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTTYPE, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_FONTTYPE)-1), PROPERTY_ID_FONTTYPE, &::getCppuType(&aFont.Type) ,PropertyAttribute::BOUND,0}, - { NULL, 0, 0, NULL, 0, 0 } + {PROPERTY_FONTNAME, PROPERTY_ID_FONTNAME, ::getCppuType(&aFont.Name) ,PropertyAttribute::BOUND,0}, + {PROPERTY_CHARFONTHEIGHT, PROPERTY_ID_FONTHEIGHT, ::getCppuType(&aFont.Height) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTWIDTH, PROPERTY_ID_FONTWIDTH, ::getCppuType(&aFont.Width) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTSTYLENAME, PROPERTY_ID_FONTSTYLENAME, ::getCppuType(&aFont.StyleName) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTFAMILY, PROPERTY_ID_FONTFAMILY, ::getCppuType(&aFont.Family) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTCHARSET, PROPERTY_ID_FONTCHARSET, ::getCppuType(&aFont.CharSet) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTPITCH, PROPERTY_ID_FONTPITCH, ::getCppuType(&aFont.Pitch) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTCHARWIDTH, PROPERTY_ID_FONTCHARWIDTH, ::getCppuType(&aFont.CharacterWidth),PropertyAttribute::BOUND,0}, + {PROPERTY_FONTWEIGHT, PROPERTY_ID_FONTWEIGHT, ::getCppuType(&aFont.Weight) ,PropertyAttribute::BOUND,0}, + {PROPERTY_CHARPOSTURE, PROPERTY_ID_FONTSLANT, ::getCppuType(&aFont.Slant) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTUNDERLINE, PROPERTY_ID_FONTUNDERLINE, ::getCppuType(&aFont.Underline) ,PropertyAttribute::BOUND,0}, + {PROPERTY_CHARSTRIKEOUT, PROPERTY_ID_FONTSTRIKEOUT, ::getCppuType(&aFont.Strikeout) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTORIENTATION, PROPERTY_ID_FONTORIENTATION, ::getCppuType(&aFont.Orientation) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTKERNING, PROPERTY_ID_FONTKERNING, ::getCppuType(&aFont.Kerning) ,PropertyAttribute::BOUND,0}, + {PROPERTY_CHARWORDMODE, PROPERTY_ID_FONTWORDLINEMODE, ::getCppuType(&aFont.WordLineMode) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTTYPE, PROPERTY_ID_FONTTYPE, ::getCppuType(&aFont.Type) ,PropertyAttribute::BOUND,0}, + {} }; try { @@ -320,13 +320,13 @@ void OXMLHelper::copyStyleElements(const bool _bOld,const OUString& _sStyleName, // ----------------------------------------------------------------------------- uno::Reference<beans::XPropertySet> OXMLHelper::createBorderPropertySet() { - static comphelper::PropertyMapEntry pMap[] = + static comphelper::PropertyMapEntry const pMap[] = { - {PROPERTY_BORDERLEFT, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_BORDERLEFT)-1), 0, &::getCppuType((const table::BorderLine2*)0) ,PropertyAttribute::BOUND,0}, - {PROPERTY_BORDERRIGHT, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_BORDERRIGHT)-1), 1, &::getCppuType((const table::BorderLine2*)0) ,PropertyAttribute::BOUND,0}, - {PROPERTY_BORDERTOP, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_BORDERTOP)-1), 2, &::getCppuType((const table::BorderLine2*)0) ,PropertyAttribute::BOUND,0}, - {PROPERTY_BORDERBOTTOM, static_cast<sal_uInt16>(SAL_N_ELEMENTS(PROPERTY_BORDERBOTTOM)-1), 3, &::getCppuType((const table::BorderLine2*)0) ,PropertyAttribute::BOUND,0}, - { NULL, 0, 0, NULL, 0, 0 } + {PROPERTY_BORDERLEFT, 0, ::getCppuType((const table::BorderLine2*)0) ,PropertyAttribute::BOUND,0}, + {PROPERTY_BORDERRIGHT, 1, ::getCppuType((const table::BorderLine2*)0) ,PropertyAttribute::BOUND,0}, + {PROPERTY_BORDERTOP, 2, ::getCppuType((const table::BorderLine2*)0) ,PropertyAttribute::BOUND,0}, + {PROPERTY_BORDERBOTTOM, 3, ::getCppuType((const table::BorderLine2*)0) ,PropertyAttribute::BOUND,0}, + {} }; return comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(pMap)); } diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx index a35b4d764871..f3768c427297 100644 --- a/reportdesign/source/filter/xml/xmlfilter.cxx +++ b/reportdesign/source/filter/xml/xmlfilter.cxx @@ -59,9 +59,6 @@ #include <xmloff/txtprmap.hxx> #include "ReportDefinition.hxx" - -#define MAP_LEN(x) x, sizeof(x) - 1 -//-------------------------------------------------------------------------- namespace rptxml { using namespace ::com::sun::star::uno; @@ -528,14 +525,14 @@ sal_Bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) xEmbeddedObjectResolver.set( xReportServiceFactory->createInstanceWithArguments(OUString("com.sun.star.document.ImportEmbeddedObjectResolver"),aArgs) , uno::UNO_QUERY); static const OUString s_sOld("OldFormat"); - static comphelper::PropertyMapEntry pMap[] = + static comphelper::PropertyMapEntry const pMap[] = { - { MAP_LEN( "OldFormat" ), 1, &::getCppuType((const sal_Bool*)0), beans::PropertyAttribute::BOUND, 0 }, - { MAP_LEN( "StreamName"), 0, &::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, - { MAP_LEN("PrivateData"), 0, &::getCppuType( (uno::Reference<XInterface> *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, - { MAP_LEN( "BaseURI"), 0, &::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, - { MAP_LEN( "StreamRelPath"), 0, &::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, - { NULL, 0, 0, NULL, 0, 0 } + { "OldFormat" , 1, ::getCppuType((const sal_Bool*)0), beans::PropertyAttribute::BOUND, 0 }, + { "StreamName", 0, ::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, + { "PrivateData",0, ::getCppuType( (uno::Reference<XInterface> *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, + { "BaseURI", 0, ::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, + { "StreamRelPath", 0, ::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, + {} }; utl::MediaDescriptor aDescriptor(rDescriptor); uno::Reference<beans::XPropertySet> xProp = comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(pMap)); |