[Libreoffice-commits] core.git: 6 commits - include/comphelper libreofficekit/source oox/source sw/qa sw/source writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Sun May 17 22:47:48 PDT 2015


 include/comphelper/propertyvalue.hxx                |   37 +++++++
 libreofficekit/source/gtk/lokdocview.cxx            |   61 +++++++++++
 oox/source/crypto/DocumentDecryption.cxx            |    2 
 oox/source/drawingml/clrscheme.cxx                  |    2 
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |    2 
 oox/source/export/ColorPropertySet.cxx              |    2 
 oox/source/mathml/importutils.cxx                   |    2 
 oox/source/ppt/buildlistcontext.hxx                 |    2 
 oox/source/shape/LockedCanvasContext.hxx            |    2 
 oox/source/shape/WpgContext.hxx                     |    2 
 sw/qa/extras/rtfimport/data/tdf86814.rtf            |    8 +
 sw/qa/extras/rtfimport/rtfimport.cxx                |    6 +
 sw/source/core/unocore/unosett.cxx                  |   66 ++++--------
 writerfilter/source/dmapper/DomainMapper_Impl.cxx   |  102 ++++++++++----------
 writerfilter/source/dmapper/DomainMapper_Impl.hxx   |    4 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx      |   57 ++++++-----
 16 files changed, 232 insertions(+), 125 deletions(-)

New commits:
commit 6896712f9e5c8005d0c7e4f6ab403a271d9586f7
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon May 18 07:46:26 2015 +0200

    writerfilter: avoid unnecessary roundtrip to css::uno::Sequence
    
    Just pass over an std::vector instead of getAsConstPropertyValueList()
    and comphelper::sequenceToContainer().
    
    Change-Id: I584c44918b526cbed99abdbbf069c4bbf27ac887

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 6dd884b..90f517f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -83,6 +83,7 @@
 #include <officecfg/Office/Common.hxx>
 #include <filter/msfilter/util.hxx>
 #include <comphelper/sequence.hxx>
+#include <comphelper/propertyvalue.hxx>
 
 using namespace ::com::sun::star;
 using namespace oox;
@@ -748,7 +749,7 @@ bool DomainMapper_Impl::isParaSdtEndDeferred()
     return m_bParaSdtEndDeferred;
 }
 
-void lcl_MoveBorderPropertiesToFrame(comphelper::SequenceAsHashMap& rFrameProperties,
+void lcl_MoveBorderPropertiesToFrame(std::vector<beans::PropertyValue>& rFrameProperties,
     uno::Reference<text::XTextRange> const& xStartTextRange,
     uno::Reference<text::XTextRange> const& xEndTextRange )
 {
@@ -781,7 +782,10 @@ void lcl_MoveBorderPropertiesToFrame(comphelper::SequenceAsHashMap& rFrameProper
         for( sal_uInt32 nProperty = 0; nProperty < nBorderPropertyCount; ++nProperty)
         {
             OUString sPropertyName = rPropNameSupplier.GetName(aBorderProperties[nProperty]);
-            rFrameProperties[sPropertyName] = xTextRangeProperties->getPropertyValue(sPropertyName);
+            beans::PropertyValue aValue;
+            aValue.Name = sPropertyName;
+            aValue.Value = xTextRangeProperties->getPropertyValue(sPropertyName);
+            rFrameProperties.push_back(aValue);
             if( nProperty < 4 )
                 xTextRangeProperties->setPropertyValue( sPropertyName, uno::makeAny(table::BorderLine2()));
         }
@@ -837,7 +841,7 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
             StyleSheetEntryPtr pParaStyle =
                 GetStyleSheetTable()->FindStyleSheetByConvertedStyleName(rAppendContext.pLastParagraphProperties->GetParaStyleName());
 
-            comphelper::SequenceAsHashMap aFrameProperties;
+            std::vector<beans::PropertyValue> aFrameProperties;
 
             if ( pParaStyle.get( ) )
             {
@@ -851,60 +855,60 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
                 bool bAutoWidth = nWidth < 1;
                 if( bAutoWidth )
                     nWidth = DEFAULT_FRAME_MIN_WIDTH;
-                aFrameProperties[rPropNameSupplier.GetName(PROP_WIDTH)] <<= nWidth;
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_WIDTH), nWidth));
 
-                aFrameProperties[rPropNameSupplier.GetName(PROP_HEIGHT)] <<=
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_HEIGHT),
                     rAppendContext.pLastParagraphProperties->Geth() > 0 ?
                         rAppendContext.pLastParagraphProperties->Geth() :
-                        pStyleProperties->Geth() > 0 ? pStyleProperties->Geth() : DEFAULT_FRAME_MIN_HEIGHT;
+                        pStyleProperties->Geth() > 0 ? pStyleProperties->Geth() : DEFAULT_FRAME_MIN_HEIGHT));
 
-                aFrameProperties[rPropNameSupplier.GetName(PROP_SIZE_TYPE)] <<= sal_Int16(
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_SIZE_TYPE), sal_Int16(
                     rAppendContext.pLastParagraphProperties->GethRule() >= 0 ?
                         rAppendContext.pLastParagraphProperties->GethRule() :
-                pStyleProperties->GethRule() >=0 ? pStyleProperties->GethRule() : text::SizeType::VARIABLE);
+                        pStyleProperties->GethRule() >=0 ? pStyleProperties->GethRule() : text::SizeType::VARIABLE)));
 
-                aFrameProperties[rPropNameSupplier.GetName(PROP_WIDTH_TYPE)] <<= bAutoWidth ?  text::SizeType::MIN : text::SizeType::FIX;
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_WIDTH_TYPE), bAutoWidth ?  text::SizeType::MIN : text::SizeType::FIX));
 
                 sal_Int16 nHoriOrient = sal_Int16(
                     rAppendContext.pLastParagraphProperties->GetxAlign() >= 0 ?
                         rAppendContext.pLastParagraphProperties->GetxAlign() :
                         pStyleProperties->GetxAlign() >= 0 ? pStyleProperties->GetxAlign() : text::HoriOrientation::NONE );
-                aFrameProperties[rPropNameSupplier.GetName(PROP_HORI_ORIENT)] <<= nHoriOrient;
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_HORI_ORIENT), nHoriOrient));
 
                 //set a non negative default value
