[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) New commits: commit c5282a72180ab7747c923cdc2b1988d15d3956b1 Author: Miklos Vajna vmik...@suse.cz Date: Sat Apr 21 11:25:18 2012 +0200 fdo#48023 fix RTF import of Russian characters without an encoding specified lcl_GetDefaultTextEncodingForRTF() in editeng did the same. Signed-off-by: Caolán McNamara caol...@redhat.com diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index aca6a29..02afdc0 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -549,13 +549,26 @@ sal_uInt32 RTFDocumentImpl::getColorTable(sal_uInt32 nIndex) return 0; } +rtl_TextEncoding lcl_getDefaultTextEncoding() +{ + +const OUString rLanguage = Application::GetSettings().GetLocale().Language; + +if (rLanguage == ru || rLanguage == uk) +return RTL_TEXTENCODING_MS_1251; +if (rLanguage == tr) +return RTL_TEXTENCODING_MS_1254; +else +return RTL_TEXTENCODING_MS_1252; +} + rtl_TextEncoding RTFDocumentImpl::getEncoding(sal_uInt32 nFontIndex) { if (!m_pSuperstream) { if (nFontIndex m_aFontEncodings.size()) return m_aFontEncodings[nFontIndex]; -return 0; +return lcl_getDefaultTextEncoding(); } else return m_pSuperstream-getEncoding(nFontIndex); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 66 + writerfilter/source/rtftok/rtfdocumentimpl.hxx |4 + writerfilter/source/rtftok/rtftokenizer.cxx|4 + 3 files changed, 53 insertions(+), 21 deletions(-) New commits: commit ed5010f24fc3992945f72225e3d7d1351f048404 Author: Miklos Vajna vmik...@suse.cz Date: Sun Apr 15 14:10:49 2012 +0200 fdo#39053 writerfilter: implement RTF_BIN Conflicts: writerfilter/source/rtftok/rtfdocumentimpl.cxx writerfilter/source/rtftok/rtftokenizer.cxx (cherry-picked from 5187174cd4054486100ef29125ee4a36f7e3bee3) Signed-off-by: Michael Stahl mst...@redhat.com diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 016943d..aca6a29 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -609,34 +609,42 @@ void RTFDocumentImpl::resolve(Stream rMapper) int RTFDocumentImpl::resolvePict(bool bInline) { SvMemoryStream aStream; -int b = 0, count = 2; +SvStream *pStream = 0; -// Feed the destination text to a stream. -OString aStr = OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US); -const char *str = aStr.getStr(); -for (int i = 0; i aStr.getLength(); ++i) +if (!m_pBinaryData.get()) { -char ch = str[i]; -if (ch != 0x0d ch != 0x0a) +pStream = aStream; +int b = 0, count = 2; + +// Feed the destination text to a stream. +OString aStr = OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US); +const char *str = aStr.getStr(); +for (int i = 0; i aStr.getLength(); ++i) { -b = b 4; -sal_Int8 parsed = m_pTokenizer-asHex(ch); -if (parsed == -1) -return ERROR_HEX_INVALID; -b += parsed; -count--; -if (!count) -{ -aStream (char)b; -count = 2; -b = 0; +char ch = str[i]; +if (ch != 0x0d ch != 0x0a) +{ +b = b 4; +sal_Int8 parsed = m_pTokenizer-asHex(ch); +if (parsed == -1) +return ERROR_HEX_INVALID; +b += parsed; +count--; +if (!count) +{ +aStream (char)b; +count = 2; +b = 0; +} } } } +else +pStream = m_pBinaryData.get(); // Store, and get its URL. -aStream.Seek(0); -uno::Referenceio::XInputStream xInputStream(new utl::OInputStreamWrapper(aStream)); +pStream-Seek(0); +uno::Referenceio::XInputStream xInputStream(new utl::OInputStreamWrapper(pStream)); WMF_EXTERNALHEADER aExtHeader; aExtHeader.mapMode = m_aStates.top().aPicture.eWMetafile; aExtHeader.xExt = m_aStates.top().aPicture.nWidth; @@ -775,6 +783,19 @@ int RTFDocumentImpl::resolvePict(bool bInline) int RTFDocumentImpl::resolveChars(char ch) { +if (m_aStates.top().nInternalState == INTERNAL_BIN) +{ +m_pBinaryData.reset(new SvMemoryStream()); +*m_pBinaryData ch; +for (int i = 0; i m_aStates.top().nBinaryToRead - 1; ++i) +{ +Strm() ch; +*m_pBinaryData ch; +} +m_aStates.top().nInternalState = INTERNAL_NORMAL; +return 0; +} + if (m_aStates.top().nInternalState != INTERNAL_HEX) checkUnicode(false, true); @@ -2778,6 +2799,10 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) lcl_putNestedSprm(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_Lvl_rPr, NS_sprm::LN_CRgFtc0, pValue); } break; +case RTF_BIN: +m_aStates.top().nInternalState = INTERNAL_BIN; +m_aStates.top().nBinaryToRead = nParam; +break; default: #if OSL_DEBUG_LEVEL 1 OSL_TRACE(%s: TODO handle value '%s', OSL_THIS_FUNC, lcl_RtfToString(nKeyword)); @@ -3595,6 +3620,7 @@ RTFParserState::RTFParserState(RTFDocumentImpl *pDocumentImpl) nCurrentEncoding(0), nUc(1), nCharsToSkip(0), +nBinaryToRead(0), nListLevelNum(0), aListLevelEntries(), aLevelNumbers(), diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 0126882..1d0a37d 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -281,6 +281,8 @@ namespace writerfilter { int nUc; /// Characters to skip, set to nUc by \u. int nCharsToSkip; +/// Characters to read, once in binary mode. +
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/rtftok/rtfdocumentimpl.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 299387dab1b365427cc44d810026facd30e11a31 Author: Miklos Vajna vmik...@suse.cz Date: Fri Apr 20 12:42:23 2012 +0200 fdo#48356 fix RTF import of special unicode characters The \'0d string should not be an exception when ignoring characters after the \u control word. Signed-off-by: Andras Timar ati...@suse.com diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 9633176..016943d 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -784,7 +784,7 @@ int RTFDocumentImpl::resolveChars(char ch) bool bSkipped = false; while(!Strm().IsEof() ch != '{' ch != '}' ch != '\\') { -if (ch != 0x0d ch != 0x0a) +if (m_aStates.top().nInternalState == INTERNAL_HEX || (ch != 0x0d ch != 0x0a)) { if (m_aStates.top().nCharsToSkip == 0) { ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/rtftok/rtfdocumentimpl.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit 08a54e148d56542cdb3603234dc72f2620969a4f Author: Miklos Vajna vmik...@suse.cz Date: Tue Apr 10 15:42:23 2012 +0200 fdo#47802 fix crash on RTF import of shapes inside tables We already ignore textframes inside tables, the same should be done with textboxes till they can be handled properly. Signed-off-by: Petr Mladek pmla...@suse.cz diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 84e2b48..9633176 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1164,7 +1164,11 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) m_aStates.top().nDestinationState = DESTINATION_SHAPE; break; case RTF_SHPINST: -m_aStates.top().nDestinationState = DESTINATION_SHAPEINSTRUCTION; +// Don't try to support shapes inside tables for now. +if (m_pCurrentBuffer != m_aTableBuffer) +m_aStates.top().nDestinationState = DESTINATION_SHAPEINSTRUCTION; +else +m_aStates.top().nDestinationState = DESTINATION_SKIP; break; case RTF_NESTTABLEPROPS: m_aStates.top().nDestinationState = DESTINATION_NESTEDTABLEPROPERTIES; ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 17 +++-- writerfilter/source/rtftok/rtfdocumentimpl.hxx |2 ++ 2 files changed, 17 insertions(+), 2 deletions(-) New commits: commit 5e7f26787c6025ec1dffa9eee17405220325f7ae Author: Miklos Vajna vmik...@suse.cz Date: Tue Apr 3 16:49:41 2012 +0200 fdo#45182 fix RTF import of character encoding in footnotes There were two problems here: 1) \plain reset the character properties, but did not touch the current encoding 2) the default properties were not passed to substreams Signed-off-by: LuboÅ¡ LuÅák l.lu...@suse.cz diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 04160e6..84e2b48 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -569,6 +569,14 @@ int RTFDocumentImpl::getFontIndex(int nIndex) return m_pSuperstream-getFontIndex(nIndex); } +RTFParserState RTFDocumentImpl::getDefaultState() +{ +if (!m_pSuperstream) +return m_aDefaultState; +else +return m_pSuperstream-getDefaultState(); +} + void RTFDocumentImpl::resolve(Stream rMapper) { m_pMapperStream = rMapper; @@ -1778,8 +1786,13 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) m_aStates.top().nCurrentEncoding = RTL_TEXTENCODING_MS_1252; break; case RTF_PLAIN: -m_aStates.top().aCharacterSprms = m_aDefaultState.aCharacterSprms; -m_aStates.top().aCharacterAttributes = m_aDefaultState.aCharacterAttributes; +{ +m_aStates.top().aCharacterSprms = getDefaultState().aCharacterSprms; +RTFValue::Pointer_t pValue = m_aStates.top().aCharacterSprms.find(NS_sprm::LN_CRgFtc0); +if (pValue.get()) +m_aStates.top().nCurrentEncoding = getEncoding(pValue-getInt()); +m_aStates.top().aCharacterAttributes = getDefaultState().aCharacterAttributes; +} break; case RTF_PARD: m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms; diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 4a7551d..0126882 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -373,6 +373,8 @@ namespace writerfilter { int getFontIndex(int nIndex); /// Return the encoding associated with a dmapper font index. rtl_TextEncoding getEncoding(sal_uInt32 nFontIndex); +/// Get the default parser state. +RTFParserState getDefaultState(); private: SvStream Strm(); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/dmapper/DomainMapper_Impl.cxx |7 +++ 1 file changed, 7 insertions(+) New commits: commit 2ff3c94c471ee586c733121e528e9623c4344224 Author: Cédric Bosdonnat cedric.bosdon...@free.fr Date: Tue Dec 20 16:27:46 2011 +0100 fdo#47036 n#703032 RTF/DOCX import: fixed the import of consecutive frames When we have two consecutive paragraphs with different frame properties, the second frame wasn't created. Now store the current paragraph properties in order to create the frame later. (cherry picked from commit e040d2931658b411bfbd1c668dc96422374a74be) Signed-off-by: Miklos Vajna vmik...@suse.cz diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index bc38966..5461a99 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1010,6 +1010,13 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap ) { //handles (8)(9) and completes (6) CheckUnregisteredFrameConversion( ); + +// If different frame properties are set on this paragraph, keep them. +if ( !bIsDropCap pParaContext-IsFrameMode() ) +{ +pToBeSavedProperties.reset( new ParagraphProperties(*pParaContext) ); +lcl_AddRangeAndStyle(pToBeSavedProperties, xTextAppend, pPropertyMap); +} } } ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/rtftok/rtfdocumentimpl.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 05fde8006966df49221871fe3489aba8c2ca8e3f Author: Miklos Vajna vmik...@suse.cz Date: Sat Mar 24 17:14:12 2012 +0100 fdo#46955 fix RTF import of all capitals char prop diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index d5d8ee6..ef4d3b8 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2770,6 +2770,7 @@ int RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam case RTF_STRIKED: nSprm = NS_sprm::LN_CFDStrike; break; case RTF_SCAPS: nSprm = NS_sprm::LN_CFSmallCaps; break; case RTF_IMPR: nSprm = NS_sprm::LN_CFImprint; break; +case RTF_CAPS: nSprm = NS_sprm::LN_CFCaps; break; default: break; } if (nSprm = 0) ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/rtftok/rtfcontrolwords.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 1ce604a5f3366513bd86fe9feb938a53d996886e Author: Christina Rossmanith chrrossman...@web.de Date: Sat Mar 10 15:21:49 2012 +0100 Bug 45563 - incorrect IMPORT of Zotero RTF, regression (cherry picked from commit f8c9ed1663ac675ed2151a584fcbf86b319cdaf1) Signed-off-by: Miklos Vajna vmik...@suse.cz diff --git a/writerfilter/source/rtftok/rtfcontrolwords.cxx b/writerfilter/source/rtftok/rtfcontrolwords.cxx index 3dd2672..f7036eb 100644 --- a/writerfilter/source/rtftok/rtfcontrolwords.cxx +++ b/writerfilter/source/rtftok/rtfcontrolwords.cxx @@ -39,6 +39,7 @@ RTFSymbol aRTFControlWords[] = { {:, CONTROL_SYMBOL, RTF_SUBENTRY}, {\\, CONTROL_SYMBOL, RTF_BACKSLASH}, {\n, CONTROL_SYMBOL, RTF_PAR}, +{\r\n, CONTROL_SYMBOL, RTF_PAR}, {_, CONTROL_SYMBOL, RTF_NOBRKHYPH}, {{, CONTROL_SYMBOL, RTF_LBRACE}, {|, CONTROL_SYMBOL, RTF_FORMULA}, ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) New commits: commit 75fce8a65679a9383b139f3f9866a43ac7bda803 Author: Tor Lillqvist tlillqv...@suse.com Date: Mon Mar 12 15:19:14 2012 +0200 Fix crash with document from bnc#693238 Signed-off-by: Cedric Bosdonnat cbosdon...@suse.com diff --git a/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx b/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx index 52dd4b7..5353d84 100644 --- a/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx @@ -424,10 +424,15 @@ OOXMLPropertySetImpl::~OOXMLPropertySetImpl() void OOXMLPropertySetImpl::resolve(Properties rHandler) { -OOXMLProperties_t::iterator aIt = begin(); -while (aIt != end()) +size_t nIt = 0; + +// The pProp-resolve(rHandler) call below can cause elements to +// be appended to mProperties. I don't think it can cause elements +// to be deleted. But let's check with here just to be safe that +// the indexing below works. +while (nIt mProperties.size()) { -OOXMLProperty::Pointer_t pProp = *aIt; +OOXMLProperty::Pointer_t pProp = mProperties[nIt]; if (pProp.get() != NULL) pProp-resolve(rHandler); @@ -440,7 +445,7 @@ void OOXMLPropertySetImpl::resolve(Properties rHandler) } #endif -++aIt; +++nIt; } } ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 32 - writerfilter/source/rtftok/rtfdocumentimpl.hxx |6 +++- 2 files changed, 30 insertions(+), 8 deletions(-) New commits: commit ede11e29bf051e3d7850b45118cd011d582a Author: Miklos Vajna vmik...@suse.cz Date: Mon Feb 13 18:42:56 2012 +0100 fdo#45543 fix RTF import of ms932-encoded characters (cherry picked from commits d7baacd81bbcfaa35b7fbf9981fa3fa7c9fb1cb4, 0915f1b3d77afa694a2ca692aec307846827da99 and 00859026749e005759ce4e7115b746b064cd902b) Signed-off-by: Caolán McNamara caol...@redhat.com diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 737350b..824615d 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -305,7 +305,8 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Referenceuno::XComponentContext const x m_bWasInFrame(false), m_bIsInFrame(false), m_bHasPage(false), -m_aUnicodeBuffer() +m_aUnicodeBuffer(), +m_aHexBuffer() { OSL_ASSERT(xInputStream.is()); m_pInStream.reset(utl::UcbStreamHelper::CreateStream(xInputStream, sal_True)); @@ -738,9 +739,13 @@ int RTFDocumentImpl::resolvePict(bool bInline) int RTFDocumentImpl::resolveChars(char ch) { +if (m_aStates.top().nInternalState != INTERNAL_HEX) +checkUnicode(false, true); + OStringBuffer aBuf; bool bUnicodeChecked = false; +bool bSkipped = false; while(!Strm().IsEof() ch != '{' ch != '}' ch != '\\') { if (ch != 0x0d ch != 0x0a) @@ -749,13 +754,16 @@ int RTFDocumentImpl::resolveChars(char ch) { if (!bUnicodeChecked) { -checkUnicode(); +checkUnicode(true, false); bUnicodeChecked = true; } aBuf.append(ch); } else +{ +bSkipped = true; m_aStates.top().nCharsToSkip--; +} } // read a single char if we're in hex mode if (m_aStates.top().nInternalState == INTERNAL_HEX) @@ -764,6 +772,14 @@ int RTFDocumentImpl::resolveChars(char ch) } if (m_aStates.top().nInternalState != INTERNAL_HEX !Strm().IsEof()) Strm().SeekRel(-1); + +if (m_aStates.top().nInternalState == INTERNAL_HEX m_aStates.top().nDestinationState != DESTINATION_LEVELNUMBERS) +{ +if (!bSkipped) +m_aHexBuffer.append(ch); +return 0; +} + if (m_aStates.top().nDestinationState == DESTINATION_SKIP) return 0; OString aStr = aBuf.makeStringAndClear(); @@ -2031,8 +2047,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { -if (nKeyword != RTF_U) -checkUnicode(); +checkUnicode(nKeyword != RTF_U, true); RTFSkipDestination aSkip(*this); int nSprm = 0; RTFValue::Pointer_t pIntValue(new RTFValue(nParam)); @@ -3370,13 +3385,18 @@ void RTFDocumentImpl::setSkipUnknown(bool bSkipUnknown) m_bSkipUnknown = bSkipUnknown; } -void RTFDocumentImpl::checkUnicode() +void RTFDocumentImpl::checkUnicode(bool bUnicode, bool bHex) { -if (m_aUnicodeBuffer.getLength() 0) +if (bUnicode m_aUnicodeBuffer.getLength() 0) { OUString aString = m_aUnicodeBuffer.makeStringAndClear(); text(aString); } +if (bHex m_aHexBuffer.getLength() 0) +{ +OUString aString = OStringToOUString(m_aHexBuffer.makeStringAndClear(), m_aStates.top().nCurrentEncoding); +text(aString); +} } RTFParserState::RTFParserState() diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 713fd7d..3644375 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -364,8 +364,8 @@ namespace writerfilter { void replayBuffer(RTFBuffer_t rBuffer); /// If we got tokens indicating we're in a frame. bool inFrame(); -/// If we have some unicode characters to send. -void checkUnicode(); +/// If we have some unicode or hex characters to send. +void checkUnicode(bool bUnicode = true, bool bHex = true); uno::Referenceuno::XComponentContext const m_xContext; uno::Referenceio::XInputStream const m_xInputStream; @@ -454,6 +454,8 @@ namespace writerfilter { bool m_bHasPage; // Unicode characters are collected here so we don't have to send them one by one. rtl::OUStringBuffer m_aUnicodeBuffer; +/// Same for hex characters. +rtl::OStringBuffer m_aHexBuffer; }; } // namespace
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 30 +++-- writerfilter/source/rtftok/rtfdocumentimpl.hxx |1 2 files changed, 29 insertions(+), 2 deletions(-) New commits: commit e67c7884d10caf4714d152f1d98c0f4f7e6c10f1 Author: Miklos Vajna vmik...@suse.cz Date: Wed Feb 22 11:38:29 2012 +0100 implement RTF import of non-box paragraph borders (cherry picked from commit 343b52ee76f1a88a27007319af644dcce76536cc) Signed-off-by: Michael Stahl mst...@redhat.com diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 413a82f..737350b 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -146,7 +146,7 @@ static RTFSprms lcl_getLastAttributes(RTFSprms rSprms, Id nId) static void lcl_putBorderProperty(std::stackRTFParserState aStates, Id nId, RTFValue::Pointer_t pValue) { -if (aStates.top().nBorderState == BORDER_PARAGRAPH) +if (aStates.top().nBorderState == BORDER_PARAGRAPH_BOX) for (int i = 0; i 4; i++) { RTFValue::Pointer_t p = aStates.top().aParagraphSprms.find(lcl_getParagraphBorder(i)); @@ -156,6 +156,12 @@ static void lcl_putBorderProperty(std::stackRTFParserState aStates, Id nId, R rAttributes-push_back(make_pair(nId, pValue)); } } +else if (aStates.top().nBorderState == BORDER_PARAGRAPH) +{ +// Attributes of the last border type +RTFSprms rAttributes = lcl_getLastAttributes(aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_pBdr); +rAttributes-push_back(make_pair(nId, pValue)); +} else if (aStates.top().nBorderState == BORDER_CELL) { // Attributes of the last border type @@ -1754,7 +1760,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) m_aStates.top().aParagraphSprms-push_back(make_pair(NS_sprm::LN_PBrcLeft, pValue)); m_aStates.top().aParagraphSprms-push_back(make_pair(NS_sprm::LN_PBrcBottom, pValue)); m_aStates.top().aParagraphSprms-push_back(make_pair(NS_sprm::LN_PBrcRight, pValue)); -m_aStates.top().nBorderState = BORDER_PARAGRAPH; +m_aStates.top().nBorderState = BORDER_PARAGRAPH_BOX; } break; case RTF_LTRSECT: @@ -1831,6 +1837,26 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) m_aStates.top().nBorderState = BORDER_PAGE; } break; +case RTF_BRDRT: +case RTF_BRDRL: +case RTF_BRDRB: +case RTF_BRDRR: +{ +RTFSprms aAttributes; +RTFSprms aSprms; +RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms)); +switch (nKeyword) +{ +case RTF_BRDRT: nParam = lcl_getParagraphBorder(0); break; +case RTF_BRDRL: nParam = lcl_getParagraphBorder(1); break; +case RTF_BRDRB: nParam = lcl_getParagraphBorder(2); break; +case RTF_BRDRR: nParam = lcl_getParagraphBorder(3); break; +default: break; +} +lcl_putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_pBdr, nParam, pValue); +m_aStates.top().nBorderState = BORDER_PARAGRAPH; +} +break; case RTF_CLVMGF: { RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_Merge_restart)); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 0e92eb4..713fd7d 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -116,6 +116,7 @@ namespace writerfilter { { BORDER_NONE, BORDER_PARAGRAPH, +BORDER_PARAGRAPH_BOX, BORDER_CELL, BORDER_PAGE }; ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/dmapper/DomainMapper_Impl.cxx |7 ++- writerfilter/source/dmapper/PropertyIds.cxx |1 + writerfilter/source/dmapper/PropertyIds.hxx |1 + 3 files changed, 8 insertions(+), 1 deletion(-) New commits: commit c8d9f6461c9dcb6280635ffa46686a45f507486f Author: Miklos Vajna vmik...@suse.cz Date: Mon Feb 20 15:46:08 2012 +0100 n#695479 fix rtf/docx import of transparent frames Previously all frames were opaque by default, which is the Writer but not the docx/rtf default. Change the default, while keeping the possibility to set an opaque color background for the frame. (cherry picked from commits 4ac48167662c592c21025b89fe8f6925c680c6e0 and c306532e0bed1df36abf5d7ad6f0363056e69739) Signed-off-by: Michael Meeks michael.me...@suse.com diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index d36fda0..bc38966 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -702,7 +702,7 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) StyleSheetEntryPtr pParaStyle = GetStyleSheetTable()-FindStyleSheetByConvertedStyleName(rAppendContext.pLastParagraphProperties-GetParaStyleName()); -uno::Sequence beans::PropertyValue aFrameProperties(pParaStyle ? 15: 9); +uno::Sequence beans::PropertyValue aFrameProperties(pParaStyle ? 16: 9); if ( pParaStyle.get( ) ) { @@ -722,6 +722,7 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) pFrameProperties[12].Name = rPropNameSupplier.GetName(PROP_RIGHT_MARGIN); pFrameProperties[13].Name = rPropNameSupplier.GetName(PROP_TOP_MARGIN); pFrameProperties[14].Name = rPropNameSupplier.GetName(PROP_BOTTOM_MARGIN); +pFrameProperties[15].Name = rPropNameSupplier.GetName(PROP_BACK_COLOR_TRANSPARENCY); const ParagraphProperties* pStyleProperties = dynamic_castconst ParagraphProperties*( pParaStyle-pProperties.get() ); sal_Int32 nWidth = @@ -794,6 +795,10 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) pStyleProperties-GetvSpace() = 0 ? pStyleProperties-GetvSpace() : 0; pFrameProperties[13].Value = nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist; pFrameProperties[14].Value = nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist; +// If there is no fill, the Word default is 100% transparency. +// Otherwise CellColorHandler has priority, and this setting +// will be ignored. +pFrameProperties[15].Value = sal_Int32(100); lcl_MoveBorderPropertiesToFrame(aFrameProperties, rAppendContext.pLastParagraphProperties-GetStartingRange(), diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index 173be40..c8f8a55 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -196,6 +196,7 @@ const rtl::OUString PropertyNameSupplier::GetName( PropertyIds eId ) const case PROP_CONTOUR_POLY_POLYGON :sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ContourPolyPolygon)); break; case PROP_PAGE_TOGGLE :sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(PageToggle)); break; case PROP_BACK_COLOR :sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(BackColor)); break; +case PROP_BACK_COLOR_TRANSPARENCY: sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(BackColorTransparency)); break; case PROP_ALTERNATIVE_TEXT :sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(AlternativeText)); break; case PROP_HEADER_TEXT_LEFT :sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(HeaderTextLeft)); break; case PROP_HEADER_TEXT :sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(HeaderText)); break; diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index dd20f06..b109cd6 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -51,6 +51,7 @@ enum PropertyIds ,PROP_ANCHOR_TYPE ,PROP_AUTOMATIC_DISTANCE ,PROP_BACK_COLOR +,PROP_BACK_COLOR_TRANSPARENCY ,PROP_BITMAP ,PROP_BOTTOM_BORDER ,PROP_BOTTOM_BORDER_DISTANCE ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) New commits: commit e21cd8ac21062485bc36f63998d2b15674c71a89 Author: Miklos Vajna vmik...@frugalware.org Date: Thu Feb 9 11:18:34 2012 +0100 fdo#45553 fix RTF import of space-before/after tokens (cherry picked from commit c32b9cd2139249f0c680f664a0ceac3702dd0e73) Signed-off-by: Caolán McNamara caol...@redhat.com diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index df60ff7..7f1569e 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2039,8 +2039,6 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { case RTF_SBASEDON: nSprm = NS_rtf::LN_ISTDBASE; break; case RTF_SNEXT: nSprm = NS_rtf::LN_ISTDNEXT; break; -case RTF_SB: nSprm = NS_ooxml::LN_CT_Spacing_before; break; -case RTF_SA: nSprm = NS_ooxml::LN_CT_Spacing_after; break; default: break; } if (nSprm 0) @@ -2604,6 +2602,14 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_WMETAFILE: m_aStates.top().aPicture.eWMetafile = nParam; break; +case RTF_SB: +lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, +NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_before, pIntValue); +break; +case RTF_SA: +lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, +NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_after, pIntValue); +break; default: #if OSL_DEBUG_LEVEL 1 OSL_TRACE(%s: TODO handle value '%s', OSL_THIS_FUNC, lcl_RtfToString(nKeyword)); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/dmapper/DomainMapperTableManager.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 06c62190b2c28720294a603d26878c2cb0b35b9c Author: Miklos Vajna vmik...@frugalware.org Date: Mon Feb 6 10:58:12 2012 +0100 n#228839 an empty table grid can't have implicit merges Signed-off-by: Cédric Bosdonnat cedric.bosdonnat@free.fr diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 31d46bd..2331e57 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -477,7 +477,7 @@ void DomainMapperTableManager::endOfRowAction() #endif insertRowProps(pPropMap); } -else if (m_bImplicitMerges) +else if (m_bImplicitMerges pTableGrid-size()) { // More grid than cells definitions? Then take the last ones. // This feature is used by the RTF implicit horizontal cell merges. ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/rtftok/rtfdocumentimpl.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 11897d4ddb50539c6351ccf6dce3cdb2f768fe27 Author: Cédric Bosdonnat cedric.bosdon...@free.fr Date: Fri Dec 9 17:04:13 2011 +0100 rtf import: Check for the first run even when getting \par (cherry picked from commit 1d1f049859e080b403c743f7e0604bd72475a824) Signed-off-by: Miklos Vajna vmik...@frugalware.org diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index e23a25f..a96d821 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1308,6 +1308,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) break; case RTF_PAR: { +checkFirstRun(); checkNeedPap(); if (!m_pCurrentBuffer) parBreak(); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) New commits: commit 4ad1652522aff11f53edc45bf29531225979935a Author: Miklos Vajna vmik...@frugalware.org Date: Sat Jan 21 00:58:48 2012 +0100 fdo#44983 Fix RTF import of \paperh and \paperw These keywords should not only set the *default* paper height/width but also set the current values. (cherry picked from commit c39e891d4dc963d2cac9843b426494e4dc490278) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 62445de..18643af 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2357,18 +2357,16 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) pIntValue)); } break; -case RTF_PAPERH: +case RTF_PAPERH: // fall through: set the default + current value lcl_putNestedAttribute(m_aDefaultState.aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_h, pIntValue, true); -break; -case RTF_PAPERW: -lcl_putNestedAttribute(m_aDefaultState.aSectionSprms, -NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_w, pIntValue, true); -break; case RTF_PGHSXN: lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_h, pIntValue, true); break; +case RTF_PAPERW: // fall through: set the default + current value +lcl_putNestedAttribute(m_aDefaultState.aSectionSprms, +NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_w, pIntValue, true); case RTF_PGWSXN: lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_w, pIntValue, true); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 14 -- writerfilter/source/rtftok/rtftokenizer.cxx|4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) New commits: commit 375de2b8bcd591d013c3411ead2e24dc23a8115e Author: Miklos Vajna vmik...@frugalware.org Date: Wed Jan 11 00:15:51 2012 -0500 fdo#41034 improve RTF import of table cell spacings 1) for empty cells, not only paragraph properties, but but character properties should be emitted as well (e.g. font) 2) \sb and \sb is an attribute, not an sprm (it was ignored) 3) \sl was ~ignored due to a typo (cherry picked from commit 9f15592e08f17908b1e54fed200d0ec6aff29509) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 3dd41c0..82b2a31 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1351,9 +1351,11 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) { if (m_bNeedPap) { -// There were no runs in the cell, so we need to send paragraph properties here. -RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms)); -m_aTableBuffer.push_back(make_pair(BUFFER_PROPS, pValue)); +// There were no runs in the cell, so we need to send paragraph and character properties here. +RTFValue::Pointer_t pPValue(new RTFValue(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms)); +m_aTableBuffer.push_back(make_pair(BUFFER_PROPS, pPValue)); +RTFValue::Pointer_t pCValue(new RTFValue(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms)); +m_aTableBuffer.push_back(make_pair(BUFFER_PROPS, pCValue)); } RTFValue::Pointer_t pValue; @@ -1955,8 +1957,6 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_LIN: nSprm = 0x845e; break; case RTF_RI: nSprm = NS_sprm::LN_PDxaRight; break; case RTF_RIN: nSprm = 0x845d; break; -case RTF_SB: nSprm = NS_sprm::LN_PDyaBefore; break; -case RTF_SA: nSprm = NS_sprm::LN_PDyaAfter; break; case RTF_ITAP: nSprm = NS_sprm::LN_PTableDepth; break; default: break; } @@ -1974,6 +1974,8 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { case RTF_SBASEDON: nSprm = NS_rtf::LN_ISTDBASE; break; case RTF_SNEXT: nSprm = NS_rtf::LN_ISTDNEXT; break; +case RTF_SB: nSprm = NS_ooxml::LN_CT_Spacing_before; break; +case RTF_SA: nSprm = NS_ooxml::LN_CT_Spacing_after; break; default: break; } if (nSprm 0) @@ -2163,7 +2165,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) if (nParam 0) { // NS_sprm::LN_PDyaLine could be used, but that won't work with slmult - m_aStates.top().aParagraphAttributes-push_back(make_pair(nSprm, pIntValue)); + m_aStates.top().aParagraphAttributes-push_back(make_pair(NS_ooxml::LN_CT_Spacing_line, pIntValue)); } break; case RTF_SLMULT: diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx index 0a989d8..897e316 100644 --- a/writerfilter/source/rtftok/rtftokenizer.cxx +++ b/writerfilter/source/rtftok/rtftokenizer.cxx @@ -65,8 +65,8 @@ int RTFTokenizer::resolveParse() int ret; // for hex chars int b = 0, count = 2; -sal_uInt32 nPercentSize; -sal_uInt32 nLastPos; +sal_uInt32 nPercentSize = 0; +sal_uInt32 nLastPos = 0; if (m_xStatusIndicator.is()) { ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/rtftok/rtfdocumentimpl.cxx |7 +++ 1 file changed, 7 insertions(+) New commits: commit 00a2444e051aaa2495b20a651f3ae096b4ff3cad Author: Miklos Vajna vmik...@frugalware.org Date: Mon Jan 9 14:58:42 2012 +0100 fdo#42151 fix RTF import of vertically merged table cells The problem was that \row took care of states (which is right, since \trowd wants to reset row properties to the default state), but it should not respect state pops. (cherry picked from commit 7ec8f13d3ac0650c7e62e31220f1eda9d0a9284c) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 02a6cef..25c2e2d 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2744,6 +2744,7 @@ int RTFDocumentImpl::popState() bool bFaltEnd = false; RTFFrame aFrame; bool bPopFrame = false; +RTFParserState aState(m_aStates.top()); if (m_aStates.top().nDestinationState == DESTINATION_FONTTABLE) { @@ -3158,6 +3159,12 @@ int RTFDocumentImpl::popState() m_pCurrentBuffer = 0; m_bHasFootnote = false; } +if (m_aStates.size()) +{ +m_aStates.top().nCells = aState.nCells; +m_aStates.top().aTableCellsSprms = aState.aTableCellsSprms; +m_aStates.top().aTableCellsAttributes = aState.aTableCellsAttributes; +} return 0; } ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/dmapper/DomainMapperTableManager.cxx | 38 +-- writerfilter/source/dmapper/DomainMapperTableManager.hxx |3 - writerfilter/source/dmapper/DomainMapper_Impl.hxx|2 writerfilter/source/rtftok/rtfdocumentimpl.cxx | 11 writerfilter/source/rtftok/rtfdocumentimpl.hxx |2 5 files changed, 38 insertions(+), 18 deletions(-) New commits: commit 4b6f8b09e6823dfb237a4b9ea5c2abc21ccf030a Author: Miklos Vajna vmik...@frugalware.org Date: Fri Jan 6 00:36:18 2012 +0100 fdo#44053 fix RTF import of implicit horizontal table cell merges (cherry picked from commit 01292f171cc851ba092510f10a97cd293670829e) diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 3bfb463..31d46bd 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -48,7 +48,7 @@ using namespace ::com::sun::star; using namespace ::std; -DomainMapperTableManager::DomainMapperTableManager(bool bOOXML) : +DomainMapperTableManager::DomainMapperTableManager(bool bOOXML, bool bImplicitMerges) : m_nRow(0), m_nCell(0), m_nGridSpan(1), @@ -56,6 +56,7 @@ DomainMapperTableManager::DomainMapperTableManager(bool bOOXML) : m_nHeaderRepeat(0), m_nTableWidth(0), m_bOOXML( bOOXML ), +m_bImplicitMerges(bImplicitMerges), m_pTablePropsHandler( new TablePropertiesHandler( bOOXML ) ) { m_pTablePropsHandler-SetTableManager( this ); @@ -437,12 +438,12 @@ void DomainMapperTableManager::endOfRowAction() for( ; aGridSpanIter != pCurrentSpans-end(); ++aGridSpanIter) nGrids += *aGridSpanIter; +//determine table width +double nFullWidth = m_nTableWidth; +//the positions have to be distibuted in a range of 1 +const double nFullWidthRelative = 1.; if( pTableGrid-size() == nGrids ) { -//determine table width -double nFullWidth = m_nTableWidth; -//the positions have to be distibuted in a range of 1 -const double nFullWidthRelative = 1.; uno::Sequence text::TableColumnSeparator aSeparators( m_nCell - 1 ); text::TableColumnSeparator* pSeparators = aSeparators.getArray(); sal_Int16 nLastRelPos = 0; @@ -476,6 +477,33 @@ void DomainMapperTableManager::endOfRowAction() #endif insertRowProps(pPropMap); } +else if (m_bImplicitMerges) +{ +// More grid than cells definitions? Then take the last ones. +// This feature is used by the RTF implicit horizontal cell merges. +uno::Sequence text::TableColumnSeparator aSeparators(m_nCell - 1); +text::TableColumnSeparator* pSeparators = aSeparators.getArray(); + +sal_Int16 nSum = 0; +sal_uInt32 nPos = 0; +// Ignoring the i=0 case means we assume that the width of the last cell matches the table width +for (int i = m_nCell; i 1; i--) +{ +nSum += (*pTableGrid.get())[pTableGrid-size() - i]; // Size of the current cell +pSeparators[nPos].Position = nSum * nFullWidthRelative / nFullWidth; // Relative position +pSeparators[nPos].IsVisible = sal_True; +nPos++; +} + +TablePropertyMapPtr pPropMap( new TablePropertyMap ); +pPropMap-Insert( PROP_TABLE_COLUMN_SEPARATORS, false, uno::makeAny( aSeparators ) ); +#ifdef DEBUG_DOMAINMAPPER +dmapper_logger-startElement(rowProperties); +pPropMap-dumpXml( dmapper_logger ); +dmapper_logger-endElement(); +#endif +insertRowProps(pPropMap); +} ++m_nRow; m_nCell = 0; diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx b/writerfilter/source/dmapper/DomainMapperTableManager.hxx index 6b20f02..67aeb74 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx @@ -50,6 +50,7 @@ class DomainMapperTableManager : public DomainMapperTableManager_Base_t sal_Int32 m_nHeaderRepeat; //counter of repeated headers - if == -1 then the repeating stops sal_Int32 m_nTableWidth; //might be set directly or has to be calculated from the column positions boolm_bOOXML; +boolm_bImplicitMerges; ::rtl::OUString m_sTableStyleName; PropertyMapPtr m_pTableStyleTextProperies; @@ -63,7 +64,7 @@ class DomainMapperTableManager : public DomainMapperTableManager_Base_t public: -DomainMapperTableManager(bool bOOXML); +DomainMapperTableManager(bool bOOXML, bool bImplicitMerges); virtual ~DomainMapperTableManager(); // use this method to avoid adding the properties for the table diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index d7d0546..c4899cb 100644 ---
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/dmapper/GraphicImport.cxx | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) New commits: commit 1c84402c87142f1f473c08dbac926a683f86f067 Author: Miklos Vajna vmik...@frugalware.org Date: Thu Dec 22 02:19:00 2011 +0100 fdo#40937 fix RTF import of images with invalid crop data Add a try-catch, so in case setting crop data fails, the size data will be still set. (cherry picked from commit 3c86591749aae36f997944d9c972d1c71b21bc7b) diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 744361d..2bb6693 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -1475,8 +1475,17 @@ uno::Reference text::XTextContent GraphicImport::createGraphicObject( const b lcl_CalcCrop( m_pImpl-nRightCrop, aGraphicSize.Width ); - xGraphicProperties-setPropertyValue(rPropNameSupplier.GetName( PROP_GRAPHIC_CROP ), -uno::makeAny(text::GraphicCrop(m_pImpl-nTopCrop, m_pImpl-nBottomCrop, m_pImpl-nLeftCrop, m_pImpl-nRightCrop))); +// We need a separate try-catch here, otherwise a bad crop setting will also nuke the size settings as well. +try +{ + xGraphicProperties-setPropertyValue(rPropNameSupplier.GetName( PROP_GRAPHIC_CROP ), + uno::makeAny(text::GraphicCrop(m_pImpl-nTopCrop, m_pImpl-nBottomCrop, m_pImpl-nLeftCrop, m_pImpl-nRightCrop))); +} +catch (const uno::Exception e) +{ +clog __FILE__ : __LINE__ failed. Message :; +clog rtl::OUStringToOString (e.Message, RTL_TEXTENCODING_UTF8).getStr() endl; +} } } ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/rtftok/rtfdocumentimpl.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 42d176fd3e7c310c63d325826e6d3ffb3124c777 Author: Cédric Bosdonnat cedric.bosdonnat@free.fr Date: Wed Dec 14 15:44:07 2011 +0100 n#228839: Fix RTF import crasher with \keep in table properties diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 57d8b9b..4c8648e 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1609,8 +1609,8 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // Trivial paragraph flags switch (nKeyword) { -case RTF_KEEP: nParam = NS_sprm::LN_PFKeep; break; -case RTF_KEEPN: nParam = NS_sprm::LN_PFKeepFollow; break; +case RTF_KEEP: if (m_pCurrentBuffer != m_aTableBuffer) nParam = NS_sprm::LN_PFKeep; break; +case RTF_KEEPN: if (m_pCurrentBuffer != m_aTableBuffer) nParam = NS_sprm::LN_PFKeepFollow; break; case RTF_INTBL: m_pCurrentBuffer = m_aTableBuffer; nParam = NS_sprm::LN_PFInTable; break; case RTF_PAGEBB: nParam = NS_sprm::LN_PFPageBreakBefore; break; default: break; ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
writerfilter/source/rtftok/rtfdocumentimpl.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 2857e160a599d4df97e3d890f480561abe99cedb Author: Cédric Bosdonnat cedric.bosdon...@free.fr Date: Tue Dec 13 10:35:24 2011 +0100 RTF import: default scale for images is 100% not 0% This fixes the import of pictures in n#228839 and n#77738 diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index a378e83..718d60e 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -3223,8 +3223,8 @@ RTFPicture::RTFPicture() nHeight(0), nGoalWidth(0), nGoalHeight(0), -nScaleX(0), -nScaleY(0), +nScaleX(100), +nScaleY(100), nCropT(0), nCropB(0), nCropL(0), ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits