summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--writerfilter/source/rtftok/rtfdispatchflag.cxx134
-rw-r--r--writerfilter/source/rtftok/rtfdispatchsymbol.cxx2
-rw-r--r--writerfilter/source/rtftok/rtfdispatchvalue.cxx82
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx60
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx29
5 files changed, 159 insertions, 148 deletions
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index 870ab1e9cd27..ff45f0b93ef2 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -472,7 +472,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aCharacterAttributes = getDefaultState().aCharacterAttributes;
m_aStates.top().setCurrentCharacterStyleIndex(-1);
m_aStates.top().setIsRightToLeft(false);
- m_aStates.top().eRunType = RTFParserState::RunType::LOCH;
+ m_aStates.top().setRunType(RTFParserState::RunType::LOCH);
}
break;
case RTF_PARD:
@@ -757,13 +757,13 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
// These should be mapped to NS_ooxml::LN_EG_SectPrContents_pgNumType, but dmapper has no API for that at the moment.
break;
case RTF_LOCH:
- m_aStates.top().eRunType = RTFParserState::RunType::LOCH;
+ m_aStates.top().setRunType(RTFParserState::RunType::LOCH);
break;
case RTF_HICH:
- m_aStates.top().eRunType = RTFParserState::RunType::HICH;
+ m_aStates.top().setRunType(RTFParserState::RunType::HICH);
break;
case RTF_DBCH:
- m_aStates.top().eRunType = RTFParserState::RunType::DBCH;
+ m_aStates.top().setRunType(RTFParserState::RunType::DBCH);
break;
case RTF_TITLEPG:
{
@@ -853,74 +853,74 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aPicture.eStyle = RTFBmpStyle::JPEG;
break;
case RTF_POSYT:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign,
- NS_ooxml::LN_Value_doc_ST_YAlign_top);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign,
+ NS_ooxml::LN_Value_doc_ST_YAlign_top);
break;
case RTF_POSYB:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign,
- NS_ooxml::LN_Value_doc_ST_YAlign_bottom);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign,
+ NS_ooxml::LN_Value_doc_ST_YAlign_bottom);
break;
case RTF_POSYC:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign,
- NS_ooxml::LN_Value_doc_ST_YAlign_center);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign,
+ NS_ooxml::LN_Value_doc_ST_YAlign_center);
break;
case RTF_POSYIN:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign,
- NS_ooxml::LN_Value_doc_ST_YAlign_inside);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign,
+ NS_ooxml::LN_Value_doc_ST_YAlign_inside);
break;
case RTF_POSYOUT:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign,
- NS_ooxml::LN_Value_doc_ST_YAlign_outside);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign,
+ NS_ooxml::LN_Value_doc_ST_YAlign_outside);
break;
case RTF_POSYIL:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign,
- NS_ooxml::LN_Value_doc_ST_YAlign_inline);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign,
+ NS_ooxml::LN_Value_doc_ST_YAlign_inline);
break;
case RTF_PHMRG:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor,
- NS_ooxml::LN_Value_doc_ST_HAnchor_margin);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_hAnchor,
+ NS_ooxml::LN_Value_doc_ST_HAnchor_margin);
break;
case RTF_PVMRG:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor,
- NS_ooxml::LN_Value_doc_ST_VAnchor_margin);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_vAnchor,
+ NS_ooxml::LN_Value_doc_ST_VAnchor_margin);
break;
case RTF_PHPG:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor,
- NS_ooxml::LN_Value_doc_ST_HAnchor_page);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_hAnchor,
+ NS_ooxml::LN_Value_doc_ST_HAnchor_page);
break;
case RTF_PVPG:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor,
- NS_ooxml::LN_Value_doc_ST_VAnchor_page);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_vAnchor,
+ NS_ooxml::LN_Value_doc_ST_VAnchor_page);
break;
case RTF_PHCOL:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor,
- NS_ooxml::LN_Value_doc_ST_HAnchor_text);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_hAnchor,
+ NS_ooxml::LN_Value_doc_ST_HAnchor_text);
break;
case RTF_PVPARA:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor,
- NS_ooxml::LN_Value_doc_ST_VAnchor_text);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_vAnchor,
+ NS_ooxml::LN_Value_doc_ST_VAnchor_text);
break;
case RTF_POSXC:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign,
- NS_ooxml::LN_Value_doc_ST_XAlign_center);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign,
+ NS_ooxml::LN_Value_doc_ST_XAlign_center);
break;
case RTF_POSXI:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign,
- NS_ooxml::LN_Value_doc_ST_XAlign_inside);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign,
+ NS_ooxml::LN_Value_doc_ST_XAlign_inside);
break;
case RTF_POSXO:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign,
- NS_ooxml::LN_Value_doc_ST_XAlign_outside);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign,
+ NS_ooxml::LN_Value_doc_ST_XAlign_outside);
break;
case RTF_POSXL:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign,
- NS_ooxml::LN_Value_doc_ST_XAlign_left);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign,
+ NS_ooxml::LN_Value_doc_ST_XAlign_left);
break;
case RTF_POSXR:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign,
- NS_ooxml::LN_Value_doc_ST_XAlign_right);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign,
+ NS_ooxml::LN_Value_doc_ST_XAlign_right);
break;
case RTF_DPLINE:
@@ -938,7 +938,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
uno::Reference<drawing::XShape> xShape(
getModelFactory()->createInstance("com.sun.star.drawing.LineShape"),
uno::UNO_QUERY);
- m_aStates.top().aDrawingObject.setShape(xShape);
+ m_aStates.top().getDrawingObject().setShape(xShape);
break;
}
case RTF_DPPOLYLINE:
@@ -947,7 +947,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
uno::Reference<drawing::XShape> xShape(
getModelFactory()->createInstance("com.sun.star.drawing.PolyLineShape"),
uno::UNO_QUERY);
- m_aStates.top().aDrawingObject.setShape(xShape);
+ m_aStates.top().getDrawingObject().setShape(xShape);
break;
}
case RTF_DPPOLYGON:
@@ -955,7 +955,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
uno::Reference<drawing::XShape> xShape(
getModelFactory()->createInstance("com.sun.star.drawing.PolyPolygonShape"),
uno::UNO_QUERY);
- m_aStates.top().aDrawingObject.setShape(xShape);
+ m_aStates.top().getDrawingObject().setShape(xShape);
break;
}
case RTF_DPRECT:
@@ -963,7 +963,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
uno::Reference<drawing::XShape> xShape(
getModelFactory()->createInstance("com.sun.star.drawing.RectangleShape"),
uno::UNO_QUERY);
- m_aStates.top().aDrawingObject.setShape(xShape);
+ m_aStates.top().getDrawingObject().setShape(xShape);
break;
}
case RTF_DPELLIPSE:
@@ -974,19 +974,20 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
uno::Reference<drawing::XShape> xShape(
getModelFactory()->createInstance("com.sun.star.text.TextFrame"),
uno::UNO_QUERY);
- m_aStates.top().aDrawingObject.setShape(xShape);
+ m_aStates.top().getDrawingObject().setShape(xShape);
std::vector<beans::PropertyValue> aDefaults
= RTFSdrImport::getTextFrameDefaults(false);
for (const auto& rDefault : aDefaults)
{
- if (!findPropertyName(m_aStates.top().aDrawingObject.getPendingProperties(),
- rDefault.Name))
- m_aStates.top().aDrawingObject.getPendingProperties().push_back(
+ if (!findPropertyName(
+ m_aStates.top().getDrawingObject().getPendingProperties(),
+ rDefault.Name))
+ m_aStates.top().getDrawingObject().getPendingProperties().push_back(
rDefault);
}
checkFirstRun();
- Mapper().startShape(m_aStates.top().aDrawingObject.getShape());
- m_aStates.top().aDrawingObject.setHadShapeText(true);
+ Mapper().startShape(m_aStates.top().getDrawingObject().getShape());
+ m_aStates.top().getDrawingObject().setHadShapeText(true);
}
break;
default:
@@ -997,12 +998,12 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
uno::Reference<drawing::XShape> xShape(
getModelFactory()->createInstance("com.sun.star.drawing.CustomShape"),
uno::UNO_QUERY);
- m_aStates.top().aDrawingObject.setShape(xShape);
+ m_aStates.top().getDrawingObject().setShape(xShape);
}
uno::Reference<drawing::XDrawPageSupplier> xDrawSupplier(m_xDstDoc, uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xPropertySet(
- m_aStates.top().aDrawingObject.getShape(), uno::UNO_QUERY);
- m_aStates.top().aDrawingObject.setPropertySet(xPropertySet);
+ m_aStates.top().getDrawingObject().getShape(), uno::UNO_QUERY);
+ m_aStates.top().getDrawingObject().setPropertySet(xPropertySet);
if (xDrawSupplier.is())
{
uno::Reference<drawing::XShapes> xShapes(xDrawSupplier->getDrawPage(),
@@ -1010,24 +1011,25 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
if (xShapes.is() && nKeyword != RTF_DPTXBX)
{
// set default VertOrient before inserting
- m_aStates.top().aDrawingObject.getPropertySet()->setPropertyValue(
+ m_aStates.top().getDrawingObject().getPropertySet()->setPropertyValue(
"VertOrient", uno::makeAny(text::VertOrientation::NONE));
- xShapes->add(m_aStates.top().aDrawingObject.getShape());
+ xShapes->add(m_aStates.top().getDrawingObject().getShape());
}
}
if (nType)
{
uno::Reference<drawing::XEnhancedCustomShapeDefaulter> xDefaulter(
- m_aStates.top().aDrawingObject.getShape(), uno::UNO_QUERY);
+ m_aStates.top().getDrawingObject().getShape(), uno::UNO_QUERY);
xDefaulter->createCustomShapeDefaults(OUString::number(nType));
}
std::vector<beans::PropertyValue>& rPendingProperties
- = m_aStates.top().aDrawingObject.getPendingProperties();
+ = m_aStates.top().getDrawingObject().getPendingProperties();
for (auto& rPendingProperty : rPendingProperties)
- m_aStates.top().aDrawingObject.getPropertySet()->setPropertyValue(
+ m_aStates.top().getDrawingObject().getPropertySet()->setPropertyValue(
rPendingProperty.Name, rPendingProperty.Value);
- m_pSdrImport->resolveDhgt(m_aStates.top().aDrawingObject.getPropertySet(),
- m_aStates.top().aDrawingObject.getDhgt(), /*bOldStyle=*/true);
+ m_pSdrImport->resolveDhgt(m_aStates.top().getDrawingObject().getPropertySet(),
+ m_aStates.top().getDrawingObject().getDhgt(),
+ /*bOldStyle=*/true);
}
break;
case RTF_DOBXMARGIN:
@@ -1037,7 +1039,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
aPropertyValue.Name = (nKeyword == RTF_DOBXMARGIN ? OUString("HoriOrientRelation")
: OUString("VertOrientRelation"));
aPropertyValue.Value <<= text::RelOrientation::PAGE_PRINT_AREA;
- m_aStates.top().aDrawingObject.getPendingProperties().push_back(aPropertyValue);
+ m_aStates.top().getDrawingObject().getPendingProperties().push_back(aPropertyValue);
}
break;
case RTF_DOBXPAGE:
@@ -1047,7 +1049,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
aPropertyValue.Name = (nKeyword == RTF_DOBXPAGE ? OUString("HoriOrientRelation")
: OUString("VertOrientRelation"));
aPropertyValue.Value <<= text::RelOrientation::PAGE_FRAME;
- m_aStates.top().aDrawingObject.getPendingProperties().push_back(aPropertyValue);
+ m_aStates.top().getDrawingObject().getPendingProperties().push_back(aPropertyValue);
}
break;
case RTF_DOBYPARA:
@@ -1055,7 +1057,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
beans::PropertyValue aPropertyValue;
aPropertyValue.Name = "VertOrientRelation";
aPropertyValue.Value <<= text::RelOrientation::FRAME;
- m_aStates.top().aDrawingObject.getPendingProperties().push_back(aPropertyValue);
+ m_aStates.top().getDrawingObject().getPendingProperties().push_back(aPropertyValue);
}
break;
case RTF_CONTEXTUALSPACE:
@@ -1115,17 +1117,17 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page);
break;
case RTF_DPLINEHOLLOW:
- m_aStates.top().aDrawingObject.setFLine(0);
+ m_aStates.top().getDrawingObject().setFLine(0);
break;
case RTF_DPROUNDR:
- if (m_aStates.top().aDrawingObject.getPropertySet().is())
+ if (m_aStates.top().getDrawingObject().getPropertySet().is())
// Seems this old syntax has no way to specify a custom radius, and this is the default
- m_aStates.top().aDrawingObject.getPropertySet()->setPropertyValue(
+ m_aStates.top().getDrawingObject().getPropertySet()->setPropertyValue(
"CornerRadius", uno::makeAny(sal_Int32(83)));
break;
case RTF_NOWRAP:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_wrap,
- NS_ooxml::LN_Value_doc_ST_Wrap_notBeside);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap,
+ NS_ooxml::LN_Value_doc_ST_Wrap_notBeside);
break;
case RTF_MNOR:
m_bMathNor = true;
diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
index 61099ba7baae..ea205bf33a0a 100644
--- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
@@ -128,7 +128,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
}
// but don't emit properties yet, since they may change till the first text token arrives
m_bNeedPap = true;
- if (!m_aStates.top().aFrame.inFrame())
+ if (!m_aStates.top().getFrame().inFrame())
m_bNeedPar = false;
m_bNeedFinalPar = false;
}
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index fbf76b468ce0..2d8f901845ed 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -165,7 +165,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
case RTF_FS:
case RTF_AFS:
nSprm = (m_aStates.top().getIsRightToLeft()
- || m_aStates.top().eRunType == RTFParserState::RunType::HICH)
+ || m_aStates.top().getRunType() == RTFParserState::RunType::HICH)
? NS_ooxml::LN_EG_RPrBase_szCs
: NS_ooxml::LN_EG_RPrBase_sz;
break;
@@ -192,17 +192,17 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
case RTF_LANG:
case RTF_ALANG:
if (m_aStates.top().getIsRightToLeft()
- || m_aStates.top().eRunType == RTFParserState::RunType::HICH)
+ || m_aStates.top().getRunType() == RTFParserState::RunType::HICH)
{
nSprm = NS_ooxml::LN_CT_Language_bidi;
}
- else if (m_aStates.top().eRunType == RTFParserState::RunType::DBCH)
+ else if (m_aStates.top().getRunType() == RTFParserState::RunType::DBCH)
{
nSprm = NS_ooxml::LN_CT_Language_eastAsia;
}
else
{
- assert(m_aStates.top().eRunType == RTFParserState::RunType::LOCH);
+ assert(m_aStates.top().getRunType() == RTFParserState::RunType::LOCH);
nSprm = NS_ooxml::LN_CT_Language_val;
}
break;
@@ -308,13 +308,13 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
case RTF_POSX:
{
nId = NS_ooxml::LN_CT_FramePr_x;
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, 0);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign, 0);
}
break;
case RTF_POSY:
{
nId = NS_ooxml::LN_CT_FramePr_y;
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, 0);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign, 0);
}
break;
default:
@@ -326,7 +326,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
m_bNeedPap = true;
// Don't try to support text frames inside tables for now.
if (m_aStates.top().getCurrentBuffer() != &m_aTableBufferStack.back())
- m_aStates.top().aFrame.setSprm(nId, nParam);
+ m_aStates.top().getFrame().setSprm(nId, nParam);
return RTFError::OK;
}
@@ -337,17 +337,17 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
case RTF_F:
case RTF_AF:
if (m_aStates.top().getIsRightToLeft()
- || m_aStates.top().eRunType == RTFParserState::RunType::HICH)
+ || m_aStates.top().getRunType() == RTFParserState::RunType::HICH)
{
nSprm = NS_ooxml::LN_CT_Fonts_cs;
}
- else if (m_aStates.top().eRunType == RTFParserState::RunType::DBCH)
+ else if (m_aStates.top().getRunType() == RTFParserState::RunType::DBCH)
{
nSprm = NS_ooxml::LN_CT_Fonts_eastAsia;
}
else
{
- assert(m_aStates.top().eRunType == RTFParserState::RunType::LOCH);
+ assert(m_aStates.top().getRunType() == RTFParserState::RunType::LOCH);
nSprm = NS_ooxml::LN_CT_Fonts_ascii;
}
if (m_aStates.top().eDestination == Destination::FONTTABLE
@@ -1163,31 +1163,33 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
NS_ooxml::LN_EG_FtnEdnNumProps_numStart, pIntValue);
break;
case RTF_DFRMTXTX:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hSpace, nParam);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_hSpace, nParam);
break;
case RTF_DFRMTXTY:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vSpace, nParam);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_vSpace, nParam);
break;
case RTF_DXFRTEXT:
{
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hSpace, nParam);
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vSpace, nParam);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_hSpace, nParam);
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_vSpace, nParam);
}
break;
case RTF_FLYVERT:
{
RTFVertOrient aVertOrient(nParam);
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, aVertOrient.GetAlign());
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor,
- aVertOrient.GetAnchor());
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign,
+ aVertOrient.GetAlign());
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_vAnchor,
+ aVertOrient.GetAnchor());
}
break;
case RTF_FLYHORZ:
{
RTFHoriOrient aHoriOrient(nParam);
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, aHoriOrient.GetAlign());
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor,
- aHoriOrient.GetAnchor());
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign,
+ aHoriOrient.GetAlign());
+ m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_hAnchor,
+ aHoriOrient.GetAnchor());
}
break;
case RTF_FLYANCHOR:
@@ -1204,16 +1206,16 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
NS_ooxml::LN_CT_Spacing_after, pIntValue);
break;
case RTF_DPX:
- m_aStates.top().aDrawingObject.setLeft(convertTwipToMm100(nParam));
+ m_aStates.top().getDrawingObject().setLeft(convertTwipToMm100(nParam));
break;
case RTF_DPY:
- m_aStates.top().aDrawingObject.setTop(convertTwipToMm100(nParam));
+ m_aStates.top().getDrawingObject().setTop(convertTwipToMm100(nParam));
break;
case RTF_DPXSIZE:
- m_aStates.top().aDrawingObject.setRight(convertTwipToMm100(nParam));
+ m_aStates.top().getDrawingObject().setRight(convertTwipToMm100(nParam));
break;
case RTF_DPYSIZE:
- m_aStates.top().aDrawingObject.setBottom(convertTwipToMm100(nParam));
+ m_aStates.top().getDrawingObject().setBottom(convertTwipToMm100(nParam));
break;
case RTF_PNSTART:
m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_start, pIntValue);
@@ -1237,28 +1239,28 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
}
break;
case RTF_DPLINECOR:
- m_aStates.top().aDrawingObject.setLineColorR(nParam);
- m_aStates.top().aDrawingObject.setHasLineColor(true);
+ m_aStates.top().getDrawingObject().setLineColorR(nParam);
+ m_aStates.top().getDrawingObject().setHasLineColor(true);
break;
case RTF_DPLINECOG:
- m_aStates.top().aDrawingObject.setLineColorG(nParam);
- m_aStates.top().aDrawingObject.setHasLineColor(true);
+ m_aStates.top().getDrawingObject().setLineColorG(nParam);
+ m_aStates.top().getDrawingObject().setHasLineColor(true);
break;
case RTF_DPLINECOB:
- m_aStates.top().aDrawingObject.setLineColorB(nParam);
- m_aStates.top().aDrawingObject.setHasLineColor(true);
+ m_aStates.top().getDrawingObject().setLineColorB(nParam);
+ m_aStates.top().getDrawingObject().setHasLineColor(true);
break;
case RTF_DPFILLBGCR:
- m_aStates.top().aDrawingObject.setFillColorR(nParam);
- m_aStates.top().aDrawingObject.setHasFillColor(true);
+ m_aStates.top().getDrawingObject().setFillColorR(nParam);
+ m_aStates.top().getDrawingObject().setHasFillColor(true);
break;
case RTF_DPFILLBGCG:
- m_aStates.top().aDrawingObject.setFillColorG(nParam);
- m_aStates.top().aDrawingObject.setHasFillColor(true);
+ m_aStates.top().getDrawingObject().setFillColorG(nParam);
+ m_aStates.top().getDrawingObject().setHasFillColor(true);
break;
case RTF_DPFILLBGCB:
- m_aStates.top().aDrawingObject.setFillColorB(nParam);
- m_aStates.top().aDrawingObject.setHasFillColor(true);
+ m_aStates.top().getDrawingObject().setFillColorB(nParam);
+ m_aStates.top().getDrawingObject().setHasFillColor(true);
break;
case RTF_CLSHDNG:
{
@@ -1343,17 +1345,17 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
}
break;
case RTF_DODHGT:
- m_aStates.top().aDrawingObject.setDhgt(nParam);
+ m_aStates.top().getDrawingObject().setDhgt(nParam);
break;
case RTF_DPPOLYCOUNT:
if (nParam >= 0)
{
- m_aStates.top().aDrawingObject.setPolyLineCount(nParam);
+ m_aStates.top().getDrawingObject().setPolyLineCount(nParam);
}
break;
case RTF_DPPTX:
{
- RTFDrawingObject& rDrawingObject = m_aStates.top().aDrawingObject;
+ RTFDrawingObject& rDrawingObject = m_aStates.top().getDrawingObject();
if (rDrawingObject.getPolyLinePoints().empty())
dispatchValue(RTF_DPPOLYCOUNT, 2);
@@ -1364,7 +1366,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
break;
case RTF_DPPTY:
{
- RTFDrawingObject& rDrawingObject = m_aStates.top().aDrawingObject;
+ RTFDrawingObject& rDrawingObject = m_aStates.top().getDrawingObject();
if (!rDrawingObject.getPolyLinePoints().empty())
{
rDrawingObject.getPolyLinePoints().back().Y = convertTwipToMm100(nParam);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 5ac66cce3abc..62ffed2ef54b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -558,7 +558,7 @@ void RTFDocumentImpl::checkNeedPap()
// Writer will ignore a page break before a text frame, so guard it with empty paragraphs
bool hasBreakBeforeFrame
- = m_aStates.top().aFrame.hasProperties()
+ = m_aStates.top().getFrame().hasProperties()
&& m_aStates.top()
.aParagraphSprms.find(NS_ooxml::LN_CT_PPrBase_pageBreakBefore)
.get();
@@ -571,10 +571,10 @@ void RTFDocumentImpl::checkNeedPap()
if (hasBreakBeforeFrame)
dispatchSymbol(RTF_PAR);
- if (m_aStates.top().aFrame.hasProperties())
+ if (m_aStates.top().getFrame().hasProperties())
{
writerfilter::Reference<Properties>::Pointer_t const pFrameProperties(
- new RTFReferenceProperties(RTFSprms(), m_aStates.top().aFrame.getSprms()));
+ new RTFReferenceProperties(RTFSprms(), m_aStates.top().getFrame().getSprms()));
Mapper().props(pFrameProperties);
}
}
@@ -907,7 +907,7 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
std::clamp<sal_Int32>(m_aStates.top().aPicture.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().aDrawingObject.getShape(),
+ uno::Reference<lang::XServiceInfo> xServiceInfo(m_aStates.top().getDrawingObject().getShape(),
uno::UNO_QUERY);
if (xServiceInfo.is() && xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
pExtHeader = nullptr;
@@ -1216,7 +1216,7 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
{
// fdo#79384: Word will reject Shift-JIS following \loch
// but apparently OOo could read and (worse) write such documents
- SAL_INFO_IF(m_aStates.top().eRunType != RTFParserState::RunType::DBCH,
+ SAL_INFO_IF(m_aStates.top().getRunType() != RTFParserState::RunType::DBCH,
"writerfilter.rtf", "invalid Shift-JIS without DBCH");
assert(bUnicodeChecked);
aBuf.append(ch);
@@ -1531,9 +1531,9 @@ void RTFDocumentImpl::prepareProperties(
o_rpParagraphProperties = getProperties(rState.aParagraphAttributes, rState.aParagraphSprms,
NS_ooxml::LN_Value_ST_StyleType_paragraph);
- if (rState.aFrame.hasProperties())
+ if (rState.getFrame().hasProperties())
{
- o_rpFrameProperties = new RTFReferenceProperties(RTFSprms(), rState.aFrame.getSprms());
+ o_rpFrameProperties = new RTFReferenceProperties(RTFSprms(), rState.getFrame().getSprms());
}
// Table width.
@@ -1841,14 +1841,14 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n
case RTF_B:
case RTF_AB:
nSprm = (m_aStates.top().getIsRightToLeft()
- || m_aStates.top().eRunType == RTFParserState::RunType::HICH)
+ || m_aStates.top().getRunType() == RTFParserState::RunType::HICH)
? NS_ooxml::LN_EG_RPrBase_bCs
: NS_ooxml::LN_EG_RPrBase_b;
break;
case RTF_I:
case RTF_AI:
nSprm = (m_aStates.top().getIsRightToLeft()
- || m_aStates.top().eRunType == RTFParserState::RunType::HICH)
+ || m_aStates.top().getRunType() == RTFParserState::RunType::HICH)
? NS_ooxml::LN_EG_RPrBase_iCs
: NS_ooxml::LN_EG_RPrBase_i;
break;
@@ -1939,7 +1939,7 @@ RTFError RTFDocumentImpl::pushState()
else
{
// fdo#85812 group resets run type of _current_ and new state (but not RTL)
- m_aStates.top().eRunType = RTFParserState::RunType::LOCH;
+ m_aStates.top().setRunType(RTFParserState::RunType::LOCH);
if (m_aStates.top().eDestination == Destination::MR)
lcl_DestinationToMath(m_aStates.top().getCurrentDestinationText(), m_aMathBuffer,
@@ -2123,7 +2123,7 @@ RTFError RTFDocumentImpl::popState()
checkUnicode(/*bUnicode =*/true, /*bHex =*/true);
RTFParserState aState(m_aStates.top());
- m_bWasInFrame = aState.aFrame.inFrame();
+ m_bWasInFrame = aState.getFrame().inFrame();
// dmapper expects some content in header/footer, so if there would be nothing, add an empty paragraph.
if (m_pTokenizer->getGroup() == 1 && m_bFirstRun)
@@ -2727,9 +2727,9 @@ RTFError RTFDocumentImpl::popState()
}
break;
case Destination::DRAWINGOBJECT:
- if (m_aStates.top().aDrawingObject.getShape().is())
+ if (m_aStates.top().getDrawingObject().getShape().is())
{
- RTFDrawingObject& rDrawing = m_aStates.top().aDrawingObject;
+ RTFDrawingObject& rDrawing = m_aStates.top().getDrawingObject();
uno::Reference<drawing::XShape> xShape(rDrawing.getShape());
uno::Reference<beans::XPropertySet> xPropertySet(rDrawing.getPropertySet());
@@ -2774,7 +2774,7 @@ RTFError RTFDocumentImpl::popState()
RTFSdrImport::resolveFLine(xPropertySet, rDrawing.getFLine());
- if (!m_aStates.top().aDrawingObject.getHadShapeText())
+ if (!m_aStates.top().getDrawingObject().getHadShapeText())
{
Mapper().startShape(xShape);
}
@@ -2792,7 +2792,7 @@ RTFError RTFDocumentImpl::popState()
case Destination::SHAPE:
m_bNeedFinalPar = true;
m_bNeedCr = m_bNeedCrOrig;
- if (aState.aFrame.inFrame())
+ if (aState.getFrame().inFrame())
{
// parBreak() modifies m_aStates.top() so we can't apply resetFrame() directly on aState
resetFrame();
@@ -3388,7 +3388,7 @@ RTFError RTFDocumentImpl::popState()
case Destination::SHAPE:
if (!m_aStates.empty())
{
- m_aStates.top().aFrame = aState.aFrame;
+ m_aStates.top().getFrame() = aState.getFrame();
if (aState.eDestination == Destination::SHPPICT
&& m_aStates.top().eDestination == Destination::LISTPICTURE)
{
@@ -3409,7 +3409,7 @@ RTFError RTFDocumentImpl::popState()
{
// If we're leaving the shapetext group (it may have nested ones) and this is a shape, not an old drawingobject.
if (m_aStates.top().eDestination != Destination::SHAPETEXT
- && !m_aStates.top().aDrawingObject.getHadShapeText())
+ && !m_aStates.top().getDrawingObject().getHadShapeText())
{
m_aStates.top().setHadShapeText(true);
if (!m_aStates.top().getCurrentBuffer())
@@ -3421,14 +3421,16 @@ RTFError RTFDocumentImpl::popState()
// It's allowed to declare these inside the shape text, and they
// are expected to have an effect for the whole shape.
- if (aState.aDrawingObject.getLeft())
- m_aStates.top().aDrawingObject.setLeft(aState.aDrawingObject.getLeft());
- if (aState.aDrawingObject.getTop())
- m_aStates.top().aDrawingObject.setTop(aState.aDrawingObject.getTop());
- if (aState.aDrawingObject.getRight())
- m_aStates.top().aDrawingObject.setRight(aState.aDrawingObject.getRight());
- if (aState.aDrawingObject.getBottom())
- m_aStates.top().aDrawingObject.setBottom(aState.aDrawingObject.getBottom());
+ if (aState.getDrawingObject().getLeft())
+ m_aStates.top().getDrawingObject().setLeft(aState.getDrawingObject().getLeft());
+ if (aState.getDrawingObject().getTop())
+ m_aStates.top().getDrawingObject().setTop(aState.getDrawingObject().getTop());
+ if (aState.getDrawingObject().getRight())
+ m_aStates.top().getDrawingObject().setRight(
+ aState.getDrawingObject().getRight());
+ if (aState.getDrawingObject().getBottom())
+ m_aStates.top().getDrawingObject().setBottom(
+ aState.getDrawingObject().getBottom());
}
break;
case Destination::PROPNAME:
@@ -3544,8 +3546,8 @@ RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl)
, nBinaryToRead(0)
, nListLevelNum(0)
, bLevelNumbersValid(true)
- , aFrame(this)
- , eRunType(RunType::LOCH)
+ , m_aFrame(this)
+ , m_eRunType(RunType::LOCH)
, m_bIsRightToLeft(false)
, m_nYear(0)
, m_nMonth(0)
@@ -3567,7 +3569,7 @@ RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl)
{
}
-void RTFDocumentImpl::resetFrame() { m_aStates.top().aFrame = RTFFrame(&m_aStates.top()); }
+void RTFDocumentImpl::resetFrame() { m_aStates.top().getFrame() = RTFFrame(&m_aStates.top()); }
void RTFDocumentImpl::bufferProperties(RTFBuffer_t& rBuffer, const RTFValue::Pointer_t& pValue,
const tools::SvRef<TableRowBuffer>& pTableProperties)
@@ -3739,7 +3741,7 @@ RTFSprms RTFFrame::getSprms()
return frameprSprms;
}
-bool RTFFrame::hasProperties()
+bool RTFFrame::hasProperties() const
{
return m_nX != 0 || m_nY != 0 || m_nW != 0 || m_nH != 0 || m_nHoriPadding != 0
|| m_nVertPadding != 0 || m_nHoriAlign != 0 || m_nHoriAnchor != 0 || m_nVertAlign != 0
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 42249dd5e590..7c04f60793f6 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -389,7 +389,7 @@ public:
RTFSprms getSprms();
/// Store a property
void setSprm(Id nId, Id nValue);
- bool hasProperties();
+ bool hasProperties() const;
/// If we got tokens indicating we're in a frame.
bool inFrame();
};
@@ -398,6 +398,14 @@ public:
class RTFParserState
{
public:
+ /// Maps to OOXML's ascii, cs or eastAsia.
+ enum class RunType
+ {
+ LOCH,
+ HICH,
+ DBCH
+ };
+
explicit RTFParserState(RTFDocumentImpl* pDocumentImpl);
void appendDestinationText(const OUString& rString)
@@ -469,6 +477,10 @@ public:
sal_uInt16 getYear() const { return m_nYear; }
void setIsRightToLeft(bool bIsRightToLeft) { m_bIsRightToLeft = bIsRightToLeft; }
bool getIsRightToLeft() const { return m_bIsRightToLeft; }
+ void setRunType(RunType eRunType) { m_eRunType = eRunType; }
+ RunType getRunType() const { return m_eRunType; }
+ RTFFrame& getFrame() { return m_aFrame; }
+ RTFDrawingObject& getDrawingObject() { return m_aDrawingObject; }
RTFDocumentImpl* m_pDocumentImpl;
RTFInternalState nInternalState;
@@ -519,19 +531,12 @@ public:
RTFPicture aPicture;
RTFShape aShape;
- RTFDrawingObject aDrawingObject;
- RTFFrame aFrame;
-
- /// Maps to OOXML's ascii, cs or eastAsia.
- enum class RunType
- {
- LOCH,
- HICH,
- DBCH
- };
- RunType eRunType;
private:
+ RTFDrawingObject m_aDrawingObject;
+ RTFFrame m_aFrame;
+
+ RunType m_eRunType;
/// ltrch or rtlch
bool m_bIsRightToLeft;