summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-03-09 09:04:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-03-13 09:02:22 +0000
commit7e9857c2935bb2533806db4e71c6cd1e171c3478 (patch)
treed9f8a6d4f94e19f349b67141359cc7c49130b5fc /reportdesign
parent7c0e3d0b37131b12262d0f610505b3384923c4a1 (diff)
templatize SvXMLEnumMapEntry
in preparation for "scoped UNO enums". This is a little hacky: In order to limit the scope of this change, the templated SvXMLEnumMapEntry struct actually has a fixed size field, and we cast it to SvXMLEnumMapEntry<sal_uInt16>* in various places, to avoid carrying the type param around. Change-Id: Idfbc5561303c557598dd5564b7a7259ae5261d83 Reviewed-on: https://gerrit.libreoffice.org/34987 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/source/filter/xml/xmlExport.cxx22
-rw-r--r--reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx2
-rw-r--r--reportdesign/source/filter/xml/xmlGroup.cxx6
-rw-r--r--reportdesign/source/filter/xml/xmlHelper.cxx32
-rw-r--r--reportdesign/source/filter/xml/xmlHelper.hxx10
-rw-r--r--reportdesign/source/filter/xml/xmlImage.cxx4
-rw-r--r--reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx4
-rw-r--r--reportdesign/source/filter/xml/xmlReport.cxx4
-rw-r--r--reportdesign/source/filter/xml/xmlSection.cxx6
-rw-r--r--reportdesign/source/filter/xml/xmlTable.cxx6
10 files changed, 48 insertions, 48 deletions
diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx
index cc5fe5f8d2ed..6d8707c336a0 100644
--- a/reportdesign/source/filter/xml/xmlExport.cxx
+++ b/reportdesign/source/filter/xml/xmlExport.cxx
@@ -388,8 +388,8 @@ void ORptExport::exportReport(const Reference<XReportDefinition>& _xReportDefini
if ( _xReportDefinition->getPageHeaderOn() )
{
OUStringBuffer sValue;
- sal_uInt16 nRet = _xReportDefinition->getPageHeaderOption();
- const SvXMLEnumMapEntry* aXML_EnumMap = OXMLHelper::GetReportPrintOptions();
+ sal_Int16 nRet = _xReportDefinition->getPageHeaderOption();
+ const SvXMLEnumMapEntry<sal_Int16>* aXML_EnumMap = OXMLHelper::GetReportPrintOptions();
if ( SvXMLUnitConverter::convertEnum( sValue, nRet,aXML_EnumMap ) )
AddAttribute(XML_NAMESPACE_REPORT, XML_PAGE_PRINT_OPTION,sValue.makeStringAndClear());
@@ -402,8 +402,8 @@ void ORptExport::exportReport(const Reference<XReportDefinition>& _xReportDefini
if ( _xReportDefinition->getPageFooterOn() )
{
OUStringBuffer sValue;
- sal_uInt16 nRet = _xReportDefinition->getPageFooterOption();
- const SvXMLEnumMapEntry* aXML_EnumMap = OXMLHelper::GetReportPrintOptions();
+ sal_Int16 nRet = _xReportDefinition->getPageFooterOption();
+ const SvXMLEnumMapEntry<sal_Int16>* aXML_EnumMap = OXMLHelper::GetReportPrintOptions();
if ( SvXMLUnitConverter::convertEnum( sValue, nRet,aXML_EnumMap ) )
AddAttribute(XML_NAMESPACE_REPORT, XML_PAGE_PRINT_OPTION,sValue.makeStringAndClear());
SvXMLElementExport aGroupSection(*this,XML_NAMESPACE_REPORT, XML_PAGE_FOOTER, true, true);
@@ -707,8 +707,8 @@ void ORptExport::exportSection(const Reference<XSection>& _xSection,bool bHeader
if ( !bHeader )
{
- sal_uInt16 nRet = _xSection->getForceNewPage();
- const SvXMLEnumMapEntry* aXML_EnumMap = OXMLHelper::GetForceNewPageOptions();
+ sal_Int16 nRet = _xSection->getForceNewPage();
+ const SvXMLEnumMapEntry<sal_Int16>* aXML_EnumMap = OXMLHelper::GetForceNewPageOptions();
if ( SvXMLUnitConverter::convertEnum( sValue, nRet,aXML_EnumMap ) )
AddAttribute(XML_NAMESPACE_REPORT, XML_FORCE_NEW_PAGE,sValue.makeStringAndClear());
@@ -886,7 +886,7 @@ void ORptExport::exportContainer(const Reference< XSection>& _xSection)
}
bExportData = true;
OUStringBuffer sValue;
- const SvXMLEnumMapEntry* aXML_ImageScaleEnumMap = OXMLHelper::GetImageScaleOptions();
+ const SvXMLEnumMapEntry<sal_Int16>* aXML_ImageScaleEnumMap = OXMLHelper::GetImageScaleOptions();
if ( SvXMLUnitConverter::convertEnum( sValue, xImage->getScaleMode(),aXML_ImageScaleEnumMap ) )
AddAttribute(XML_NAMESPACE_REPORT, XML_SCALE, sValue.makeStringAndClear() );
}
@@ -1073,8 +1073,8 @@ void ORptExport::exportGroup(const Reference<XReportDefinition>& _xReportDefinit
AddAttribute(XML_NAMESPACE_REPORT, XML_GROUP_EXPRESSION,sExpression);
sal_Int16 nRet = xGroup->getKeepTogether();
OUStringBuffer sValue;
- const SvXMLEnumMapEntry* aXML_KeepTogetherEnumMap = OXMLHelper::GetKeepTogetherOptions();
- if ( SvXMLUnitConverter::convertEnum( sValue, nRet,aXML_KeepTogetherEnumMap ) )
+ const SvXMLEnumMapEntry<sal_Int16>* aXML_KeepTogetherEnumMap = OXMLHelper::GetKeepTogetherOptions();
+ if ( SvXMLUnitConverter::convertEnum( sValue, nRet, aXML_KeepTogetherEnumMap ) )
AddAttribute(XML_NAMESPACE_REPORT, XML_KEEP_TOGETHER,sValue.makeStringAndClear());
SvXMLElementExport aGroup(*this,XML_NAMESPACE_REPORT, XML_GROUP, true, true);
@@ -1254,8 +1254,8 @@ void ORptExport::exportReportAttributes(const Reference<XReportDefinition>& _xRe
if ( _xReport.is() )
{
OUStringBuffer sValue;
- const SvXMLEnumMapEntry* aXML_CommnadTypeEnumMap = OXMLHelper::GetCommandTypeOptions();
- if ( SvXMLUnitConverter::convertEnum( sValue, static_cast<sal_uInt16>(_xReport->getCommandType()),aXML_CommnadTypeEnumMap ) )
+ const SvXMLEnumMapEntry<sal_Int32>* aXML_CommnadTypeEnumMap = OXMLHelper::GetCommandTypeOptions();
+ if ( SvXMLUnitConverter::convertEnum( sValue, _xReport->getCommandType(), aXML_CommnadTypeEnumMap ) )
AddAttribute(XML_NAMESPACE_REPORT, XML_COMMAND_TYPE,sValue.makeStringAndClear());
OUString sComamnd = _xReport->getCommand();
diff --git a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
index d736f52305f3..bbbb39b562a9 100644
--- a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
+++ b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
@@ -143,7 +143,7 @@ void SAL_CALL ExportDocumentHandler::startElement(const OUString & _sName, const
SvXMLAttributeList* pList = new SvXMLAttributeList();
uno::Reference< xml::sax::XAttributeList > xNewAttribs = pList;
OUStringBuffer sValue;
- static const SvXMLEnumMapEntry aXML_CommnadTypeEnumMap[] =
+ static const SvXMLEnumMapEntry<sal_uInt16> aXML_CommnadTypeEnumMap[] =
{
{ XML_TABLE, sdb::CommandType::TABLE },
{ XML_QUERY, sdb::CommandType::QUERY },
diff --git a/reportdesign/source/filter/xml/xmlGroup.cxx b/reportdesign/source/filter/xml/xmlGroup.cxx
index 79b30a80784e..8b6830f89e12 100644
--- a/reportdesign/source/filter/xml/xmlGroup.cxx
+++ b/reportdesign/source/filter/xml/xmlGroup.cxx
@@ -39,10 +39,10 @@ namespace rptxml
using namespace ::com::sun::star::report;
using namespace ::com::sun::star::xml::sax;
- sal_uInt16 lcl_getKeepTogetherOption(const OUString& _sValue)
+ sal_Int16 lcl_getKeepTogetherOption(const OUString& _sValue)
{
- sal_uInt16 nRet = report::KeepTogether::NO;
- const SvXMLEnumMapEntry* aXML_EnumMap = OXMLHelper::GetKeepTogetherOptions();
+ sal_Int16 nRet = report::KeepTogether::NO;
+ const SvXMLEnumMapEntry<sal_Int16>* aXML_EnumMap = OXMLHelper::GetKeepTogetherOptions();
(void)SvXMLUnitConverter::convertEnum( nRet, _sValue, aXML_EnumMap );
return nRet;
}
diff --git a/reportdesign/source/filter/xml/xmlHelper.cxx b/reportdesign/source/filter/xml/xmlHelper.cxx
index f11c01e3a7b6..50c9e469e337 100644
--- a/reportdesign/source/filter/xml/xmlHelper.cxx
+++ b/reportdesign/source/filter/xml/xmlHelper.cxx
@@ -78,15 +78,15 @@ const XMLPropertyHandler* OPropertyHandlerFactory::GetPropertyHandler(sal_Int32
{
case XML_RPT_ALGINMENT:
{
- static SvXMLEnumMapEntry const pXML_VerticalAlign_Enum[] =
+ static SvXMLEnumMapEntry<style::VerticalAlignment> const pXML_VerticalAlign_Enum[] =
{
{ XML_TOP, style::VerticalAlignment_TOP },
{ XML_MIDDLE, style::VerticalAlignment_MIDDLE },
{ XML_BOTTOM, style::VerticalAlignment_BOTTOM },
- { XML_TOKEN_INVALID, 0 }
+ { XML_TOKEN_INVALID, (style::VerticalAlignment)0 }
};
- pHandler = new XMLEnumPropertyHdl( pXML_VerticalAlign_Enum, cppu::UnoType<css::style::VerticalAlignment>::get());
+ pHandler = new XMLEnumPropertyHdl( pXML_VerticalAlign_Enum );
}
break;
case (XML_SD_TYPES_START+34):
@@ -187,21 +187,21 @@ const XMLPropertyMapEntry* OXMLHelper::GetColumnStyleProps()
return aXMLColumnStylesProperties;
}
-const SvXMLEnumMapEntry* OXMLHelper::GetReportPrintOptions()
+const SvXMLEnumMapEntry<sal_Int16>* OXMLHelper::GetReportPrintOptions()
{
- static const SvXMLEnumMapEntry s_aXML_EnumMap[] =
+ static const SvXMLEnumMapEntry<sal_Int16> s_aXML_EnumMap[] =
{
- { XML_NOT_WITH_REPORT_HEADER, report::ReportPrintOption::NOT_WITH_REPORT_HEADER },
- { XML_NOT_WITH_REPORT_FOOTER, report::ReportPrintOption::NOT_WITH_REPORT_FOOTER },
- { XML_NOT_WITH_REPORT_HEADER_NOR_FOOTER, report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER },
+ { XML_NOT_WITH_REPORT_HEADER, report::ReportPrintOption::NOT_WITH_REPORT_HEADER },
+ { XML_NOT_WITH_REPORT_FOOTER, report::ReportPrintOption::NOT_WITH_REPORT_FOOTER },
+ { XML_NOT_WITH_REPORT_HEADER_NOR_FOOTER, report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER },
{ XML_TOKEN_INVALID, 0 }
};
return s_aXML_EnumMap;
}
-const SvXMLEnumMapEntry* OXMLHelper::GetForceNewPageOptions()
+const SvXMLEnumMapEntry<sal_Int16>* OXMLHelper::GetForceNewPageOptions()
{
- static const SvXMLEnumMapEntry s_aXML_EnumMap[] =
+ static const SvXMLEnumMapEntry<sal_Int16> s_aXML_EnumMap[] =
{
{ XML_BEFORE_SECTION, report::ForceNewPage::BEFORE_SECTION },
{ XML_AFTER_SECTION, report::ForceNewPage::AFTER_SECTION },
@@ -211,9 +211,9 @@ const SvXMLEnumMapEntry* OXMLHelper::GetForceNewPageOptions()
return s_aXML_EnumMap;
}
-const SvXMLEnumMapEntry* OXMLHelper::GetKeepTogetherOptions()
+const SvXMLEnumMapEntry<sal_Int16>* OXMLHelper::GetKeepTogetherOptions()
{
- static const SvXMLEnumMapEntry s_aXML_EnumMap[] =
+ static const SvXMLEnumMapEntry<sal_Int16> s_aXML_EnumMap[] =
{
{ XML_WHOLE_GROUP, report::KeepTogether::WHOLE_GROUP },
{ XML_WITH_FIRST_DETAIL, report::KeepTogether::WITH_FIRST_DETAIL },
@@ -222,9 +222,9 @@ const SvXMLEnumMapEntry* OXMLHelper::GetKeepTogetherOptions()
return s_aXML_EnumMap;
}
-const SvXMLEnumMapEntry* OXMLHelper::GetCommandTypeOptions()
+const SvXMLEnumMapEntry<sal_Int32>* OXMLHelper::GetCommandTypeOptions()
{
- static const SvXMLEnumMapEntry s_aXML_EnumMap[] =
+ static const SvXMLEnumMapEntry<sal_Int32> s_aXML_EnumMap[] =
{
{ XML_TABLE, CommandType::TABLE },
{ XML_QUERY, CommandType::QUERY },
@@ -370,9 +370,9 @@ SvXMLTokenMap* OXMLHelper::GetSubDocumentElemTokenMap()
return new SvXMLTokenMap( aElemTokenMap );
}
-const SvXMLEnumMapEntry* OXMLHelper::GetImageScaleOptions()
+const SvXMLEnumMapEntry<sal_Int16>* OXMLHelper::GetImageScaleOptions()
{
- static const SvXMLEnumMapEntry s_aXML_EnumMap[] =
+ static const SvXMLEnumMapEntry<sal_Int16> s_aXML_EnumMap[] =
{
{ XML_ISOTROPIC, awt::ImageScaleMode::ISOTROPIC },
{ XML_ANISOTROPIC, awt::ImageScaleMode::ANISOTROPIC },
diff --git a/reportdesign/source/filter/xml/xmlHelper.hxx b/reportdesign/source/filter/xml/xmlHelper.hxx
index 7ed59b241852..739be57a96be 100644
--- a/reportdesign/source/filter/xml/xmlHelper.hxx
+++ b/reportdesign/source/filter/xml/xmlHelper.hxx
@@ -51,11 +51,11 @@ namespace rptxml
public:
static rtl::Reference < XMLPropertySetMapper > GetCellStylePropertyMap(bool _bOldFormat, bool bForExport);
- static const SvXMLEnumMapEntry* GetReportPrintOptions();
- static const SvXMLEnumMapEntry* GetForceNewPageOptions();
- static const SvXMLEnumMapEntry* GetKeepTogetherOptions();
- static const SvXMLEnumMapEntry* GetCommandTypeOptions();
- static const SvXMLEnumMapEntry* GetImageScaleOptions();
+ static const SvXMLEnumMapEntry<sal_Int16>* GetReportPrintOptions();
+ static const SvXMLEnumMapEntry<sal_Int16>* GetForceNewPageOptions();
+ static const SvXMLEnumMapEntry<sal_Int16>* GetKeepTogetherOptions();
+ static const SvXMLEnumMapEntry<sal_Int32>* GetCommandTypeOptions();
+ static const SvXMLEnumMapEntry<sal_Int16>* GetImageScaleOptions();
static const XMLPropertyMapEntry* GetTableStyleProps();
static const XMLPropertyMapEntry* GetColumnStyleProps();
diff --git a/reportdesign/source/filter/xml/xmlImage.cxx b/reportdesign/source/filter/xml/xmlImage.cxx
index 818524e15567..6e1a59e367ef 100644
--- a/reportdesign/source/filter/xml/xmlImage.cxx
+++ b/reportdesign/source/filter/xml/xmlImage.cxx
@@ -76,14 +76,14 @@ OXMLImage::OXMLImage( ORptFilter& rImport,
break;
case XML_TOK_SCALE:
{
- sal_uInt16 nRet = awt::ImageScaleMode::NONE;
+ sal_Int16 nRet = awt::ImageScaleMode::NONE;
if ( s_sTRUE == sValue )
{
nRet = awt::ImageScaleMode::ANISOTROPIC;
}
else
{
- const SvXMLEnumMapEntry* aXML_EnumMap = OXMLHelper::GetImageScaleOptions();
+ const SvXMLEnumMapEntry<sal_Int16>* aXML_EnumMap = OXMLHelper::GetImageScaleOptions();
bool bConvertOk = SvXMLUnitConverter::convertEnum( nRet, sValue, aXML_EnumMap );
SAL_WARN_IF(!bConvertOk, "reportdesign", "convertEnum failed");
}
diff --git a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx
index 488fceaf3dff..0cb121a49f45 100644
--- a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx
+++ b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx
@@ -178,8 +178,8 @@ void SAL_CALL ImportDocumentHandler::startElement(const OUString & _sName, const
{
case XML_TOK_COMMAND_TYPE:
{
- sal_uInt16 nRet = static_cast<sal_uInt16>(sdb::CommandType::COMMAND);
- const SvXMLEnumMapEntry* aXML_EnumMap = OXMLHelper::GetCommandTypeOptions();
+ sal_Int32 nRet = sdb::CommandType::COMMAND;
+ const SvXMLEnumMapEntry<sal_Int32>* aXML_EnumMap = OXMLHelper::GetCommandTypeOptions();
(void)SvXMLUnitConverter::convertEnum( nRet, sValue, aXML_EnumMap );
m_xDatabaseDataProvider->setCommandType(nRet);
}
diff --git a/reportdesign/source/filter/xml/xmlReport.cxx b/reportdesign/source/filter/xml/xmlReport.cxx
index 67fa765b8270..4c2ed009dc3a 100644
--- a/reportdesign/source/filter/xml/xmlReport.cxx
+++ b/reportdesign/source/filter/xml/xmlReport.cxx
@@ -67,8 +67,8 @@ OXMLReport::OXMLReport( ORptFilter& rImport,
{
case XML_TOK_COMMAND_TYPE:
{
- sal_uInt16 nRet = static_cast<sal_uInt16>(sdb::CommandType::COMMAND);
- const SvXMLEnumMapEntry* aXML_EnumMap = OXMLHelper::GetCommandTypeOptions();
+ sal_Int32 nRet = sdb::CommandType::COMMAND;
+ const SvXMLEnumMapEntry<sal_Int32>* aXML_EnumMap = OXMLHelper::GetCommandTypeOptions();
bool bConvertOk = SvXMLUnitConverter::convertEnum( nRet, sValue, aXML_EnumMap );
SAL_WARN_IF(!bConvertOk, "reportdesign", "convertEnum failed");
m_xReportDefinition->setCommandType(nRet);
diff --git a/reportdesign/source/filter/xml/xmlSection.cxx b/reportdesign/source/filter/xml/xmlSection.cxx
index 9c8e41df34a0..29714f7dce87 100644
--- a/reportdesign/source/filter/xml/xmlSection.cxx
+++ b/reportdesign/source/filter/xml/xmlSection.cxx
@@ -41,10 +41,10 @@ namespace rptxml
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::xml::sax;
- sal_uInt16 lcl_getReportPrintOption(const OUString& _sValue)
+ sal_Int16 lcl_getReportPrintOption(const OUString& _sValue)
{
- sal_uInt16 nRet = report::ReportPrintOption::ALL_PAGES;
- const SvXMLEnumMapEntry* aXML_EnumMap = OXMLHelper::GetReportPrintOptions();
+ sal_Int16 nRet = report::ReportPrintOption::ALL_PAGES;
+ const SvXMLEnumMapEntry<sal_Int16>* aXML_EnumMap = OXMLHelper::GetReportPrintOptions();
(void)SvXMLUnitConverter::convertEnum( nRet, _sValue, aXML_EnumMap );
return nRet;
}
diff --git a/reportdesign/source/filter/xml/xmlTable.cxx b/reportdesign/source/filter/xml/xmlTable.cxx
index f211e01872be..a1d9c582bc0e 100644
--- a/reportdesign/source/filter/xml/xmlTable.cxx
+++ b/reportdesign/source/filter/xml/xmlTable.cxx
@@ -46,10 +46,10 @@ namespace rptxml
using namespace ::com::sun::star::xml::sax;
using ::com::sun::star::xml::sax::XAttributeList;
- sal_uInt16 lcl_getForceNewPageOption(const OUString& _sValue)
+ sal_Int16 lcl_getForceNewPageOption(const OUString& _sValue)
{
- sal_uInt16 nRet = report::ForceNewPage::NONE;
- const SvXMLEnumMapEntry* aXML_EnumMap = OXMLHelper::GetForceNewPageOptions();
+ sal_Int16 nRet = report::ForceNewPage::NONE;
+ const SvXMLEnumMapEntry<sal_Int16>* aXML_EnumMap = OXMLHelper::GetForceNewPageOptions();
(void)SvXMLUnitConverter::convertEnum( nRet,_sValue,aXML_EnumMap );
return nRet;
}