sw/qa/extras/rtfexport/rtfexport.cxx | 4 ++-- sw/qa/extras/rtfimport/rtfimport.cxx | 9 +++++++-- sw/source/core/doc/textboxhelper.cxx | 20 ++++++++++---------- sw/source/filter/ww8/rtfattributeoutput.cxx | 5 ++--- writerfilter/source/dmapper/SdtHelper.hxx | 5 ++++- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 20 +++++++------------- writerfilter/source/rtftok/rtfdocumentimpl.hxx | 5 ++++- writerfilter/source/rtftok/rtflookahead.hxx | 5 ++++- writerfilter/source/rtftok/rtfsdrimport.cxx | 19 ++++++++++--------- writerfilter/source/rtftok/rtfsdrimport.hxx | 4 +++- writerfilter/source/rtftok/rtftokenizer.hxx | 10 ++++++++-- 11 files changed, 61 insertions(+), 45 deletions(-)
New commits: commit b577c99adca2e4c2f506cb9107a6d4489f5a2744 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Sat Jun 14 11:24:39 2014 +0200 sw, writerfilter: identation fixes Change-Id: I1f1db08447006515e7e6842792241aca992984c0 diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 0c78227..71113f1 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -320,8 +320,8 @@ DECLARE_RTFEXPORT_TEST(testMathRuns, "math-runs.rtf") DECLARE_RTFEXPORT_TEST(testFdo77979, "fdo77979.odt") { // font name is encoded with \fcharset of font - CPPUNIT_ASSERT_EQUAL(OUString("\xE5\xBE\xAE\xE8\xBD\xAF\xE9\x9B\x85\xE9\xBB\x91", 12, RTL_TEXTENCODING_UTF8), - getProperty<OUString>(getRun(getParagraph(1), 1), "CharFontName")); + OUString aExpected("\xE5\xBE\xAE\xE8\xBD\xAF\xE9\x9B\x85\xE9\xBB\x91", 12, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_EQUAL(aExpected, getProperty<OUString>(getRun(getParagraph(1), 1), "CharFontName")); } DECLARE_RTFEXPORT_TEST(testFdo53113, "fdo53113.odt") diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 89366d0..2eba05a 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -578,10 +578,15 @@ DECLARE_RTFIMPORT_TEST(testFdo76633, "fdo76633.rtf") uno::Reference<lang::XServiceInfo> xShape(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT(xShape.is()); CPPUNIT_ASSERT(xShape->supportsService("com.sun.star.text.TextGraphicObject")); - try { + try + { uno::Reference<drawing::XShape> xShape2(getShape(2), uno::UNO_QUERY); CPPUNIT_FAIL("exception expected"); - } catch (lang::IndexOutOfBoundsException const&) { /* expected */ } + } + catch (lang::IndexOutOfBoundsException const&) + { + /* expected */ + } } DECLARE_RTFIMPORT_TEST(testFdo48033, "fdo48033.rtf") diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index c7fbb8d..39e9828 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -371,18 +371,18 @@ void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8 } break; case FN_TEXT_RANGE: + { + uno::Reference<text::XTextRange> xRange; + rValue >>= xRange; + SwUnoInternalPaM aInternalPaM(*pFmt->GetDoc()); + if (sw::XTextRangeToSwPaM(aInternalPaM, xRange)) { - uno::Reference<text::XTextRange> xRange; - rValue >>= xRange; - SwUnoInternalPaM aInternalPaM(*pFmt->GetDoc()); - if (sw::XTextRangeToSwPaM(aInternalPaM, xRange)) - { - SwFmtAnchor aAnchor(pFmt->GetAnchor()); - aAnchor.SetAnchor(aInternalPaM.Start()); - pFmt->SetFmtAttr(aAnchor); - } + SwFmtAnchor aAnchor(pFmt->GetAnchor()); + aAnchor.SetAnchor(aInternalPaM.Start()); + pFmt->SetFmtAttr(aAnchor); } - break; + } + break; case RES_CHAIN: switch (nMemberId) { diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 162b6cc..0020e05 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -2076,9 +2076,8 @@ void RtfAttributeOutput::CharFont(const SvxFontItem& rFont) // FIXME: this may be a tad expensive... but the charset needs to be // consistent with what wwFont::WriteRtf() does FontMapExport aTmp(rFont.GetFamilyName()); - m_rExport.eCurrentEncoding = rtl_getTextEncodingFromWindowsCharset( - sw::ms::rtl_TextEncodingToWinCharsetRTF( - aTmp.msPrimary, aTmp.msSecondary, rFont.GetCharSet())); + sal_uInt8 nWindowsCharset = sw::ms::rtl_TextEncodingToWinCharsetRTF(aTmp.msPrimary, aTmp.msSecondary, rFont.GetCharSet()); + m_rExport.eCurrentEncoding = rtl_getTextEncodingFromWindowsCharset(nWindowsCharset); if (m_rExport.eCurrentEncoding == RTL_TEXTENCODING_DONTKNOW) m_rExport.eCurrentEncoding = m_rExport.eDefaultEncoding; } diff --git a/writerfilter/source/dmapper/SdtHelper.hxx b/writerfilter/source/dmapper/SdtHelper.hxx index 9472c71..b9d9cdf 100644 --- a/writerfilter/source/dmapper/SdtHelper.hxx +++ b/writerfilter/source/dmapper/SdtHelper.hxx @@ -75,7 +75,10 @@ public: OUStringBuffer& getDateFormat(); OUStringBuffer& getLocale(); /// If createControlShape() was ever called. - bool hasElements() { return m_bHasElements;} + bool hasElements() + { + return m_bHasElements; + } /// Create drop-down control from w:sdt's w:dropDownList. void createDropDownControl(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 5f67432..d8ccd49 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -780,14 +780,11 @@ int RTFDocumentImpl::resolvePict(bool bInline) else { if (m_xModelFactory.is()) - xShape.set(m_xModelFactory->createInstance( - "com.sun.star.drawing.GraphicObjectShape"), uno::UNO_QUERY); - uno::Reference<drawing::XDrawPageSupplier> const xDrawSupplier( - m_xDstDoc, uno::UNO_QUERY); + xShape.set(m_xModelFactory->createInstance("com.sun.star.drawing.GraphicObjectShape"), uno::UNO_QUERY); + uno::Reference<drawing::XDrawPageSupplier> const xDrawSupplier(m_xDstDoc, uno::UNO_QUERY); if (xDrawSupplier.is()) { - uno::Reference<drawing::XShapes> xShapes( - xDrawSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<drawing::XShapes> xShapes(xDrawSupplier->getDrawPage(), uno::UNO_QUERY); if (xShapes.is()) xShapes->add(xShape); } @@ -1427,8 +1424,7 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, else if (boost::get<0>(aTuple) == BUFFER_PAR) parBreak(); else if (boost::get<0>(aTuple) == BUFFER_STARTSHAPE) - m_pSdrImport->resolve(boost::get<1>(aTuple)->getShape(), false, - RTFSdrImport::SHAPE); + m_pSdrImport->resolve(boost::get<1>(aTuple)->getShape(), false, RTFSdrImport::SHAPE); else if (boost::get<0>(aTuple) == BUFFER_ENDSHAPE) m_pSdrImport->close(); else @@ -1714,8 +1710,7 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) if (nKeyword == RTF_SHPTXT) { if (!m_aStates.top().pCurrentBuffer) - m_pSdrImport->resolve(m_aStates.top().aShape, false, - RTFSdrImport::SHAPE); + m_pSdrImport->resolve(m_aStates.top().aShape, false, RTFSdrImport::SHAPE); else { RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aShape)); @@ -4853,9 +4848,8 @@ int RTFDocumentImpl::popState() // Don't trigger a shape import in case we're only leaving the \shpinst of the groupshape itself. if (!m_bObject && !aState.bInListpicture && !aState.bHadShapeText && !(aState.bInShapeGroup && !aState.bInShape)) { - m_pSdrImport->resolve(m_aStates.top().aShape, true, - (aState.nDestinationState == DESTINATION_SHAPEINSTRUCTION) - ? RTFSdrImport::SHAPE : RTFSdrImport::PICT); + RTFSdrImport::ShapeOrPict eType = (aState.nDestinationState == DESTINATION_SHAPEINSTRUCTION) ? RTFSdrImport::SHAPE : RTFSdrImport::PICT; + m_pSdrImport->resolve(m_aStates.top().aShape, true, eType); } else if (aState.bInShapeGroup && !aState.bInShape) { diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 2f73a8f..d400742 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -361,7 +361,10 @@ public: /// If this is the first run of the document, starts the initial paragraph. void checkFirstRun(); /// If the initial paragraph is started. - bool getFirstRun() { return m_bFirstRun;} + bool getFirstRun() + { + return m_bFirstRun; + } /// If we need to add a dummy paragraph before a section break. void setNeedPar(bool bNeedPar); /// Return the dmapper index of an RTF index for fonts. diff --git a/writerfilter/source/rtftok/rtflookahead.hxx b/writerfilter/source/rtftok/rtflookahead.hxx index 682878c..2f5fed1b 100644 --- a/writerfilter/source/rtftok/rtflookahead.hxx +++ b/writerfilter/source/rtftok/rtflookahead.hxx @@ -44,7 +44,10 @@ public: virtual void setSkipUnknown(bool bSkipUnknown) SAL_OVERRIDE; virtual void finishSubstream() SAL_OVERRIDE; virtual bool isSubstream() const SAL_OVERRIDE; - bool hasTable() { return m_bHasTable;} + bool hasTable() + { + return m_bHasTable; + } private: boost::shared_ptr<RTFTokenizer> m_pTokenizer; SvStream& m_rStream; diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index a47731d..05c4e12 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -215,8 +215,7 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> xShape, const O } } -void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, - ShapeOrPict const shapeOrPict) +void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shapeOrPict) { int nType = -1; bool bPib = false; @@ -253,13 +252,15 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, sal_Int16 nRelativeWidthRelation = text::RelOrientation::PAGE_FRAME; sal_Int16 nRelativeHeightRelation = text::RelOrientation::PAGE_FRAME; - // The spec doesn't state what is the default for shapeType, Word seems to implement it as a rectangle. - if (SHAPE == shapeOrPict && - std::find_if(rShape.aProperties.begin(), - rShape.aProperties.end(), - boost::bind(&OUString::equals, boost::bind(&std::pair<OUString, OUString>::first, _1), OUString("shapeType"))) - == rShape.aProperties.end()) - rShape.aProperties.insert(rShape.aProperties.begin(), std::pair<OUString, OUString>("shapeType", OUString::number(ESCHER_ShpInst_Rectangle))); + if (SHAPE == shapeOrPict) + { + // The spec doesn't state what is the default for shapeType, Word seems to implement it as a rectangle. + if (std::find_if(rShape.aProperties.begin(), + rShape.aProperties.end(), + boost::bind(&OUString::equals, boost::bind(&std::pair<OUString, OUString>::first, _1), OUString("shapeType"))) + == rShape.aProperties.end()) + rShape.aProperties.insert(rShape.aProperties.begin(), std::pair<OUString, OUString>("shapeType", OUString::number(ESCHER_ShpInst_Rectangle))); + } for (std::vector< std::pair<OUString, OUString> >::iterator i = rShape.aProperties.begin(); i != rShape.aProperties.end(); ++i) diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx index 0b69589..5cf8fa4 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.hxx +++ b/writerfilter/source/rtftok/rtfsdrimport.hxx @@ -44,7 +44,9 @@ public: /// Pop the current group shape from the parent stack. void popParent(); css::uno::Reference<css::drawing::XShape> const& getCurrentShape() - { return m_xShape; } + { + return m_xShape; + } private: void createShape(const OUString& aService, css::uno::Reference<css::drawing::XShape>& xShape, css::uno::Reference<css::beans::XPropertySet>& xPropertySet); void applyProperty(css::uno::Reference<css::drawing::XShape> xShape, const OUString& aKey, const OUString& aValue); diff --git a/writerfilter/source/rtftok/rtftokenizer.hxx b/writerfilter/source/rtftok/rtftokenizer.hxx index 36be2b5..b2ce73b 100644 --- a/writerfilter/source/rtftok/rtftokenizer.hxx +++ b/writerfilter/source/rtftok/rtftokenizer.hxx @@ -29,13 +29,19 @@ public: int resolveParse(); int asHex(char ch); /// Number of states on the stack. - int getGroup() const { return m_nGroup;} + int getGroup() const + { + return m_nGroup; + } /// To be invoked by the pushState() callback to signal when the importer enters a group. void pushGroup(); /// To be invoked by the popState() callback to single when the importer leaves a group. void popGroup(); OUString getPosition(); - sal_Size getGroupStart() { return m_nGroupStart;} + sal_Size getGroupStart() + { + return m_nGroupStart; + } /// To look up additional properties of a math symbol. static bool lookupMathKeyword(RTFMathSymbol& rSymbol); private: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits