[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2013-01-09 Thread Libreoffice Gerrit user
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 10a6a58e8d55f5d6c1ce7b6cba38f710b6edab6f
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Jan 9 15:29:29 2013 +0100

fdo#58933 RTF import: avoid fake pars / cells when having graphic inside 
cells

Regression from 8063e36115a11ddf3db05928db9287947beee74d.
(cherry picked from commit 555bc780c83114220012e198b5471a0d7452fb32)

Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx

Change-Id: Ied422751783a00983bd137d6151e0d58217ef76d
Reviewed-on: https://gerrit.libreoffice.org/1618
Reviewed-by: Michael Stahl mst...@redhat.com
Tested-by: Michael Stahl mst...@redhat.com

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 5529703..a7677d1 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -785,15 +785,16 @@ int RTFDocumentImpl::resolvePict(bool bInline)
 writerfilter::ReferenceProperties::Pointer_t const pProperties(new 
RTFReferenceProperties(aAttributes, aSprms));
 checkFirstRun();
 if (!m_pCurrentBuffer)
+{
 Mapper().props(pProperties);
+// Make sure we don't loose these properties with a too early reset.
+m_bHadPicture = true;
+}
 else
 {
 RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms));
 m_pCurrentBuffer-push_back(make_pair(BUFFER_PROPS, pValue));
 }
-
-// Make sure we don't loose these properties with a too early reset.
-m_bHadPicture = true;
 return 0;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-12-28 Thread Libreoffice Gerrit user
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit be09d157c3dc114e4933c85499baa41bfa0510a7
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Oct 17 11:17:14 2012 +0200

fdo#57678 fix import of RTF_PARD between RTF_CELL and RTF_ROW

(cherry picked from commits 6fc868c6535932bedfa0fc51d8dd5a1814d73ee8 and
c58981ca3dbf65c998acf979fb104534991b08c4)

Change-Id: I3e3d0de98c9df1a5f9041f6a7dd03b92efb5d0f5
Reviewed-on: https://gerrit.libreoffice.org/1482
Reviewed-by: Muthu Subramanian K muthus...@gmail.com
Tested-by: Muthu Subramanian K muthus...@gmail.com
Reviewed-by: Norbert Thiebaud nthieb...@gmail.com

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 9a348b8..5529703 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1933,10 +1933,15 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 case RTF_PARD:
 if (m_bHadPicture)
 dispatchSymbol(RTF_PAR);
-m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms;
-m_aStates.top().aParagraphAttributes = 
m_aDefaultState.aParagraphAttributes;
+// \pard is allowed between \cell and \row, but in that case it 
should not reset the fact that we're inside a table.
+if (m_aStates.top().nCells == 0)
+{
+m_aStates.top().aParagraphSprms = 
m_aDefaultState.aParagraphSprms;
+m_aStates.top().aParagraphAttributes = 
m_aDefaultState.aParagraphAttributes;
+if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT)
+m_pCurrentBuffer = 0;
+}
 m_aStates.top().resetFrame();
-m_pCurrentBuffer = 0;
 break;
 case RTF_SECTD:
 m_aStates.top().aSectionSprms = m_aDefaultState.aSectionSprms;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-12-12 Thread Libreoffice Gerrit user
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 8454a88e1818fa498c6860a2db434ad51591257c
Author: Caolán McNamara caol...@redhat.com
Date:   Thu Jul 5 21:37:49 2012 +0100

Resolves: fdo#49587 apparent loop in style hierarchy

Change-Id: I32317a1a6500377f7e7bb98d1dcc65ad86feb9a2
(cherry picked from commit 7e3923520c27ff139bc3abab35a1c01e1a785fb1)

Signed-off-by: Michael Stahl mst...@redhat.com

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 951d500..2296761 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -572,7 +572,14 @@ uno::Any 
DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId)
 }
 }
 //search until the property is set or no parent is available
-pEntry = 
GetStyleSheetTable()-FindParentStyleSheet(pEntry-sBaseStyleIdentifier);
+StyleSheetEntryPtr pNewEntry = 
GetStyleSheetTable()-FindParentStyleSheet(pEntry-sBaseStyleIdentifier);
+
+SAL_WARN_IF( pEntry == pNewEntry, writerfilter, circular loop in 
style hierarchy?);
+
+if (pEntry == pNewEntry) //fdo#49587
+break;
+
+pEntry = pNewEntry;
 }
 return uno::Any();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-12-04 Thread Libreoffice Gerrit user
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3d43dc3318a0692287e877b2e70e873372d2c248
Author: Miklos Vajna vmik...@suse.cz
Date:   Tue Dec 4 10:38:53 2012 +0100

fdo#54473 fdo#57133 fix RTF import of character styles

Regression from commit d2d77fd86e6cb7341e113557e2cfe3d7948759bd

(cherry picked from commit 41890bf714803969515578b47e63fa9730ea7090)

Change-Id: I7accc5c383de3fa53c12527766c3fc155bfa9863
Reviewed-on: https://gerrit.libreoffice.org/1235
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index a910401..9a348b8 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2479,7 +2479,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, 
int nParam)
 m_aStates.top().aParagraphAttributes.set(NS_rtf::LN_ISTD, 
pIntValue);
 break;
 case RTF_CS:
-if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET)
+if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET || 
m_aStates.top().nDestinationState == DESTINATION_STYLEENTRY)
 {
 m_nCurrentStyleIndex = nParam;
 m_aStates.top().aTableAttributes.set(NS_rtf::LN_ISTD, 
pIntValue);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-12-01 Thread Libreoffice Gerrit user
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |9 -
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |2 ++
 2 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit fb17de573c582eca7548bf8cd0a0ea86cfad17df
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Nov 30 16:32:56 2012 +0100

fdo#57708 fix RTF import of pictures right before text frames

Change-Id: Ibfeaadd5b48fd48c2c1f20de5dc272d9a326bfc4
(cherry picked from commit 8063e36115a11ddf3db05928db9287947beee74d)
Reviewed-on: https://gerrit.libreoffice.org/1215
Tested-by: Caolán McNamara caol...@redhat.com
Reviewed-by: Caolán McNamara caol...@redhat.com

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 3ebb8da..a910401 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -280,7 +280,8 @@ 
RTFDocumentImpl::RTFDocumentImpl(uno::Referenceuno::XComponentContext const x
 m_aHexBuffer(),
 m_bIgnoreNextContSectBreak(false),
 m_bNeedSect(true),
-m_bWasInFrame(false)
+m_bWasInFrame(false),
+m_bHadPicture(false)
 {
 OSL_ASSERT(xInputStream.is());
 m_pInStream.reset(utl::UcbStreamHelper::CreateStream(xInputStream, 
sal_True));
@@ -480,6 +481,8 @@ void RTFDocumentImpl::parBreak()
 Mapper().endCharacterGroup();
 Mapper().endParagraphGroup();
 
+m_bHadPicture = false;
+
 // start new one
 Mapper().startParagraphGroup();
 }
@@ -789,6 +792,8 @@ int RTFDocumentImpl::resolvePict(bool bInline)
 m_pCurrentBuffer-push_back(make_pair(BUFFER_PROPS, pValue));
 }
 
+// Make sure we don't loose these properties with a too early reset.
+m_bHadPicture = true;
 return 0;
 }
 
@@ -1926,6 +1931,8 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 }
 break;
 case RTF_PARD:
+if (m_bHadPicture)
+dispatchSymbol(RTF_PAR);
 m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms;
 m_aStates.top().aParagraphAttributes = 
m_aDefaultState.aParagraphAttributes;
 m_aStates.top().resetFrame();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index d36a5ec..5e88ef8 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -520,6 +520,8 @@ namespace writerfilter {
 bool m_bNeedSect;
 /// If aFrame.inFrame() was true in the previous state.
 bool m_bWasInFrame;
+/// A picture was seen in the current paragraph.
+bool m_bHadPicture;
 };
 } // namespace rtftok
 } // namespace writerfilter
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-11-28 Thread Libreoffice Gerrit user
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |   51 --
 1 file changed, 25 insertions(+), 26 deletions(-)

New commits:
commit 41459013f8ffed4cbfd6e7c4a59b5d9a7d90fb74
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Nov 28 11:15:56 2012 +

bigendian utext mixup triggering regression test failure

text takes a pointer to a sal_uInt8 buffer but
utext takes a pointer to a sal_Unicode buffer

passing a sal_uInt8 sequence of e.g. \x0D\x00 to utext only happens
to work on little endian machines to represent 0x000D, its 0x0D00 on
bigendian.

for more excitement text and utext do not share the same logic!
Various special chars are treated different in text vs utext so
we can't simply blindly change utext() calls to text() calls and
get the same behaviour without reworking those.

So keep the text()/utext() calls as they are, but change what's
passed to be the right thing.

Change-Id: I66696530c4a9482690c461146bdcf0a507b39b68
(cherry picked from commit 49f2a69fa7d8eaa23d77519ac29748f4dc3e4c5a)
Reviewed-on: https://gerrit.libreoffice.org/1188
Reviewed-by: Michael Stahl mst...@redhat.com
Tested-by: Michael Stahl mst...@redhat.com

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx 
b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index f062a26..9667c79 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -48,19 +48,18 @@
 #include Handler.hxx
 #include ooxmlLoggers.hxx
 
