From 64b6e19323cdd80ac5469ff43cac263df7e18329 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 30 Mar 2017 16:28:56 +0200 Subject: use actual UNO enums in writerfilter Change-Id: I59afe1ec7096cc7d173baab2042254eb647587b5 Reviewed-on: https://gerrit.libreoffice.org/35918 Tested-by: Jenkins Reviewed-by: Noel Grandin --- writerfilter/source/dmapper/ConversionHelper.cxx | 5 ++--- writerfilter/source/dmapper/ConversionHelper.hxx | 4 +++- writerfilter/source/dmapper/DomainMapper.cxx | 12 ++++++------ writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 2 +- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 14 ++++++++------ writerfilter/source/dmapper/FormControlHelper.cxx | 2 +- writerfilter/source/dmapper/GraphicHelpers.cxx | 5 ++--- writerfilter/source/dmapper/GraphicHelpers.hxx | 3 ++- writerfilter/source/dmapper/GraphicImport.cxx | 8 ++++---- writerfilter/source/dmapper/OLEHandler.cxx | 4 ++-- writerfilter/source/dmapper/OLEHandler.hxx | 4 ++-- writerfilter/source/dmapper/PropertyMap.cxx | 4 ++-- writerfilter/source/dmapper/PropertyMap.hxx | 7 ++++--- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 2 +- writerfilter/source/rtftok/rtfdocumentimpl.hxx | 3 ++- writerfilter/source/rtftok/rtfsdrimport.cxx | 2 +- 16 files changed, 43 insertions(+), 38 deletions(-) (limited to 'writerfilter/source') diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx index 805bac53d2e0..7560a8ff9ef5 100644 --- a/writerfilter/source/dmapper/ConversionHelper.cxx +++ b/writerfilter/source/dmapper/ConversionHelper.cxx @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -424,9 +423,9 @@ sal_uInt32 convertTwipToMM100Unsigned(sal_Int32 _t) return convertTwipToMM100( _t ); } -sal_Int16 convertRubyAlign( sal_Int32 nIntValue ) +text::RubyAdjust convertRubyAlign( sal_Int32 nIntValue ) { - sal_Int16 rubyAdjust = text::RubyAdjust_LEFT; + text::RubyAdjust rubyAdjust = text::RubyAdjust_LEFT; switch( nIntValue ) { case NS_ooxml::LN_Value_ST_RubyAlign_center: diff --git a/writerfilter/source/dmapper/ConversionHelper.hxx b/writerfilter/source/dmapper/ConversionHelper.hxx index faf5c27d234a..25ca7f8b8ce9 100644 --- a/writerfilter/source/dmapper/ConversionHelper.hxx +++ b/writerfilter/source/dmapper/ConversionHelper.hxx @@ -23,6 +23,8 @@ #include #include #include +#include + namespace com{ namespace sun{ namespace star{ namespace lang{ struct Locale; @@ -47,7 +49,7 @@ namespace ConversionHelper{ SAL_DLLPUBLIC_EXPORT sal_Int32 convertTwipToMM100(sal_Int32 _t); SAL_DLLPUBLIC_EXPORT sal_uInt32 convertTwipToMM100Unsigned(sal_Int32 _t); sal_Int16 convertTableJustification( sal_Int32 nIntValue ); - sal_Int16 convertRubyAlign( sal_Int32 nIntValue ); + css::text::RubyAdjust convertRubyAlign( sal_Int32 nIntValue ); sal_Int16 ConvertNumberingType(sal_Int32 nFmt); css::util::DateTime ConvertDateStringToDateTime(const OUString& rDateTime); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 2c44cbbc141f..4e3ff7676b5e 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1773,7 +1773,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) /* 0 HoriLR 1 Vert TR 2 Vert TR 3 Vert TT 4 HoriLT only 0 and 1 can be imported correctly */ - sal_Int16 nDirection = text::WritingMode_LR_TB; + text::WritingMode nDirection = text::WritingMode_LR_TB; switch( nIntValue ) { case NS_ooxml::LN_Value_ST_TextDirection_lrTb: @@ -2726,7 +2726,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) { rContext->Insert(PROP_RUBY_TEXT, uno::makeAny(aInfo.sRubyText)); rContext->Insert(PROP_RUBY_STYLE, uno::makeAny(aInfo.sRubyStyle)); - rContext->Insert(PROP_RUBY_ADJUST, uno::makeAny(ConversionHelper::convertRubyAlign(aInfo.nRubyAlign))); + rContext->Insert(PROP_RUBY_ADJUST, uno::makeAny(ConversionHelper::convertRubyAlign(aInfo.nRubyAlign))); m_pImpl->SetRubySprmId(0); } } @@ -3498,8 +3498,8 @@ void DomainMapper::handleUnderlineType(const Id nId, const ::std::shared_ptr& rContext, const bool bExchangeLeftRight) { - sal_Int16 nAdjust = 0; - sal_Int16 nLastLineAdjust = 0; + style::ParagraphAdjust nAdjust = style::ParagraphAdjust_LEFT; + style::ParagraphAdjust nLastLineAdjust = style::ParagraphAdjust_LEFT; OUString aStringValue = "left"; switch(nIntValue) { @@ -3509,7 +3509,7 @@ void DomainMapper::handleParaJustification(const sal_Int32 nIntValue, const ::st break; case NS_ooxml::LN_Value_ST_Jc_right: case NS_ooxml::LN_Value_ST_Jc_end: - nAdjust = static_cast< sal_Int16 > (bExchangeLeftRight ? style::ParagraphAdjust_LEFT : style::ParagraphAdjust_RIGHT); + nAdjust = bExchangeLeftRight ? style::ParagraphAdjust_LEFT : style::ParagraphAdjust_RIGHT; aStringValue = "right"; break; case 4: @@ -3522,7 +3522,7 @@ void DomainMapper::handleParaJustification(const sal_Int32 nIntValue, const ::st case NS_ooxml::LN_Value_ST_Jc_left: case NS_ooxml::LN_Value_ST_Jc_start: default: - nAdjust = static_cast< sal_Int16 > (bExchangeLeftRight ? style::ParagraphAdjust_RIGHT : style::ParagraphAdjust_LEFT); + nAdjust = bExchangeLeftRight ? style::ParagraphAdjust_RIGHT : style::ParagraphAdjust_LEFT; break; } rContext->Insert( PROP_PARA_ADJUST, uno::makeAny( nAdjust ) ); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 2c33391d9c7b..c4d26e514429 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -824,7 +824,7 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl { // btLr, so map ParagraphAdjust_CENTER to VertOrientation::CENTER. uno::Reference xPropertySet(m_aTableRanges[nRow][nCell][0], uno::UNO_QUERY); - if (xPropertySet->getPropertyValue("ParaAdjust").get() == style::ParagraphAdjust_CENTER) + if (xPropertySet->getPropertyValue("ParaAdjust").get() == (sal_Int16)style::ParagraphAdjust_CENTER) (*aCellIterator)->Insert(PROP_VERT_ORIENT, uno::makeAny(text::VertOrientation::CENTER)); } (*aCellIterator)->Erase(PROP_CELL_DIRECTION); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 0238820a2e12..9042e341afb2 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -916,10 +916,12 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) rAppendContext.pLastParagraphProperties->GetvAnchor() : pStyleProperties->GetvAnchor() >= 0 ? pStyleProperties->GetvAnchor() : text::RelOrientation::FRAME ))); - aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_SURROUND), text::WrapTextMode( - rAppendContext.pLastParagraphProperties->GetWrap() >= 0 ? - rAppendContext.pLastParagraphProperties->GetWrap() : - pStyleProperties->GetWrap() >= 0 ? pStyleProperties->GetWrap() : 0 ))); + aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_SURROUND), + rAppendContext.pLastParagraphProperties->GetWrap() >= text::WrapTextMode_NONE + ? rAppendContext.pLastParagraphProperties->GetWrap() + : pStyleProperties->GetWrap() >= text::WrapTextMode_NONE + ? pStyleProperties->GetWrap() + : text::WrapTextMode_NONE )); /** FDO#73546 : distL & distR should be unsigned integers Swapped the array elements 11,12 & 13,14 since 11 & 12 are @@ -1012,7 +1014,7 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) if( rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 ) aFrameProperties.push_back(comphelper::makePropertyValue("VertOrientRelation", sal_Int16(rAppendContext.pLastParagraphProperties->GetvAnchor()))); - if( rAppendContext.pLastParagraphProperties->GetWrap() >= 0 ) + if( rAppendContext.pLastParagraphProperties->GetWrap() >= text::WrapTextMode_NONE ) aFrameProperties.push_back(comphelper::makePropertyValue("Surround", text::WrapTextMode(rAppendContext.pLastParagraphProperties->GetWrap()))); lcl_MoveBorderPropertiesToFrame(aFrameProperties, @@ -3099,7 +3101,7 @@ void DomainMapper_Impl::handleRubyEQField( const FieldContextPtr& pContext) pCharContext->InsertProps(m_pLastCharacterContext); pCharContext->InsertProps(pContext->getProperties()); pCharContext->Insert(PROP_RUBY_TEXT, uno::makeAny( aInfo.sRubyText ) ); - pCharContext->Insert(PROP_RUBY_ADJUST, uno::makeAny(ConversionHelper::convertRubyAlign(aInfo.nRubyAlign))); + pCharContext->Insert(PROP_RUBY_ADJUST, uno::makeAny(ConversionHelper::convertRubyAlign(aInfo.nRubyAlign))); pCharContext->Insert(PROP_RUBY_STYLE, uno::makeAny(aInfo.sRubyStyle)); appendTextPortion(sPart2, pCharContext); } diff --git a/writerfilter/source/dmapper/FormControlHelper.cxx b/writerfilter/source/dmapper/FormControlHelper.cxx index f4efa9011ed5..13e64697f6b0 100644 --- a/writerfilter/source/dmapper/FormControlHelper.cxx +++ b/writerfilter/source/dmapper/FormControlHelper.cxx @@ -307,7 +307,7 @@ void FormControlHelper::insertControl(uno::Reference const& xT uno::Reference xShapeProps(xShape, uno::UNO_QUERY); - sal_uInt16 nTmp = text::TextContentAnchorType_AS_CHARACTER; + sal_uInt16 nTmp = (sal_uInt16)text::TextContentAnchorType_AS_CHARACTER; xShapeProps->setPropertyValue("AnchorType", uno::makeAny(nTmp)); nTmp = text::VertOrientation::CENTER; diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx b/writerfilter/source/dmapper/GraphicHelpers.cxx index 8c4dd9c5aed8..6be0cfa27c67 100644 --- a/writerfilter/source/dmapper/GraphicHelpers.cxx +++ b/writerfilter/source/dmapper/GraphicHelpers.cxx @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -211,11 +210,11 @@ void WrapHandler::lcl_sprm( Sprm& ) { } -sal_Int32 WrapHandler::getWrapMode( ) +text::WrapTextMode WrapHandler::getWrapMode( ) { // The wrap values do not map directly to our wrap mode, // e.g. none in .docx actually means through in LO. - sal_Int32 nMode = text::WrapTextMode_THROUGHT; + text::WrapTextMode nMode = text::WrapTextMode_THROUGHT; switch ( m_nType ) { diff --git a/writerfilter/source/dmapper/GraphicHelpers.hxx b/writerfilter/source/dmapper/GraphicHelpers.hxx index 0911992a4d73..58a24cc5ce20 100644 --- a/writerfilter/source/dmapper/GraphicHelpers.hxx +++ b/writerfilter/source/dmapper/GraphicHelpers.hxx @@ -21,6 +21,7 @@ #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_GRAPHICHELPERS_HXX #include "LoggedResources.hxx" +#include #include #include @@ -58,7 +59,7 @@ public: sal_Int32 m_nType; sal_Int32 m_nSide; - sal_Int32 getWrapMode( ); + css::text::WrapTextMode getWrapMode( ); private: virtual void lcl_attribute( Id aName, Value& rVal ) override; diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 564221979261..55c4342368d1 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -199,7 +199,7 @@ public: bool bPageToggle; sal_Int16 nVertOrient; sal_Int16 nVertRelation; - sal_Int32 nWrap; + text::WrapTextMode nWrap; bool bLayoutInCell; bool bOpaque; bool bContour; @@ -269,7 +269,7 @@ public: ,bPageToggle( false ) ,nVertOrient( text::VertOrientation::NONE ) ,nVertRelation( text::RelOrientation::FRAME ) - ,nWrap(0) + ,nWrap(text::WrapTextMode_NONE) ,bLayoutInCell(false) ,bOpaque( true ) ,bContour(false) @@ -842,7 +842,7 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) m_pImpl->applyMargins(xShapeProps); bool bOpaque = m_pImpl->bOpaque && !m_pImpl->rDomainMapper.IsInHeaderFooter(); xShapeProps->setPropertyValue("Opaque", uno::makeAny(bOpaque)); - xShapeProps->setPropertyValue("Surround", uno::makeAny(m_pImpl->nWrap)); + xShapeProps->setPropertyValue("Surround", uno::makeAny(m_pImpl->nWrap)); m_pImpl->applyZOrder(xShapeProps); m_pImpl->applyName(xShapeProps); @@ -1264,7 +1264,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b uno::makeAny(bOpaque)); } xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_SURROUND ), - uno::makeAny(m_pImpl->nWrap)); + uno::makeAny(m_pImpl->nWrap)); if( m_pImpl->rDomainMapper.IsInTable() && m_pImpl->bLayoutInCell && m_pImpl->nWrap != text::WrapTextMode_THROUGHT ) xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_FOLLOW_TEXT_FLOW ), uno::makeAny(true)); diff --git a/writerfilter/source/dmapper/OLEHandler.cxx b/writerfilter/source/dmapper/OLEHandler.cxx index 194d1d3b1113..c4ffbfb301e6 100644 --- a/writerfilter/source/dmapper/OLEHandler.cxx +++ b/writerfilter/source/dmapper/OLEHandler.cxx @@ -57,7 +57,7 @@ OLEHandler::OLEHandler(DomainMapper& rDomainMapper) : LoggedProperties("OLEHandler"), m_nDxaOrig(0), m_nDyaOrig(0), - m_nWrapMode(1), + m_nWrapMode(text::WrapTextMode_THROUGHT), m_rDomainMapper(rDomainMapper) { } @@ -165,7 +165,7 @@ void OLEHandler::lcl_sprm(Sprm & rSprm) xShapeProps->setPropertyValue( getPropertyName( PROP_SURROUND ), - uno::makeAny( m_nWrapMode ) ); + uno::makeAny( (sal_Int32)m_nWrapMode ) ); // Through shapes in the header or footer(that spill into the body) should be in the background. // It is just assumed that all shapes will spill into the body. diff --git a/writerfilter/source/dmapper/OLEHandler.hxx b/writerfilter/source/dmapper/OLEHandler.hxx index 268138dcbbcd..c51217a924b0 100644 --- a/writerfilter/source/dmapper/OLEHandler.hxx +++ b/writerfilter/source/dmapper/OLEHandler.hxx @@ -23,8 +23,8 @@ #include #include #include - #include +#include namespace com{ namespace sun{ namespace star{ namespace graphic{ @@ -60,7 +60,7 @@ class OLEHandler : public LoggedProperties sal_Int32 m_nDxaOrig; sal_Int32 m_nDyaOrig; - sal_Int32 m_nWrapMode; + css::text::WrapTextMode m_nWrapMode; css::uno::Reference m_xShape; diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index c4edba3d18ca..af073bd5b758 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1554,7 +1554,7 @@ ParagraphProperties::ParagraphProperties() : m_nLines(0), m_w(-1), m_h(-1), - m_nWrap(-1), + m_nWrap((text::WrapTextMode)-1), m_hAnchor(-1), m_vAnchor(-1), m_x(-1), @@ -1634,7 +1634,7 @@ void ParagraphProperties::ResetFrameProperties() m_nLines = 0; m_w = -1; m_h = -1; - m_nWrap = -1; + m_nWrap = (text::WrapTextMode)-1; m_hAnchor = -1; m_vAnchor = -1; m_x = -1; diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx index 7e6a1365bcab..48c4f47716db 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "PropertyIds.hxx" #include @@ -354,7 +355,7 @@ class ParagraphProperties sal_Int32 m_nLines; //number of lines of the drop cap sal_Int32 m_w; //width sal_Int32 m_h; //height - sal_Int32 m_nWrap; // from ST_Wrap around, auto, none, notBeside, through, tight + css::text::WrapTextMode m_nWrap; // from ST_Wrap around, auto, none, notBeside, through, tight sal_Int32 m_hAnchor; // page, from ST_HAnchor margin, page, text sal_Int32 m_vAnchor; // around from ST_VAnchor margin, page, text sal_Int32 m_x; //x-position @@ -397,8 +398,8 @@ public: void Seth( sal_Int32 nSet ) { m_h = nSet; } sal_Int32 Geth() const { return m_h; } - void SetWrap( sal_Int32 nSet ) { m_nWrap = nSet; } - sal_Int32 GetWrap() const { return m_nWrap; } + void SetWrap( css::text::WrapTextMode nSet ) { m_nWrap = nSet; } + css::text::WrapTextMode GetWrap() const { return m_nWrap; } void SethAnchor( sal_Int32 nSet ) { m_hAnchor = nSet; } sal_Int32 GethAnchor() const { return m_hAnchor;} diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index e48645c23547..598175806400 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -3272,7 +3272,7 @@ RTFShape::RTFShape() nVertOrientRelation(0), nHoriOrientRelationToken(0), nVertOrientRelationToken(0), - nWrap(-1), + nWrap((text::WrapTextMode)-1), bInBackground(false) { } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index eb688896b6f9..34ba2750a685 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -146,7 +147,7 @@ public: sal_Int16 nVertOrientRelation; ///< Vertical text::RelOrientation for drawinglayer shapes. sal_uInt32 nHoriOrientRelationToken; ///< Horizontal dmapper token for Writer pictures. sal_uInt32 nVertOrientRelationToken; ///< Vertical dmapper token for Writer pictures. - int nWrap; + css::text::WrapTextMode nWrap; /// If shape is below text (true) or text is below shape (false). bool bInBackground; /// Wrap polygon, written by RTFSdrImport::resolve(), read by RTFDocumentImpl::resolvePict(). diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index fa05c83e9e02..28ef52f8bfa3 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -958,7 +958,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap xPropertySet->setPropertyValue("HoriOrientRelation", uno::makeAny(rShape.nHoriOrientRelation)); if (rShape.nVertOrientRelation != 0) xPropertySet->setPropertyValue("VertOrientRelation", uno::makeAny(rShape.nVertOrientRelation)); - if (rShape.nWrap != -1) + if (rShape.nWrap != (text::WrapTextMode)-1) xPropertySet->setPropertyValue("Surround", uno::makeAny(text::WrapTextMode(rShape.nWrap))); oox::ModelObjectHelper aModelObjectHelper(m_rImport.getModelFactory()); if (aFillModel.moType.has()) -- cgit