[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-07-10 Thread Michael Stahl
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit e8be529787b89f5a3f7d71c8885503e08d34a9a3
Author: Michael Stahl mst...@redhat.com
Date:   Wed Jul 10 12:38:16 2013 +0200

writerfilter: not every field has a Content property

... so don't try to get it unconditionally  (but SetExpression does
have it).

(regression from c7e4264bed4e77daccf2f72063e5e00f1008c3cf)

Change-Id: I14d24bd70f569ba0bc4f1e48d56ebf43c1441783
(cherry picked from commit 1c90902cbccd4e4f5946dfc454da351c33c24f71)
Reviewed-on: https://gerrit.libreoffice.org/4808
Reviewed-by: Bosdonnat Cedric cedric.bosdon...@free.fr
Tested-by: Bosdonnat Cedric cedric.bosdon...@free.fr

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index c4b4697..0be95a2 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3313,9 +3313,12 @@ void DomainMapper_Impl::SetFieldResult( OUString 
rResult )
 bool bIsSetExpression = 
xServiceInfo-supportsService(com.sun.star.text.TextField.SetExpression);
 // If we already have content set, then use the 
current presentation
 rtl::OUString sValue;
-uno::Any aValue = xFieldProperties-getPropertyValue(
-rPropNameSupplier.GetName(PROP_CONTENT));
-aValue = sValue;
+if (bIsSetExpression)
+{   // this will throw for field types without Content
+uno::Any aValue(xFieldProperties-getPropertyValue(
+rPropNameSupplier.GetName(PROP_CONTENT)));
+aValue = sValue;
+}
 xFieldProperties-setPropertyValue(
 rPropNameSupplier.GetName(bIsSetExpression  
sValue.isEmpty()? PROP_CONTENT : PROP_CURRENT_PRESENTATION),
  uno::makeAny( rResult ));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-07-08 Thread Cédric Bosdonnat
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   37 +++---
 1 file changed, 33 insertions(+), 4 deletions(-)

New commits:
commit 4967809914871066acda64c28704e74e7047e76f
Author: Cédric Bosdonnat cedric.bosdon...@free.fr
Date:   Wed Jul 3 17:43:33 2013 +0200

n#825976: writerfilter initial support of SEQ fields

No switch and no numeric formatting is taken into account ATM, just the
defaults, but at least we have the fields properly created.

Change-Id: Ib17c5e93199044a05005e4648c7e4cc81baf51dd
(cherry picked from commit 94a9bce4fb61aeeece8809eec1cbdc37101bdd22)
Reviewed-on: https://gerrit.libreoffice.org/4720
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 48e40dea..66d68dd 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3116,7 +3116,37 @@ void DomainMapper_Impl::CloseFieldCommand()
 break;
 case FIELD_SECTION  : break;
 case FIELD_SECTIONPAGES : break;
-case FIELD_SEQ  : break;
+case FIELD_SEQ  :
+{
+OUString sIdentifier = 
lcl_ExtractParameter(pContext-GetCommand(), sizeof( SEQ) );
+if (xFieldProperties.is()  !sIdentifier.isEmpty())
+{
+uno::Reference beans::XPropertySet xMaster = 
FindOrCreateFieldMaster(
+
com.sun.star.text.fieldmaster.SetExpression, sIdentifier);
+
+// SubType 1 makes the difference between range 
and normal SetExpression
+xMaster-setPropertyValue(
+rPropNameSupplier.GetName(PROP_SUB_TYPE),
+uno::makeAny(sal_Int8(1)));
+
+uno::Reference text::XDependentTextField  
xDependentField(
+xFieldInterface, uno::UNO_QUERY_THROW );
+xDependentField-attachTextFieldMaster( xMaster );
+
+// TODO This formula may change with the flags of 
the SEQ field
+rtl::OUString sFormula = sIdentifier + +1;
+xFieldProperties-setPropertyValue(
+rPropNameSupplier.GetName(PROP_CONTENT),
+uno::makeAny(sFormula));
+
+// TODO Take care of the numeric formatting 
definition, default is Arabic
+xFieldProperties-setPropertyValue(
+
rPropNameSupplier.GetName(PROP_NUMBERING_TYPE),
+
uno::makeAny(style::NumberingType::ARABIC));
+}
+
+}
+break;
 case FIELD_SET  : break;
 case FIELD_SKIPIF   : break;
 case FIELD_STYLEREF : break;
@@ -3192,15 +3222,14 @@ void DomainMapper_Impl::CloseFieldCommand()
 rPropNameSupplier.GetName(PROP_NUMBERING_TYPE),
 uno::makeAny( 
lcl_ParseNumberingType(pContext-GetCommand()) ));
 break;
-
 }
 }
 //set the text field if there is any
 pContext-SetTextField( uno::Reference text::XTextField ( 
xFieldInterface, uno::UNO_QUERY ) );
 }
-catch( const uno::Exception )
+catch( const uno::Exception e )
 {
-OSL_FAIL( Exception in CloseFieldCommand() );
+SAL_WARN( writerfilter, Exception in CloseFieldCommand():   
e.Message );
 }
 pContext-SetCommandCompleted();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-07-08 Thread Cédric Bosdonnat
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)

New commits:
commit 5911674f1b009ee29b8df6169f2d5452a397b008
Author: Cédric Bosdonnat cedric.bosdon...@free.fr
Date:   Thu Jul 4 10:13:07 2013 +0200

n#825976: Added common flags support for SEQ field import

Change-Id: I9a4505cf060880811abfe355b2ebf810cde9a4d6
(cherry picked from commit 031ced0d1ade5350ef0b17a245a2cb5c76e6173d)
Reviewed-on: https://gerrit.libreoffice.org/4721
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 66d68dd..56740bd 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3133,16 +3133,29 @@ void DomainMapper_Impl::CloseFieldCommand()
 xFieldInterface, uno::UNO_QUERY_THROW );
 xDependentField-attachTextFieldMaster( xMaster );
 
-// TODO This formula may change with the flags of 
the SEQ field
 rtl::OUString sFormula = sIdentifier + +1;
+rtl::OUString sValue;
+if( lcl_FindInCommand( pContext-GetCommand(), 
'c', sValue ))
+{
+sFormula = sIdentifier;
+}
+else if( lcl_FindInCommand( 
pContext-GetCommand(), 'r', sValue ))
+{
+sFormula = sValue;
+}
+// TODO \s isn't handled, but the spec isn't easy 
to understand without
+// an example for this one.
 xFieldProperties-setPropertyValue(
 rPropNameSupplier.GetName(PROP_CONTENT),
 uno::makeAny(sFormula));
 