-static const sal_uInt8 s0x7[] = { 0x7, 0x0 };
-static const sal_uInt8 s0xd[] = { 0xd, 0x0 };
-static const sal_uInt8 sCR[] = { 0xd, 0x0 };
-static const sal_uInt8 sFtnEdnRef[] = { 0x2, 0x0 };
-static const sal_uInt8 sFtnEdnSep[] = { 0x3, 0x0 };
-static const sal_uInt8 sFtnEdnCont[] = { 0x4, 0x0 };
-static const sal_uInt8 sTab[] = { 0x9, 0x0 };
-static const sal_uInt8 sPgNum[] = { 0x0, 0x0 };
-static const sal_uInt8 sFieldStart[] = { 0x13  };
-static const sal_uInt8 sFieldSep[] = { 0x14 };
-static const sal_uInt8 sFieldEnd[] = { 0x15 };
-static const sal_uInt8 sNoBreakHyphen[] = { 0x1e, 0x0 };
-static const sal_uInt8 sSoftHyphen[] = { 0x1f, 0x0 };
+static const sal_Unicode uCR = 0xd;
+static const sal_Unicode uFtnEdnRef = 0x2;
+static const sal_Unicode uFtnEdnSep = 0x3;
+static const sal_Unicode uTab = 0x9;
+static const sal_Unicode uPgNum = 0x0;
+static const sal_Unicode uNoBreakHyphen = 0x1e;
+static const sal_Unicode uSoftHyphen = 0x1f;
+
+static const sal_uInt8 cFtnEdnCont = 0x4;
+static const sal_uInt8 cFieldStart = 0x13;
+static const sal_uInt8 cFieldSep = 0x14;
+static const sal_uInt8 cFieldEnd = 0x15;
 
 namespace writerfilter {
 namespace ooxml
@@ -693,7 +692,7 @@ void OOXMLFastContextHandler::startField()
 #endif
 startCharacterGroup();
 if (isForwardEvents())
-mpStream-text(sFieldStart, 1);
+mpStream-text(cFieldStart, 1);
 endCharacterGroup();
 }
 
@@ -704,7 +703,7 @@ void OOXMLFastContextHandler::fieldSeparator()
 #endif
 startCharacterGroup();
 if (isForwardEvents())
-mpStream-text(sFieldSep, 1);
+mpStream-text(cFieldSep, 1);
 endCharacterGroup();
 }
 
@@ -715,7 +714,7 @@ void OOXMLFastContextHandler::endField()
 #endif
 startCharacterGroup();
 if (isForwardEvents())
-mpStream-text(sFieldEnd, 1);
+mpStream-text(cFieldEnd, 1);
 endCharacterGroup();
 }
 
@@ -725,7 +724,7 @@ void OOXMLFastContextHandler::ftnednref()
 debug_logger-element(contexthandler.ftnednref);
 #endif
 if (isForwardEvents())
-mpStream-utext(sFtnEdnRef, 1);
+mpStream-utext((const sal_uInt8*)uFtnEdnRef, 1);
 }
 
 void OOXMLFastContextHandler::ftnednsep()
@@ -734,7 +733,7 @@ void OOXMLFastContextHandler::ftnednsep()
 debug_logger-element(contexthandler.ftnednsep);
 #endif
 if (isForwardEvents())
-mpStream-utext(sFtnEdnSep, 1);
+mpStream-utext((const sal_uInt8*)uFtnEdnSep, 1);
 }
 
 void OOXMLFastContextHandler::ftnedncont()
@@ -743,7 +742,7 @@ void OOXMLFastContextHandler::ftnedncont()
 debug_logger-element(contexthandler.ftnedncont);
 #endif
 if (isForwardEvents())
-mpStream-text(sFtnEdnCont, 1);
+mpStream-text(cFtnEdnCont, 1);
 }
 
 void OOXMLFastContextHandler::pgNum()
@@ -752,7 +751,7 @@ void OOXMLFastContextHandler::pgNum()
 debug_logger-element(contexthandler.pgNum);
 #endif
 if (isForwardEvents())
-mpStream-utext((const sal_uInt8*)sPgNum, 1);
+mpStream-utext((const sal_uInt8*)uPgNum, 1);
 }
 
 void OOXMLFastContextHandler::tab()
@@ -761,7 +760,7 @@ void OOXMLFastContextHandler::tab()
 debug_logger-element(contexthandler.tab);
 #endif
 if (isForwardEvents())
-mpStream-utext((const sal_uInt8*)sTab, 1);
+mpStream-utext((const sal_uInt8*)uTab, 1);
 }
 
 void OOXMLFastContextHandler::cr()
@@ -770,7 +769,7 @@ void OOXMLFastContextHandler::cr()
 

[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-11-14 Thread Libreoffice Gerrit user
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   37 +
 1 file changed, 37 insertions(+)

New commits:
commit 2ebbfbb64ea0c1034e3d62e63d4212399b8651d6
Author: Miklos Vajna vmik...@suse.cz
Date:   Tue Nov 13 17:30:18 2012 +0100

fdo#55525 import RTF_TRLEFT

Additionally:
1) Make sure cell margins are zero when they are not defined.
2) Handle cellx values in case of a negative left margin.

(cherry picked from commit c4b91ae3178011c66c76c711c1a6469ba658872e)

Change-Id: I9b8fb700b6459e622396c98e4344aba79f62c96e
Reviewed-on: https://gerrit.libreoffice.org/1058
Reviewed-by: Tor Lillqvist t...@iki.fi
Tested-by: Tor Lillqvist t...@iki.fi

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index b84e303..cb54d38 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1583,6 +1583,22 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
 RTFValue::Pointer_t pRowValue(new RTFValue(1));
 if (m_aStates.top().nCells  0)
 m_aStates.top().aTableRowSprms.set(NS_sprm::LN_PRow, 
pRowValue);
+
+RTFValue::Pointer_t pCellMar = 
m_aStates.top().aTableRowSprms.find(NS_ooxml::LN_CT_TblPrBase_tblCellMar);
+if (!pCellMar.get())
+{
+// If no cell margins are defined, the default left/right 
margin is 0 in Word, but not in Writer.
+RTFSprms aAttributes;
+aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, 
RTFValue::Pointer_t(new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)));
+aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, 
RTFValue::Pointer_t(new RTFValue(0)));
+lcl_putNestedSprm(m_aStates.top().aTableRowSprms,
+NS_ooxml::LN_CT_TblPrBase_tblCellMar, 
NS_ooxml::LN_CT_TblCellMar_left,
+RTFValue::Pointer_t(new RTFValue(aAttributes)));
+lcl_putNestedSprm(m_aStates.top().aTableRowSprms,
+NS_ooxml::LN_CT_TblPrBase_tblCellMar, 
NS_ooxml::LN_CT_TblCellMar_right,
+RTFValue::Pointer_t(new RTFValue(aAttributes)));
+}
+
 writerfilter::ReferenceProperties::Pointer_t const 
pTableRowProperties(
 new 
RTFReferenceProperties(m_aStates.top().aTableRowAttributes, 
m_aStates.top().aTableRowSprms)
 );
@@ -2642,6 +2658,16 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, 
int nParam)
 case RTF_CELLX:
 {
 int nCellX = nParam - m_aStates.top().nCellX;
+
+// If there is a negative left margin, then the first cellx is 
relateve to that.
+RTFValue::Pointer_t pTblInd = 
m_aStates.top().aTableRowSprms.find(NS_ooxml::LN_CT_TblPrBase_tblInd);
+if (m_aStates.top().nCellX == 0  pTblInd.get())
+{
+RTFValue::Pointer_t pWidth = 
pTblInd-getAttributes().find(NS_ooxml::LN_CT_TblWidth_w);
+if (pWidth.get()  pWidth-getInt()  0)
+nCellX = -1 * (pWidth-getInt() - nParam);
+}
+
 m_aStates.top().nCellX = nParam;
 RTFValue::Pointer_t pXValue(new RTFValue(nCellX));
 
m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, 
pXValue, false);
@@ -2677,6 +2703,17 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, 
int nParam)
 NS_ooxml::LN_CT_TrPrBase_trHeight, 
NS_ooxml::LN_CT_Height_hRule, pHRule);
 }
 break;
+case RTF_TRLEFT:
+{
+// the value is in twips
+lcl_putNestedAttribute(m_aStates.top().aTableRowSprms,
+NS_ooxml::LN_CT_TblPrBase_tblInd, 
NS_ooxml::LN_CT_TblWidth_type,
+RTFValue::Pointer_t(new 
RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)));
+lcl_putNestedAttribute(m_aStates.top().aTableRowSprms,
+NS_ooxml::LN_CT_TblPrBase_tblInd, 
NS_ooxml::LN_CT_TblWidth_w,
+RTFValue::Pointer_t(new RTFValue(nParam)));
+}
+break;
 case RTF_COLS:
 lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
 NS_ooxml::LN_EG_SectPrContents_cols, 
NS_ooxml::LN_CT_Columns_num, pIntValue);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-11-06 Thread Libreoffice Gerrit user
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 99324a9dc5b2963be31ebb7a78679c2f3ed3d7a9
Author: Miklos Vajna vmik...@suse.cz
Date:   Tue Nov 6 10:53:10 2012 +0100

fdo#48442 fix default hori/vert frame anchor during RTF import

We used to send nothing when we got nothing, but this is not correct:
\pvmrg and \phmrg is the default in RTF, but not in Writer.

(cherry picked from commit 7b7bee4ed5722ce59ffd3394a0330d71d69d66b3)

Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx

Change-Id: I9f69e282e68f0828c8b5ba98657cad1dd0715eb3
Reviewed-on: https://gerrit.libreoffice.org/993
Tested-by: Caolán McNamara caol...@redhat.com
Reviewed-by: Caolán McNamara caol...@redhat.com

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index bf981d9..dbaa6e5 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3942,12 +3942,14 @@ RTFSprms RTFFrame::getSprms()
 pValue.reset(new RTFValue(nVertPadding));
 break;
 case NS_ooxml::LN_CT_FramePr_hAnchor:
-if ( nHoriAnchor != 0 )
-pValue.reset(new RTFValue(nHoriAnchor));
+if ( nHoriAnchor == 0 )
+nHoriAnchor = 
NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_margin;
+pValue.reset(new RTFValue(nHoriAnchor));
 break;
 case NS_ooxml::LN_CT_FramePr_vAnchor:
-if ( nVertAnchor != 0 )
-pValue.reset(new RTFValue(nVertAnchor));
+if ( nVertAnchor == 0 )
+nVertAnchor = 
NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_margin;
+pValue.reset(new RTFValue(nVertAnchor));
 break;
 case NS_ooxml::LN_CT_FramePr_xAlign:
 pValue.reset(new RTFValue(nHoriAlign));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-11-06 Thread Libreoffice Gerrit user
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |7 +--
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 2bccaecfb4f9b31964bc8789c3bd5d7080bfc4d9
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Nov 5 16:35:59 2012 +0100

fdo#52989 ignore provided size of JPEG files during RTF import

See commit 66fa759b for rationale, this fix just does the same for JPEG
files as well.

(cherry picked from commit ebc61e11cdb02f5cc33aeabead3d191eaf0d23d3)

Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx

Change-Id: I6a9ead5f4b4b9c4661cae99501bd7c14a2a79409
Reviewed-on: https://gerrit.libreoffice.org/991
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index dbaa6e5..b84e303 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -640,9 +640,9 @@ int RTFDocumentImpl::resolvePict(bool bInline)
 aExtHeader.yExt = m_aStates.top().aPicture.nHeight;
 OUString aGraphicUrl = m_pGraphicHelper-importGraphicObject(xInputStream, 
aExtHeader);
 
-if (m_aStates.top().aPicture.nStyle == BMPSTYLE_PNG)
+if (m_aStates.top().aPicture.nStyle != BMPSTYLE_NONE)
 {
-// In case of PNG, the real size is known, don't use the values
+// In case of PNG/JPEG, the real size is known, don't use the values
 // provided by picw and pich.
 OString aURLBS(OUStringToOString(aGraphicUrl, RTL_TEXTENCODING_UTF8));
 const char aURLBegin[] = vnd.sun.star.GraphicObject:;
@@ -2140,6 +2140,9 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 case RTF_PNGBLIP:
 m_aStates.top().aPicture.nStyle = BMPSTYLE_PNG;
 break;
+case RTF_JPEGBLIP:
+m_aStates.top().aPicture.nStyle = BMPSTYLE_JPEG;
+break;
 case RTF_POSYT: 
m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, 
NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_top); break;
 case RTF_POSYB: 
m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, 
NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_bottom); break;
 case RTF_POSYC: 
m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, 
NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_center); break;
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 6d34e8b..6c0608f 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -163,7 +163,8 @@ namespace writerfilter {
 enum RTFBmpStyles
 {
 BMPSTYLE_NONE,
-BMPSTYLE_PNG
+BMPSTYLE_PNG,
+BMPSTYLE_JPEG
 };
 
 enum RTFFieldStatus
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-10-19 Thread Libreoffice Gerrit user
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

New commits:
commit 9a2f97b9539f8101745467758fe03d5e76c0346f
Author: Miklos Vajna vmik...@suse.cz
Date:   Thu Oct 11 16:48:55 2012 +0200

fdo#55493 fix RTF import of specific PNG image

The image was special in that the resulting Graphic's
GetPrefMapMode().GetMapUnit() wasn't MAP_PIXEL.

(cherry picked from commit 5ef0f1dc9a70c20fe6879832b782a0c34724353f)

Conflicts:
writerfilter/source/rtftok/rtfdocumentimpl.cxx

Change-Id: I681e344a042721b99f6cb2e599f9c65156d219a4
Reviewed-on: https://gerrit.libreoffice.org/860
Reviewed-by: Michael Stahl mst...@redhat.com
Tested-by: Michael Stahl mst...@redhat.com

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 45e1920..bf981d9 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -646,12 +646,18 @@ int RTFDocumentImpl::resolvePict(bool bInline)
 // provided by picw and pich.
 OString aURLBS(OUStringToOString(aGraphicUrl, RTL_TEXTENCODING_UTF8));
 const char aURLBegin[] = vnd.sun.star.GraphicObject:;
-Graphic aGraphic = 
GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin))).GetTransformedGraphic();
-Size aSize(aGraphic.GetPrefSize());
-MapMode aMap(MAP_100TH_MM);
-aSize = Application::GetDefaultDevice()-PixelToLogic( aSize, aMap );
-m_aStates.top().aPicture.nWidth = aSize.Width();
-m_aStates.top().aPicture.nHeight = aSize.Height();
+if (aURLBS.compareTo(aURLBegin, RTL_CONSTASCII_LENGTH(aURLBegin)) == 0)
+{
+Graphic aGraphic = 
GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin))).GetTransformedGraphic();
+Size aSize(aGraphic.GetPrefSize());
+MapMode aMap(MAP_100TH_MM);
+if (aGraphic.GetPrefMapMode().GetMapUnit() == MAP_PIXEL)
+aSize = Application::GetDefaultDevice()-PixelToLogic(aSize, 
aMap);
+else
+aSize = OutputDevice::LogicToLogic(aSize, 
aGraphic.GetPrefMapMode(), aMap);
+m_aStates.top().aPicture.nWidth = aSize.Width();
+m_aStates.top().aPicture.nHeight = aSize.Height();
+}
 }
 
 // Wrap it in an XShape.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-10-19 Thread Libreoffice Gerrit user
 writerfilter/source/dmapper/DomainMapper.cxx |   12 ++--
 writerfilter/source/dmapper/PropertyMap.hxx  |1 +
 2 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit b7cc2a8a22d3723a1efff515eb07669166f158a8
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Oct 15 12:53:05 2012 +0200

fdo#52208 DOCX import: don't always ignore cont sect break at the doc end

Regression from commit 1fdd61db155cf63d5dd55cc2bfb45af33796e131,
continuous section break does make sense at the end of the doc, if the
previous type was a non-continuous.

(cherry picked from commit abd4ffadf30e02284290ea35e8f45d9ffd8eb5ee)

Change-Id: I6d82c67e068d8dc3ce1edb1a5fe6ad293afd805d
Reviewed-on: https://gerrit.libreoffice.org/877
Reviewed-by: Michael Stahl mst...@redhat.com
Tested-by: Michael Stahl mst...@redhat.com

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 2068b61..3eed3cd 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2372,9 +2372,17 @@ void DomainMapper::sprmWithProps( Sprm rSprm, 
PropertyMapPtr rContext, SprmType
 OSL_ENSURE(pSectionContext, SectionContext unavailable!);
 if(pSectionContext)
 {
-// Ignore continous section break at the end of the document
+// Ignore continous section break at the end of the document, if 
the previous section had the same type as well
 // It makes the importer loose margin settings with no benefit
-if (m_pImpl-GetParaSectpr() || nIntValue != 0)
+SectionPropertyMap* pLastContext = 
m_pImpl-GetLastSectionContext();
+int nPrevBreakType = 0;
+bool bHasPrevSection = false;
+if (pLastContext)
+{
+bHasPrevSection = true;
+nPrevBreakType = pLastContext-GetBreakType();
+}
+if (m_pImpl-GetParaSectpr() || nIntValue != 0 || (bHasPrevSection 
 nPrevBreakType != nIntValue))
 pSectionContext-SetBreakType( nIntValue );
 }
 break;
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx 
b/writerfilter/source/dmapper/PropertyMap.hxx
index b9a3d5d..7a3b5bd 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -245,6 +245,7 @@ public:
 void SetPageNoRestart( bool bSet ) { m_bPageNoRestart = bSet; }
 void SetPageNumber( sal_Int32 nSet ) { m_nPageNumber = nSet; }
 void SetBreakType( sal_Int32 nSet ) { m_nBreakType = nSet; }
+sal_Int32 GetBreakType( ) { return m_nBreakType; }
 void SetPaperBin( sal_Int32 nSet );
 void SetFirstPaperBin( sal_Int32 nSet );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-10-04 Thread Libreoffice Gerrit user
 writerfilter/source/dmapper/GraphicImport.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 9e553fcf085149dcaec15541278d910e59b04676
Author: Cédric Bosdonnat cedric.bosdon...@free.fr
Date:   Wed Oct 3 14:11:31 2012 +0200

fdo#44278: fix leaked image when import docx

Unused temporary XShape need to be disposed to avoid remaining garbage
in the document.

Change-Id: Iaf6e720a1c47605136f7f9ccafb605cab6dc260a
(cherry picked from commit f1fc7c5655dde547b721b3afffabcd8bdbe0add2)

Signed-off-by: Miklos Vajna vmik...@suse.cz

diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 6d16a8d..73cc341 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -916,6 +916,10 @@ void GraphicImport::lcl_attribute(Id nName, Value  val)
uno::makeAny( aSize.Height ) );
 xGraphProps-setPropertyValue( 
rtl::OUString(Width),
uno::makeAny( aSize.Width ) );
+
+// We need to drop the shape here somehow
+uno::Reference lang::XComponent  
xShapeComponent( xShape, uno::UNO_QUERY );
+xShapeComponent-dispose( );
 }
 }
 catch( const beans::UnknownPropertyException  )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-10-01 Thread Libreoffice Gerrit user
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 52b6ab689bbeb2611af84b694a98282e58426345
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Sep 28 17:45:21 2012 +0200

fdo#52475 fix import of RTF_CHCBPAT with value 0

0 means auto, and for fdo#50539, this value was ignored. However a next
sample shows that we should send something to the dmapper: COL_AUTO.

Change-Id: I8d7d35125c9027dfb45288bbfbfa81ba4799e78d
Reviewed-on: https://gerrit.libreoffice.org/740
Reviewed-by: Michael Stahl mst...@redhat.com
Tested-by: Michael Stahl mst...@redhat.com

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 2d918f4..45e1920 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2449,9 +2449,8 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, 
int nParam)
 m_aDefaultState.aCharacterSprms.set(NS_sprm::LN_CLidBi, 
pIntValue);
 break;
 case RTF_CHCBPAT:
-if (nParam)
 {
-RTFValue::Pointer_t pValue(new 
RTFValue(getColorTable(nParam)));
+RTFValue::Pointer_t pValue(new RTFValue(nParam ? 
getColorTable(nParam) : COL_AUTO));
 lcl_putNestedAttribute(m_aStates.top().aCharacterSprms, 
NS_sprm::LN_CShd, NS_ooxml::LN_CT_Shd_fill, pValue);
 }
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-09-24 Thread Libreoffice Gerrit user
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit 94ca682d70afc707c4c560e7a4a62546ae7c5669
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Sep 21 19:14:01 2012 +0200

fdo#49655 fix RTF import of text in the middle of table definition

Usually table text comes after the \intbl control word, but it turns out
text is allowed earlier. Make sure such text is buffered, otherwise
we'll send paragraph / run properties to the dmapper in the middle of
table properties, which is obviously not allowed.

(cherry picked from commit af6b7d8ba30d395e5f4a17876526434cf0a06005)

Change-Id: I34f1df7e171316a7d926179689627301860d492f
Reviewed-on: https://gerrit.libreoffice.org/689
Reviewed-by: Noel Power noel.po...@suse.com
Tested-by: Noel Power noel.po...@suse.com

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 35d42c7..2d918f4 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -991,6 +991,14 @@ void RTFDocumentImpl::text(OUString rString)
 return;
 }
 
+// Are we in the middle of the table definition? (No cell defs yet, but we 
already have some cell props.)
+if 
(m_aStates.top().aTableCellSprms.find(NS_ooxml::LN_CT_TcPrBase_vAlign).get() 
+m_aStates.top().nCells == 0)
+{
+m_aTableBuffer.push_back(make_pair(BUFFER_UTEXT, 
RTFValue::Pointer_t(new RTFValue(rString;
+return;
+}
+
 checkFirstRun();
 checkNeedPap();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-09-21 Thread Libreoffice Gerrit user
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 363029af2207dc890939e31850aba82263c97ec6
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Sep 21 11:58:02 2012 +0200

fdo#52389 fix RTF import of paragraph without RTF_PAR at the end of the doc

(cherry picked from commit ebf0e1953ef422bb83201c89f0558bb9071edf63)

Change-Id: Ib7b48986d5b01c75ae0be8dd6618a2e8be2ae51c
Reviewed-on: https://gerrit.libreoffice.org/663
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index fb18553..35d42c7 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3483,6 +3483,8 @@ int RTFDocumentImpl::popState()
 // This is the end of the doc, see if we need to close the last section.
 if (m_nGroup == 1  !m_bFirstRun)
 {
+if (m_bNeedCr)
+dispatchSymbol(RTF_PAR);
 m_bDeferredContSectBreak = false;
 sectBreak(true);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-09-21 Thread Libreoffice Gerrit user
 writerfilter/source/dmapper/DomainMapper.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 9d3af8d699c95b7433591701666a70554d543b96
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Sep 21 14:57:26 2012 +0200

fdo#55187 fix DOCX import of unicode 0xNN0d when it's a separate run

E.g. 0x010d was parsed as a newline character... This also makes the RTF
workaround from fdo#39856 unnecessary.

(cherry picked from commit b3603e0e0e5dbfbeaa2426c499e8f64be2d15765)

Change-Id: I5e4a95b4436e1492b64961820702caace0a33e4b
Reviewed-on: https://gerrit.libreoffice.org/665
Reviewed-by: Noel Power noel.po...@suse.com
Tested-by: Noel Power noel.po...@suse.com

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 8634644..2068b61 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3447,8 +3447,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 {
 m_pImpl-getTableManager().utext(data_, len);
 
-// RTF always uses text() instead of utext() for run break
-if(len == 1  ((*data_) == 0x0d || (*data_) == 0x07)  
!IsRTFImport())
+if(len == 1  (sText[0] == 0x0d || sText[0] == 0x07))
 {
 bool bSingleParagraph = m_pImpl-GetIsFirstParagraphInSection()  
m_pImpl-GetIsLastParagraphInSection();
 // If the paragraph contains only the section properties and it has
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-09-12 Thread Libreoffice Gerrit user
 writerfilter/source/dmapper/PropertyMap.cxx |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 6f86bad46d6cd64544bde1dc9367189c9a586c5e
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Sep 12 10:23:51 2012 +0100

Resolves: rhbz#831755 crash with 0 dyaLinePitch in .docx

This is similar to fdo#40686 (dyaLinePitch only valid between [1-31680]) for
the .doc format

Change-Id: I7d2745d695320b4b6b22ec2b519f092932587c2e
(cherry picked from commit a9b7ceea2bf3d6d38fb6c8a4c1fffb9be4714348)
Reviewed-on: https://gerrit.libreoffice.org/599
Reviewed-by: Luboš Luňák l.lu...@suse.cz
Tested-by: Luboš Luňák l.lu...@suse.cz

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 2d3d4cb..f26e9ed 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -916,14 +916,20 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl rDM_Impl )
 if( aElement != end())
 aElement-second = eWritingMode;
 
-
-
 sal_Int32 nTextAreaHeight = eWritingMode == text::WritingMode_LR_TB ?
 nHeight - m_nTopMargin - m_nBottomMargin :
 nWidth - m_nLeftMargin - m_nRightMargin;
 
+sal_Int32 nGridLinePitch = m_nGridLinePitch;
+//sep.dyaLinePitch
+if (nGridLinePitch  1 || nGridLinePitch  31680)
+{
+SAL_WARN(writerfilter, sep.dyaLinePitch outside legal range:  
 nGridLinePitch);
+nGridLinePitch = 1;
+}
+
 operator[]( PropertyDefinition( PROP_GRID_LINES, false )) =
-uno::makeAny( 
static_castsal_Int16(nTextAreaHeight/m_nGridLinePitch));
+uno::makeAny( 
static_castsal_Int16(nTextAreaHeight/nGridLinePitch));
 
 sal_Int32 nCharWidth = 423; //240 twip/ 12 pt
 //todo: is '0' the right index here?
@@ -953,7 +959,7 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl rDM_Impl )
 nCharWidth += ConversionHelper::convertTwipToMM100( nFraction );
 }
 operator[]( PropertyDefinition( PROP_GRID_BASE_HEIGHT, false )) = 
uno::makeAny( nCharWidth );
-sal_Int32 nRubyHeight = m_nGridLinePitch - nCharWidth;
+sal_Int32 nRubyHeight = nGridLinePitch - nCharWidth;
 if(nRubyHeight  0 )
 nRubyHeight = 0;
 operator[]( PropertyDefinition( PROP_GRID_RUBY_HEIGHT, false )) = 
uno::makeAny( nRubyHeight );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-08-29 Thread Libreoffice Gerrit user
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   51 ++---
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |3 +
 2 files changed, 48 insertions(+), 6 deletions(-)

New commits:
commit 8c32e8758a2244174a533e045ff9e8113581ee7d
Author: Miklos Vajna vmik...@suse.cz
Date:   Tue Aug 28 11:21:50 2012 +0200

fdo#52052 fix RTF import of page breaks on landscape pages

The problem was that we tried to insert a page break before reaching the
first section break, where section properties are sent.

Additionally, the continuous section break at the end of the doc caused
trouble, so ignore it explicitly.

(cherry picked from commit 1efa576ef88141c4deb5da9818537e053dc6517b)

Change-Id: I22bc355994991beeadb41d26b44ce3e2beedbdb2
Reviewed-on: https://gerrit.libreoffice.org/497
Reviewed-by: Norbert Thiebaud nthieb...@gmail.com
Tested-by: Norbert Thiebaud nthieb...@gmail.com

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index c814b91..fb18553 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -277,7 +277,8 @@ 
RTFDocumentImpl::RTFDocumentImpl(uno::Referenceuno::XComponentContext const x
 m_bFormField(false),
 m_bIsInFrame(false),
 m_aUnicodeBuffer(),
-m_aHexBuffer()
+m_aHexBuffer(),
+m_bDeferredContSectBreak(false)
 {
 OSL_ASSERT(xInputStream.is());
 m_pInStream.reset(utl::UcbStreamHelper::CreateStream(xInputStream, 
sal_True));
@@ -1077,6 +1078,7 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t rBuffer)
 int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
 {
 checkUnicode();
+checkDeferredContSectBreak();
 RTFSkipDestination aSkip(*this);
 switch (nKeyword)
 {
@@ -1406,6 +1408,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
 {
 if (nKeyword != RTF_HEXCHAR)
 checkUnicode();
+checkDeferredContSectBreak();
 RTFSkipDestination aSkip(*this);
 sal_uInt8 cCh = 0;
 
@@ -1462,7 +1465,17 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
 }
 break;
 case RTF_SECT:
-sectBreak();
+{
+RTFValue::Pointer_t pBreak = 
m_aStates.top().aSectionSprms.find(NS_sprm::LN_SBkc);
+if (pBreak.get()  !pBreak-getInt())
+{
+// This is a continous section break, don't send it yet.
+// It's possible that we'll have nothing after this token, 
and then we should ignore it.
+m_bDeferredContSectBreak = true;
+}
+else
+sectBreak();
+}
 break;
 case RTF_NOBREAK:
 {
@@ -1583,10 +1596,21 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
 break;
 case RTF_PAGE:
 {
-sal_uInt8 sBreak[] = { 0xc };
-Mapper().text(sBreak, 1);
-if (!m_bNeedPap)
-parBreak();
+// If we're inside a continous section, we should send a 
section break, not a page one.
+RTFValue::Pointer_t pBreak = 
m_aStates.top().aSectionSprms.find(NS_sprm::LN_SBkc);
+if (pBreak.get()  !pBreak-getInt())
+{
+dispatchFlag(RTF_SBKPAGE);
+sectBreak();
+dispatchFlag(RTF_SBKNONE);
+}
+else
+{
+sal_uInt8 sBreak[] = { 0xc };
+Mapper().text(sBreak, 1);
+if (!m_bNeedPap)
+parBreak();
+}
 }
 break;
 case RTF_CHPGN:
@@ -1609,6 +1633,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
 int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 {
 checkUnicode();
+checkDeferredContSectBreak();
 RTFSkipDestination aSkip(*this);
 int nParam = -1;
 int nSprm = -1;
@@ -2224,6 +2249,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
 {
 checkUnicode(nKeyword != RTF_U, true);
+checkDeferredContSectBreak();
 RTFSkipDestination aSkip(*this);
 int nSprm = 0;
 RTFValue::Pointer_t pIntValue(new RTFValue(nParam));
@@ -2923,6 +2949,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, 
int nParam)
 int RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int 
nParam)
 {
 checkUnicode();
+checkDeferredContSectBreak();
 RTFSkipDestination aSkip(*this);
 int nSprm = -1;
 RTFValue::Pointer_t pBoolValue(new RTFValue(!bParam || nParam != 0));
@@ -3455,7 +3482,10 @@ int RTFDocumentImpl::popState()
 
 // This is the end of the doc, see if we need to close the last section.
 if (m_nGroup == 1  

[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-08-14 Thread Petr Mladek
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 1067832bbfae15811ff2e1d478139b5af283de51
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Aug 13 12:23:05 2012 +0200

fdo#47495 fix RTF import of multiple shapes inside textframes

(cherry-picked from commit ad72a47dbd16f65316432df71dffe3b9b835fcc7)

Change-Id: Iee8541ff9e88139648d45f08968476f2b1d4e1b3

Signed-off-by: Petr Mladek pmla...@suse.cz

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 1355501..aa58eaa 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3411,7 +3411,8 @@ int RTFDocumentImpl::popState()
 bFaltEnd = true;
 }
 else if (m_aStates.top().nDestinationState == DESTINATION_FLYMAINCONTENT
-|| m_aStates.top().nDestinationState == DESTINATION_SHPPICT)
+|| m_aStates.top().nDestinationState == DESTINATION_SHPPICT
+|| aState.nDestinationState == DESTINATION_SHAPE)
 bPopFrame = true;
 else if (m_aStates.top().nDestinationState == DESTINATION_DRAWINGOBJECT  
m_aStates.top().aDrawingObject.xShape.is())
 {
@@ -3436,6 +3437,8 @@ int RTFDocumentImpl::popState()
 {
 m_aStates.top().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();
 m_bNeedPap = true;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-08-14 Thread Petr Mladek
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 7910c47221d07e836d62b7d816e1afe19859b601
Author: Miklos Vajna vmik...@suse.cz
Date:   Tue Aug 14 16:50:16 2012 +0200

Fix fdo#47495 backport

On master, the fix was fine, but on -3-6 this broke the fdo#47036 unit
test, fix this.

Change-Id: I02449a41801646c7eb2408e60f9051e1269d6693

Signed-off-by: Petr Mladek pmla...@suse.cz

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index aa58eaa..c814b91 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3411,8 +3411,7 @@ int RTFDocumentImpl::popState()
 bFaltEnd = true;
 }
 else if (m_aStates.top().nDestinationState == DESTINATION_FLYMAINCONTENT
-|| m_aStates.top().nDestinationState == DESTINATION_SHPPICT
-|| aState.nDestinationState == DESTINATION_SHAPE)
+|| m_aStates.top().nDestinationState == DESTINATION_SHPPICT)
 bPopFrame = true;
 else if (m_aStates.top().nDestinationState == DESTINATION_DRAWINGOBJECT  
m_aStates.top().aDrawingObject.xShape.is())
 {
@@ -3439,6 +3438,7 @@ int RTFDocumentImpl::popState()
 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();
+bPopFrame = true;
 m_bNeedPap = true;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-08-13 Thread Petr Mladek
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 8054472f666c87d6437dcea064c3cef379916245
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Aug 10 17:48:57 2012 +0200

fdo#48446 implement RTF_CPG

(cherry picked from commit f6a24ace5ad12e79f0cc90709a290a30e3758781)

Change-Id: I2fb2004f2f755ce337ddd1419acf2510f17622f3

Signed-off-by: Petr Mladek pmla...@suse.cz

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 2074d69..1355501 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2373,6 +2373,9 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, 
int nParam)
 case RTF_ANSICPG:
 m_aStates.top().nCurrentEncoding = 
rtl_getTextEncodingFromWindowsCodePage(nParam);
 break;
+case RTF_CPG:
+m_aFontEncodings[m_nCurrentFontIndex] = 
rtl_getTextEncodingFromWindowsCodePage(nParam);
+break;
 case RTF_CF:
 {
 // NS_sprm::LN_CIco won't work, that would be an index in a 
static table
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-08-02 Thread Noel Power
 writerfilter/source/rtftok/rtfsdrimport.cxx |   10 ++
 1 file changed, 10 insertions(+)

New commits:
commit 78b0de49c342402648b71ba59e91b03a7e7cc38e
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Aug 1 15:37:45 2012 +0200

fdo#49892 implement RTF import of dhgt shape property

Change-Id: I36d574c5f7915d732c6c158fadb91b6032370a01
(cherry picked from commit ce701e94db740ea8c2bb9f6dcf55a2aeda4d71af)

diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index dba4545..f12e44c 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -37,6 +37,8 @@
 #include filter/msfilter/escherex.hxx
 #include filter/msfilter/util.hxx
 
+#include dmapper/DomainMapper.hxx
+#include ../dmapper/GraphicHelpers.hxx
 #include rtfsdrimport.hxx
 
 using rtl::OString;
@@ -258,6 +260,14 @@ void RTFSdrImport::resolve(RTFShape rShape)
 aViewBox.Width = i-second.toInt32();
 else if ( i-first == geoBottom )
 aViewBox.Height = i-second.toInt32();
+else if ( i-first == dhgt )
+{
+writerfilter::dmapper::DomainMapper rMapper = 
(writerfilter::dmapper::DomainMapper)m_rImport.Mapper();
+writerfilter::dmapper::GraphicZOrderHelper* pHelper = 
rMapper.graphicZOrderHelper();
+sal_Int32 nZOrder = i-second.toInt32();
+xPropertySet-setPropertyValue(ZOrder, 
uno::makeAny(pHelper-findZOrder(nZOrder)));
+pHelper-addItem(xPropertySet, nZOrder);
+}
 else
 SAL_INFO(writerfilter, OSL_THIS_FUNC  : TODO handle shape 
property ' 
 OUStringToOString( i-first, RTL_TEXTENCODING_UTF8 
).getStr()  ':' 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-08-02 Thread Noel Power
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   16 
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |3 +++
 writerfilter/source/rtftok/rtfsdrimport.cxx|4 
 3 files changed, 23 insertions(+)

New commits:
commit 5ea5a0ff387d22e10b7565eec7f0f4abc685dda7
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Aug 1 20:30:40 2012 +0200

fdo#49892 import RTF_SHPB{X,Y}PAGE

(cherry picked from commit 2111c6e6dc18f3ffd11de176791ecc04bab41afb)

Conflicts:

writerfilter/source/rtftok/rtfdocumentimpl.cxx

Change-Id: I8fe2b28f44ee61fc0f1438de3681fd86b16d29ae

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index a59c06d..2074d69 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2207,6 +2207,12 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 case RTF_LANDSCAPE:
 lcl_putNestedAttribute(m_aStates.top().aSectionSprms, 
NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_orient, 
RTFValue::Pointer_t(new RTFValue(1)));
 break;
+case RTF_SHPBXPAGE:
+m_aStates.top().aShape.nHoriOrientRelation = 
text::RelOrientation::PAGE_FRAME;
+break;
+case RTF_SHPBYPAGE:
+m_aStates.top().aShape.nVertOrientRelation = 
text::RelOrientation::PAGE_FRAME;
+break;
 default:
 SAL_INFO(writerfilter, OSL_THIS_FUNC  : TODO handle flag ' 
 lcl_RtfToString(nKeyword)  ');
 aSkip.setParsed(false);
@@ -3734,6 +3740,16 @@ RTFPicture::RTFPicture()
 {
 }
 
+RTFShape::RTFShape()
+: nLeft(0),
+nTop(0),
+nRight(0),
+nBottom(0),
+nHoriOrientRelation(0),
+nVertOrientRelation(0)
+{
+}
+
 RTFDrawingObject::RTFDrawingObject()
 : nLineColorR(0),
 nLineColorG(0),
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 9778ce7..c43ca29 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -190,11 +190,14 @@ namespace writerfilter {
 class RTFShape
 {
 public:
+RTFShape();
 std::vector std::pairrtl::OUString, rtl::OUString  
aProperties;
 int nLeft;
 int nTop;
 int nRight;
 int nBottom;
+sal_Int16 nHoriOrientRelation;
+sal_Int16 nVertOrientRelation;
 };
 
 /// Stores the properties of a drawing object.
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index f12e44c..701780d 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -321,6 +321,10 @@ void RTFSdrImport::resolve(RTFShape rShape)
 {
 xShape-setPosition(awt::Point(rShape.nLeft, rShape.nTop));
 xShape-setSize(awt::Size(rShape.nRight - rShape.nLeft, rShape.nBottom 
- rShape.nTop));
+if (rShape.nHoriOrientRelation != 0)
+xPropertySet-setPropertyValue(HoriOrientRelation, 
uno::makeAny(rShape.nHoriOrientRelation));
+if (rShape.nVertOrientRelation != 0)
+xPropertySet-setPropertyValue(VertOrientRelation, 
uno::makeAny(rShape.nVertOrientRelation));
 }
 
 // Send it to dmapper
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-08-02 Thread Noel Power
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cadbe56429244c300d01b0abad8f66077cf40e7c
Author: Miklos Vajna vmik...@suse.cz
Date:   Thu Aug 2 10:49:02 2012 +0200

fdo#51034 fix docx import of HYPERLINK field, l param

Change-Id: Ic6896f7c795d7d303bf7589a74afb937d4a8e8b5
(cherry picked from commit 68cb050f0fcd37a6b1e78c147402a521d24c25c1)

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 270bb12..ee6e291 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2832,7 +2832,7 @@ void DomainMapper_Impl::CloseFieldCommand()
 if (aPartIt == aItEnd)
 break;
 
-sURL = OUString('#');
+sURL += OUString('#');
 sURL += *aPartIt;
 }
 else if ( *aPartIt == \\m || *aPartIt == \\n )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-07-30 Thread Noel Power
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 577f1a54efe800c0e45bb64d78e2d9f6e489c2c6
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Jul 27 21:20:34 2012 +0200

fdo#48033 fix RTF import of pictures inside table cells

Change-Id: I2d9ef3b346d4b10b99b67d0934d63d59f6119f97

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 08fef7a..a59c06d 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -759,7 +759,13 @@ int RTFDocumentImpl::resolvePict(bool bInline)
 }
 writerfilter::ReferenceProperties::Pointer_t const pProperties(new 
RTFReferenceProperties(aAttributes, aSprms));
 checkFirstRun();
-Mapper().props(pProperties);
+if (!m_pCurrentBuffer)
+Mapper().props(pProperties);
+else
+{
+RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms));
+m_pCurrentBuffer-push_back(make_pair(BUFFER_PROPS, pValue));
+}
 
 return 0;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-07-20 Thread Miklos Vajna
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   74 +++---
 1 file changed, 40 insertions(+), 34 deletions(-)

New commits:
commit 5586159e46d5f38e322c88459e1e7beed8133161
Author: Caolán McNamara caol...@redhat.com
Date:   Thu Jul 19 23:34:18 2012 +0100

Resolves: fdo#51772 failure to import a specific .rtf file

In this example the xCharacterStyles-getByName(aCharStyle) throws, and the
whole import is abandoned

i.e.  xRet.set(xCharacterStyles-getByName(aCharStyle), uno::UNO_QUERY);

so to keep things simple wrap the entire block in a try catch and return
an empty xRet. Could use the hasByName around the specific failing query.

Change-Id: I4f4970534cc2ff15c7d96ff2ee0a9affcfce1737
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 897402c..270bb12 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3620,42 +3620,48 @@ void DomainMapper_Impl::ApplySettingsTable()
 uno::Referencebeans::XPropertySet 
DomainMapper_Impl::GetCurrentNumberingCharStyle()
 {
 uno::Referencebeans::XPropertySet xRet;
-OUString aStyle = GetCurrentParaStyleId();
-if (aStyle.isEmpty() || GetTopContextType() != CONTEXT_PARAGRAPH)
-return xRet;
-const StyleSheetEntryPtr pEntry = 
GetStyleSheetTable()-FindStyleSheetByISTD(aStyle);
-if (!pEntry)
-return xRet;
-const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_castconst 
StyleSheetPropertyMap*(pEntry ? pEntry-pProperties.get() : 0);
-sal_Int32 nListId = pStyleSheetProperties-GetListId();
-sal_Int32 nListLevel = pStyleSheetProperties-GetListLevel();
-if (nListId  0 || nListLevel  0)
-return xRet;
-
-// So we are in a paragraph style and it has numbering. Look up the 
relevant character style.
-OUString aListName = ListDef::GetStyleName(nListId);
-uno::Reference style::XStyleFamiliesSupplier  
xStylesSupplier(GetTextDocument(), uno::UNO_QUERY);
-uno::Reference container::XNameAccess  xStyleFamilies = 
xStylesSupplier-getStyleFamilies();
-uno::Referencecontainer::XNameAccess xNumberingStyles;
-xStyleFamilies-getByName(NumberingStyles) = xNumberingStyles;
-uno::Referencebeans::XPropertySet 
xStyle(xNumberingStyles-getByName(aListName), uno::UNO_QUERY);
-uno::Referencecontainer::XIndexAccess 
xLevels(xStyle-getPropertyValue(NumberingRules), uno::UNO_QUERY);
-uno::Sequencebeans::PropertyValue aProps;
-xLevels-getByIndex(nListLevel) = aProps;
-for (int i = 0; i  aProps.getLength(); ++i)
-{
-const beans::PropertyValue rProp = aProps[i];
-
-if (rProp.Name == CharStyleName)
-{
-OUString aCharStyle;
-rProp.Value = aCharStyle;
-uno::Referencecontainer::XNameAccess xCharacterStyles;
-xStyleFamilies-getByName(CharacterStyles) = xCharacterStyles;
-xRet.set(xCharacterStyles-getByName(aCharStyle), uno::UNO_QUERY);
-break;
+try
+{
+OUString aStyle = GetCurrentParaStyleId();
+if (aStyle.isEmpty() || GetTopContextType() != CONTEXT_PARAGRAPH)
+return xRet;
+const StyleSheetEntryPtr pEntry = 
GetStyleSheetTable()-FindStyleSheetByISTD(aStyle);
+if (!pEntry)
+return xRet;
+const StyleSheetPropertyMap* pStyleSheetProperties = 
dynamic_castconst StyleSheetPropertyMap*(pEntry ? pEntry-pProperties.get() : 
0);
+sal_Int32 nListId = pStyleSheetProperties-GetListId();
+sal_Int32 nListLevel = pStyleSheetProperties-GetListLevel();
+if (nListId  0 || nListLevel  0)
+return xRet;
+
+// So we are in a paragraph style and it has numbering. Look up the 
relevant character style.
+OUString aListName = ListDef::GetStyleName(nListId);
+uno::Reference style::XStyleFamiliesSupplier  
xStylesSupplier(GetTextDocument(), uno::UNO_QUERY);
+uno::Reference container::XNameAccess  xStyleFamilies = 
xStylesSupplier-getStyleFamilies();
+uno::Referencecontainer::XNameAccess xNumberingStyles;
+xStyleFamilies-getByName(NumberingStyles) = xNumberingStyles;
+uno::Referencebeans::XPropertySet 
xStyle(xNumberingStyles-getByName(aListName), uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xLevels(xStyle-getPropertyValue(NumberingRules), uno::UNO_QUERY);
+uno::Sequencebeans::PropertyValue aProps;
+xLevels-getByIndex(nListLevel) = aProps;
+for (int i = 0; i  aProps.getLength(); ++i)
+{
+const beans::PropertyValue rProp = aProps[i];
+
+if (rProp.Name == CharStyleName)
+{
+OUString aCharStyle;
+rProp.Value = aCharStyle;
+uno::Referencecontainer::XNameAccess xCharacterStyles;
+

[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-07-19 Thread Lubos Lunak
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |4 +++-
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |2 +-
 writerfilter/source/rtftok/rtfsdrimport.cxx|   10 ++
 3 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 0c1de6d3d6320f91770967d1b23c8dd57d168fe7
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Jul 18 22:47:03 2012 +0200

fdo#52066 fix RTF import of rectangle shape without text in it

We used to always add a paragraph on shapes, which breaks import of
abused rectangle shapes with minimal height, used as lines.

Change-Id: Ice240bad68bc030e7889c46f72c45646307f17e5

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 be34248..08fef7a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3624,9 +3624,11 @@ void RTFDocumentImpl::setDestinationText(OUString 
rString)
 m_aStates.top().aDestinationText.append(rString);
 }
 
-void RTFDocumentImpl::replayShapetext()
+bool RTFDocumentImpl::replayShapetext()
 {
+bool bRet = !m_aShapetextBuffer.empty();
 replayBuffer(m_aShapetextBuffer);
+return bRet;
 }
 
 bool RTFDocumentImpl::getSkipUnknown()
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 5756b5a..9778ce7 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -368,7 +368,7 @@ namespace writerfilter {
 /// Resolve a picture: If not inline, then anchored.
 int resolvePict(bool bInline);
 void runBreak();
-void replayShapetext();
+bool replayShapetext();
 bool getSkipUnknown();
 void setSkipUnknown(bool bSkipUnknown);
 
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index ab4118c..dba4545 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -316,10 +316,12 @@ void RTFSdrImport::resolve(RTFShape rShape)
 // Send it to dmapper
 m_rImport.Mapper().startShape(xShape);
 m_rImport.Mapper().startParagraphGroup();
-m_rImport.replayShapetext();
-m_rImport.Mapper().startCharacterGroup();
-m_rImport.runBreak();
-m_rImport.Mapper().endCharacterGroup();
+if (m_rImport.replayShapetext())
+{
+m_rImport.Mapper().startCharacterGroup();
+m_rImport.runBreak();
+m_rImport.Mapper().endCharacterGroup();
+}
 m_rImport.Mapper().endParagraphGroup();
 m_rImport.Mapper().endShape();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-07-13 Thread Caolán McNamara
 writerfilter/source/dmapper/DomainMapper.cxx |   24 +++-
 1 file changed, 15 insertions(+), 9 deletions(-)

New commits:
commit 62a6b49aa78b0d55342e79aad2ebb60d46349b3b
Author: Luboš Luňák l.lu...@suse.cz
Date:   Wed Jul 11 12:15:40 2012 +0200

do not let a style override paragraph's numbering

If a paragraph has its own w:numPr, do not let w:pStyle override that.

Change-Id: I7cea0d1c8bf59804f8c56382ee68c7fad5ed3ef6
(cherry picked from commit e7ab4bb6b0e83f0114841e8c5eaa0c5ba0a4)

Signed-off-by: Caolán McNamara caol...@redhat.com

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index ac52d07..8634644 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1533,6 +1533,8 @@ void DomainMapper::sprmWithProps( Sprm rSprm, 
PropertyMapPtr rContext, SprmType
 {
 uno::Any aRules = uno::makeAny( pList-GetNumberingRules( 
) );
 rContext-Insert( PROP_NUMBERING_RULES, true, aRules );
+// erase numbering from pStyle if already set
+rContext-erase( PropertyDefinition( 
PROP_NUMBERING_STYLE_NAME, true ));
 }
 }
 else if ( !m_pImpl-IsStyleSheetImport( ) )
@@ -2990,17 +2992,21 @@ void DomainMapper::sprmWithProps( Sprm rSprm, 
PropertyMapPtr rContext, SprmType
 const ::rtl::OUString sConvertedStyleName = 
pStyleTable-ConvertStyleName( sStringValue, true );
 if (m_pImpl-GetTopContext()  m_pImpl-GetTopContextType() != 
CONTEXT_SECTION)
 m_pImpl-GetTopContext()-Insert( PROP_PARA_STYLE_NAME, true, 
uno::makeAny( sConvertedStyleName ));
-const StyleSheetEntryPtr pEntry = 
pStyleTable-FindStyleSheetByISTD(sStringValue);
-//apply numbering to paragraph if it was set at the style
-OSL_ENSURE( pEntry.get(), no style sheet found );
-const StyleSheetPropertyMap* pStyleSheetProperties = 
dynamic_castconst StyleSheetPropertyMap*(pEntry ? pEntry-pProperties.get() : 
0);
+//apply numbering to paragraph if it was set at the style, but only if 
the paragraph itself
+//does not specify the numbering
+if( rContext-find( PropertyDefinition( PROP_NUMBERING_RULES, true )) 
== rContext-end()) // !contains
+{
+const StyleSheetEntryPtr pEntry = 
pStyleTable-FindStyleSheetByISTD(sStringValue);
+OSL_ENSURE( pEntry.get(), no style sheet found );
+const StyleSheetPropertyMap* pStyleSheetProperties = 
dynamic_castconst StyleSheetPropertyMap*(pEntry ? pEntry-pProperties.get() : 
0);
 
-if( pStyleSheetProperties  pStyleSheetProperties-GetListId() = 0 )
-rContext-Insert( PROP_NUMBERING_STYLE_NAME, true, uno::makeAny(
-ListDef::GetStyleName( 
pStyleSheetProperties-GetListId( ) ) ), false);
+if( pStyleSheetProperties  pStyleSheetProperties-GetListId() = 
0 )
+rContext-Insert( PROP_NUMBERING_STYLE_NAME, true, 
uno::makeAny(
+ListDef::GetStyleName( 
pStyleSheetProperties-GetListId( ) ) ), false);
 
-if( pStyleSheetProperties  pStyleSheetProperties-GetListLevel() = 
0 )
-rContext-Insert( PROP_NUMBERING_LEVEL, true, 
uno::makeAny(pStyleSheetProperties-GetListLevel()), false);
+if( pStyleSheetProperties  pStyleSheetProperties-GetListLevel() 
= 0 )
+rContext-Insert( PROP_NUMBERING_LEVEL, true, 
uno::makeAny(pStyleSheetProperties-GetListLevel()), false);
+}
 }
 break;
 case NS_ooxml::LN_EG_RPrBase_rStyle:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-06-27 Thread Miklos Vajna
 writerfilter/source/dmapper/DomainMapper.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 2992b53f39ea3d61d4acbe7f7c494f90228ce377
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Jun 27 16:59:24 2012 +0200

n#693238 dmapper: fix margin values vs SBkc = 0 at the end of the doc

The problem was that a continous section break at the end of the
document caused the section margins to be ignored. Just ignoring the
continous section break (only in case it's at the end of the document)
makes the problem go away.

The original fix was commit cd1c434c4bd4756fa1355e906cb2e8de4aae0618,
but it got reverted in commit 2dee7d6205832a1212790ac1ab168a6b6fce686d,
as it caused fdo#44292. This second attempt fixes the original bug
again, without introducing the 4 columns bug.

Change-Id: I75d612430a5cd631dec0d224127cba580070900d

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 5ecceba..ac52d07 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2369,7 +2369,12 @@ void DomainMapper::sprmWithProps( Sprm rSprm, 
PropertyMapPtr rContext, SprmType
 */
 OSL_ENSURE(pSectionContext, SectionContext unavailable!);
 if(pSectionContext)
-pSectionContext-SetBreakType( nIntValue );
+{
+// Ignore continous section break at the end of the document
+// It makes the importer loose margin settings with no benefit
+if (m_pImpl-GetParaSectpr() || nIntValue != 0)
+pSectionContext-SetBreakType( nIntValue );
+}
 break;
 case 143:
 case NS_sprm::LN_SFTitlePage: // sprmSFTitlePage
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-06-25 Thread Miklos Vajna
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit ac00b2881824ebd40bfcb2b20c70df6d21daf677
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Jun 22 18:55:15 2012 +0200

fdo#46966 dmapper: fix headery/footery default value

The docx spec doesn't say what is the default value, the rtf spec says
it's 720, not 1440.

Change-Id: Icb331591d4f2f96a7786f808d99af5974e645f8e

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 13abcad..0f9af17 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3394,7 +3394,8 @@ void DomainMapper_Impl::SetPageMarginTwip( PageMarElement 
eElement, sal_Int32 nV
 
 _PageMar::_PageMar()
 {
-header = footer = top = bottom = ConversionHelper::convertTwipToMM100( 
sal_Int32(1440));
+header = footer = ConversionHelper::convertTwipToMM100(sal_Int32(720));
+top = bottom = ConversionHelper::convertTwipToMM100( sal_Int32(1440));
 right = left = ConversionHelper::convertTwipToMM100( sal_Int32(1800));
 gutter = 0;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-06-25 Thread Miklos Vajna
 writerfilter/source/dmapper/DomainMapper.cxx  |   11 +++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   31 ++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |   10 +++
 writerfilter/source/dmapper/PropertyMap.cxx   |1 
 4 files changed, 53 insertions(+)

New commits:
commit ca555c596043c88894b964ac5e21f5a7271d5f3b
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Jun 25 15:58:11 2012 +0200

n#766481 dmapper: don't import fake paragraph containing sectpr only, take 
two

Change-Id: I4623dfd05498b5ba8de73b7e301eaf486f667738

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index f51ce3f..c11935d 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2795,6 +2795,8 @@ void DomainMapper::sprmWithProps( Sprm rSprm, 
PropertyMapPtr rContext, SprmType
 case NS_ooxml::LN_CT_Style_rPr:
 case NS_ooxml::LN_CT_PPr_rPr:
 case NS_ooxml::LN_CT_PPrBase_numPr:
+if (nSprmId == NS_ooxml::LN_CT_PPr_sectPr)
+m_pImpl-SetParaSectpr(true);
 resolveSprmProps(*this, rSprm);
 break;
 case NS_ooxml::LN_EG_SectPrContents_footnotePr:
@@ -3396,7 +3398,16 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 
 // RTF always uses text() instead of utext() for run break
 if(len == 1  ((*data_) == 0x0d || (*data_) == 0x07)  
!IsRTFImport())
+{
+bool bSingleParagraph = m_pImpl-GetIsFirstParagraphInSection()  
m_pImpl-GetIsLastParagraphInSection();
+// If the paragraph contains only the section properties and it has
+// no runs, we should not create a paragraph for it in Writer, 
unless that would remove the whole section.
+bool bRemove = !m_pImpl-GetParaChanged()  
m_pImpl-GetParaSectpr()  !bSingleParagraph;
+m_pImpl-SetParaSectpr(false);
 
m_pImpl-finishParagraph(m_pImpl-GetTopContextOfType(CONTEXT_PARAGRAPH));
+if (bRemove)
+m_pImpl-RemoveLastParagraph();
+}
 else
 {
 
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0f9af17..897402c 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -206,7 +206,9 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bIsCustomFtnMark( false ),
 m_bIsParaChange( false ),
 m_bParaChanged( false ),
+m_bIsFirstParaInSection( true ),
 m_bIsLastParaInSection( false ),
+m_bParaSectpr( false ),
 m_bUsingEnhancedFields( false )
 {
 appendTableManager( );
@@ -307,7 +309,35 @@ void DomainMapper_Impl::SetIsLastParagraphInSection( bool 
bIsLast )
 m_bIsLastParaInSection = bIsLast;
 }
 
+bool DomainMapper_Impl::GetIsLastParagraphInSection()
+{
+return m_bIsLastParaInSection;
+}
+
+void DomainMapper_Impl::SetIsFirstParagraphInSection( bool bIsFirst )
+{
+m_bIsFirstParaInSection = bIsFirst;
+}
+
+bool DomainMapper_Impl::GetIsFirstParagraphInSection()
+{
+return m_bIsFirstParaInSection;
+}
 
+void DomainMapper_Impl::SetParaSectpr(bool bParaSectpr)
+{
+m_bParaSectpr = bParaSectpr;
+}
+
+bool DomainMapper_Impl::GetParaSectpr()
+{
+return m_bParaSectpr;
+}
+
+bool DomainMapper_Impl::GetParaChanged()
+{
+return m_bParaChanged;
+}
 
 voidDomainMapper_Impl::PushProperties(ContextType eId)
 {
@@ -1030,6 +1060,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr 
pPropertyMap )
 uno::Reference text::XTextRange  xParaEnd( xCur, 
uno::UNO_QUERY );
 CheckParaRedline( xParaEnd );
 
+m_bIsFirstParaInSection = false;
 m_bIsLastParaInSection = false;
 m_bParaChanged = false;
 
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 77a2b62..0cfee56 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -349,8 +349,12 @@ private:
 RedlineParamsPtrm_pParaRedline;
 boolm_bIsParaChange;
 
+/// If the current paragraph has any runs.
 boolm_bParaChanged;
+boolm_bIsFirstParaInSection;
 boolm_bIsLastParaInSection;
+/// If the current paragraph contains section property definitions.
+boolm_bParaSectpr;
 boolm_bUsingEnhancedFields;
 
 //annotation import
@@ -406,6 +410,12 @@ public:
 
 void RemoveLastParagraph( );
 void SetIsLastParagraphInSection( bool bIsLast );
+bool GetIsLastParagraphInSection();
+void SetIsFirstParagraphInSection( bool bIsFirst );
+bool 

[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-06-15 Thread Miklos Vajna
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 ++--
 writerfilter/source/dmapper/SettingsTable.cxx |   10 ++
 writerfilter/source/dmapper/SettingsTable.hxx |2 ++
 3 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 975e916421f46e913f0fec1b8a9372ac3dc57382
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Jun 15 15:09:53 2012 +0200

n#750935 fix docx import of w:evenAndOddHeaders

Change-Id: I172073bac10e8d0449c0f5c0a226dd7ace013376

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 546613a..165fd2f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1271,7 +1271,7 @@ void 
DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType)
 uno::makeAny(sal_True) );
 // if a left header is available then header are not shared
 bool bLeft = eType == SectionPropertyMap::PAGE_LEFT;
-if( bLeft )
+if( bLeft  m_pSettingsTable-GetEvenAndOddHeaders())
 
xPageStyle-setPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_IS_SHARED), 
uno::makeAny( false ));
 
 //set the interface
@@ -1310,7 +1310,7 @@ void 
DomainMapper_Impl::PushPageFooter(SectionPropertyMap::PageType eType)
 uno::makeAny(sal_True) );
 // if a left header is available then footer is not shared
 bool bLeft = eType == SectionPropertyMap::PAGE_LEFT;
-if( bLeft )
+if( bLeft  m_pSettingsTable-GetEvenAndOddHeaders())
 
xPageStyle-setPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_IS_SHARED), 
uno::makeAny( false ));
 //set the interface
 uno::Reference text::XText  xFooterText;
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx 
b/writerfilter/source/dmapper/SettingsTable.cxx
index ab89c6a..2a69cc6 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -76,6 +76,7 @@ struct SettingsTable_Impl
 ::rtl::OUString m_sSalt;
 boolm_bLinkStyles;
 sal_Int16   m_nZoomFactor;
+boolm_bEvenAndOddHeaders;
 
 SettingsTable_Impl( DomainMapper rDMapper, const uno::Reference 
lang::XMultiServiceFactory  xTextFactory ) :
 m_rDMapper( rDMapper )
@@ -94,6 +95,7 @@ struct SettingsTable_Impl
 , m_nCryptSpinCount(0)
 , m_bLinkStyles(false)
 , m_nZoomFactor(0)
+, m_bEvenAndOddHeaders(false)
 {}
 
 };
@@ -165,6 +167,9 @@ void SettingsTable::lcl_sprm(Sprm rSprm)
 case NS_ooxml::LN_CT_Settings_linkStyles: // 92663;
 m_pImpl-m_bLinkStyles = nIntValue;
 break;
+case NS_ooxml::LN_CT_Settings_evenAndOddHeaders:
+m_pImpl-m_bEvenAndOddHeaders = nIntValue;
+break;
 case NS_ooxml::LN_CT_Settings_noPunctuationKerning: //  92526;
 m_pImpl-m_bNoPunctuationKerning = nIntValue ? true : false;
 break;
@@ -230,6 +235,11 @@ sal_Int16 SettingsTable::GetZoomFactor() const
 return m_pImpl-m_nZoomFactor;
 }
 
+bool SettingsTable::GetEvenAndOddHeaders() const
+{
+return m_pImpl-m_bEvenAndOddHeaders;
+}
+
 void SettingsTable::ApplyProperties( uno::Reference text::XTextDocument  
xDoc )
 {
 uno::Reference beans::XPropertySet xDocProps( xDoc, uno::UNO_QUERY );
diff --git a/writerfilter/source/dmapper/SettingsTable.hxx 
b/writerfilter/source/dmapper/SettingsTable.hxx
index 3d9a560..2c43ec6 100644
--- a/writerfilter/source/dmapper/SettingsTable.hxx
+++ b/writerfilter/source/dmapper/SettingsTable.hxx
@@ -70,6 +70,8 @@ class WRITERFILTER_DLLPRIVATE SettingsTable : public 
LoggedProperties, public Lo
 /// What's the zoom factor set in percents?
 sal_Int16 GetZoomFactor() const;
 
+bool GetEvenAndOddHeaders() const;
+
 void ApplyProperties( uno::Reference text::XTextDocument  xDoc );
 
  private:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

2012-06-13 Thread Miklos Vajna
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 54ffca05745da60db73d331bbad4af175aaf1788
Author: Julien Nabet serval2...@yahoo.fr
Date:   Tue Jun 12 19:50:23 2012 +0200

Resolves: fdo#49178 CRASH when FILEOPEN particular RTF

Change-Id: Idd938980b91ec8b822a92dfd7013a20fe5b6f498
(cherry picked from commit 104badf31c8a39994cadc460561bfa01e428b67b)

Signed-off-by: Miklos Vajna vmik...@suse.cz

diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 89a71f1..2b59358 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -486,8 +486,9 @@ void DomainMapperTableManager::endOfRowAction()
 
 sal_Int16 nSum = 0;
 sal_uInt32 nPos = 0;
+sal_uInt32 nSizeTableGrid = pTableGrid-size();
 // 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--)
+for (sal_uInt32 i = m_nCell; i  1  nSizeTableGrid = i; i--)
 {
 nSum += (*pTableGrid.get())[pTableGrid-size() - i]; // Size of 
the current cell
 pSeparators[nPos].Position = nSum * nFullWidthRelative / 
nFullWidth; // Relative position
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits