[Libreoffice-commits] core.git: 2 commits - writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Mar 3 08:34:56 UTC 2016
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 134 ++++++++++++-------------
writerfilter/source/rtftok/rtfdocumentimpl.hxx | 16 +-
2 files changed, 75 insertions(+), 75 deletions(-)
New commits:
commit cad7f8ddd91ab6fa6711f442c14ae02f5164ef29
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Mar 3 09:34:03 2016 +0100
writerfilter: prefix members of RTFFrame
Change-Id: I2cfc356a4bc570484b9fd1566e338aa4081c6f24
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 46852da..187eb5a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1129,10 +1129,10 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
bool RTFFrame::inFrame()
{
- return nW > 0
- || nH > 0
- || nX > 0
- || nY > 0;
+ return m_nW > 0
+ || m_nH > 0
+ || m_nX > 0
+ || m_nY > 0;
}
void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps)
@@ -4547,7 +4547,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
}
break;
case RTF_FLYANCHOR:
- m_aStates.top().aFrame.nAnchorType = nParam;
+ m_aStates.top().aFrame.m_nAnchorType = nParam;
break;
case RTF_WMETAFILE:
m_aStates.top().aPicture.eWMetafile = nParam;
@@ -6390,18 +6390,18 @@ RTFDrawingObject::RTFDrawingObject()
RTFFrame::RTFFrame(RTFParserState* pParserState)
: m_pParserState(pParserState),
- nX(0),
- nY(0),
- nW(0),
- nH(0),
- nHoriPadding(0),
- nVertPadding(0),
- nHoriAlign(0),
- nHoriAnchor(0),
- nVertAlign(0),
- nVertAnchor(0),
- nHRule(NS_ooxml::LN_Value_doc_ST_HeightRule_auto),
- nAnchorType(0)
+ 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),
+ m_nVertAnchor(0),
+ m_nHRule(NS_ooxml::LN_Value_doc_ST_HeightRule_auto),
+ m_nAnchorType(0)
{
}
@@ -6415,37 +6415,37 @@ void RTFFrame::setSprm(Id nId, Id nValue)
switch (nId)
{
case NS_ooxml::LN_CT_FramePr_w:
- nW = nValue;
+ m_nW = nValue;
break;
case NS_ooxml::LN_CT_FramePr_h:
- nH = nValue;
+ m_nH = nValue;
break;
case NS_ooxml::LN_CT_FramePr_x:
- nX = nValue;
+ m_nX = nValue;
break;
case NS_ooxml::LN_CT_FramePr_y:
- nY = nValue;
+ m_nY = nValue;
break;
case NS_ooxml::LN_CT_FramePr_hSpace:
- nHoriPadding = nValue;
+ m_nHoriPadding = nValue;
break;
case NS_ooxml::LN_CT_FramePr_vSpace:
- nVertPadding = nValue;
+ m_nVertPadding = nValue;
break;
case NS_ooxml::LN_CT_FramePr_xAlign:
- nHoriAlign = nValue;
+ m_nHoriAlign = nValue;
break;
case NS_ooxml::LN_CT_FramePr_hAnchor:
- nHoriAnchor = nValue;
+ m_nHoriAnchor = nValue;
break;
case NS_ooxml::LN_CT_FramePr_yAlign:
- nVertAlign = nValue;
+ m_nVertAlign = nValue;
break;
case NS_ooxml::LN_CT_FramePr_vAnchor:
- nVertAnchor = nValue;
+ m_nVertAnchor = nValue;
break;
case NS_ooxml::LN_CT_FramePr_wrap:
- oWrap = nValue;
+ m_oWrap = nValue;
break;
default:
break;
@@ -6482,66 +6482,66 @@ RTFSprms RTFFrame::getSprms()
switch (nId)
{
case NS_ooxml::LN_CT_FramePr_x:
- if (nX != 0)
- pValue = std::make_shared<RTFValue>(nX);
+ if (m_nX != 0)
+ pValue = std::make_shared<RTFValue>(m_nX);
break;
case NS_ooxml::LN_CT_FramePr_y:
- if (nY != 0)
- pValue = std::make_shared<RTFValue>(nY);
+ if (m_nY != 0)
+ pValue = std::make_shared<RTFValue>(m_nY);
break;
case NS_ooxml::LN_CT_FramePr_h:
- if (nH != 0)
+ if (m_nH != 0)
{
- if (nHRule == NS_ooxml::LN_Value_doc_ST_HeightRule_exact)
- pValue = std::make_shared<RTFValue>(-nH); // The negative value just sets nHRule
+ if (m_nHRule == NS_ooxml::LN_Value_doc_ST_HeightRule_exact)
+ pValue = std::make_shared<RTFValue>(-m_nH); // The negative value just sets nHRule
else
- pValue = std::make_shared<RTFValue>(nH);
+ pValue = std::make_shared<RTFValue>(m_nH);
}
break;
case NS_ooxml::LN_CT_FramePr_w:
- if (nW != 0)
- pValue = std::make_shared<RTFValue>(nW);
+ if (m_nW != 0)
+ pValue = std::make_shared<RTFValue>(m_nW);
break;
case NS_ooxml::LN_CT_FramePr_hSpace:
- if (nHoriPadding != 0)
- pValue = std::make_shared<RTFValue>(nHoriPadding);
+ if (m_nHoriPadding != 0)
+ pValue = std::make_shared<RTFValue>(m_nHoriPadding);
break;
case NS_ooxml::LN_CT_FramePr_vSpace:
- if (nVertPadding != 0)
- pValue = std::make_shared<RTFValue>(nVertPadding);
+ if (m_nVertPadding != 0)
+ pValue = std::make_shared<RTFValue>(m_nVertPadding);
break;
case NS_ooxml::LN_CT_FramePr_hAnchor:
{
- if (nHoriAnchor == 0)
- nHoriAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_margin;
- pValue = std::make_shared<RTFValue>(nHoriAnchor);
+ if (m_nHoriAnchor == 0)
+ m_nHoriAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_margin;
+ pValue = std::make_shared<RTFValue>(m_nHoriAnchor);
}
break;
case NS_ooxml::LN_CT_FramePr_vAnchor:
{
- if (nVertAnchor == 0)
- nVertAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_margin;
- pValue = std::make_shared<RTFValue>(nVertAnchor);
+ if (m_nVertAnchor == 0)
+ m_nVertAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_margin;
+ pValue = std::make_shared<RTFValue>(m_nVertAnchor);
}
break;
case NS_ooxml::LN_CT_FramePr_xAlign:
- pValue = std::make_shared<RTFValue>(nHoriAlign);
+ pValue = std::make_shared<RTFValue>(m_nHoriAlign);
break;
case NS_ooxml::LN_CT_FramePr_yAlign:
- pValue = std::make_shared<RTFValue>(nVertAlign);
+ pValue = std::make_shared<RTFValue>(m_nVertAlign);
break;
case NS_ooxml::LN_CT_FramePr_hRule:
{
- if (nH < 0)
- nHRule = NS_ooxml::LN_Value_doc_ST_HeightRule_exact;
- else if (nH > 0)
- nHRule = NS_ooxml::LN_Value_doc_ST_HeightRule_atLeast;
- pValue = std::make_shared<RTFValue>(nHRule);
+ if (m_nH < 0)
+ m_nHRule = NS_ooxml::LN_Value_doc_ST_HeightRule_exact;
+ else if (m_nH > 0)
+ m_nHRule = NS_ooxml::LN_Value_doc_ST_HeightRule_atLeast;
+ pValue = std::make_shared<RTFValue>(m_nHRule);
}
break;
case NS_ooxml::LN_CT_FramePr_wrap:
- if (oWrap)
- pValue = std::make_shared<RTFValue>(*oWrap);
+ if (m_oWrap)
+ pValue = std::make_shared<RTFValue>(*m_oWrap);
break;
default:
break;
@@ -6558,10 +6558,10 @@ RTFSprms RTFFrame::getSprms()
bool RTFFrame::hasProperties()
{
- return nX != 0 || nY != 0 || nW != 0 || nH != 0 ||
- nHoriPadding != 0 || nVertPadding != 0 ||
- nHoriAlign != 0 || nHoriAnchor != 0 || nVertAlign != 0 || nVertAnchor != 0 ||
- nAnchorType != 0;
+ 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 || m_nVertAnchor != 0 ||
+ m_nAnchorType != 0;
}
} // namespace rtftok
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index faee9c2..37727d8 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -185,14 +185,14 @@ class RTFFrame
{
private:
RTFParserState* m_pParserState;
- sal_Int32 nX, nY, nW, nH;
- sal_Int32 nHoriPadding, nVertPadding;
- sal_Int32 nHoriAlign, nHoriAnchor, nVertAlign, nVertAnchor;
- Id nHRule;
- boost::optional<Id> oWrap;
+ sal_Int32 m_nX, m_nY, m_nW, m_nH;
+ sal_Int32 m_nHoriPadding, m_nVertPadding;
+ sal_Int32 m_nHoriAlign, m_nHoriAnchor, m_nVertAlign, m_nVertAnchor;
+ Id m_nHRule;
+ boost::optional<Id> m_oWrap;
public:
RTFFrame(RTFParserState* pParserState);
- sal_Int16 nAnchorType;
+ sal_Int16 m_nAnchorType;
/// Convert the stored properties to Sprms
RTFSprms getSprms();
commit e6e9b853c55c8b6095617db4b3f79eeaf9a5acab
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Mar 3 09:33:44 2016 +0100
writerfilter: RTFParserState is meant to be a struct with no member functions
So move its only member function to RTFDocumentImpl.
Change-Id: I93874c729bc21f0545f62e654577e4b9842e898c
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 59ad5ee..46852da 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1615,7 +1615,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
m_aStates.top().eDestination = Destination::LEVELNUMBERS;
break;
case RTF_SHPPICT:
- m_aStates.top().resetFrame();
+ resetFrame();
m_aStates.top().eDestination = Destination::SHPPICT;
break;
case RTF_PICT:
@@ -3013,7 +3013,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
// Ideally getDefaultSPRM() would take care of this, but it would not when we're buffering.
m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_tabs, std::make_shared<RTFValue>());
}
- m_aStates.top().resetFrame();
+ resetFrame();
// Reset currently selected paragraph style as well.
// By default the style with index 0 is applied.
@@ -5643,8 +5643,8 @@ RTFError RTFDocumentImpl::popState()
m_bNeedCr = m_bNeedCrOrig;
if (aState.aFrame.inFrame())
{
- // parBreak modify m_aStates.top() so we can't apply resetFrame directly on aState
- m_aStates.top().resetFrame();
+ // parBreak() modifies m_aStates.top() so we can't apply resetFrame() directly on aState
+ resetFrame();
parBreak();
// Save this state for later use, so we only reset frame status only for the first shape inside a frame.
aState = m_aStates.top();
@@ -6330,9 +6330,9 @@ RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl)
{
}
-void RTFParserState::resetFrame()
+void RTFDocumentImpl::resetFrame()
{
- aFrame = RTFFrame(this);
+ m_aStates.top().aFrame = RTFFrame(&m_aStates.top());
}
RTFColorTableEntry::RTFColorTableEntry()
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 257f483..faee9c2 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -210,8 +210,6 @@ class RTFParserState
{
public:
RTFParserState(RTFDocumentImpl* pDocumentImpl);
- /// Resets aFrame.
- void resetFrame();
RTFDocumentImpl* m_pDocumentImpl;
RTFInternalState nInternalState;
@@ -397,6 +395,8 @@ public:
oox::GraphicHelper& getGraphicHelper();
/// Are we inside the stylesheet table?
bool isStyleSheetImport();
+ /// Resets m_aStates.top().aFrame.
+ void resetFrame();
private:
SvStream& Strm();
More information about the Libreoffice-commits
mailing list