-// TODO Take care of the numeric formatting 
definition, default is Arabic
+// Take care of the numeric formatting definition, 
default is Arabic
+sal_Int16 nNumberingType = 
lcl_ParseNumberingType(pContext-GetCommand());
+if (nNumberingType == 
style::NumberingType::PAGE_DESCRIPTOR)
+nNumberingType == style::NumberingType::ARABIC;
 xFieldProperties-setPropertyValue(
 
rPropNameSupplier.GetName(PROP_NUMBERING_TYPE),
-
uno::makeAny(style::NumberingType::ARABIC));
+uno::makeAny(nNumberingType));
 }
 
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-07-08 Thread Cédric Bosdonnat
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   19 +--
 writerfilter/source/dmapper/PropertyIds.cxx   |1 +
 writerfilter/source/dmapper/PropertyIds.hxx   |1 +
 3 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit b86fe11a8374e9b1cb6b0f5326b5f13b1a61b78b
Author: Cédric Bosdonnat cedric.bosdon...@free.fr
Date:   Thu Jul 4 15:45:01 2013 +0200

n#825976: Fixed the import of Table of Figures

Support the TOC \c switch and fixed the SetExpression current
presentation property to have updated fields and TOC.

(cherry picked from commit 22a22a0983ec9c95e5b471395fc1c5bb813bd0d2)

Conflicts:
writerfilter/source/dmapper/PropertyIds.cxx

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

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 56740bd..c4b4697 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2502,6 +2502,8 @@ void DomainMapper_Impl::handleToc
 sal_Int16 nMaxLevel = 10;
 OUString sTemplate;
 OUString sChapterNoSeparator;
+OUString sFigureSequence;
+
 //  \a Builds a table of figures but does not include the 
captions's label and number
 if( lcl_FindInCommand( pContext-GetCommand(), 'a', sValue ))
 { //make it a table of figures
@@ -2516,6 +2518,8 @@ void DomainMapper_Impl::handleToc
 {
 //todo: sValue contains the label's name
 bTableOfFigures = true;
+sFigureSequence = sValue.trim();
+sFigureSequence = sFigureSequence.replaceAll(\, 
).replaceAll(',);
 }
 //  \d Defines the separator between sequence and page numbers
 if( lcl_FindInCommand( pContext-GetCommand(), 'd', sValue ))
@@ -2698,6 +2702,12 @@ void DomainMapper_Impl::handleToc
 }
 }
 }
+else if (bTableOfFigures  xTOC.is())
+{
+if (!sFigureSequence.isEmpty())
+
xTOC-setPropertyValue(rPropNameSupplier.GetName(PROP_LABEL_CATEGORY),
+   uno::makeAny(sFigureSequence));
+}
 pContext-SetTOC( xTOC );
 }
 
@@ -3152,7 +3162,7 @@ void DomainMapper_Impl::CloseFieldCommand()
 // Take care of the numeric formatting definition, 
default is Arabic
 sal_Int16 nNumberingType = 
lcl_ParseNumberingType(pContext-GetCommand());
 if (nNumberingType == 
style::NumberingType::PAGE_DESCRIPTOR)
-nNumberingType == style::NumberingType::ARABIC;
+nNumberingType = style::NumberingType::ARABIC;
 xFieldProperties-setPropertyValue(
 
rPropNameSupplier.GetName(PROP_NUMBERING_TYPE),
 uno::makeAny(nNumberingType));
@@ -3301,8 +3311,13 @@ void DomainMapper_Impl::SetFieldResult( OUString 
rResult )
 // In case of SetExpression, the field result contains 
the content of the variable.
 uno::Referencelang::XServiceInfo 
xServiceInfo(xTextField, uno::UNO_QUERY);
 bool bIsSetExpression = 
xServiceInfo-supportsService(com.sun.star.text.TextField.SetExpression);
+// If we already have content set, then use the 
current presentation
+rtl::OUString sValue;
+uno::Any aValue = xFieldProperties-getPropertyValue(
+rPropNameSupplier.GetName(PROP_CONTENT));
+aValue = sValue;
 xFieldProperties-setPropertyValue(
-rPropNameSupplier.GetName(bIsSetExpression ? 
PROP_CONTENT : PROP_CURRENT_PRESENTATION),
+rPropNameSupplier.GetName(bIsSetExpression  
sValue.isEmpty()? PROP_CONTENT : PROP_CURRENT_PRESENTATION),
  uno::makeAny( rResult ));
 }
 }
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx 
b/writerfilter/source/dmapper/PropertyIds.cxx
index 1fbf3d1..1862bf7 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -320,6 +320,7 @@ const OUString PropertyNameSupplier::GetName( PropertyIds 
eId ) const
 case PROP_EMBED_FONTS: sName = EmbedFonts; break;
 case PROP_EMBED_SYSTEM_FONTS: sName = EmbedSystemFonts; break;
 case PROP_SHADOW_FORMAT: sName = ShadowFormat; break;
+case PROP_LABEL_CATEGORY: sName = LabelCategory; break;
 }
 

[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-06-28 Thread Cédric Bosdonnat
 writerfilter/source/dmapper/StyleSheetTable.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 2e2679cb0b79acb81028fa75518ffa1bb368d403
Author: Cédric Bosdonnat cedric.bosdon...@free.fr
Date:   Mon Jun 17 13:42:34 2013 +0200

n#820504: default color hidden by Default style in writerfilter

Setting the font color of the default paragraph style to Auto makes the
color set in the Writer defaults (from rPrDefault) ignored.

Change-Id: I1dcd92bcd0774f5229785373242899a492ab7b7c
(cherry picked from commit d7acb5ba0924f848f1ae96eceab50a0169d18445)
Reviewed-on: https://gerrit.libreoffice.org/4534
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index cf2ae05..325c9a4 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -774,8 +774,7 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr 
rFontTable )
 pEntry-pProperties-Insert(PROP_PARA_ORPHANS, true, 
aTwo, false);
 //  Left-to-right direction if not already set
 pEntry-pProperties-Insert(PROP_WRITING_MODE, true, 
uno::makeAny( sal_Int16(text::WritingMode_LR_TB) ), false);
-//  font color COL_AUTO if not already set
-pEntry-pProperties-Insert(PROP_CHAR_COLOR, true, 
uno::makeAny( sal_Int32(0x) ), false);
+// Don't set font color to Auto if not already set: 
this could hide the default font color setting
 }
 
 uno::Sequence beans::PropertyValue  aPropValues = 
pEntry-pProperties-GetPropertyValues();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-06-19 Thread David Tardon
 writerfilter/source/rtftok/rtffly.hxx |   42 --
 1 file changed, 15 insertions(+), 27 deletions(-)

New commits:
commit 593b0352d22d775b5646eaf4928863fbb5a40aea
Author: David Tardon dtar...@redhat.com
Date:   Wed Jun 19 12:38:43 2013 +0200

fix rtf import on big endian

(cherry picked from commit fa2363344cbf85af17a80c4757b226ab43391af6)

Change-Id: Ia9f589752176849f7f6700483e933767e509edf3
Signed-off-by: David Tardon dtar...@redhat.com
Reviewed-on: https://gerrit.libreoffice.org/4355
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/writerfilter/source/rtftok/rtffly.hxx 
b/writerfilter/source/rtftok/rtffly.hxx
index 918f800..f804b00 100644
--- a/writerfilter/source/rtftok/rtffly.hxx
+++ b/writerfilter/source/rtftok/rtffly.hxx
@@ -36,18 +36,18 @@ namespace writerfilter {
 {
 public:
 RTFVertOrient(sal_uInt16 nValue)
+: nVal(nValue)
 {
-Value.nVal = nValue;
 }
 
 sal_uInt16 GetOrient() const
 {
-return Value.Flags.nOrient;
+return OSL_LONIBBLE(OSL_LOBYTE(nVal));
 }
 
 sal_uInt16 GetRelation() const
 {
-return Value.Flags.nRelOrient;
+return OSL_HINIBBLE(OSL_LOBYTE(nVal));
 }
 
 sal_Int32 GetAlign() const
@@ -90,19 +90,11 @@ namespace writerfilter {
 
 sal_uInt16 GetValue() const
 {
-return Value.nVal;
+return nVal;
 }
 
 private:
-union
-{
-struct
-{
-sal_uInt16 nOrient : 4;
-sal_uInt16 nRelOrient : 4;
-} Flags;
-sal_uInt16 nVal;
-} Value;
+sal_uInt16 nVal;
 };
 
 /// Stores the horizontal orientation properties of an RTF fly frame.
@@ -110,18 +102,23 @@ namespace writerfilter {
 {
 public:
 RTFHoriOrient(sal_uInt16 nValue)
+: nVal(nValue)
 {
-Value.nVal = nValue;
 }
 
 sal_uInt16 GetOrient() const
 {
-return Value.Flags.nOrient;
+return OSL_LONIBBLE(OSL_LOBYTE(nVal));
 }
 
 sal_uInt16 GetRelation() const
 {
-return Value.Flags.nRelOrient;
+return OSL_LONIBBLE(OSL_HIBYTE(nVal));
+}
+
+sal_uInt16 GetRelAnchor() const
+{
+return OSL_HINIBBLE(OSL_LOBYTE(nVal));
 }
 
 sal_Int32 GetAlign() const
@@ -170,20 +167,11 @@ namespace writerfilter {
 
 sal_uInt16 GetValue() const
 {
-return Value.nVal;
+return nVal;
 }
 
 private:
-union
-{
-struct
-{
-sal_uInt16 nOrient : 4;
-sal_uInt16 nRelAnchor : 4;
-sal_uInt16 nRelOrient : 4;
-} Flags;
-sal_uInt16 nVal;
-} Value;
+sal_uInt16 nVal;
 };
 } // namespace rtftok
 } // namespace writerfilter
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-06-11 Thread Julien Nabet
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 8f50adc18112877214495e723976f18fa41cc18d
Author: Julien Nabet serval2...@yahoo.fr
Date:   Sat Jun 8 15:28:55 2013 +0200

Related fdo#33895 add some checks against NULL derefs

Change-Id: I9c62a063788a494125ce8dc27748ed66022f5c48
Reviewed-on: https://gerrit.libreoffice.org/4199
Reviewed-by: Miklos Vajna vmik...@suse.cz
Tested-by: Miklos Vajna vmik...@suse.cz
Reviewed-on: https://gerrit.libreoffice.org/4224

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx 
b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index c8af924..aae56aa 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1161,8 +1161,13 @@ void OOXMLFastContextHandler::resolveFooter
 // Add the data pointed to by the reference as another property.
 void OOXMLFastContextHandler::resolveData(const OUString  rId)
 {
+OOXMLDocument * objDocument = getDocument();
+SAL_WARN_IF(!objDocument, writerfilter, no document to resolveData);
+if (!objDocument)
+return;
+
 uno::Referenceio::XInputStream xInputStream
-(mpParserState-getDocument()-getInputStreamForId(rId));
+(objDocument-getInputStreamForId(rId));
 
 OOXMLValue::Pointer_t aValue(new OOXMLInputStreamValue(xInputStream));
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-06-06 Thread Caolán McNamara
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |3 +++
 writerfilter/source/ooxml/OOXMLParserState.cxx|3 +++
 2 files changed, 6 insertions(+)

New commits:
commit 098819a289651793d4dc198dfb0a044ff723893f
Author: Caolán McNamara caol...@redhat.com
Date:   Thu Jun 6 11:41:03 2013 +0100

add some checks against NULL derefs

(cherry picked from commit fa671cecd4bb2f38a0a9171cfdbb56efddda1cfa)

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

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx 
b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 5865846..c8af924 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1335,6 +1335,9 @@ void OOXMLFastContextHandlerProperties::lcl_endFastElement
 {
 if (isForwardEvents())
 {
+SAL_WARN_IF(!mpStream, writerfilter, no stream to set 
properties on);
+if (!mpStream)
+return;
 mpStream-props(mpPropertySet);
 }
 }
diff --git a/writerfilter/source/ooxml/OOXMLParserState.cxx 
b/writerfilter/source/ooxml/OOXMLParserState.cxx
index 45f8b1c..723aef8 100644
--- a/writerfilter/source/ooxml/OOXMLParserState.cxx
+++ b/writerfilter/source/ooxml/OOXMLParserState.cxx
@@ -125,6 +125,9 @@ OOXMLDocument * OOXMLParserState::getDocument() const
 
 void OOXMLParserState::setXNoteId(const sal_Int32 nId)
 {
+SAL_WARN_IF(!mpDocument, writerfilter, no document to set note id on);
+if (!mpDocument)
+return;
 mpDocument-setXNoteId(nId);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-05-15 Thread Cédric Bosdonnat
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

New commits:
commit df73fa5feb10df10c4ba036be5fac1ddb9b6915f
Author: Cédric Bosdonnat cedric.bosdon...@free.fr
Date:   Tue May 14 14:59:31 2013 +0200

fdo#64249: make sure we have matching start/end level for table in shapes

Change-Id: I4928f6a54e6cca9b26c0d2391fc1545688be2375
(cherry picked from commit 9ceda3013a6b7e60e0e56ba540e217fd36a34a0f)
Reviewed-on: https://gerrit.libreoffice.org/3907
Reviewed-by: Miklos Vajna vmik...@suse.cz
Tested-by: Miklos Vajna vmik...@suse.cz

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index deda4f1..48e40dea 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1627,6 +1627,10 @@ void DomainMapper_Impl::PushShapeContext( const 
uno::Reference drawing::XShape
 if (m_aTextAppendStack.empty())
 return;
 uno::Referencetext::XTextAppend xTextAppend = 
m_aTextAppendStack.top().xTextAppend;
+
+appendTableManager( );
+appendTableHandler( );
+getTableManager().startLevel();
 try
 {
 uno::Reference lang::XServiceInfo  xSInfo( xShape, 
uno::UNO_QUERY_THROW );
@@ -1685,10 +1689,6 @@ void DomainMapper_Impl::PushShapeContext( const 
uno::Reference drawing::XShape
 xProps-setPropertyValue( rPropNameSupplier.GetName( 
PROP_ANCHOR_TYPE ), bIsGraphic  ?  uno::makeAny( 
text::TextContentAnchorType_AS_CHARACTER ) : uno::makeAny( 
text::TextContentAnchorType_AT_PARAGRAPH ) );
 }
 }
-
-appendTableManager( );
-appendTableHandler( );
-getTableManager().startLevel();
 }
 catch ( const uno::Exception e )
 {
@@ -1700,11 +1700,10 @@ void DomainMapper_Impl::PushShapeContext( const 
uno::Reference drawing::XShape
 
 void DomainMapper_Impl::PopShapeContext()
 {
+getTableManager().endLevel();
+popTableManager();
 if ( m_aAnchoredStack.size()  0 )
 {
-getTableManager().endLevel();
-popTableManager();
-
 // For OLE object replacement shape, the text append context was 
already removed
 // or the OLE object couldn't be inserted.
 if ( !m_aAnchoredStack.top().bToRemove )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-05-02 Thread Fridrich Štrba
 writerfilter/source/dmapper/NumberingManager.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit f98dcf9b07ee5ce6e2a241679086b1326072a28d
Author: Fridrich Å trba fridrich.st...@bluewin.ch
Date:   Thu May 2 12:57:40 2013 +0200

Fix out-of-bonds Sequence access in NumberingManager with page numbering

Change-Id: Ib35fcee1605215fb22ae9838b29fe1d8be5eaf58
(cherry picked from commit 4314e6548356a5d2f1dc45e2aa501e37bd5a794e)
Reviewed-on: https://gerrit.libreoffice.org/3739
Reviewed-by: Bosdonnat Cedric cedric.bosdon...@free.fr
Tested-by: Bosdonnat Cedric cedric.bosdon...@free.fr

diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index 470cb0c..0cd9138 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -492,7 +492,8 @@ uno::Sequence uno::Sequence beans::PropertyValue   
ListDef::GetPropertyValue
 
 // Merge the results of [2] in [1]
 sal_Int32 nThisCount = aThis.getLength( );
-for ( sal_Int32 i = 0; i  nThisCount; i++ )
+sal_Int32 nAbstractCount = aAbstract.getLength( );
+for ( sal_Int32 i = 0; i  nThisCount  i  nAbstractCount; i++ )
 {
 uno::Sequence beans::PropertyValue  level = aThis[i];
 if ( level.hasElements() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-03-28 Thread Maxime de Roucy
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   83 -
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |5 -
 2 files changed, 44 insertions(+), 44 deletions(-)

New commits:
commit 1145265b3f4bac37939726b1f4bf430eb5ec2c54
Author: Maxime de Roucy mdero...@linagora.com
Date:   Mon Mar 25 16:33:55 2013 +0100

solve fdo#62805

move m_pCurrentBuffer to RTFParserState

Change-Id: Ied16ee1704d35c6bd0368b26a210131b60bc91a3
Reviewed-on: https://gerrit.libreoffice.org/3082
Reviewed-by: Miklos Vajna vmik...@suse.cz
Tested-by: Miklos Vajna vmik...@suse.cz

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 3f18695..7e9c8b0 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -254,7 +254,6 @@ 
RTFDocumentImpl::RTFDocumentImpl(uno::Referenceuno::XComponentContext const x
 m_aTableBuffer(),
 m_aSuperBuffer(),
 m_aShapetextBuffer(),
-m_pCurrentBuffer(0),
 m_bHasFootnote(false),
 m_pSuperstream(0),
 m_nHeaderFooterPositions(),
@@ -437,7 +436,7 @@ void RTFDocumentImpl::checkNeedPap()
 if (m_bNeedPap)
 {
 m_bNeedPap = false; // reset early, so we can avoid recursion when 
calling ourselves
-if (!m_pCurrentBuffer)
+if (!m_aStates.top().pCurrentBuffer)
 {
 writerfilter::ReferenceProperties::Pointer_t const 
pParagraphProperties(
 getProperties(m_aStates.top().aParagraphAttributes, 
m_aStates.top().aParagraphSprms)
@@ -465,14 +464,14 @@ void RTFDocumentImpl::checkNeedPap()
 else
 {
 RTFValue::Pointer_t pValue(new 
RTFValue(m_aStates.top().aParagraphAttributes, 
m_aStates.top().aParagraphSprms));
-m_pCurrentBuffer-push_back(make_pair(BUFFER_PROPS, pValue));
+m_aStates.top().pCurrentBuffer-push_back(make_pair(BUFFER_PROPS, 
pValue));
 }
 }
 }
 
 void RTFDocumentImpl::runProps()
 {
-if (!m_pCurrentBuffer)
+if (!m_aStates.top().pCurrentBuffer)
 {
 writerfilter::ReferenceProperties::Pointer_t const pProperties = 
getProperties(m_aStates.top().aCharacterAttributes, 
m_aStates.top().aCharacterSprms);
 Mapper().props(pProperties);
@@ -480,7 +479,7 @@ void RTFDocumentImpl::runProps()
 else
 {
 RTFValue::Pointer_t pValue(new 
RTFValue(m_aStates.top().aCharacterAttributes, 
m_aStates.top().aCharacterSprms));
-m_pCurrentBuffer-push_back(make_pair(BUFFER_PROPS, pValue));
+m_aStates.top().pCurrentBuffer-push_back(make_pair(BUFFER_PROPS, 
pValue));
 }
 }
 
@@ -839,7 +838,7 @@ int RTFDocumentImpl::resolvePict(bool bInline)
 }
 writerfilter::ReferenceProperties::Pointer_t const pProperties(new 
RTFReferenceProperties(aAttributes, aSprms));
 checkFirstRun();
-if (!m_pCurrentBuffer)
+if (!m_aStates.top().pCurrentBuffer)
 {
 Mapper().props(pProperties);
 // Make sure we don't loose these properties with a too early reset.
@@ -848,7 +847,7 @@ int RTFDocumentImpl::resolvePict(bool bInline)
 else
 {
 RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms));
-m_pCurrentBuffer-push_back(make_pair(BUFFER_PROPS, pValue));
+m_aStates.top().pCurrentBuffer-push_back(make_pair(BUFFER_PROPS, 
pValue));
 }
 return 0;
 }
@@ -948,7 +947,7 @@ bool RTFFrame::inFrame()
 void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps)
 {
 sal_uInt8 sValue[] = { nValue };
-if (!m_pCurrentBuffer)
+if (!m_aStates.top().pCurrentBuffer)
 {
 Mapper().startCharacterGroup();
 // Should we send run properties?
@@ -959,10 +958,10 @@ void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool 
bRunProps)
 }
 else
 {
-m_pCurrentBuffer-push_back(make_pair(BUFFER_STARTRUN, 
RTFValue::Pointer_t()));
+m_aStates.top().pCurrentBuffer-push_back(make_pair(BUFFER_STARTRUN, 
RTFValue::Pointer_t()));
 RTFValue::Pointer_t pValue(new RTFValue(*sValue));
-m_pCurrentBuffer-push_back(make_pair(BUFFER_TEXT, pValue));
-m_pCurrentBuffer-push_back(make_pair(BUFFER_ENDRUN, 
RTFValue::Pointer_t()));
+m_aStates.top().pCurrentBuffer-push_back(make_pair(BUFFER_TEXT, 
pValue));
+m_aStates.top().pCurrentBuffer-push_back(make_pair(BUFFER_ENDRUN, 
RTFValue::Pointer_t()));
 }
 }
 
@@ -1109,31 +1108,31 @@ void RTFDocumentImpl::text(OUString rString)
 return;
 }
 
-if (!m_pCurrentBuffer  m_aStates.top().nDestinationState != 
DESTINATION_FOOTNOTE)
+if (!m_aStates.top().pCurrentBuffer  m_aStates.top().nDestinationState 
!= DESTINATION_FOOTNOTE)
 Mapper().startCharacterGroup();
-else if (m_pCurrentBuffer)
+else if (m_aStates.top().pCurrentBuffer)
 {
 RTFValue::Pointer_t pValue;
-m_pCurrentBuffer-push_back(make_pair(BUFFER_STARTRUN, pValue));
+

[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-03-12 Thread Jian Fang Zhang
 writerfilter/source/dmapper/ConversionHelper.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 775c3ddd47e0619a7f0ebed6dbcba3d5b41a708e
Author: Jian Fang Zhang zhan...@apache.org
Date:   Mon Sep 3 07:50:59 2012 +

Resolves: #i119658#, some Chinese numbering formats not supported

Found by: xiao ting xiao, tingxi...@gmail.com
Patch by: bjcheny, compan...@gmail.com
Review by: zhangjf
(cherry picked from commit 50eca22976c42014f5e2c53f4bf19e2e1d21ee62)

Change-Id: If3f27764352b59fdb45bf84c4a0e604c9c844077
Signed-off-by: Fridrich Å trba fridrich.st...@bluewin.ch
(cherry picked from commit 3c1eba7314d3a0dae925cbe90e0cd98cfb79c81b)
Reviewed-on: https://gerrit.libreoffice.org/2682
Reviewed-by: Michael Stahl mst...@redhat.com
Tested-by: Michael Stahl mst...@redhat.com

diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx 
b/writerfilter/source/dmapper/ConversionHelper.cxx
index 88c9372..86357af 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -426,8 +426,12 @@ sal_Int16 ConvertNumberingType(sal_Int32 nNFC)
 case NS_ooxml::LN_Value_ST_NumberFormat_japaneseCounting:
 case NS_ooxml::LN_Value_ST_NumberFormat_taiwaneseCounting:
 case NS_ooxml::LN_Value_ST_NumberFormat_ideographDigital:
+case NS_ooxml::LN_Value_ST_NumberFormat_chineseCountingThousand:
 nRet = style::NumberingType::NUMBER_LOWER_ZH;
 break;
+case NS_ooxml::LN_Value_ST_NumberFormat_chineseLegalSimplified:
+nRet = style::NumberingType::NUMBER_UPPER_ZH;
+break;
 default: nRet = style::NumberingType::ARABIC;
 }
 /*  TODO: Lots of additional values are available - some are supported in the 
I18 framework
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-02-28 Thread Michael Stahl
 writerfilter/source/dmapper/NumberingManager.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 0d6df6312d84e1ae2680af78538de94938f94605
Author: Michael Stahl mst...@redhat.com
Date:   Wed Feb 27 23:20:24 2013 +0100

fdo#61000: writerfilter: filter out unsupported list tab stops

Change-Id: Ic9d31eba84b1d8d9cf93d8289621a65d43521a8b
(cherry picked from commit dbb74ee9950dc706ea4fde3397a4c1d19b172fa9)
Reviewed-on: https://gerrit.libreoffice.org/2464
Reviewed-by: Niko Rönkkö ron...@iki.fi
Reviewed-by: Joren De Cuyper joren.libreoff...@telenet.be
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index 23b7225..529a794 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -135,7 +135,13 @@ void ListLevel::SetValue( Id nId, sal_Int32 nValue )
 m_nXChFollow = nValue;
 break;
 case NS_ooxml::LN_CT_TabStop_pos:
-m_nTabstop = nValue;
+if (nValue  0)
+{
+SAL_INFO(writerfilter,
+unsupported list tab stop position   nValue);
+}
+else
+m_nTabstop = nValue;
 break;
 default:
 OSL_FAIL( this line should never be reached);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-02-25 Thread Cédric Bosdonnat
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |2 -
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |   26 ---
 writerfilter/source/dmapper/DomainMapperTableManager.hxx |6 ++-
 3 files changed, 27 insertions(+), 7 deletions(-)

New commits:
commit 67b069cf42b990f47af0a2de4f9cb0bc5e44eeab
Author: Cédric Bosdonnat cedric.bosdon...@free.fr
Date:   Thu Feb 21 10:27:31 2013 +0100

n#779642: table positions need to be stacked to handle nested table

(cherry picked from commit 36c64bc194714d60a5c18f63bcfc0f721c2056db)

Change-Id: I44d4f9b1547365ff1b909c15d996694d9c3c0cf4
Reviewed-on: https://gerrit.libreoffice.org/2308
Reviewed-by: Miklos Vajna vmik...@suse.cz
Tested-by: Miklos Vajna vmik...@suse.cz

diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 3b81773..217c7f8 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -715,7 +715,7 @@ void DomainMapperTableHandler::endTable(unsigned int 
nestedTableLevel)
 uno::Referencetext::XTextRange xStart;
 uno::Referencetext::XTextRange xEnd;
 // If we want to make this table a floating one.
-uno::Sequencebeans::PropertyValue aFrameProperties = 
m_rDMapper_Impl.getTableManager().getTablePosition();
+uno::Sequencebeans::PropertyValue aFrameProperties = 
m_rDMapper_Impl.getTableManager().getCurrentTablePosition();
 bool bFloating = aFrameProperties.hasElements();
 // Additional checks: if we can do this.
 if (bFloating  (*m_pTableSeq)[0].getLength()  0  
(*m_pTableSeq)[0][0].getLength()  0)
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 80bd683..d81aea7 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -24,7 +24,6 @@
 #include CellMarginHandler.hxx
 #include ConversionHelper.hxx
 #include MeasureHandler.hxx
-#include TablePositionHandler.hxx
 #include TDefTableHandler.hxx
 #include com/sun/star/text/HoriOrientation.hpp
 #include com/sun/star/text/SizeType.hpp
@@ -323,9 +322,14 @@ bool DomainMapperTableManager::sprm(Sprm  rSprm)
 writerfilter::ReferenceProperties::Pointer_t pProperties 
= rSprm.getProps();
 if (pProperties.get())
 {
-TablePositionHandlerPtr pHandler( new 
TablePositionHandler );
+TablePositionHandlerPtr pHandler = 
m_aTablePositions.back();
+if ( !pHandler )
+{
+m_aTablePositions.pop_back();
+pHandler.reset( new TablePositionHandler );
+m_aTablePositions.push_back( pHandler );
+}
 pProperties-resolve(*pHandler);
-m_aTablePosition = pHandler-getTablePosition();
 }
 }
 break;
@@ -361,6 +365,14 @@ boost::shared_ptr vector sal_Int32   
DomainMapperTableManager::getCurrentCel
 return m_aCellWidths.back( );
 }
 
+const uno::Sequencebeans::PropertyValue 
DomainMapperTableManager::getCurrentTablePosition( )
+{
+if ( !m_aTablePositions.empty( )  m_aTablePositions.back() )
+return m_aTablePositions.back( )-getTablePosition();
+else
+return uno::Sequence beans::PropertyValue ( 0 );
+}
+
 void DomainMapperTableManager::startLevel( )
 {
 DomainMapperTableManager_Base_t::startLevel( );
@@ -376,9 +388,11 @@ void DomainMapperTableManager::startLevel( )
 IntVectorPtr pNewGrid( new vectorsal_Int32 );
 IntVectorPtr pNewSpans( new vectorsal_Int32 );
 IntVectorPtr pNewCellWidths( new vectorsal_Int32 );
+TablePositionHandlerPtr pNewPositionHandler;
 m_aTableGrid.push_back( pNewGrid );
 m_aGridSpans.push_back( pNewSpans );
 m_aCellWidths.push_back( pNewCellWidths );
+m_aTablePositions.push_back( pNewPositionHandler );
 m_nCell.push_back( 0 );
 m_nTableWidth = 0;
 
@@ -395,6 +409,7 @@ void DomainMapperTableManager::endLevel( )
 m_nCell.pop_back( );
 m_nTableWidth = 0;
 
+
 DomainMapperTableManager_Base_t::endLevel( );
 #ifdef DEBUG_DOMAINMAPPER
 dmapper_logger-startElement(dmappertablemanager.endLevel);
@@ -404,6 +419,10 @@ void DomainMapperTableManager::endLevel( )
 
 dmapper_logger-endElement();
 #endif
+
+// Pop back the table position after endLevel as it's used
+// in the endTable method called in endLevel.
+m_aTablePositions.pop_back();
 }
 
 
@@ -577,7 +596,6 @@ void DomainMapperTableManager::clearData()
 m_nRow = m_nCellBorderIndex = m_nHeaderRepeat = m_nTableWidth = 0;
 m_sTableStyleName = OUString();
 

[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-02-25 Thread Maxime de Roucy
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   41 +++--
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |4 +-
 2 files changed, 41 insertions(+), 4 deletions(-)

New commits:
commit 04a761f330b6ff17a125cc5522e71aae86a862f9
Author: Maxime de Roucy mdero...@linagora.com
Date:   Wed Feb 20 14:27:47 2013 +0100

fdo#53594 RTF IMPORT : considere OLE objects as pictures

If the OLE object is in a container, don't try to import it as
OLE object (use the \objdata element) but use the \result element which
is the appareance of the object (it's a picture).

Change-Id: Id97b36ce89beae02885cf82383321c14b58f2ea5
Reviewed-on: https://gerrit.libreoffice.org/2243
Reviewed-by: Miklos Vajna vmik...@suse.cz
Tested-by: Miklos Vajna vmik...@suse.cz
Signed-off-by: Miklos Vajna vmik...@suse.cz

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 366959e..cf1a1aa 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -715,6 +715,9 @@ int RTFDocumentImpl::resolvePict(bool bInline)
 if ( xShapes.is() )
 xShapes-add( xShape );
 }
+
+// check if the picture is in an OLE object and if the \objdata element is 
used
+// (see RTF_OBJECT in RTFDocumentImpl::dispatchDestination)
 if (m_bObject)
 {
 // Set bitmap
@@ -735,6 +738,7 @@ int RTFDocumentImpl::resolvePict(bool bInline)
 m_aObjectAttributes.set(NS_ooxml::LN_shape, pShapeValue);
 return 0;
 }
+
 if (xPropertySet.is())
 xPropertySet-setPropertyValue(GraphicURL, uno::Any(aGraphicUrl));
 
@@ -1445,11 +1449,34 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword 
nKeyword)
 m_aStates.top().nDestinationState = DESTINATION_COMMENT;
 break;
 case RTF_OBJECT:
-m_aStates.top().nDestinationState = DESTINATION_OBJECT;
-m_bObject = true;
+{
+// begining of an OLE Object
+m_aStates.top().nDestinationState = DESTINATION_OBJECT;
+
+// check if the object is in a special container (e.g. a table)
+if (!m_pCurrentBuffer)
+{
+// the object is in a table or another container.
+// Don't try to treate it as an OLE object (fdo#53594).
+// Use the \result (RTF_RESULT) element of the object 
instead,
+// the result element contain picture representing the OLE 
Object.
+m_bObject = true;
+}
+}
 break;
 case RTF_OBJDATA:
-m_aStates.top().nDestinationState = DESTINATION_OBJDATA;
+// check if the object is in a special container (e.g. a table)
+if (m_pCurrentBuffer)
+{
+// the object is in a table or another container.
+// Use the \result (RTF_RESULT) element of the object instead,
+// of the \objdata.
+m_aStates.top().nDestinationState = DESTINATION_SKIP;
+}
+else
+{
+m_aStates.top().nDestinationState = DESTINATION_OBJDATA;
+}
 break;
 case RTF_RESULT:
 m_aStates.top().nDestinationState = DESTINATION_RESULT;
@@ -3860,6 +3887,14 @@ int RTFDocumentImpl::popState()
 break;
 case DESTINATION_OBJECT:
 {
+if (!m_bObject)
+{
+// if the object is in a special container we will use the \result
+// element instead of the \objdata
+// (see RTF_OBJECT in RTFDocumentImpl::dispatchDestination)
+break;
+}
+
 RTFSprms aObjAttributes;
 RTFSprms aObjSprms;
 RTFValue::Pointer_t pValue(new RTFValue(m_aObjectAttributes, 
m_aObjectSprms));
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index d61efef..82490eb 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -561,7 +561,9 @@ namespace writerfilter {
 
 RTFSprms m_aObjectSprms;
 RTFSprms m_aObjectAttributes;
-/// If we are in an object group.
+/** If we are in an object group and if the we use its
+ *  \objdata element.
+ *  (if we don't use the \objdata we use the \result element)*/
 bool m_bObject;
 /// Contents of the objdata group.
 boost::shared_ptrSvStream m_pObjectData;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-02-21 Thread Michael Stahl
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   45 +++---
 1 file changed, 31 insertions(+), 14 deletions(-)

New commits:
commit a09865cc0f177a28622330866b3ad5baf4b99bd6
Author: Michael Stahl mst...@redhat.com
Date:   Wed Feb 20 16:29:40 2013 +0100

fdo#60789: writerfilter: continue the import if comment insertion fails

Catch exceptions in DomainMapper_Impl::PopFieldContext().

Change-Id: Ia60857a5f773c9d89217991d481a5f20d0de3151
(cherry picked from commit 4c165c708ce852b4d52527422b327b2f6ad73685)
Reviewed-on: https://gerrit.libreoffice.org/2294
Reviewed-by: Miklos Vajna vmik...@suse.cz
Tested-by: Miklos Vajna vmik...@suse.cz

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 68449a0..695a0f3 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1574,23 +1574,40 @@ void DomainMapper_Impl::PopAnnotation()
 
 m_aTextAppendStack.pop();
 
-// See if the annotation will be a single position or a range.
-if (!m_aAnnotationPosition.m_xStart.is() || 
!m_aAnnotationPosition.m_xEnd.is())
+try
 {
-uno::Sequence beans::PropertyValue  aEmptyProperties;
-appendTextContent( uno::Reference text::XTextContent ( 
m_xAnnotationField, uno::UNO_QUERY_THROW ), aEmptyProperties );
+// See if the annotation will be a single position or a range.
+if (!m_aAnnotationPosition.m_xStart.is() ||
+!m_aAnnotationPosition.m_xEnd.is())
+{
+uno::Sequence beans::PropertyValue  aEmptyProperties;
+appendTextContent(uno::Referencetext::XTextContent(
+m_xAnnotationField, uno::UNO_QUERY_THROW), aEmptyProperties);
+}
+else
+{
+// Create a range that points to the annotation start/end.
+uno::Referencetext::XText const xText =
+m_aAnnotationPosition.m_xStart-getText();
+uno::Referencetext::XTextCursor const xCursor =
+xText-createTextCursorByRange(m_aAnnotationPosition.m_xStart);
+xCursor-gotoRange(m_aAnnotationPosition.m_xEnd, true);
+uno::Referencetext::XTextRange const xTextRange(
+xCursor, uno::UNO_QUERY_THROW);
+
+// Attach the annotation to the range.
+uno::Referencetext::XTextAppend const xTextAppend =
+m_aTextAppendStack.top().xTextAppend;
+xTextAppend-insertTextContent(xTextRange,
+uno::Referencetext::XTextContent(m_xAnnotationField,
+uno::UNO_QUERY_THROW),
+!xCursor-isCollapsed());
+}
 }
-else
+catch (uno::Exception const e)
 {
-// Create a range that points to the annotation start/end.
-uno::Referencetext::XText xText = 
m_aAnnotationPosition.m_xStart-getText();
-uno::Referencetext::XTextCursor xCursor = 
xText-createTextCursorByRange(m_aAnnotationPosition.m_xStart);
-xCursor-gotoRange(m_aAnnotationPosition.m_xEnd, true);
-uno::Referencetext::XTextRange xTextRange(xCursor, 
uno::UNO_QUERY_THROW);
-
-// Attach the annotation to the range.
-uno::Referencetext::XTextAppend xTextAppend = 
m_aTextAppendStack.top().xTextAppend;
-xTextAppend-insertTextContent(xTextRange, 
uno::Referencetext::XTextContent(m_xAnnotationField, uno::UNO_QUERY_THROW), 
!xCursor-isCollapsed());
+SAL_WARN(writerfilter,
+Cannot insert annotation field: exception:   e.Message);
 }
 
 m_aAnnotationPosition.m_xStart.clear();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-02-21 Thread Michael Stahl
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |6 --
 1 file changed, 6 deletions(-)

New commits:
commit 310b5976bb827a0ffb274f70878852e4474a0559
Author: Michael Stahl mst...@redhat.com
Date:   Wed Feb 20 16:32:59 2013 +0100

fdo#60789: writerfilter: do not insert a character at field start

The character inserted in DomainMapper_Impl::PushFieldContext() causes
problems in this bugdoc because there is a commentRangeStart immediately
before a text field and the call to delete it via setString() disposes
the SwXTextRange that is stored in m_aAnnotationPosition.m_xStart,
which results in an exception when trying to insert the comment.

At least all the fields in the bugdoc import fine with this change.

Change-Id: I6c08d72fafb0529e8612f1e35b2c8b871edb5a52
(cherry picked from commit 6145c6efa4f346287ed9693c9d00038d829d5a35)
Reviewed-on: https://gerrit.libreoffice.org/2295
Reviewed-by: Miklos Vajna vmik...@suse.cz
Tested-by: Miklos Vajna vmik...@suse.cz

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 695a0f3..88b4e42 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2033,10 +2033,7 @@ void DomainMapper_Impl::PushFieldContext()
 uno::Reference text::XTextRange  xStart;
 if (xTextAppend.is())
 {
-//insert a dummy char to make sure the start range doesn't move 
together with the to-be-appended text
-xTextAppend-appendTextPortion(OUString( '-' ), uno::Sequence 
beans::PropertyValue () );
 uno::Reference text::XTextCursor  xCrsr = 
xTextAppend-createTextCursorByRange( xTextAppend-getEnd() );
-xCrsr-goLeft( 1, false );
 xStart = xCrsr-getStart();
 }
 m_aFieldStack.push( FieldContextPtr( new FieldContext( xStart ) ) );
@@ -3310,9 +3307,6 @@ void DomainMapper_Impl::PopFieldContext()
 try
 {
 uno::Reference text::XTextCursor  xCrsr = 
xTextAppend-createTextCursorByRange(pContext-GetStartRange());
-//remove the dummy character
-xCrsr-goRight( 1, true );
-xCrsr-setString( OUString() );
 uno::Reference text::XTextContent  xToInsert( 
pContext-GetTOC(), uno::UNO_QUERY );
 if( xToInsert.is() )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-02-05 Thread Miklos Vajna
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit bc6a23a47936f6d74f5348a22ada4874945dc884
Author: Miklos Vajna vmik...@suse.cz
Date:   Sat Feb 2 15:29:24 2013 +0100

fdo#58646 fix import of RTF_PAGE in cont section when having titlepg

(cherry picked from commit 3974e9952102dbfb4f004872768b1096133bd9a5)

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

Change-Id: Ia632edb24869ddfb76a029fdb460bcf24d9a2059
Reviewed-on: https://gerrit.libreoffice.org/1968
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 37d0376..2fc5a10 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1811,7 +1811,9 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
 {
 // 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())
+// Unless we're on a title page.
+RTFValue::Pointer_t pTitlePg = 
m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_titlePg);
+if ((pBreak.get()  !pBreak-getInt())  !(pTitlePg.get()  
pTitlePg-getInt()))
 {
 if (m_bWasInFrame)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-02-05 Thread Miklos Vajna
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 94765a1b3f543b3b60f8c1de05048d12f2576be4
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Feb 1 11:20:52 2013 +0100

fdo#48440 fix import of RTF_PAGE between text frames

Normally such a page break is surrounded by text, and text() already
calls checkNeedPap(), but in case the whole paragraph contains a page
break only, we need it here as well.

(cherry picked from commit b70f74cb5f4b499f14831fd6ad49d9238735e6ef)

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

Change-Id: I3961272d77c743e0e6da2d5052e57cec5f5937e7
Reviewed-on: https://gerrit.libreoffice.org/1965
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 2fc5a10..3ef92ac 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1829,6 +1829,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
 }
 else
 {
+checkNeedPap();
 sal_uInt8 sBreak[] = { 0xc };
 Mapper().text(sBreak, 1);
 if (!m_bNeedPap)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-02-05 Thread Miklos Vajna
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit f5b7e504324f3284ccb118c0006c716685746710
Author: Miklos Vajna vmik...@suse.cz
Date:   Tue Feb 5 18:16:12 2013 +0100

fdo#58076 import RTF_SHPLEFT/TOP of ESCHER_ShpInst_PictureFrame

(cherry picked from commit bd52275bf311f4ea2f94aec4336deb7ee14a3ba4)

Change-Id: Ia655743710778ea7d48a9b2221f22f55a4ccce32
Reviewed-on: https://gerrit.libreoffice.org/2005
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 3ef92ac..db8a06d 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -63,6 +63,7 @@
 #include ooxml/OOXMLFastTokens.hxx // ooxml namespace
 #include oox/token/namespaces.hxx // oox namespace
 #include oox/token/tokens.hxx
+#include dmapper/GraphicHelpers.hxx
 
 #include rtfsdrimport.hxx
 #include rtftokenizer.hxx
@@ -72,6 +73,7 @@
 #include rtffly.hxx
 
 #define TWIP_TO_MM100(TWIP) ((TWIP) = 0 ? (((TWIP)*127L+36L)/72L) : 
(((TWIP)*127L-36L)/72L))
+#define MM100_TO_EMU(MM100) (MM100 * 360)
 #define M_TOKEN(token) OOX_TOKEN(officeMath, token)
 #define OPEN_M_TOKEN( rtftok, ooxtok ) \
 case RTF_M##rtftok: \
@@ -807,6 +809,19 @@ int RTFDocumentImpl::resolvePict(bool bInline)
 aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_extent, pExtentValue);
 if (aAnchorWrapAttributes.size())
 aAnchorSprms.set(NS_ooxml::LN_EG_WrapType_wrapSquare, 
pAnchorWrapValue);
+
+// See OOXMLFastContextHandler::positionOffset(), we can't just put 
values in an RTFValue.
+if (m_aStates.top().aShape.nLeft  0)
+{
+
writerfilter::dmapper::PositionHandler::setPositionOffset(OUString::number(MM100_TO_EMU(m_aStates.top().aShape.nLeft)),
 false);
+aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionH, 
RTFValue::Pointer_t(new RTFValue(RTFSprms(;
+}
+if (m_aStates.top().aShape.nTop  0)
+{
+
writerfilter::dmapper::PositionHandler::setPositionOffset(OUString::number(MM100_TO_EMU(m_aStates.top().aShape.nTop)),
 true);
+aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionV, 
RTFValue::Pointer_t(new RTFValue(RTFSprms(;
+}
+
 aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_docPr, pDocprValue);
 aAnchorSprms.set(NS_ooxml::LN_graphic_graphic, pGraphicValue);
 // anchor sprm
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-02-05 Thread Michael Stahl
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit f5b58a5ed32b4f4bcb6e48e2c6db059c9163dc96
Author: Michael Stahl mst...@redhat.com
Date:   Tue Feb 5 22:48:37 2013 +0100

previous commit used OUString::number, use valueOf instead

Change-Id: I3c684ceced78f1238320972312be83e2cf5b59d2

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index db8a06d..cdea1b1 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -813,12 +813,12 @@ int RTFDocumentImpl::resolvePict(bool bInline)
 // See OOXMLFastContextHandler::positionOffset(), we can't just put 
values in an RTFValue.
 if (m_aStates.top().aShape.nLeft  0)
 {
-
writerfilter::dmapper::PositionHandler::setPositionOffset(OUString::number(MM100_TO_EMU(m_aStates.top().aShape.nLeft)),
 false);
+
writerfilter::dmapper::PositionHandler::setPositionOffset(OUString::valueOf(sal::static_int_castsal_Int32(MM100_TO_EMU(m_aStates.top().aShape.nLeft))),
 false);
 aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionH, 
RTFValue::Pointer_t(new RTFValue(RTFSprms(;
 }
 if (m_aStates.top().aShape.nTop  0)
 {
-
writerfilter::dmapper::PositionHandler::setPositionOffset(OUString::number(MM100_TO_EMU(m_aStates.top().aShape.nTop)),
 true);
+
writerfilter::dmapper::PositionHandler::setPositionOffset(OUString::valueOf(sal::static_int_castsal_Int32(MM100_TO_EMU(m_aStates.top().aShape.nTop))),
 true);
 aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionV, 
RTFValue::Pointer_t(new RTFValue(RTFSprms(;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

2013-02-03 Thread Miklos Vajna
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit 285c71000aece675f982e8c637f202e606522daf
Author: Miklos Vajna vmik...@suse.cz
Date:   Sun Feb 3 14:37:38 2013 +0100

fdo#59419 fix RTF import of hex form of \r and \n

(cherry picked from commits a5e885df24eb11c028a94ac709966b3ce2976db9 and
927de8786850936bb42c5595c41a4353c076fdea)

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

Change-Id: Ic700cdc67f756cafc454c326b73f680a8a47a6e8
Reviewed-on: https://gerrit.libreoffice.org/1974
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 c961c7d..37d0376 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -944,6 +944,14 @@ void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool 
bRunProps)
 
 void RTFDocumentImpl::text(OUString rString)
 {
+if (rString.getLength() == 1  m_aStates.top().nDestinationState != 
DESTINATION_DOCCOMM)
+{
+// No cheating! Tokenizer ignores bare \r and \n, their hex \'0d / 
\'0a form doesn't count, either.
+sal_Unicode ch = rString.getStr()[0];
+if (ch == 0x0d || ch == 0x0a)
+return;
+}
+
 bool bRet = true;
 switch (m_aStates.top().nDestinationState)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits