writerfilter: various small cleanups

Change-Id: I258a03909e2a166b8f1c077cf758974a06ad3403
Reviewed-on: https://gerrit.libreoffice.org/32215
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
This commit is contained in:
Miklos Vajna
2016-12-20 09:09:53 +01:00
parent 5c5a6c3668
commit 51b6a7c87b
8 changed files with 14 additions and 19 deletions

View File

@@ -47,7 +47,7 @@ sal_Bool RtfExportFilter::filter(const uno::Sequence< beans::PropertyValue >& aD
// get SwDoc* // get SwDoc*
uno::Reference< uno::XInterface > xIfc(m_xSrcDoc, uno::UNO_QUERY); uno::Reference< uno::XInterface > xIfc(m_xSrcDoc, uno::UNO_QUERY);
SwXTextDocument* pTextDoc = dynamic_cast< SwXTextDocument* >(xIfc.get()); auto pTextDoc = dynamic_cast<SwXTextDocument*>(xIfc.get());
if (!pTextDoc) if (!pTextDoc)
{ {
return false; return false;

View File

@@ -471,7 +471,7 @@ void RtfSdrExport::impl_writeGraphic()
(void)GraphicConverter::Export(aStream, aGraphic, ConvertDataFormat::PNG); (void)GraphicConverter::Export(aStream, aGraphic, ConvertDataFormat::PNG);
aStream.Seek(STREAM_SEEK_TO_END); aStream.Seek(STREAM_SEEK_TO_END);
sal_uInt32 nSize = aStream.Tell(); sal_uInt32 nSize = aStream.Tell();
const sal_uInt8* pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData()); auto pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
Size aMapped(aGraphic.GetPrefSize()); Size aMapped(aGraphic.GetPrefSize());
@@ -531,7 +531,7 @@ sal_Int32 RtfSdrExport::StartShape()
} }
} }
const SdrTextObj* pTextObj = dynamic_cast<const SdrTextObj*>(m_pSdrObject); auto pTextObj = dynamic_cast<const SdrTextObj*>(m_pSdrObject);
if (pTextObj) if (pTextObj)
{ {
const OutlinerParaObject* pParaObj = nullptr; const OutlinerParaObject* pParaObj = nullptr;

View File

@@ -68,7 +68,7 @@ void SmartTagHandler::lcl_sprm(Sprm& rSprm)
case NS_ooxml::LN_CT_SmartTagPr_attr: case NS_ooxml::LN_CT_SmartTagPr_attr:
{ {
writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
if (pProperties.get()) if (pProperties)
pProperties->resolve(*this); pProperties->resolve(*this);
break; break;
} }

View File

@@ -24,9 +24,7 @@ using namespace ::com::sun::star;
TablePositionHandler::TablePositionHandler() : TablePositionHandler::TablePositionHandler() :
LoggedProperties("TablePositionHandler"), LoggedProperties("TablePositionHandler"),
m_aVertAnchor("margin"), m_aVertAnchor("margin"),
m_aYSpec(),
m_aHorzAnchor("text"), m_aHorzAnchor("text"),
m_aXSpec(),
m_nY(0), m_nY(0),
m_nX(0), m_nX(0),
m_nLeftFromText(0), m_nLeftFromText(0),

View File

@@ -47,9 +47,7 @@ public:
uno::Sequence<OUString> SAL_CALL WriterFilterDetection_getSupportedServiceNames() throw (uno::RuntimeException); uno::Sequence<OUString> SAL_CALL WriterFilterDetection_getSupportedServiceNames() throw (uno::RuntimeException);
WriterFilterDetection::WriterFilterDetection() WriterFilterDetection::WriterFilterDetection() = default;
{
}
OUString WriterFilterDetection::detect(uno::Sequence<beans::PropertyValue>& rDescriptor) throw (uno::RuntimeException, std::exception) OUString WriterFilterDetection::detect(uno::Sequence<beans::PropertyValue>& rDescriptor) throw (uno::RuntimeException, std::exception)
{ {

View File

@@ -332,9 +332,8 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
case RTF_DPTXBXTEXT: case RTF_DPTXBXTEXT:
{ {
bool bPictureFrame = false; bool bPictureFrame = false;
for (std::size_t i = 0; i < m_aStates.top().aShape.aProperties.size(); ++i) for (auto& rProperty : m_aStates.top().aShape.aProperties)
{ {
std::pair<OUString, OUString>& rProperty = m_aStates.top().aShape.aProperties[i];
if (rProperty.first == "shapeType" && rProperty.second == OUString::number(ESCHER_ShpInst_PictureFrame)) if (rProperty.first == "shapeType" && rProperty.second == OUString::number(ESCHER_ShpInst_PictureFrame))
{ {
bPictureFrame = true; bPictureFrame = true;

View File

@@ -889,10 +889,10 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
{ {
m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.text.TextFrame"), uno::UNO_QUERY); m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.text.TextFrame"), uno::UNO_QUERY);
std::vector<beans::PropertyValue> aDefaults = RTFSdrImport::getTextFrameDefaults(false); std::vector<beans::PropertyValue> aDefaults = RTFSdrImport::getTextFrameDefaults(false);
for (std::size_t i = 0; i < aDefaults.size(); ++i) for (const auto& rDefault : aDefaults)
{ {
if (!findPropertyName(m_aStates.top().aDrawingObject.aPendingProperties, aDefaults[i].Name)) if (!findPropertyName(m_aStates.top().aDrawingObject.aPendingProperties, rDefault.Name))
m_aStates.top().aDrawingObject.aPendingProperties.push_back(aDefaults[i]); m_aStates.top().aDrawingObject.aPendingProperties.push_back(rDefault);
} }
checkFirstRun(); checkFirstRun();
Mapper().startShape(m_aStates.top().aDrawingObject.xShape); Mapper().startShape(m_aStates.top().aDrawingObject.xShape);

View File

@@ -178,13 +178,13 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
{ {
// There were no runs in the cell, so we need to send paragraph and character properties here. // There were no runs in the cell, so we need to send paragraph and character properties here.
auto pPValue = std::make_shared<RTFValue>(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms); auto pPValue = std::make_shared<RTFValue>(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms);
m_aTableBufferStack.back().push_back(Buf_t(BUFFER_PROPS, pPValue, nullptr)); m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_PROPS, pPValue, nullptr));
auto pCValue = std::make_shared<RTFValue>(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms); auto pCValue = std::make_shared<RTFValue>(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms);
m_aTableBufferStack.back().push_back(Buf_t(BUFFER_PROPS, pCValue, nullptr)); m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_PROPS, pCValue, nullptr));
} }
RTFValue::Pointer_t pValue; RTFValue::Pointer_t pValue;
m_aTableBufferStack.back().push_back(Buf_t(BUFFER_CELLEND, pValue, nullptr)); m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_CELLEND, pValue, nullptr));
m_bNeedPap = true; m_bNeedPap = true;
} }
break; break;
@@ -218,7 +218,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
} }
} }
m_aTableBufferStack.pop_back(); m_aTableBufferStack.pop_back();
m_aTableBufferStack.back().push_back( m_aTableBufferStack.back().emplace_back(
Buf_t(BUFFER_NESTROW, RTFValue::Pointer_t(), pBuffer)); Buf_t(BUFFER_NESTROW, RTFValue::Pointer_t(), pBuffer));
m_aNestedTableCellsSprms.clear(); m_aNestedTableCellsSprms.clear();
@@ -322,7 +322,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
{ {
bool bColumns = false; // If we have multiple columns bool bColumns = false; // If we have multiple columns
RTFValue::Pointer_t pCols = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_cols); RTFValue::Pointer_t pCols = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_cols);
if (pCols.get()) if (pCols)
{ {
RTFValue::Pointer_t pNum = pCols->getAttributes().find(NS_ooxml::LN_CT_Columns_num); RTFValue::Pointer_t pNum = pCols->getAttributes().find(NS_ooxml::LN_CT_Columns_num);
if (pNum.get() && pNum->getInt() > 1) if (pNum.get() && pNum->getInt() > 1)