diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-05-17 21:42:12 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-05-20 10:06:39 +0200 |
commit | 558c6c1161e52f2c5048407fde08c80df9c2186a (patch) | |
tree | 2973e3687135d1edbaa25c0961a1685233bec292 /writerfilter/source/rtftok | |
parent | 26c291686ac646beca59b10c692c92fb4a7af37f (diff) |
writerfilter: make RTFParserState members private, part 5
Change-Id: Iecab0f89283d182eb51329bb8e8281bedd57950c
Reviewed-on: https://gerrit.libreoffice.org/72558
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter/source/rtftok')
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchdestination.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchflag.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchvalue.cxx | 46 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 146 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 7 |
5 files changed, 112 insertions, 105 deletions
diff --git a/writerfilter/source/rtftok/rtfdispatchdestination.cxx b/writerfilter/source/rtftok/rtfdispatchdestination.cxx index a855f1c99510..9c65e1317bbf 100644 --- a/writerfilter/source/rtftok/rtfdispatchdestination.cxx +++ b/writerfilter/source/rtftok/rtfdispatchdestination.cxx @@ -362,7 +362,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) case RTF_DPTXBXTEXT: { bool bPictureFrame = false; - for (auto& rProperty : m_aStates.top().aShape.getProperties()) + for (auto& rProperty : m_aStates.top().getShape().getProperties()) { if (rProperty.first == "shapeType" && rProperty.second == OUString::number(ESCHER_ShpInst_PictureFrame)) @@ -383,11 +383,11 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) if (nKeyword == RTF_SHPTXT) { if (!m_aStates.top().getCurrentBuffer()) - m_pSdrImport->resolve(m_aStates.top().aShape, false, + m_pSdrImport->resolve(m_aStates.top().getShape(), false, RTFSdrImport::SHAPE); else { - auto pValue = new RTFValue(m_aStates.top().aShape); + auto pValue = new RTFValue(m_aStates.top().getShape()); m_aStates.top().getCurrentBuffer()->push_back( Buf_t(BUFFER_STARTSHAPE, pValue, nullptr)); } diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx index ff45f0b93ef2..d51ec80bdfae 100644 --- a/writerfilter/source/rtftok/rtfdispatchflag.cxx +++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx @@ -847,10 +847,10 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // Noop, this is the default in Writer. break; case RTF_PNGBLIP: - m_aStates.top().aPicture.eStyle = RTFBmpStyle::PNG; + m_aStates.top().getPicture().eStyle = RTFBmpStyle::PNG; break; case RTF_JPEGBLIP: - m_aStates.top().aPicture.eStyle = RTFBmpStyle::JPEG; + m_aStates.top().getPicture().eStyle = RTFBmpStyle::JPEG; break; case RTF_POSYT: m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign, @@ -1107,13 +1107,13 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } break; case RTF_SHPBXPAGE: - m_aStates.top().aShape.setHoriOrientRelation(text::RelOrientation::PAGE_FRAME); - m_aStates.top().aShape.setHoriOrientRelationToken( + m_aStates.top().getShape().setHoriOrientRelation(text::RelOrientation::PAGE_FRAME); + m_aStates.top().getShape().setHoriOrientRelationToken( NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page); break; case RTF_SHPBYPAGE: - m_aStates.top().aShape.setVertOrientRelation(text::RelOrientation::PAGE_FRAME); - m_aStates.top().aShape.setVertOrientRelationToken( + m_aStates.top().getShape().setVertOrientRelation(text::RelOrientation::PAGE_FRAME); + m_aStates.top().getShape().setVertOrientRelationToken( NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page); break; case RTF_DPLINEHOLLOW: diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index 2d8f901845ed..bce3a1cf44d6 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -758,34 +758,34 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) // Ignore this for now, the exporter always emits it with a zero parameter. break; case RTF_PICSCALEX: - m_aStates.top().aPicture.nScaleX = nParam; + m_aStates.top().getPicture().nScaleX = nParam; break; case RTF_PICSCALEY: - m_aStates.top().aPicture.nScaleY = nParam; + m_aStates.top().getPicture().nScaleY = nParam; break; case RTF_PICW: - m_aStates.top().aPicture.nWidth = nParam; + m_aStates.top().getPicture().nWidth = nParam; break; case RTF_PICH: - m_aStates.top().aPicture.nHeight = nParam; + m_aStates.top().getPicture().nHeight = nParam; break; case RTF_PICWGOAL: - m_aStates.top().aPicture.nGoalWidth = convertTwipToMm100(nParam); + m_aStates.top().getPicture().nGoalWidth = convertTwipToMm100(nParam); break; case RTF_PICHGOAL: - m_aStates.top().aPicture.nGoalHeight = convertTwipToMm100(nParam); + m_aStates.top().getPicture().nGoalHeight = convertTwipToMm100(nParam); break; case RTF_PICCROPL: - m_aStates.top().aPicture.nCropL = convertTwipToMm100(nParam); + m_aStates.top().getPicture().nCropL = convertTwipToMm100(nParam); break; case RTF_PICCROPR: - m_aStates.top().aPicture.nCropR = convertTwipToMm100(nParam); + m_aStates.top().getPicture().nCropR = convertTwipToMm100(nParam); break; case RTF_PICCROPT: - m_aStates.top().aPicture.nCropT = convertTwipToMm100(nParam); + m_aStates.top().getPicture().nCropT = convertTwipToMm100(nParam); break; case RTF_PICCROPB: - m_aStates.top().aPicture.nCropB = convertTwipToMm100(nParam); + m_aStates.top().getPicture().nCropB = convertTwipToMm100(nParam); break; case RTF_SHPWRK: { @@ -822,23 +822,23 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) switch (nParam) { case 1: - m_aStates.top().aShape.setWrap(text::WrapTextMode_NONE); + m_aStates.top().getShape().setWrap(text::WrapTextMode_NONE); break; case 2: - m_aStates.top().aShape.setWrap(text::WrapTextMode_PARALLEL); + m_aStates.top().getShape().setWrap(text::WrapTextMode_PARALLEL); break; case 3: - m_aStates.top().aShape.setWrap(text::WrapTextMode_THROUGH); + m_aStates.top().getShape().setWrap(text::WrapTextMode_THROUGH); m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_WrapType_wrapNone, new RTFValue()); break; case 4: - m_aStates.top().aShape.setWrap(text::WrapTextMode_PARALLEL); + m_aStates.top().getShape().setWrap(text::WrapTextMode_PARALLEL); m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_WrapType_wrapTight, new RTFValue()); break; case 5: - m_aStates.top().aShape.setWrap(text::WrapTextMode_THROUGH); + m_aStates.top().getShape().setWrap(text::WrapTextMode_THROUGH); break; } } @@ -1060,19 +1060,19 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } break; case RTF_SHPLEFT: - m_aStates.top().aShape.setLeft(convertTwipToMm100(nParam)); + m_aStates.top().getShape().setLeft(convertTwipToMm100(nParam)); break; case RTF_SHPTOP: - m_aStates.top().aShape.setTop(convertTwipToMm100(nParam)); + m_aStates.top().getShape().setTop(convertTwipToMm100(nParam)); break; case RTF_SHPRIGHT: - m_aStates.top().aShape.setRight(convertTwipToMm100(nParam)); + m_aStates.top().getShape().setRight(convertTwipToMm100(nParam)); break; case RTF_SHPBOTTOM: - m_aStates.top().aShape.setBottom(convertTwipToMm100(nParam)); + m_aStates.top().getShape().setBottom(convertTwipToMm100(nParam)); break; case RTF_SHPZ: - m_aStates.top().aShape.setZ(nParam); + m_aStates.top().getShape().setZ(nParam); break; case RTF_FFTYPE: switch (nParam) @@ -1195,7 +1195,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_FLYANCHOR: break; case RTF_WMETAFILE: - m_aStates.top().aPicture.eWMetafile = nParam; + m_aStates.top().getPicture().eWMetafile = nParam; break; case RTF_SB: putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, @@ -1383,7 +1383,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; case RTF_SHPFBLWTXT: // Shape is below text -> send it to the background. - m_aStates.top().aShape.setInBackground(nParam != 0); + m_aStates.top().getShape().setInBackground(nParam != 0); break; case RTF_CLPADB: case RTF_CLPADL: @@ -1577,7 +1577,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } break; case RTF_DIBITMAP: - m_aStates.top().aPicture.eStyle = RTFBmpStyle::DIBITMAP; + m_aStates.top().getPicture().eStyle = RTFBmpStyle::DIBITMAP; break; case RTF_TRWWIDTHA: m_aStates.top().setTableRowWidthAfter(nParam); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 62ffed2ef54b..2455ef579a18 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -878,7 +878,7 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS return; SvMemoryStream aDIBStream; - if (m_aStates.top().aPicture.eStyle == RTFBmpStyle::DIBITMAP) + if (m_aStates.top().getPicture().eStyle == RTFBmpStyle::DIBITMAP) { // Construct a BITMAPFILEHEADER structure before the real data. SvStream& rBodyStream = *pStream; @@ -899,12 +899,12 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS pStream->Seek(0); uno::Reference<io::XInputStream> xInputStream(new utl::OInputStreamWrapper(pStream)); WmfExternal aExtHeader; - aExtHeader.mapMode = m_aStates.top().aPicture.eWMetafile; + aExtHeader.mapMode = m_aStates.top().getPicture().eWMetafile; aExtHeader.xExt = sal_uInt16( - std::clamp<sal_Int32>(m_aStates.top().aPicture.nWidth, 0, + std::clamp<sal_Int32>(m_aStates.top().getPicture().nWidth, 0, SAL_MAX_UINT16)); //TODO: better way to handle out-of-bounds values? aExtHeader.yExt = sal_uInt16( - std::clamp<sal_Int32>(m_aStates.top().aPicture.nHeight, 0, + std::clamp<sal_Int32>(m_aStates.top().getPicture().nHeight, 0, SAL_MAX_UINT16)); //TODO: better way to handle out-of-bounds values? WmfExternal* pExtHeader = &aExtHeader; uno::Reference<lang::XServiceInfo> xServiceInfo(m_aStates.top().getDrawingObject().getShape(), @@ -915,7 +915,7 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS uno::Reference<graphic::XGraphic> xGraphic = m_pGraphicHelper->importGraphic(xInputStream, pExtHeader); - if (m_aStates.top().aPicture.eStyle != RTFBmpStyle::NONE) + if (m_aStates.top().getPicture().eStyle != RTFBmpStyle::NONE) { // In case of PNG/JPEG, the real size is known, don't use the values // provided by picw and pich. @@ -927,8 +927,8 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, aMap); else aSize = OutputDevice::LogicToLogic(aSize, aGraphic.GetPrefMapMode(), aMap); - m_aStates.top().aPicture.nWidth = aSize.Width(); - m_aStates.top().aPicture.nHeight = aSize.Height(); + m_aStates.top().getPicture().nWidth = aSize.Width(); + m_aStates.top().getPicture().nHeight = aSize.Height(); } // Wrap it in an XShape. @@ -972,10 +972,12 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS { // Set the object size awt::Size aSize; - aSize.Width = (m_aStates.top().aPicture.nGoalWidth ? m_aStates.top().aPicture.nGoalWidth - : m_aStates.top().aPicture.nWidth); - aSize.Height = (m_aStates.top().aPicture.nGoalHeight ? m_aStates.top().aPicture.nGoalHeight - : m_aStates.top().aPicture.nHeight); + aSize.Width + = (m_aStates.top().getPicture().nGoalWidth ? m_aStates.top().getPicture().nGoalWidth + : m_aStates.top().getPicture().nWidth); + aSize.Height + = (m_aStates.top().getPicture().nGoalHeight ? m_aStates.top().getPicture().nGoalHeight + : m_aStates.top().getPicture().nHeight); xShape->setSize(aSize); // Replacement graphic is inline by default, see oox::vml::SimpleShape::implConvertAndInsert(). @@ -1017,23 +1019,25 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS // extent sprm RTFSprms aExtentAttributes; int nXExt, nYExt; - nXExt = (m_aStates.top().aPicture.nGoalWidth ? m_aStates.top().aPicture.nGoalWidth - : m_aStates.top().aPicture.nWidth); - nYExt = (m_aStates.top().aPicture.nGoalHeight ? m_aStates.top().aPicture.nGoalHeight - : m_aStates.top().aPicture.nHeight); - if (m_aStates.top().aPicture.nScaleX != 100) - nXExt = (static_cast<long>(m_aStates.top().aPicture.nScaleX) - * (nXExt - (m_aStates.top().aPicture.nCropL + m_aStates.top().aPicture.nCropR))) + nXExt = (m_aStates.top().getPicture().nGoalWidth ? m_aStates.top().getPicture().nGoalWidth + : m_aStates.top().getPicture().nWidth); + nYExt = (m_aStates.top().getPicture().nGoalHeight ? m_aStates.top().getPicture().nGoalHeight + : m_aStates.top().getPicture().nHeight); + if (m_aStates.top().getPicture().nScaleX != 100) + nXExt = (static_cast<long>(m_aStates.top().getPicture().nScaleX) + * (nXExt + - (m_aStates.top().getPicture().nCropL + m_aStates.top().getPicture().nCropR))) / 100L; - if (m_aStates.top().aPicture.nScaleY != 100) - nYExt = (static_cast<long>(m_aStates.top().aPicture.nScaleY) - * (nYExt - (m_aStates.top().aPicture.nCropT + m_aStates.top().aPicture.nCropB))) + if (m_aStates.top().getPicture().nScaleY != 100) + nYExt = (static_cast<long>(m_aStates.top().getPicture().nScaleY) + * (nYExt + - (m_aStates.top().getPicture().nCropT + m_aStates.top().getPicture().nCropB))) / 100L; if (m_aStates.top().getInShape()) { // Picture in shape: it looks like pib picture, so we will stretch the picture to shape size (tdf#49893) - nXExt = m_aStates.top().aShape.getRight() - m_aStates.top().aShape.getLeft(); - nYExt = m_aStates.top().aShape.getBottom() - m_aStates.top().aShape.getTop(); + nXExt = m_aStates.top().getShape().getRight() - m_aStates.top().getShape().getLeft(); + nYExt = m_aStates.top().getShape().getBottom() - m_aStates.top().getShape().getTop(); } auto pXExtValue = new RTFValue(oox::drawingml::convertHmmToEmu(nXExt)); auto pYExtValue = new RTFValue(oox::drawingml::convertHmmToEmu(nYExt)); @@ -1066,9 +1070,9 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS { // wrap sprm RTFSprms aAnchorWrapAttributes; - m_aStates.top().aShape.getAnchorAttributes().set( + m_aStates.top().getShape().getAnchorAttributes().set( NS_ooxml::LN_CT_Anchor_behindDoc, - new RTFValue((m_aStates.top().aShape.getInBackground()) ? 1 : 0)); + new RTFValue((m_aStates.top().getShape().getInBackground()) ? 1 : 0)); RTFSprms aAnchorSprms; for (auto& rCharacterAttribute : m_aStates.top().aCharacterAttributes) { @@ -1085,20 +1089,20 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS // If there is a wrap polygon prepared by RTFSdrImport, pick it up here. if (rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapTight - && !m_aStates.top().aShape.getWrapPolygonSprms().empty()) + && !m_aStates.top().getShape().getWrapPolygonSprms().empty()) rCharacterSprm.second->getSprms().set( NS_ooxml::LN_CT_WrapTight_wrapPolygon, - new RTFValue(RTFSprms(), m_aStates.top().aShape.getWrapPolygonSprms())); + new RTFValue(RTFSprms(), m_aStates.top().getShape().getWrapPolygonSprms())); aAnchorSprms.set(rCharacterSprm.first, rCharacterSprm.second); } } - if (m_aStates.top().aShape.getWrapSprm().first != 0) + if (m_aStates.top().getShape().getWrapSprm().first != 0) // Replay of a buffered shape, wrap sprm there has priority over // character sprms of the current state. - aAnchorSprms.set(m_aStates.top().aShape.getWrapSprm().first, - m_aStates.top().aShape.getWrapSprm().second); + aAnchorSprms.set(m_aStates.top().getShape().getWrapSprm().first, + m_aStates.top().getShape().getWrapSprm().second); aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_extent, pExtentValue); if (!aAnchorWrapAttributes.empty() && nWrap == -1) @@ -1108,14 +1112,15 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS // See OOXMLFastContextHandler::positionOffset(), we can't just put offset values in an RTFValue. RTFSprms aPoshAttributes; RTFSprms aPoshSprms; - if (m_aStates.top().aShape.getHoriOrientRelationToken() > 0) - aPoshAttributes.set(NS_ooxml::LN_CT_PosH_relativeFrom, - new RTFValue(m_aStates.top().aShape.getHoriOrientRelationToken())); - if (m_aStates.top().aShape.getLeft() != 0) - { - Mapper().positionOffset( - OUString::number(oox::drawingml::convertHmmToEmu(m_aStates.top().aShape.getLeft())), - /*bVertical=*/false); + if (m_aStates.top().getShape().getHoriOrientRelationToken() > 0) + aPoshAttributes.set( + NS_ooxml::LN_CT_PosH_relativeFrom, + new RTFValue(m_aStates.top().getShape().getHoriOrientRelationToken())); + if (m_aStates.top().getShape().getLeft() != 0) + { + Mapper().positionOffset(OUString::number(oox::drawingml::convertHmmToEmu( + m_aStates.top().getShape().getLeft())), + /*bVertical=*/false); aPoshSprms.set(NS_ooxml::LN_CT_PosH_posOffset, new RTFValue()); } aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionH, @@ -1123,14 +1128,15 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS RTFSprms aPosvAttributes; RTFSprms aPosvSprms; - if (m_aStates.top().aShape.getVertOrientRelationToken() > 0) - aPosvAttributes.set(NS_ooxml::LN_CT_PosV_relativeFrom, - new RTFValue(m_aStates.top().aShape.getVertOrientRelationToken())); - if (m_aStates.top().aShape.getTop() != 0) - { - Mapper().positionOffset( - OUString::number(oox::drawingml::convertHmmToEmu(m_aStates.top().aShape.getTop())), - /*bVertical=*/true); + if (m_aStates.top().getShape().getVertOrientRelationToken() > 0) + aPosvAttributes.set( + NS_ooxml::LN_CT_PosV_relativeFrom, + new RTFValue(m_aStates.top().getShape().getVertOrientRelationToken())); + if (m_aStates.top().getShape().getTop() != 0) + { + Mapper().positionOffset(OUString::number(oox::drawingml::convertHmmToEmu( + m_aStates.top().getShape().getTop())), + /*bVertical=*/true); aPosvSprms.set(NS_ooxml::LN_CT_PosV_posOffset, new RTFValue()); } aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionV, @@ -1139,7 +1145,7 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_docPr, pDocprValue); aAnchorSprms.set(NS_ooxml::LN_graphic_graphic, pGraphicValue); // anchor sprm - auto pValue = new RTFValue(m_aStates.top().aShape.getAnchorAttributes(), aAnchorSprms); + auto pValue = new RTFValue(m_aStates.top().getShape().getAnchorAttributes(), aAnchorSprms); aSprms.set(NS_ooxml::LN_anchor_anchor, pValue); } writerfilter::Reference<Properties>::Pointer_t pProperties @@ -1668,7 +1674,7 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, RTFSprms* const pSprms, // Set current shape during replay, needed by e.g. wrap in // background. - m_aStates.top().aShape = std::get<1>(aTuple)->getShape(); + m_aStates.top().getShape() = std::get<1>(aTuple)->getShape(); m_pSdrImport->resolve(std::get<1>(aTuple)->getShape(), true, RTFSdrImport::SHAPE); m_aStates.top().setCurrentBuffer(pCurrentBuffer); @@ -1684,7 +1690,7 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, RTFSprms* const pSprms, resolveSubstream(nPos, nId, aCustomMark); } else if (std::get<0>(aTuple) == BUFFER_PICTURE) - m_aStates.top().aPicture = std::get<1>(aTuple)->getPicture(); + m_aStates.top().getPicture() = std::get<1>(aTuple)->getPicture(); else if (std::get<0>(aTuple) == BUFFER_SETSTYLE) { if (!m_aStates.empty()) @@ -2311,24 +2317,24 @@ RTFError RTFDocumentImpl::popState() if (&m_aStates.top().getDestinationText() != m_aStates.top().getCurrentDestinationText()) break; // not for nested group - aState.aShape.getProperties().emplace_back( + aState.getShape().getProperties().emplace_back( m_aStates.top().getCurrentDestinationText()->makeStringAndClear(), OUString()); break; case Destination::SHAPEPROPERTYVALUE: - if (!aState.aShape.getProperties().empty()) + if (!aState.getShape().getProperties().empty()) { - aState.aShape.getProperties().back().second + aState.getShape().getProperties().back().second = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); if (m_aStates.top().getHadShapeText()) - m_pSdrImport->append(aState.aShape.getProperties().back().first, - aState.aShape.getProperties().back().second); + m_pSdrImport->append(aState.getShape().getProperties().back().first, + aState.getShape().getProperties().back().second); else if (aState.getInShapeGroup() && !aState.getInShape() - && aState.aShape.getProperties().back().first == "rotation") + && aState.getShape().getProperties().back().first == "rotation") { // Rotation should be applied on the groupshape itself, not on each shape. - aState.aShape.getGroupProperties().push_back( - aState.aShape.getProperties().back()); - aState.aShape.getProperties().pop_back(); + aState.getShape().getGroupProperties().push_back( + aState.getShape().getProperties().back()); + aState.getShape().getProperties().pop_back(); } } break; @@ -2347,16 +2353,16 @@ RTFError RTFDocumentImpl::popState() = (aState.eDestination == Destination::SHAPEINSTRUCTION) ? RTFSdrImport::SHAPE : RTFSdrImport::PICT; if (!m_aStates.top().getCurrentBuffer() || eType != RTFSdrImport::SHAPE) - m_pSdrImport->resolve(m_aStates.top().aShape, true, eType); + m_pSdrImport->resolve(m_aStates.top().getShape(), true, eType); else { // Shape inside table: buffer the import to have correct anchor position. // Also buffer the RTFPicture of the state stack as it contains // the shape size. - auto pPictureValue = new RTFValue(m_aStates.top().aPicture); + auto pPictureValue = new RTFValue(m_aStates.top().getPicture()); m_aStates.top().getCurrentBuffer()->push_back( Buf_t(BUFFER_PICTURE, pPictureValue, nullptr)); - auto pValue = new RTFValue(m_aStates.top().aShape); + auto pValue = new RTFValue(m_aStates.top().getShape()); // Buffer wrap type. for (auto& rCharacterSprm : m_aStates.top().aCharacterSprms) @@ -2364,7 +2370,7 @@ RTFError RTFDocumentImpl::popState() if (rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapNone || rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapTight) { - m_aStates.top().aShape.getWrapSprm() = rCharacterSprm; + m_aStates.top().getShape().getWrapSprm() = rCharacterSprm; break; } } @@ -2376,9 +2382,9 @@ RTFError RTFDocumentImpl::popState() else if (aState.getInShapeGroup() && !aState.getInShape()) { // End of a groupshape, as we're in shapegroup, but not in a real shape. - for (auto& rGroupProperty : aState.aShape.getGroupProperties()) + for (auto& rGroupProperty : aState.getShape().getGroupProperties()) m_pSdrImport->appendGroupProperty(rGroupProperty.first, rGroupProperty.second); - aState.aShape.getGroupProperties().clear(); + aState.getShape().getGroupProperties().clear(); } break; case Destination::BOOKMARKSTART: @@ -3353,7 +3359,7 @@ RTFError RTFDocumentImpl::popState() case Destination::SHAPEPROPERTYVALUEPICT: if (!m_aStates.empty()) { - m_aStates.top().aPicture = aState.aPicture; + m_aStates.top().getPicture() = aState.getPicture(); // both \sp and \sv are destinations, copy the text up-ward for later m_aStates.top().getDestinationText() = aState.getDestinationText(); } @@ -3367,8 +3373,8 @@ RTFError RTFDocumentImpl::popState() case Destination::SHAPEPROPERTY: if (!m_aStates.empty()) { - m_aStates.top().aShape = aState.aShape; - m_aStates.top().aPicture = aState.aPicture; + m_aStates.top().getShape() = aState.getShape(); + m_aStates.top().getPicture() = aState.getPicture(); m_aStates.top().aCharacterAttributes = aState.aCharacterAttributes; } break; @@ -3377,8 +3383,8 @@ RTFError RTFDocumentImpl::popState() { // Shape instruction inside other shape instruction: just copy new shape settings: // it will be resolved on end of topmost shape instruction destination - m_aStates.top().aShape = aState.aShape; - m_aStates.top().aPicture = aState.aPicture; + m_aStates.top().getShape() = aState.getShape(); + m_aStates.top().getPicture() = aState.getPicture(); m_aStates.top().aCharacterSprms = aState.aCharacterSprms; m_aStates.top().aCharacterAttributes = aState.aCharacterAttributes; } @@ -3440,7 +3446,7 @@ RTFError RTFDocumentImpl::popState() default: { if (!m_aStates.empty() && m_aStates.top().eDestination == Destination::PICT) - m_aStates.top().aPicture = aState.aPicture; + m_aStates.top().getPicture() = aState.getPicture(); } break; } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 7c04f60793f6..c6738dcdbfac 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -481,6 +481,8 @@ public: RunType getRunType() const { return m_eRunType; } RTFFrame& getFrame() { return m_aFrame; } RTFDrawingObject& getDrawingObject() { return m_aDrawingObject; } + RTFShape& getShape() { return m_aShape; } + RTFPicture& getPicture() { return m_aPicture; } RTFDocumentImpl* m_pDocumentImpl; RTFInternalState nInternalState; @@ -529,10 +531,9 @@ public: /// If aLevelNumbers should be read at all. bool bLevelNumbersValid; - RTFPicture aPicture; - RTFShape aShape; - private: + RTFPicture m_aPicture; + RTFShape m_aShape; RTFDrawingObject m_aDrawingObject; RTFFrame m_aFrame; |