-                aFrameProperties[rPropNameSupplier.GetName(PROP_HORI_ORIENT_POSITION)] <<=
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_HORI_ORIENT_POSITION),
                     rAppendContext.pLastParagraphProperties->IsxValid() ?
                         rAppendContext.pLastParagraphProperties->Getx() :
-                        pStyleProperties->IsxValid() ? pStyleProperties->Getx() : DEFAULT_VALUE;
+                        pStyleProperties->IsxValid() ? pStyleProperties->Getx() : DEFAULT_VALUE));
 
                 //Default the anchor in case FramePr_hAnchor is missing ECMA 17.3.1.11
-                aFrameProperties[rPropNameSupplier.GetName(PROP_HORI_ORIENT_RELATION)] <<= sal_Int16(
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_HORI_ORIENT_RELATION), sal_Int16(
                     rAppendContext.pLastParagraphProperties->GethAnchor() >= 0 ?
                         rAppendContext.pLastParagraphProperties->GethAnchor() :
-                    pStyleProperties->GethAnchor() >=0 ? pStyleProperties->GethAnchor() : text::RelOrientation::FRAME );
+                    pStyleProperties->GethAnchor() >=0 ? pStyleProperties->GethAnchor() : text::RelOrientation::FRAME )));
 
                 sal_Int16 nVertOrient = sal_Int16(
                     rAppendContext.pLastParagraphProperties->GetyAlign() >= 0 ?
                         rAppendContext.pLastParagraphProperties->GetyAlign() :
                         pStyleProperties->GetyAlign() >= 0 ? pStyleProperties->GetyAlign() : text::VertOrientation::NONE );
-                aFrameProperties[rPropNameSupplier.GetName(PROP_VERT_ORIENT)] <<= nVertOrient;
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_VERT_ORIENT), nVertOrient));
 
                 //set a non negative default value
-                aFrameProperties[rPropNameSupplier.GetName(PROP_VERT_ORIENT_POSITION)] <<=
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_VERT_ORIENT_POSITION),
                     rAppendContext.pLastParagraphProperties->IsyValid() ?
                         rAppendContext.pLastParagraphProperties->Gety() :
-                        pStyleProperties->IsyValid() ? pStyleProperties->Gety() : DEFAULT_VALUE;
+                        pStyleProperties->IsyValid() ? pStyleProperties->Gety() : DEFAULT_VALUE));
 
                 //Default the anchor in case FramePr_vAnchor is missing ECMA 17.3.1.11
-                aFrameProperties[rPropNameSupplier.GetName(PROP_VERT_ORIENT_RELATION)] <<= sal_Int16(
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_VERT_ORIENT_RELATION), sal_Int16(
                     rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 ?
                         rAppendContext.pLastParagraphProperties->GetvAnchor() :
-                        pStyleProperties->GetvAnchor() >= 0 ? pStyleProperties->GetvAnchor() : text::RelOrientation::FRAME );
+                        pStyleProperties->GetvAnchor() >= 0 ? pStyleProperties->GetvAnchor() : text::RelOrientation::FRAME )));
 
-                aFrameProperties[rPropNameSupplier.GetName(PROP_SURROUND)] <<= text::WrapTextMode(
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_SURROUND), text::WrapTextMode(
                     rAppendContext.pLastParagraphProperties->GetWrap() >= 0 ?
                     rAppendContext.pLastParagraphProperties->GetWrap() :
-                    pStyleProperties->GetWrap() >= 0 ? pStyleProperties->GetWrap() : 0 );
+                    pStyleProperties->GetWrap() >= 0 ? pStyleProperties->GetWrap() : 0 )));
 
                 /** FDO#73546 : distL & distR should be unsigned intgers <Ecma 20.4.3.6>
                     Swapped the array elements 11,12 & 13,14 since 11 & 12 are
@@ -916,8 +920,8 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
                     rAppendContext.pLastParagraphProperties->GethSpace() :
                     pStyleProperties->GethSpace() >= 0 ? pStyleProperties->GethSpace() : 0;
 
-                aFrameProperties[rPropNameSupplier.GetName(PROP_LEFT_MARGIN)] <<= nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist;
-                aFrameProperties[rPropNameSupplier.GetName(PROP_RIGHT_MARGIN)] <<= nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist;
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_LEFT_MARGIN), nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist));
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_RIGHT_MARGIN), nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist));
 
                 sal_Int32 nBottomDist;
                 sal_Int32 nTopDist = nBottomDist =
@@ -925,19 +929,19 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
                     rAppendContext.pLastParagraphProperties->GetvSpace() :
                     pStyleProperties->GetvSpace() >= 0 ? pStyleProperties->GetvSpace() : 0;
 
-                aFrameProperties[rPropNameSupplier.GetName(PROP_TOP_MARGIN)] <<= nVertOrient == text::VertOrientation::TOP ? 0 : nTopDist;
-                aFrameProperties[rPropNameSupplier.GetName(PROP_BOTTOM_MARGIN)] <<= nVertOrient == text::VertOrientation::BOTTOM ? 0 : nBottomDist;
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_TOP_MARGIN), nVertOrient == text::VertOrientation::TOP ? 0 : nTopDist));
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_BOTTOM_MARGIN), nVertOrient == text::VertOrientation::BOTTOM ? 0 : nBottomDist));
                 // If there is no fill, the Word default is 100% transparency.
                 // Otherwise CellColorHandler has priority, and this setting
                 // will be ignored.
-                aFrameProperties[rPropNameSupplier.GetName(PROP_BACK_COLOR_TRANSPARENCY)] <<= sal_Int32(100);
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_BACK_COLOR_TRANSPARENCY), sal_Int32(100)));
 
                 beans::PropertyValue aRet;
                 uno::Sequence<beans::PropertyValue> aGrabBag(1);
                 aRet.Name = "ParaFrameProperties";
                 aRet.Value <<= uno::Any(rAppendContext.pLastParagraphProperties->IsFrameMode());
                 aGrabBag[0] = aRet;
-                aFrameProperties["FrameInteropGrabBag"] <<= aGrabBag;
+                aFrameProperties.push_back(comphelper::makePropertyValue("FrameInteropGrabBag", aGrabBag));
 
                 lcl_MoveBorderPropertiesToFrame(aFrameProperties,
                     rAppendContext.pLastParagraphProperties->GetStartingRange(),
@@ -949,56 +953,56 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
                 bool bAutoWidth = nWidth < 1;
                 if( bAutoWidth )
                     nWidth = DEFAULT_FRAME_MIN_WIDTH;
-                aFrameProperties[rPropNameSupplier.GetName(PROP_WIDTH)] <<= nWidth;
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_WIDTH), nWidth));
 
-                aFrameProperties[rPropNameSupplier.GetName(PROP_SIZE_TYPE)] <<= sal_Int16(
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_SIZE_TYPE), sal_Int16(
                     rAppendContext.pLastParagraphProperties->GethRule() >= 0 ?
                         rAppendContext.pLastParagraphProperties->GethRule() :
-                        text::SizeType::VARIABLE);
+                        text::SizeType::VARIABLE)));
 
-                aFrameProperties[rPropNameSupplier.GetName(PROP_WIDTH_TYPE)] <<= bAutoWidth ?  text::SizeType::MIN : text::SizeType::FIX;
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_WIDTH_TYPE), bAutoWidth ?  text::SizeType::MIN : text::SizeType::FIX));
 
                 sal_Int16 nHoriOrient = sal_Int16(
                     rAppendContext.pLastParagraphProperties->GetxAlign() >= 0 ?
                         rAppendContext.pLastParagraphProperties->GetxAlign() :
                         text::HoriOrientation::NONE );
-                aFrameProperties[rPropNameSupplier.GetName(PROP_HORI_ORIENT)] <<= nHoriOrient;
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_HORI_ORIENT), nHoriOrient));
 
                 sal_Int16 nVertOrient = sal_Int16(
                     rAppendContext.pLastParagraphProperties->GetyAlign() >= 0 ?
                         rAppendContext.pLastParagraphProperties->GetyAlign() :
                         text::VertOrientation::NONE );
-                aFrameProperties[rPropNameSupplier.GetName(PROP_VERT_ORIENT)] <<= nVertOrient;
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_VERT_ORIENT), nVertOrient));
 
                 sal_Int32 nVertDist = rAppendContext.pLastParagraphProperties->GethSpace();
                 if( nVertDist < 0 )
                     nVertDist = 0;
-                aFrameProperties[rPropNameSupplier.GetName(PROP_LEFT_MARGIN)] <<= nVertOrient == text::VertOrientation::TOP ? 0 : nVertDist;
-                aFrameProperties[rPropNameSupplier.GetName(PROP_RIGHT_MARGIN)] <<= nVertOrient == text::VertOrientation::BOTTOM ? 0 : nVertDist;
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_LEFT_MARGIN), nVertOrient == text::VertOrientation::TOP ? 0 : nVertDist));
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_RIGHT_MARGIN), nVertOrient == text::VertOrientation::BOTTOM ? 0 : nVertDist));
 
                 sal_Int32 nHoriDist = rAppendContext.pLastParagraphProperties->GetvSpace();
                 if( nHoriDist < 0 )
                     nHoriDist = 0;
-                aFrameProperties[rPropNameSupplier.GetName(PROP_TOP_MARGIN)] <<= nHoriOrient == text::HoriOrientation::LEFT ? 0 : nHoriDist;
-                aFrameProperties[rPropNameSupplier.GetName(PROP_BOTTOM_MARGIN)] <<= nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nHoriDist;
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_TOP_MARGIN), nHoriOrient == text::HoriOrientation::LEFT ? 0 : nHoriDist));
+                aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_BOTTOM_MARGIN), nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nHoriDist));
 
                 if( rAppendContext.pLastParagraphProperties->Geth() > 0 )
-                    aFrameProperties[rPropNameSupplier.GetName(PROP_HEIGHT)] <<= rAppendContext.pLastParagraphProperties->Geth();
+                    aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_HEIGHT), rAppendContext.pLastParagraphProperties->Geth()));
 
                 if( rAppendContext.pLastParagraphProperties->IsxValid() )
-                    aFrameProperties[rPropNameSupplier.GetName(PROP_HORI_ORIENT_POSITION)] <<= rAppendContext.pLastParagraphProperties->Getx();
+                    aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_HORI_ORIENT_POSITION), rAppendContext.pLastParagraphProperties->Getx()));
 
                 if( rAppendContext.pLastParagraphProperties->GethAnchor() >= 0 )
-                    aFrameProperties[rPropNameSupplier.GetName(PROP_HORI_ORIENT_RELATION)] <<= sal_Int16( rAppendContext.pLastParagraphProperties->GethAnchor() );
+                    aFrameProperties.push_back(comphelper::makePropertyValue("HoriOrientRelation", sal_Int16(rAppendContext.pLastParagraphProperties->GethAnchor())));
 
                 if( rAppendContext.pLastParagraphProperties->IsyValid() )
-                    aFrameProperties[rPropNameSupplier.GetName(PROP_VERT_ORIENT_POSITION)] <<= rAppendContext.pLastParagraphProperties->Gety();
+                    aFrameProperties.push_back(comphelper::makePropertyValue(rPropNameSupplier.GetName(PROP_VERT_ORIENT_POSITION), rAppendContext.pLastParagraphProperties->Gety()));
 
                 if( rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 )
-                    aFrameProperties[rPropNameSupplier.GetName(PROP_VERT_ORIENT_RELATION)] <<= sal_Int16( rAppendContext.pLastParagraphProperties->GetvAnchor() );
+                    aFrameProperties.push_back(comphelper::makePropertyValue("VertOrientRelation", sal_Int16(rAppendContext.pLastParagraphProperties->GetvAnchor())));
 
                 if( rAppendContext.pLastParagraphProperties->GetWrap() >= 0 )
-                    aFrameProperties[rPropNameSupplier.GetName(PROP_SURROUND)] <<= text::WrapTextMode( rAppendContext.pLastParagraphProperties->GetWrap() );
+                    aFrameProperties.push_back(comphelper::makePropertyValue("Surround", text::WrapTextMode(rAppendContext.pLastParagraphProperties->GetWrap())));
 
                 lcl_MoveBorderPropertiesToFrame(aFrameProperties,
                     rAppendContext.pLastParagraphProperties->GetStartingRange(),
@@ -1009,7 +1013,7 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
             RegisterFrameConversion(
                 rAppendContext.pLastParagraphProperties->GetStartingRange(),
                 rAppendContext.pLastParagraphProperties->GetEndingRange(),
-                aFrameProperties.getAsConstPropertyValueList() );
+                aFrameProperties );
         }
         catch( const uno::Exception& )
         {
@@ -4718,13 +4722,13 @@ _PageMar::_PageMar()
 void DomainMapper_Impl::RegisterFrameConversion(
         uno::Reference< text::XTextRange > const&    xFrameStartRange,
         uno::Reference< text::XTextRange > const&    xFrameEndRange,
-        const uno::Sequence< beans::PropertyValue >& aFrameProperties
+        const std::vector<beans::PropertyValue>& rFrameProperties
         )
 {
     OSL_ENSURE(
         m_aFrameProperties.empty() && !m_xFrameStartRange.is() && !m_xFrameEndRange.is(),
         "frame properties not removed");
-    m_aFrameProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aFrameProperties);
+    m_aFrameProperties = rFrameProperties;
     m_xFrameStartRange = xFrameStartRange;
     m_xFrameEndRange   = xFrameEndRange;
 }
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index e13d928..7884472 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -729,7 +729,7 @@ public:
 
     void RegisterFrameConversion(css::uno::Reference<css::text::XTextRange> const& xFrameStartRange,
                                  css::uno::Reference<css::text::XTextRange> const& xFrameEndRange,
-                                 const css::uno::Sequence<css::beans::PropertyValue>& aFrameProperties);
+                                 const std::vector<css::beans::PropertyValue>& aFrameProperties);
     bool ExecuteFrameConversion();
 
     void AddNewRedline( sal_uInt32 sprmId );
commit d5268ee667fc872f1d142a4fd47368c35333d3fd
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon May 18 07:45:07 2015 +0200

    comphelper: the makePropertyValue<> template is useful outside sw
    
    Change-Id: Id6392d105bbc01bb38f5615621f4d852a94e5df9

diff --git a/include/comphelper/propertyvalue.hxx b/include/comphelper/propertyvalue.hxx
new file mode 100644
index 0000000..04968d2
--- /dev/null
+++ b/include/comphelper/propertyvalue.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROPERTYVALUE_HXX
+#define INCLUDED_COMPHELPER_PROPERTYVALUE_HXX
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+namespace comphelper
+{
+
+/**
+ * Creates a beans::PropertyValue easily, i.e. you can write:
+ *
+ * function(comphelper::makePropertyValue("Foo", nBar));
+ *
+ * instead of writing 3 extra lines to set the name and value of the beans::PropertyValue.
+ */
+template<typename T> css::beans::PropertyValue makePropertyValue(const OUString& rName, const T& rValue)
+{
+    css::beans::PropertyValue aValue;
+    aValue.Name = rName;
+    aValue.Value <<= rValue;
+    return aValue;
+}
+
+}
+
+#endif // INCLUDED_COMPHELPER_PROPERTYVALUE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 3e9439e..14bc695 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -67,6 +67,7 @@
 #include <comphelper/servicehelper.hxx>
 #include <comphelper/sequence.hxx>
 #include <cppuhelper/supportsservice.hxx>
+#include <comphelper/propertyvalue.hxx>
 #include <paratr.hxx>
 
 using namespace ::com::sun::star;
@@ -76,12 +77,6 @@ using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::text;
 using namespace ::com::sun::star::style;
 
-template<typename T>
-PropertyValue makePropertyValue(T const& rValue, OUString const& rName)
-{
-   return PropertyValue(rName, -1, makeAny(rValue), PropertyState_DIRECT_VALUE);
-}
-
 // Constants for the css::text::ColumnSeparatorStyle
 #define API_COL_LINE_NONE               0
 #define API_COL_LINE_SOLID              1
@@ -1357,47 +1352,44 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFmt(
     //adjust
     SvxAdjust eAdj = rFmt.GetNumAdjust();
     sal_Int16 nINT16 = aSvxToUnoAdjust[eAdj];
-    aPropertyValues.push_back(makePropertyValue(nINT16, "Adjust"));
+    aPropertyValues.push_back(comphelper::makePropertyValue("Adjust", nINT16));
 
     //parentnumbering
     nINT16 = rFmt.GetIncludeUpperLevels();
-    aPropertyValues.push_back(makePropertyValue(nINT16, "ParentNumbering"));
+    aPropertyValues.push_back(comphelper::makePropertyValue("ParentNumbering", nINT16));
 
     //prefix
     OUString aUString = rFmt.GetPrefix();
-    aPropertyValues.push_back(makePropertyValue(aUString, "Prefix"));
+    aPropertyValues.push_back(comphelper::makePropertyValue("Prefix", aUString));
 
     //suffix
     aUString = rFmt.GetSuffix();
-    aPropertyValues.push_back(makePropertyValue(aUString, "Suffix"));
+    aPropertyValues.push_back(comphelper::makePropertyValue("Suffix", aUString));
 
     //char style name
     OUString CharStyleName(rCharFormatName);
 
     aUString.clear();
     SwStyleNameMapper::FillProgName( CharStyleName, aUString, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, true );
-    aPropertyValues.push_back(makePropertyValue(aUString, "CharStyleName"));
+    aPropertyValues.push_back(comphelper::makePropertyValue("CharStyleName", aUString));
 
     //startvalue
     nINT16 = rFmt.GetStart();
-    aPropertyValues.push_back(makePropertyValue(nINT16, "StartWith"));
+    aPropertyValues.push_back(comphelper::makePropertyValue("StartWith", nINT16));
 
     if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
     {
         //leftmargin
         sal_Int32 nINT32 = convertTwipToMm100(rFmt.GetAbsLSpace());
-        aPropertyValues.push_back(
-                makePropertyValue(nINT32, UNO_NAME_LEFT_MARGIN));
+        aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_LEFT_MARGIN, nINT32));
 
         //chartextoffset
         nINT32 = convertTwipToMm100(rFmt.GetCharTextDistance());
-        aPropertyValues.push_back(
-                makePropertyValue(nINT32, UNO_NAME_SYMBOL_TEXT_DISTANCE));
+        aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_SYMBOL_TEXT_DISTANCE, nINT32));
 
         //firstlineoffset
         nINT32 = convertTwipToMm100(rFmt.GetFirstLineOffset());
-        aPropertyValues.push_back(
-                makePropertyValue(nINT32, UNO_NAME_FIRST_LINE_OFFSET));
+        aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_FIRST_LINE_OFFSET, nINT32));
     }
 
     // PositionAndSpaceMode
@@ -1406,8 +1398,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFmt(
     {
         nINT16 = PositionAndSpaceMode::LABEL_ALIGNMENT;
     }
-    aPropertyValues.push_back(
-            makePropertyValue(nINT16, UNO_NAME_POSITION_AND_SPACE_MODE));
+    aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_POSITION_AND_SPACE_MODE, nINT16));
 
     if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
     {
@@ -1421,28 +1412,24 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFmt(
         {
             nINT16 = LabelFollow::NOTHING;
         }
-        aPropertyValues.push_back(
-                makePropertyValue(nINT16, UNO_NAME_LABEL_FOLLOWED_BY));
+        aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_LABEL_FOLLOWED_BY, nINT16));
 
         // ListtabStopPosition
         sal_Int32 nINT32 = convertTwipToMm100(rFmt.GetListtabPos());
-        aPropertyValues.push_back(
-                makePropertyValue(nINT32, UNO_NAME_LISTTAB_STOP_POSITION));
+        aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_LISTTAB_STOP_POSITION, nINT32));
 
         // FirstLineIndent
         nINT32 = convertTwipToMm100(rFmt.GetFirstLineIndent());
-        aPropertyValues.push_back(
-                makePropertyValue(nINT32, UNO_NAME_FIRST_LINE_INDENT));
+        aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_FIRST_LINE_INDENT, nINT32));
 
         // IndentAt
         nINT32 = convertTwipToMm100(rFmt.GetIndentAt());
-        aPropertyValues.push_back(
-                makePropertyValue(nINT32, UNO_NAME_INDENT_AT));
+        aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_INDENT_AT, nINT32));
     }
 
     //numberingtype
     nINT16 = rFmt.GetNumberingType();
-    aPropertyValues.push_back(makePropertyValue(nINT16, "NumberingType"));
+    aPropertyValues.push_back(comphelper::makePropertyValue("NumberingType", nINT16));
 
     if(!bChapterNum)
     {
@@ -1450,25 +1437,24 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFmt(
         {
             //BulletId
             nINT16 = rFmt.GetBulletChar();
-            aPropertyValues.push_back(makePropertyValue(nINT16, "BulletId"));
+            aPropertyValues.push_back(comphelper::makePropertyValue("BulletId", nINT16));
 
             const vcl::Font* pFont = rFmt.GetBulletFont();
 
             //BulletChar
             aUString = OUString(rFmt.GetBulletChar());
-            aPropertyValues.push_back(makePropertyValue(aUString, "BulletChar"));
+            aPropertyValues.push_back(comphelper::makePropertyValue("BulletChar", aUString));
 
             //BulletFontName
             aUString = pFont ? pFont->GetStyleName() : OUString();
-            aPropertyValues.push_back(makePropertyValue(aUString, "BulletFontName"));
+            aPropertyValues.push_back(comphelper::makePropertyValue("BulletFontName", aUString));
 
             //BulletFont
             if(pFont)
             {
                  awt::FontDescriptor aDesc;
                 SvxUnoFontDescriptor::ConvertFromFont( *pFont, aDesc );
-                aPropertyValues.push_back(
-                        makePropertyValue(aDesc, UNO_NAME_BULLET_FONT));
+                aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_BULLET_FONT, aDesc));
             }
         }
         if(SVX_NUM_BITMAP == rFmt.GetNumberingType())
@@ -1483,8 +1469,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFmt(
             }
             else
                 aUString.clear();
-            aPropertyValues.push_back(
-                    makePropertyValue(aUString, UNO_NAME_GRAPHIC_URL));
+            aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_GRAPHIC_URL, aUString));
 
             //graphicbitmap
             const Graphic* pGraphic = 0;
@@ -1493,15 +1478,13 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFmt(
             if(pGraphic)
             {
                 uno::Reference<awt::XBitmap> xBmp = VCLUnoHelper::CreateBitmap( pGraphic->GetBitmapEx() );
-                aPropertyValues.push_back(
-                        makePropertyValue(xBmp, UNO_NAME_GRAPHIC_BITMAP));
+                aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_GRAPHIC_BITMAP, xBmp));
             }
              Size aSize = rFmt.GetGraphicSize();
             // #i101131#
             // adjust conversion due to type mismatch between <Size> and <awt::Size>
             awt::Size aAwtSize(convertTwipToMm100(aSize.Width()), convertTwipToMm100(aSize.Height()));
-            aPropertyValues.push_back(
-                    makePropertyValue(aAwtSize, UNO_NAME_GRAPHIC_SIZE));
+            aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_GRAPHIC_SIZE, aAwtSize));
 
             const SwFmtVertOrient* pOrient = rFmt.GetGraphicOrientation();
             if(pOrient)
@@ -1516,8 +1499,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFmt(
     else
     {
         aUString = *pHeadingStyleName;
-        aPropertyValues.push_back(
-                makePropertyValue(aUString, UNO_NAME_HEADING_STYLE_NAME));
+        aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_HEADING_STYLE_NAME, aUString));
     }
 
     return ::comphelper::containerToSequence(aPropertyValues);
commit e15eacb5ddeeed813c9455995ae8abb7772c9942
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon May 18 07:43:14 2015 +0200

    writerfilter: avoid manual realloc
    
    Change-Id: I5ce8b00736fed6d4fb307c6384deca4718e770a3

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index b0d4ca5..6dd884b 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4722,9 +4722,9 @@ void DomainMapper_Impl::RegisterFrameConversion(
         )
 {
     OSL_ENSURE(
-        !m_aFrameProperties.getLength() && !m_xFrameStartRange.is() && !m_xFrameEndRange.is(),
+        m_aFrameProperties.empty() && !m_xFrameStartRange.is() && !m_xFrameEndRange.is(),
         "frame properties not removed");
-    m_aFrameProperties = aFrameProperties;
+    m_aFrameProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aFrameProperties);
     m_xFrameStartRange = xFrameStartRange;
     m_xFrameEndRange   = xFrameEndRange;
 }
@@ -4742,7 +4742,7 @@ bool DomainMapper_Impl::ExecuteFrameConversion()
             xTextAppendAndConvert->convertToTextFrame(
                 m_xFrameStartRange,
                 m_xFrameEndRange,
-                m_aFrameProperties );
+                comphelper::containerToSequence(m_aFrameProperties) );
         }
         catch( const uno::Exception& rEx)
         {
@@ -4752,7 +4752,7 @@ bool DomainMapper_Impl::ExecuteFrameConversion()
     }
     m_xFrameStartRange = nullptr;
     m_xFrameEndRange = nullptr;
-    m_aFrameProperties.realloc( 0 );
+    m_aFrameProperties.clear();
     return bRet;
 }
 
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index c7cca3d..e13d928 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -398,7 +398,7 @@ private:
     bool                            m_bIsCustomFtnMark;
 
     //registered frame properties
-    css::uno::Sequence<css::beans::PropertyValue> m_aFrameProperties;
+    std::vector<css::beans::PropertyValue> m_aFrameProperties;
     css::uno::Reference<css::text::XTextRange> m_xFrameStartRange;
     css::uno::Reference<css::text::XTextRange> m_xFrameEndRange;
 
commit 5f2f57ea644dc116c131dcc82ffb434da94c344b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon May 18 07:42:39 2015 +0200

    oox: these ctors can be explicit
    
    Change-Id: Ie53422eb4684bc3d720c8922d4764b807df4c8f3

diff --git a/oox/source/crypto/DocumentDecryption.cxx b/oox/source/crypto/DocumentDecryption.cxx
index a612dcb..d582c7d 100644
--- a/oox/source/crypto/DocumentDecryption.cxx
+++ b/oox/source/crypto/DocumentDecryption.cxx
@@ -63,7 +63,7 @@ class AgileDocumentHandler : public ::cppu::WeakImplHelper1< XFastDocumentHandle
     AgileEncryptionInfo& mInfo;
 
 public:
-    AgileDocumentHandler(AgileEncryptionInfo& rInfo) :
+    explicit AgileDocumentHandler(AgileEncryptionInfo& rInfo) :
         mInfo(rInfo)
     {}
 
diff --git a/oox/source/drawingml/clrscheme.cxx b/oox/source/drawingml/clrscheme.cxx
index 9fb8382..176fd82 100644
--- a/oox/source/drawingml/clrscheme.cxx
+++ b/oox/source/drawingml/clrscheme.cxx
@@ -45,7 +45,7 @@ void ClrMap::setColorMap( sal_Int32 nClrToken, sal_Int32 nMappedClrToken )
 
 struct find_by_token
 {
-    find_by_token(sal_Int32 token):
+    explicit find_by_token(sal_Int32 token):
         m_token(token)
     {
     }
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index c1939a9..8edffb9 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -571,7 +571,7 @@ class ShallowPresNameVisitor : public LayoutAtomVisitor
     virtual void visit(LayoutNode& rAtom) SAL_OVERRIDE;
 
 public:
-    ShallowPresNameVisitor(const Diagram& rDgm) :
+    explicit ShallowPresNameVisitor(const Diagram& rDgm) :
         mrDgm(rDgm),
         mnCnt(0)
     {}
diff --git a/oox/source/export/ColorPropertySet.cxx b/oox/source/export/ColorPropertySet.cxx
index ae7df6e..aa32446 100644
--- a/oox/source/export/ColorPropertySet.cxx
+++ b/oox/source/export/ColorPropertySet.cxx
@@ -38,7 +38,7 @@ class lcl_ColorPropertySetInfo : public ::cppu::WeakImplHelper1<
         XPropertySetInfo  >
 {
 public:
-    lcl_ColorPropertySetInfo( bool bFillColor );
+    explicit lcl_ColorPropertySetInfo( bool bFillColor );
 
 protected:
     // ____ XPropertySetInfo ____
diff --git a/oox/source/mathml/importutils.cxx b/oox/source/mathml/importutils.cxx
index 8fe96b7..a759c3f 100644
--- a/oox/source/mathml/importutils.cxx
+++ b/oox/source/mathml/importutils.cxx
@@ -36,7 +36,7 @@ class AttributeListBuilder
     : public XmlStream::AttributeList
 {
 public:
-    AttributeListBuilder( const uno::Reference< xml::sax::XFastAttributeList >& a );
+    explicit AttributeListBuilder( const uno::Reference< xml::sax::XFastAttributeList >& a );
 };
 
 AttributeListBuilder::AttributeListBuilder( const uno::Reference< xml::sax::XFastAttributeList >& a )
diff --git a/oox/source/ppt/buildlistcontext.hxx b/oox/source/ppt/buildlistcontext.hxx
index 19bee76..a5a46bb 100644
--- a/oox/source/ppt/buildlistcontext.hxx
+++ b/oox/source/ppt/buildlistcontext.hxx
@@ -29,7 +29,7 @@ namespace oox { namespace ppt {
         : public ::oox::core::FragmentHandler2
     {
     public:
-        BuildListContext( ::oox::core::FragmentHandler2& rParent );
+        explicit BuildListContext( ::oox::core::FragmentHandler2& rParent );
 
         virtual ~BuildListContext( );
 
diff --git a/oox/source/shape/LockedCanvasContext.hxx b/oox/source/shape/LockedCanvasContext.hxx
index f97653f..ca1599d 100644
--- a/oox/source/shape/LockedCanvasContext.hxx
+++ b/oox/source/shape/LockedCanvasContext.hxx
@@ -22,7 +22,7 @@ namespace shape
 class LockedCanvasContext : public oox::core::ContextHandler2
 {
 public:
-    LockedCanvasContext(oox::core::ContextHandler2Helper& rParent);
+    explicit LockedCanvasContext(oox::core::ContextHandler2Helper& rParent);
     virtual ~LockedCanvasContext();
 
     virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 Element, const ::oox::AttributeList& rAttribs) SAL_OVERRIDE;
diff --git a/oox/source/shape/WpgContext.hxx b/oox/source/shape/WpgContext.hxx
index f4fc9c5..f57eff1 100644
--- a/oox/source/shape/WpgContext.hxx
+++ b/oox/source/shape/WpgContext.hxx
@@ -22,7 +22,7 @@ namespace shape
 class WpgContext : public oox::core::ContextHandler2
 {
 public:
-    WpgContext(oox::core::ContextHandler2Helper& rParent);
+    explicit WpgContext(oox::core::ContextHandler2Helper& rParent);
     virtual ~WpgContext();
 
     virtual oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElementToken, const oox::AttributeList& rAttribs) SAL_OVERRIDE;
commit b6744874cb7fc0e85996e093a56fe89b83d31e2c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon May 18 07:41:04 2015 +0200

    lokdocview: use lok::Office::registerCallback()
    
    This way we get some feedback on the state of the loading at least on
    the console.
    
    Change-Id: I95bf6cebcdd8b879c817b4e027d4f5b4acb9cd4c

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 35ce543..4fffaf3 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -179,12 +179,20 @@ struct LOKDocView_Impl
     static const char* callbackTypeToString(int nType);
     /// Invoked on the main thread if callbackWorker() requests so.
     static gboolean callback(gpointer pData);
+    /// Invoked on the main thread if globalCallbackWorker() requests so.
+    static gboolean globalCallback(gpointer pData);
     /// Implementation of the callback handler, invoked by callback();
     gboolean callbackImpl(CallbackData* pCallbackData);
+    /// Implementation of the global callback handler, invoked by globalCallback();
+    gboolean globalCallbackImpl(CallbackData* pCallbackData);
     /// Our LOK callback, runs on the LO thread.
     static void callbackWorker(int nType, const char* pPayload, void* pData);
     /// Implementation of the callback worder handler, invoked by callbackWorker().
     void callbackWorkerImpl(int nType, const char* pPayload);
+    /// Our global LOK callback, runs on the LO thread.
+    static void globalCallbackWorker(int nType, const char* pPayload, void* pData);
+    /// Implementation of the global callback worder handler, invoked by globalCallbackWorker().
+    void globalCallbackWorkerImpl(int nType, const char* pPayload);
     /// Command state (various buttons like bold are toggled or not) is changed.
     void commandChanged(const std::string& rPayload);
 };
@@ -872,6 +880,12 @@ const char* LOKDocView_Impl::callbackTypeToString(int nType)
         return "LOK_CALLBACK_HYPERLINK_CLICKED";
     case LOK_CALLBACK_STATE_CHANGED:
         return "LOK_CALLBACK_STATE_CHANGED";
+    case LOK_CALLBACK_STATUS_INDICATOR_START:
+        return "LOK_CALLBACK_STATUS_INDICATOR_START";
+    case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE:
+        return "LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE";
+    case LOK_CALLBACK_STATUS_INDICATOR_FINISH:
+        return "LOK_CALLBACK_STATUS_INDICATOR_FINISH";
     }
     return 0;
 }
@@ -882,6 +896,12 @@ gboolean LOKDocView_Impl::callback(gpointer pData)
     return pCallback->m_pDocView->m_pImpl->callbackImpl(pCallback);
 }
 
+gboolean LOKDocView_Impl::globalCallback(gpointer pData)
+{
+    LOKDocView_Impl::CallbackData* pCallback = static_cast<LOKDocView_Impl::CallbackData*>(pData);
+    return pCallback->m_pDocView->m_pImpl->globalCallbackImpl(pCallback);
+}
+
 gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
 {
     switch (pCallback->m_nType)
@@ -967,12 +987,43 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
     return G_SOURCE_REMOVE;
 }
 
+gboolean LOKDocView_Impl::globalCallbackImpl(CallbackData* pCallback)
+{
+    switch (pCallback->m_nType)
+    {
+    case LOK_CALLBACK_STATUS_INDICATOR_START:
+    {
+    }
+    break;
+    case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE:
+    {
+    }
+    break;
+    case LOK_CALLBACK_STATUS_INDICATOR_FINISH:
+    {
+    }
+    break;
+    default:
+        g_assert(false);
+        break;
+    }
+    delete pCallback;
+
+    return G_SOURCE_REMOVE;
+}
+
 void LOKDocView_Impl::callbackWorker(int nType, const char* pPayload, void* pData)
 {
     LOKDocView* pDocView = static_cast<LOKDocView*>(pData);
     pDocView->m_pImpl->callbackWorkerImpl(nType, pPayload);
 }
 
+void LOKDocView_Impl::globalCallbackWorker(int nType, const char* pPayload, void* pData)
+{
+    LOKDocView* pDocView = static_cast<LOKDocView*>(pData);
+    pDocView->m_pImpl->globalCallbackWorkerImpl(nType, pPayload);
+}
+
 void LOKDocView_Impl::callbackWorkerImpl(int nType, const char* pPayload)
 {
     LOKDocView_Impl::CallbackData* pCallback = new LOKDocView_Impl::CallbackData(nType, pPayload, m_pDocView);
@@ -982,6 +1033,15 @@ void LOKDocView_Impl::callbackWorkerImpl(int nType, const char* pPayload)
 #endif
 }
 
+void LOKDocView_Impl::globalCallbackWorkerImpl(int nType, const char* pPayload)
+{
+    LOKDocView_Impl::CallbackData* pCallback = new LOKDocView_Impl::CallbackData(nType, pPayload ? pPayload : "(nil)", m_pDocView);
+    g_info("LOKDocView_Impl::globalCallbackWorkerImpl: %s, '%s'", LOKDocView_Impl::callbackTypeToString(nType), pPayload);
+#if GTK_CHECK_VERSION(2,12,0)
+    gdk_threads_add_idle(LOKDocView_Impl::globalCallback, pCallback);
+#endif
+}
+
 enum
 {
     EDIT_CHANGED,
@@ -1085,6 +1145,7 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, c
         pDocView->m_pImpl->m_pDocument = 0;
     }
 
+    pDocView->m_pImpl->m_pOffice->pClass->registerCallback(pDocView->m_pImpl->m_pOffice, &LOKDocView_Impl::globalCallbackWorker, pDocView);
     pDocView->m_pImpl->m_pDocument = pDocView->m_pImpl->m_pOffice->pClass->documentLoad( pDocView->m_pImpl->m_pOffice,
                                                                    pPath );
     if ( !pDocView->m_pImpl->m_pDocument )
commit cbe79789a0fc9b80b2fd14a5abfe0973a2cb69dc
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon May 18 07:38:32 2015 +0200

    tdf#86814 RTF import: fix sometimes lost bold style
    
    The problem was that commit 76c0d0abc89cd8948706083c2660b71a2dad670c
    (RTF import: adapt getProperties() to createStyleProperties(),
    2014-09-07) only made the character style sprms/attributes a flat list,
    but not the paragraph style ones. Fixing that inconsistency avoids the
    tokenizer adding unwanted default sprms, which cause the bold sprms go
    away in the bugdoc.
    
    Change-Id: I86bd1b26af18cd968375c9b39be9c8e71d51271f

diff --git a/sw/qa/extras/rtfimport/data/tdf86814.rtf b/sw/qa/extras/rtfimport/data/tdf86814.rtf
new file mode 100644
index 0000000..6fb394e
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf86814.rtf
@@ -0,0 +1,8 @@
+{\rtf1
+{\stylesheet
+{\s0 Normal;}
+{\s23\sbasedon0\snext23\sl288\slmult1\ql\widctlpar\faauto\li0\ri0\lin0\rin0\fi0\sb100\sa100\ltrpar\b\dbch\af10\langfe1049\dbch\af11\afs20\alang1025\ab\loch\f5\fs20\lang1049 Style 23;}
+}
+\pard\plain \s23\sl288\slmult1\ql\widctlpar\faauto\li0\ri0\lin0\rin0\fi0\sb100\sa100\ltrpar\b\dbch\af10\langfe1049\dbch\af11\afs20\alang1025\ab\loch\f5\fs20\lang1049\ql\widctlpar\faauto\li0\ri0\lin0\rin0\fi0
+{\b\langfe1049\dbch\af11\afs20\alang1025\ab\rtlch \ltrch\loch\fs20\lang1049 hello}
+\par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 1a4dbfe..e74d694 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2286,6 +2286,12 @@ DECLARE_RTFIMPORT_TEST(testTdf90260Par, "hello.rtf")
     CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf86814, "tdf86814.rtf")
+{
+    // This was awt::FontWeight::NORMAL, i.e. the first run wasn't bold, when it should be bold (applied paragraph style with direct formatting).
+    CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(getRun(getParagraph(1), 1), "CharWeight"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 625818c..b351bef 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -415,6 +415,32 @@ void RTFDocumentImpl::setNeedSect(bool bNeedSect)
     }
 }
 
+/// Copy rProps to rStyleAttributes and rStyleSprms, but in case of nested sprms, copy their children as toplevel sprms/attributes.
+static void lcl_copyFlatten(RTFReferenceProperties& rProps, RTFSprms& rStyleAttributes, RTFSprms& rStyleSprms)
+{
+    for (RTFSprms::Iterator_t it = rProps.getSprms().begin(); it != rProps.getSprms().end(); ++it)
+    {
+        // createStyleProperties() puts properties to rPr, but here we need a flat list.
+        if (it->first == NS_ooxml::LN_CT_Style_rPr)
+        {
+            // rPr can have both attributes and SPRMs, copy over both types.
+            RTFSprms& rRPrSprms = it->second->getSprms();
+            for (RTFSprms::Iterator_t itRPrSprm = rRPrSprms.begin(); itRPrSprm != rRPrSprms.end(); ++itRPrSprm)
+                rStyleSprms.set(itRPrSprm->first, itRPrSprm->second);
+
+            RTFSprms& rRPrAttributes = it->second->getAttributes();
+            for (RTFSprms::Iterator_t itRPrAttribute = rRPrAttributes.begin(); itRPrAttribute != rRPrAttributes.end(); ++itRPrAttribute)
+                rStyleAttributes.set(itRPrAttribute->first, itRPrAttribute->second);
+        }
+        else
+            rStyleSprms.set(it->first, it->second);
+    }
+
+    RTFSprms& rAttributes = rProps.getAttributes();
+    for (RTFSprms::Iterator_t itAttr = rAttributes.begin(); itAttr != rAttributes.end(); ++itAttr)
+        rStyleAttributes.set(itAttr->first, itAttr->second);
+}
+
 writerfilter::Reference<Properties>::Pointer_t RTFDocumentImpl::getProperties(RTFSprms& rAttributes, RTFSprms& rSprms)
 {
     int nStyle = 0;
@@ -429,34 +455,17 @@ writerfilter::Reference<Properties>::Pointer_t RTFDocumentImpl::getProperties(RT
         // let's merge paragraph and character style properties here.
         int nCharStyle = m_aStates.top().nCurrentCharacterStyleIndex;
         RTFReferenceTable::Entries_t::iterator itChar = m_aStyleTableEntries.find(nCharStyle);
-        RTFSprms aStyleSprms = rProps.getSprms();
-        RTFSprms aStyleAttributes = rProps.getAttributes();
+        RTFSprms aStyleSprms;
+        RTFSprms aStyleAttributes;
+
+        // Ensure the paragraph style is a flat list.
+        lcl_copyFlatten(rProps, aStyleAttributes, aStyleSprms);
+
         if (itChar != m_aStyleTableEntries.end())
         {
             // Found active character style, then update aStyleSprms/Attributes.
             RTFReferenceProperties& rCharProps = *static_cast<RTFReferenceProperties*>(itChar->second.get());
-            RTFSprms& rCharStyleSprms = rCharProps.getSprms();
-            for (RTFSprms::Iterator_t itSprm = rCharStyleSprms.begin(); itSprm != rCharStyleSprms.end(); ++itSprm)
-            {
-                // createStyleProperties() puts properties to rPr, but here we need a flat list.
-                if (itSprm->first == NS_ooxml::LN_CT_Style_rPr)
-                {
-                    // rPr can have both attributes and SPRM's, copy over both types.
-                    RTFSprms& rRPrSprms = itSprm->second->getSprms();
-                    for (RTFSprms::Iterator_t itRPrSprm = rRPrSprms.begin(); itRPrSprm != rRPrSprms.end(); ++itRPrSprm)
-                        aStyleSprms.set(itRPrSprm->first, itRPrSprm->second);
-
-                    RTFSprms& rRPrAttributes = itSprm->second->getAttributes();
-                    for (RTFSprms::Iterator_t itRPrAttribute = rRPrAttributes.begin(); itRPrAttribute != rRPrAttributes.end(); ++itRPrAttribute)
-                        aStyleAttributes.set(itRPrAttribute->first, itRPrAttribute->second);
-                }
-                else
-                    aStyleSprms.set(itSprm->first, itSprm->second);
-            }
-
-            RTFSprms& rCharStyleAttributes = rCharProps.getAttributes();
-            for (RTFSprms::Iterator_t itAttr = rCharStyleAttributes.begin(); itAttr != rCharStyleAttributes.end(); ++itAttr)
-                aStyleAttributes.set(itAttr->first, itAttr->second);
+            lcl_copyFlatten(rCharProps, aStyleAttributes, aStyleSprms);
         }
 
         // Get rid of direct formatting what is already in the style.


More information about the Libreoffice-commits mailing list