[Libreoffice-commits] core.git: include/sax include/sfx2 include/svl include/svtools include/svx sc/source sd/inc sd/source sfx2/source svx/source sw/source

2023-10-02 Thread Gabor Kelemen (via logerrit)
 include/sax/fastattribs.hxx   |1 -
 include/sfx2/LokControlHandler.hxx|4 
 include/sfx2/lokhelper.hxx|3 ++-
 include/sfx2/msg.hxx  |1 -
 include/svl/itemset.hxx   |2 --
 include/svtools/genericasyncunodialog.hxx |1 -
 include/svtools/htmlcfg.hxx   |1 -
 include/svtools/htmlout.hxx   |1 -
 include/svtools/rtfout.hxx|3 ++-
 include/svtools/rtftoken.h|6 +-
 include/svx/ChildrenManager.hxx   |1 -
 include/svx/ColorSets.hxx |3 ---
 include/svx/constructhelper.hxx   |2 +-
 include/svx/dialog/ThemeDialog.hxx|2 --
 include/svx/dlgctl3d.hxx  |1 +
 include/svx/extedit.hxx   |1 +
 include/svx/fmgridif.hxx  |1 -
 include/svx/hlnkitem.hxx  |1 -
 include/svx/ofaitem.hxx   |2 +-
 include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx |2 --
 include/svx/sdr/table/tablecontroller.hxx |1 -
 include/svx/sidebar/AreaTransparencyGradientPopup.hxx |3 +--
 include/svx/svdetc.hxx|1 -
 include/svx/svdobj.hxx|4 +---
 include/svx/theme/ThemeColorChangerCommon.hxx |2 --
 include/svx/unopool.hxx   |1 -
 include/svx/unoprov.hxx   |1 -
 include/svx/unoshape.hxx  |2 +-
 include/svx/xcolit.hxx|1 -
 sc/source/ui/view/formatsh.cxx|1 +
 sd/inc/OutlinerIterator.hxx   |1 +
 sd/source/core/ThemeColorChanger.cxx  |1 +
 sfx2/source/view/lokhelper.cxx|1 +
 svx/source/engine3d/scene3d.cxx   |1 +
 svx/source/sdr/contact/viewcontactofe3dscene.cxx  |1 +
 svx/source/styles/ColorSets.cxx   |1 +
 svx/source/table/tableundo.hxx|1 +
 svx/source/theme/ThemeColorChangerCommon.cxx  |1 +
 svx/source/unodraw/gluepts.cxx|1 +
 sw/source/filter/ww8/ww8graf.cxx  |1 +
 sw/source/ui/dbui/mailmergewizard.cxx |2 ++
 sw/source/ui/envelp/mailmrge.cxx  |1 +
 42 files changed, 26 insertions(+), 43 deletions(-)

New commits:
commit 3e753f484910fb65065dd7eb81d2131b51990fe9
Author: Gabor Kelemen 
AuthorDate: Sat Sep 16 15:26:25 2023 +0200
Commit: Thorsten Behrens 
CommitDate: Mon Oct 2 21:32:00 2023 +0200

tdf#146619 Recheck include/s* with IWYU

Change-Id: Ia0a6330278b044f448c9928362308aadc8fc9a20
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156989
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 61eb048e881a..fb6f47eb7f9d 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -26,7 +26,6 @@
 
 #include 
 #include 
-#include 
 #include 
 
 #include 
diff --git a/include/sfx2/LokControlHandler.hxx 
b/include/sfx2/LokControlHandler.hxx
index a292f137471b..d8ff3811240b 100644
--- a/include/sfx2/LokControlHandler.hxx
+++ b/include/sfx2/LokControlHandler.hxx
@@ -9,8 +9,6 @@
 
 #pragma once
 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -25,8 +23,6 @@
 #include 
 #include 
 
-#include 
-
 #include 
 
 class LokControlHandler
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 26b222bc8aa9..bd2014f9c9d9 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -10,6 +10,8 @@
 #ifndef INCLUDED_SFX2_LOKHELPER_HXX
 #define INCLUDED_SFX2_LOKHELPER_HXX
 
+#include 
+
 #include 
 #include 
 #include 
@@ -23,7 +25,6 @@
 #include 
 #include 
 #include 
-#include 
 
 struct SFX2_DLLPUBLIC LokMouseEventData
 {
diff --git a/include/sfx2/msg.hxx b/include/sfx2/msg.hxx
index 7962fba85b0b..c8d343b04bcf 100644
--- a/include/sfx2/msg.hxx
+++ b/include/sfx2/msg.hxx
@@ -20,7 +20,6 @@
 #define INCLUDED_SFX2_MSG_HXX
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx
index 6d95ec505c0f..01d9d5058b14 100644
--- a/include/svl/itemset.hxx
+++ b/include/svl/itemset.hxx
@@ -21,9 +21,7 @@
 #include 
 
 #include 
-#include 
 #include 
-#include 
 #include 
 
 #include 
diff --git 

[Libreoffice-commits] core.git: include/sax sax/source

2023-01-16 Thread Mike Kaganski (via logerrit)
 include/sax/fastattribs.hxx  |   28 ---
 sax/source/tools/fastattribs.cxx |   40 +--
 2 files changed, 23 insertions(+), 45 deletions(-)

New commits:
commit 15fe7346ade34f09f9be016ff847421ce0fa56f4
Author: Mike Kaganski 
AuthorDate: Mon Jan 16 13:29:19 2023 +0300
Commit: Mike Kaganski 
CommitDate: Mon Jan 16 11:40:18 2023 +

Simplify FastAttributeList

Change-Id: Id89edb25e35527e8603c32e44fb2940721aeda58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145562
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 22512bd5a929..2dc7c3d72420 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -25,6 +25,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -105,9 +106,18 @@ public:
 bool getAsInteger( sal_Int32 nToken, sal_Int32 ) const;
 bool getAsDouble( sal_Int32 nToken, double ) const;
 bool getAsView( sal_Int32 nToken, std::string_view& rPos ) const;
-sal_Int32 getAsIntegerByIndex( sal_Int32 nTokenIndex ) const;
-std::string_view getAsViewByIndex( sal_Int32 nTokenIndex ) const;
-OUString getValueByIndex( sal_Int32 nTokenIndex ) const;
+sal_Int32 getAsIntegerByIndex( sal_Int32 nTokenIndex ) const
+{
+return o3tl::toInt32(getAsViewByIndex(nTokenIndex));
+}
+std::string_view getAsViewByIndex( sal_Int32 nTokenIndex ) const
+{
+return std::string_view(getFastAttributeValue(nTokenIndex), 
AttributeValueLength(nTokenIndex));
+}
+OUString getValueByIndex( sal_Int32 nTokenIndex ) const
+{
+return OStringToOUString(getAsViewByIndex(nTokenIndex), 
RTL_TEXTENCODING_UTF8);
+}
 
 // XFastAttributeList
 virtual sal_Bool SAL_CALL hasAttribute( ::sal_Int32 Token ) override;
@@ -168,14 +178,12 @@ public:
 sal_Int32 toInt32() const
 {
 assert(mnIdx < mrList.maAttributeTokens.size());
-return rtl_str_toInt32(mrList.getFastAttributeValue(mnIdx), 10);
+return mrList.getAsIntegerByIndex(mnIdx);
 }
 double toDouble() const
 {
 assert(mnIdx < mrList.maAttributeTokens.size());
-const char* pStr = mrList.getFastAttributeValue(mnIdx);
-sal_Int32 nLen = mrList.AttributeValueLength(mnIdx);
-return rtl_math_stringToDouble(pStr, pStr + nLen, '.', 0, nullptr, 
nullptr);
+return o3tl::toDouble(mrList.getAsViewByIndex(mnIdx));
 }
 bool toBoolean() const
 {
@@ -185,9 +193,7 @@ public:
 OUString toString() const
 {
 assert(mnIdx < mrList.maAttributeTokens.size());
-return OUString(mrList.getFastAttributeValue(mnIdx),
-mrList.AttributeValueLength(mnIdx),
-RTL_TEXTENCODING_UTF8);
+return mrList.getValueByIndex(mnIdx);
 }
 const char* toCString() const
 {
@@ -202,7 +208,7 @@ public:
 std::string_view toView() const
 {
 assert(mnIdx < mrList.maAttributeTokens.size());
-return std::string_view(mrList.getFastAttributeValue(mnIdx), 
mrList.AttributeValueLength(mnIdx));
+return mrList.getAsViewByIndex(mnIdx);
 }
 bool isString(const char *str) const
 {
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index d020e18de18c..27d7e57f8ad5 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -210,33 +210,19 @@ bool FastAttributeList::getAsInteger( sal_Int32 nToken, 
sal_Int32 ) const
 for (size_t i = 0, n = maAttributeTokens.size(); i < n; ++i)
 if (maAttributeTokens[i] == nToken)
 {
-sal_Int64 nVal = rtl_str_toInt64_WithLength( 
getFastAttributeValue(i), 10, AttributeValueLength(i) );
-if (nVal < SAL_MIN_INT32 || nVal > SAL_MAX_INT32) {
-nVal = 0;
-}
-rInt = nVal;
+rInt = getAsIntegerByIndex(i);
 return true;
 }
 return false;
 }
 
-sal_Int32 FastAttributeList::getAsIntegerByIndex( sal_Int32 nTokenIndex ) const
-{
-sal_Int64 n = rtl_str_toInt64_WithLength( 
getFastAttributeValue(nTokenIndex), 10, AttributeValueLength(nTokenIndex) );
-if (n < SAL_MIN_INT32 || n > SAL_MAX_INT32) {
-n = 0;
-}
-return n;
-}
-
 bool FastAttributeList::getAsDouble( sal_Int32 nToken, double ) const
 {
 rDouble = 0.0;
 for (size_t i = 0, n = maAttributeTokens.size(); i < n; ++i)
 if (maAttributeTokens[i] == nToken)
 {
-auto const p = getFastAttributeValue(i);
-rDouble = rtl_math_stringToDouble( p,  p + 
AttributeValueLength(i), '.', 0, nullptr, nullptr );
+rDouble = o3tl::toDouble(getAsViewByIndex(i));
 return true;
 }
 return 

[Libreoffice-commits] core.git: include/sax oox/source sax/source sc/source sd/source sw/source

2022-10-12 Thread Caolán McNamara (via logerrit)
 include/sax/fshelper.hxx |3 +++
 oox/source/core/xmlfilterbase.cxx|6 ++
 oox/source/export/chartexport.cxx|3 +++
 sax/source/tools/fshelper.cxx|   20 ++--
 sc/source/filter/excel/xestream.cxx  |6 ++
 sd/source/filter/eppt/pptx-epptooxml.cxx |   23 +++
 sw/source/filter/ww8/docxexport.cxx  |   20 
 7 files changed, 79 insertions(+), 2 deletions(-)

New commits:
commit 06423ddc61a378894c91a6a23fb31afb1701d8f2
Author: Caolán McNamara 
AuthorDate: Tue Oct 11 10:45:40 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Oct 12 09:52:15 2022 +0200

crashtesting: exception during dtor

Change-Id: I9874778ba79540cfde32bf59c3a63ebb72889dc7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141215
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index 115a3f912ca5..2d01066a1453 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -50,6 +50,9 @@ public:
 
 ~FastSerializerHelper();
 
+void startDocument();
+void endDocument();
+
 /// Start an element. After the first argument there can be a number of 
(attribute, value) pairs.
 template
 void startElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
char* value, Args &&... args)
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index e0e8b099ea5e..c2911a756047 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -697,6 +697,8 @@ writeCoreProperties( XmlFilterBase& rSelf, const Reference< 
XDocumentProperties
 }
 
 pCoreProps->endElementNS( XML_cp, XML_coreProperties );
+
+pCoreProps->endDocument();
 }
 
 static void
@@ -819,6 +821,8 @@ writeAppProperties( XmlFilterBase& rSelf, const Reference< 
XDocumentProperties >
 }
 
 pAppProps->endElement( XML_Properties );
+
+pAppProps->endDocument();
 }
 
 static void
@@ -937,6 +941,8 @@ writeCustomProperties( XmlFilterBase& rSelf, const 
Reference< XDocumentPropertie
 ++nIndex;
 }
 pAppProps->endElement( XML_Properties );
+
+pAppProps->endDocument();
 }
 
 void XmlFilterBase::exportDocumentProperties( const Reference< 
XDocumentProperties >& xProperties, bool bSecurityOptOpenReadOnly )
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 6bdede718f05..b60e84590ae9 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -874,6 +874,8 @@ void ChartExport::WriteChartObj( const Reference< XShape >& 
xShape, sal_Int32 nI
 
 SetFS( pChart );
 ExportContent();
+SetFS( pFS );
+pChart->endDocument();
 }
 
 void ChartExport::InitRangeSegmentationProperties( const Reference< 
chart2::XChartDocument > & xChartDoc )
@@ -1115,6 +1117,7 @@ void ChartExport::exportAdditionalShapes( const 
Reference< css::chart::XChartDoc
 pDrawing->endElement(FSNS(XML_cdr, XML_relSizeAnchor));
 }
 pDrawing->endElement(FSNS(XML_c, XML_userShapes));
+pDrawing->endDocument();
 }
 }
 catch (const uno::Exception&)
diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx
index 7cbd3c36abc1..fbf7f0672709 100644
--- a/sax/source/tools/fshelper.cxx
+++ b/sax/source/tools/fshelper.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
 #include 
 #include "fastserializer.hxx"
 
@@ -29,12 +30,27 @@ FastSerializerHelper::FastSerializerHelper(const Reference< 
io::XOutputStream >&
 mpSerializer(new FastSaxSerializer(xOutputStream))
 {
 if( bWriteHeader )
-mpSerializer->startDocument();
+startDocument();
+}
+
+void FastSerializerHelper::startDocument()
+{
+mpSerializer->startDocument();
+}
+
+void FastSerializerHelper::endDocument()
+{
+std::unique_ptr xSerializer(std::move(mpSerializer));
+xSerializer->endDocument();
 }
 
 FastSerializerHelper::~FastSerializerHelper()
 {
-mpSerializer->endDocument();
+if (mpSerializer)
+{
+assert(false && "call endDocument explicitly before dtor to avoid 
potential exceptions during dtor");
+endDocument();
+}
 }
 
 void FastSerializerHelper::startElement(sal_Int32 elementTokenId)
diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index b94959292891..04cb7ad23ec7 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -1113,6 +1113,12 @@ bool XclExpXmlStream::exportDocument()
 
 PopStream();
 // Free all FSHelperPtr, to flush data before committing storage
+for (auto& entry : maOpenedStreamMap)
+{
+if (!entry.second.second)
+continue;
+entry.second.second->endDocument();
+}
 maOpenedStreamMap.clear();
 
 commitStorage();

[Libreoffice-commits] core.git: include/sax sax/source

2022-10-11 Thread Caolán McNamara (via logerrit)
 include/sax/fshelper.hxx  |2 +-
 sax/source/tools/fshelper.cxx |1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 2241ce64b29e87e0c654ab529b71aa98f71b4a14
Author: Caolán McNamara 
AuthorDate: Tue Oct 11 10:16:08 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Oct 11 20:33:01 2022 +0200

use std::unique_ptr

Change-Id: Ibb3d71c8d50e1ad7236a6fe01ff83d3cd1a866f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141214
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index 79f0e1a0f30f..115a3f912ca5 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -156,7 +156,7 @@ private:
 void pushAttributeValue( sal_Int32 attribute, const char* value );
 void pushAttributeValue( sal_Int32 attribute, const OString& value );
 
-FastSaxSerializer* mpSerializer;
+std::unique_ptr mpSerializer;
 };
 
 typedef std::shared_ptr< FastSerializerHelper > FSHelperPtr;
diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx
index a560e5bd1bad..7cbd3c36abc1 100644
--- a/sax/source/tools/fshelper.cxx
+++ b/sax/source/tools/fshelper.cxx
@@ -35,7 +35,6 @@ FastSerializerHelper::FastSerializerHelper(const Reference< 
io::XOutputStream >&
 FastSerializerHelper::~FastSerializerHelper()
 {
 mpSerializer->endDocument();
-delete mpSerializer;
 }
 
 void FastSerializerHelper::startElement(sal_Int32 elementTokenId)


[Libreoffice-commits] core.git: include/sax sax/source writerfilter/source

2022-07-28 Thread Noel Grandin (via logerrit)
 include/sax/fastattribs.hxx |1 +
 sax/source/tools/fastattribs.cxx|7 +++
 writerfilter/source/ooxml/OOXMLFactory.cxx  |2 +-
 writerfilter/source/ooxml/OOXMLFactory.hxx  |2 +-
 writerfilter/source/ooxml/factory_ns.py |2 +-
 writerfilter/source/ooxml/factoryimpl_ns.py |   14 +++---
 6 files changed, 18 insertions(+), 10 deletions(-)

New commits:
commit 28dc1e713cfc5b5ea38e15f032aba72d05e40b33
Author: Noel Grandin 
AuthorDate: Wed Jul 27 17:56:28 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Jul 28 08:47:41 2022 +0200

tdf#119840 remove some OUString allocation

Change-Id: I488db37b3a60feb351d1ecd46278f6d5c3cdde5b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137535
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 57619b922518..24133a4f82ca 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -106,6 +106,7 @@ public:
 bool getAsChar( sal_Int32 nToken, const char*& rPos ) const;
 sal_Int32 getAsIntegerByIndex( sal_Int32 nTokenIndex ) const;
 const char* getAsCharByIndex( sal_Int32 nTokenIndex ) const;
+std::string_view getAsViewByIndex( sal_Int32 nTokenIndex ) const;
 OUString getValueByIndex( sal_Int32 nTokenIndex ) const;
 
 // XFastAttributeList
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index 81dabf727ebd..3522f38f3ef5 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -263,6 +263,13 @@ const char* FastAttributeList::getAsCharByIndex( sal_Int32 
nTokenIndex ) const
 return mpChunk + nOffset;
 }
 
+std::string_view FastAttributeList::getAsViewByIndex( sal_Int32 nTokenIndex ) 
const
+{
+sal_Int32 nOffset = maAttributeValues[nTokenIndex];
+size_t nValueLen = maAttributeValues[nTokenIndex + 1] - 
maAttributeValues[nTokenIndex] - 1;
+return { mpChunk + nOffset, nValueLen };
+}
+
 OUString FastAttributeList::getValue( ::sal_Int32 Token )
 {
 for (size_t i = 0, n = maAttributeTokens.size(); i < n; ++i)
diff --git a/writerfilter/source/ooxml/OOXMLFactory.cxx 
b/writerfilter/source/ooxml/OOXMLFactory.cxx
index 9e52c2b4c9e6..efedbe56d285 100644
--- a/writerfilter/source/ooxml/OOXMLFactory.cxx
+++ b/writerfilter/source/ooxml/OOXMLFactory.cxx
@@ -90,7 +90,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * 
pHandler,
 break;
 case ResourceType::List:
 if (sal_uInt32 nValue;
-pFactory->getListValue(pAttr->m_nRef, 
rAttribs.getValueByIndex(nAttrIndex), nValue))
+pFactory->getListValue(pAttr->m_nRef, 
rAttribs.getAsViewByIndex(nAttrIndex), nValue))
 {
 xValue = OOXMLIntegerValue::Create(nValue);
 }
diff --git a/writerfilter/source/ooxml/OOXMLFactory.hxx 
b/writerfilter/source/ooxml/OOXMLFactory.hxx
index 4f3c82f1b070..f687f3b6735c 100644
--- a/writerfilter/source/ooxml/OOXMLFactory.hxx
+++ b/writerfilter/source/ooxml/OOXMLFactory.hxx
@@ -72,7 +72,7 @@ protected:
 virtual ~OOXMLFactory_ns() override;
 
 public:
-virtual bool getListValue(Id nId, const OUString& rValue, sal_uInt32& 
rOutValue) = 0;
+virtual bool getListValue(Id nId, std::string_view aValue, sal_uInt32& 
rOutValue) = 0;
 virtual Id getResourceId(Id nDefine, sal_Int32 nToken) = 0;
 virtual const AttributeInfo* getAttributeInfoArray(Id nId) = 0;
 virtual bool getElementId(Id nDefine, Id nId, ResourceType& rOutResource, 
Id& rOutElement) = 0;
diff --git a/writerfilter/source/ooxml/factory_ns.py 
b/writerfilter/source/ooxml/factory_ns.py
index 1d9924e239c2..18b07aba1c62 100644
--- a/writerfilter/source/ooxml/factory_ns.py
+++ b/writerfilter/source/ooxml/factory_ns.py
@@ -37,7 +37,7 @@ public:
 
 virtual const AttributeInfo* getAttributeInfoArray(Id nId);
 virtual bool getElementId(Id nDefine, Id nId, ResourceType& rOutResource, 
Id& rOutElement);
-virtual bool getListValue(Id nId, const OUString& rValue, sal_uInt32& 
rOutValue);
+virtual bool getListValue(Id nId, std::string_view aValue, sal_uInt32& 
rOutValue);
 virtual Id getResourceId(Id nDefine, sal_Int32 nToken);
 """ % nsToken)
 
diff --git a/writerfilter/source/ooxml/factoryimpl_ns.py 
b/writerfilter/source/ooxml/factoryimpl_ns.py
index b17e0c8ffa97..263da3ebe9dc 100644
--- a/writerfilter/source/ooxml/factoryimpl_ns.py
+++ b/writerfilter/source/ooxml/factoryimpl_ns.py
@@ -223,13 +223,13 @@ def printValueData(values):
 if "" in values:
 output_else = ""
 for i in values[""]:
-print("%sif (rValue == \"%s\") { rOutValue = %s; return 
true; }" % (output_else, i[0], i[1]))
+print("%sif (aValue == \"%s\") { rOutValue = %s; return 
true; }" % (output_else, i[0], i[1]))
 output_else = "else "
-print("else switch (rValue[0])")
+print("

[Libreoffice-commits] core.git: include/sax include/svx include/tools include/vcl include/xmloff sax/source starmath/inc svx/source sw/inc sw/source vcl/inc vcl/source writerfilter/source xmloff/sourc

2022-06-09 Thread Noel Grandin (via logerrit)
 include/sax/tools/converter.hxx   |4 -
 include/svx/txencbox.hxx  |5 -
 include/tools/urlobj.hxx  |   31 ---
 include/vcl/metric.hxx|1 
 include/vcl/vectorgraphicdata.hxx |7 --
 include/xmloff/xmluconv.hxx   |5 -
 sax/source/tools/converter.cxx|   10 ---
 starmath/inc/ElementsDockingWindow.hxx|1 
 starmath/inc/visitors.hxx |9 ---
 svx/source/dialog/txencbox.cxx|7 --
 sw/inc/formatlinebreak.hxx|6 --
 sw/source/core/inc/unocontentcontrol.hxx  |2 
 sw/source/core/txtnode/attrlinebreak.cxx  |7 --
 sw/source/core/unocore/unocontentcontrol.cxx  |   59 --
 sw/source/filter/ww8/wrtww8.hxx   |4 -
 sw/source/uibase/inc/PageBreakWin.hxx |5 -
 vcl/inc/pdf/pdfwriter_impl.hxx|2 
 vcl/source/font/fontmetric.cxx|7 --
 vcl/source/gdi/vectorgraphicdata.cxx  |   23 +---
 vcl/source/treelist/iconviewimpl.cxx  |   14 -
 vcl/source/treelist/iconviewimpl.hxx  |2 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   41 ---
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |2 
 xmloff/source/core/xmluconv.cxx   |   59 --
 24 files changed, 3 insertions(+), 310 deletions(-)

New commits:
commit 485300f9aef53f63e24339422b1dd2bfa12d543e
Author: Noel Grandin 
AuthorDate: Wed Jun 8 20:04:28 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Jun 9 12:08:15 2022 +0200

loplugin:unusedmethods

Change-Id: Ib89ab59f7ad7e90b2a44ddd122176cde904fba4d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135520
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx
index c4391a7893fd..d797eace3042 100644
--- a/include/sax/tools/converter.hxx
+++ b/include/sax/tools/converter.hxx
@@ -218,10 +218,6 @@ public:
 static void convertDuration(OUStringBuffer& rBuffer,
 const css::util::Duration& rDuration);
 
-/** convert XMLSchema-2 "duration" string to double; negative durations 
allowed */
-static bool convertDuration(double & rfTime,
-std::u16string_view rString);
-
 /** convert XMLSchema-2 "duration" string to double; negative durations 
allowed */
 static bool convertDuration(double & rfTime,
 std::string_view rString);
diff --git a/include/svx/txencbox.hxx b/include/svx/txencbox.hxx
index d98c66713f99..c87f07b2ef41 100644
--- a/include/svx/txencbox.hxx
+++ b/include/svx/txencbox.hxx
@@ -73,11 +73,6 @@ public:
 bool bExcludeImportSubsets,
 sal_uInt32 nExcludeInfoFlags = 0);
 
-/** Fill with all known MIME encodings and select the best according to
-GetBestMimeEncoding
- */
-voidFillWithMimeAndSelectBest();
-
 voidInsertTextEncoding( const rtl_TextEncoding nEnc );
 
 voidInsertTextEncoding( const rtl_TextEncoding nEnc,
diff --git a/include/tools/urlobj.hxx b/include/tools/urlobj.hxx
index 6096e60df1b2..9d6820ddf241 100644
--- a/include/tools/urlobj.hxx
+++ b/include/tools/urlobj.hxx
@@ -806,28 +806,6 @@ public:
 Utf32
 };
 
-/** Encode some text as part of a URI.
-
-@param rText  Some text (for its interpretation, see the general
-discussion for set-methods).
-
-@param ePart  The part says which characters are 'forbidden' and must
-be encoded (replaced by escape sequences).  Characters outside the US-
-ASCII range are always 'forbidden.'
-
-@param eMechanism  See the general discussion for set-methods.
-
-@param eCharset  See the general discussion for set-methods.
-
-@return  The text, encoded according to the given mechanism and
-charset ('forbidden' characters replaced by escape sequences).
- */
-static void encode( OUStringBuffer& rOutputBuffer,
-   std::u16string_view rText, Part ePart,
-   EncodeMechanism eMechanism,
-   rtl_TextEncoding eCharset
-   = RTL_TEXTENCODING_UTF8);
-
 /** Encode some text as part of a URI.
 
 @param rText  Some text (for its interpretation, see the general
@@ -1310,15 +1288,6 @@ inline bool INetURLObject::SetMark(std::u16string_view 
rTheFragment,
setFragment(rTheFragment, eMechanism, eCharset);
 }
 
-// static
-inline void INetURLObject::encode(OUStringBuffer& rOutputBuffer,
-   std::u16string_view rText, Part ePart,
-

[Libreoffice-commits] core.git: include/sax sax/source

2022-05-27 Thread Noel Grandin (via logerrit)
 include/sax/fastattribs.hxx|4 ++--
 sax/source/fastparser/fastparser.cxx   |8 +---
 sax/source/fastparser/legacyfastparser.cxx |3 ++-
 sax/source/tools/fastattribs.cxx   |9 +
 4 files changed, 14 insertions(+), 10 deletions(-)

New commits:
commit d203d3aeb29a46bd85eb320d4ebcd7325ec4a1ab
Author: Noel Grandin 
AuthorDate: Fri May 27 10:25:58 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri May 27 12:55:23 2022 +0200

clang-tidy modernize-pass-by-value in sax

Change-Id: I0357c7e3f5ae1d0a560057ac756b1118917a5e11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135038
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 4ac958d882fc..57619b922518 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -43,8 +43,8 @@ struct UnknownAttribute
 OString maName;
 OString maValue;
 
-UnknownAttribute( const OUString& rNamespaceURL, const OString& rName, 
const OString& value );
-UnknownAttribute( const OString& rName, const OString& value );
+UnknownAttribute( OUString sNamespaceURL, OString aName, OString value );
+UnknownAttribute( OString sName, OString value );
 
 void FillAttribute( css::xml::Attribute* pAttrib ) const;
 };
diff --git a/sax/source/fastparser/fastparser.cxx 
b/sax/source/fastparser/fastparser.cxx
index 47f3da4a2ba6..250078bc5054 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -98,8 +99,8 @@ struct NameWithToken
 OUString msName;
 sal_Int32 mnToken;
 
-NameWithToken(const OUString& sName, sal_Int32 nToken) :
-msName(sName), mnToken(nToken) {}
+NameWithToken(OUString sName, sal_Int32 nToken) :
+msName(std::move(sName)), mnToken(nToken) {}
 };
 
 struct SaxContext
@@ -136,7 +137,8 @@ struct NamespaceDefine
 sal_Int32   mnToken;
 OUStringmaNamespaceURL;
 
-NamespaceDefine( const OString& rPrefix, sal_Int32 nToken, const OUString& 
rNamespaceURL ) : maPrefix( rPrefix ), mnToken( nToken ), maNamespaceURL( 
rNamespaceURL ) {}
+NamespaceDefine( OString aPrefix, sal_Int32 nToken, OUString aNamespaceURL 
)
+: maPrefix(std::move( aPrefix )), mnToken( nToken ), 
maNamespaceURL(std::move( aNamespaceURL )) {}
 NamespaceDefine() : mnToken(-1) {}
 };
 
diff --git a/sax/source/fastparser/legacyfastparser.cxx 
b/sax/source/fastparser/legacyfastparser.cxx
index d32b12d8a5f9..e4c425bd07d3 100644
--- a/sax/source/fastparser/legacyfastparser.cxx
+++ b/sax/source/fastparser/legacyfastparser.cxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 using namespace ::cppu;
@@ -46,7 +47,7 @@ private:
 OUStringm_aPrefix;
 OUStringm_aNamespaceURI;
 
-NamespaceDefine( const OUString& rPrefix, const OUString& 
rNamespaceURI ) : m_aPrefix( rPrefix ), m_aNamespaceURI( rNamespaceURI ) {}
+NamespaceDefine( OUString aPrefix, OUString aNamespaceURI ) : 
m_aPrefix(std::move( aPrefix )), m_aNamespaceURI(std::move( aNamespaceURI )) {}
 };
 std::vector< std::unique_ptr< NamespaceDefine > > m_aNamespaceDefines;
 
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index 1af7821cba24..9b309d5fb422 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::xml;
@@ -34,13 +35,13 @@ FastTokenHandlerBase::~FastTokenHandlerBase()
 {
 }
 
-UnknownAttribute::UnknownAttribute( const OUString& rNamespaceURL, const 
OString& rName, const OString& value )
-: maNamespaceURL( rNamespaceURL ), maName( rName ), maValue( value )
+UnknownAttribute::UnknownAttribute( OUString aNamespaceURL, OString aName, 
OString value )
+: maNamespaceURL(std::move( aNamespaceURL )), maName(std::move( aName )), 
maValue(std::move( value ))
 {
 }
 
-UnknownAttribute::UnknownAttribute( const OString& rName, const OString& value 
)
-: maName( rName ), maValue( value )
+UnknownAttribute::UnknownAttribute( OString aName, OString value )
+: maName(std::move( aName )), maValue(std::move( value ))
 {
 }
 


[Libreoffice-commits] core.git: include/sax sax/source sc/source sw/source xmloff/source

2022-04-20 Thread Noel Grandin (via logerrit)
 include/sax/tools/converter.hxx  |4 
 sax/source/tools/converter.cxx   |  165 ++-
 sc/source/filter/xml/SparklineGroupsImportContext.cxx|   45 ++--
 sc/source/filter/xml/XMLCalculationSettingsContext.cxx   |4 
 sc/source/filter/xml/XMLCellRangeSourceContext.cxx   |6 
 sc/source/filter/xml/XMLDetectiveContext.cxx |2 
 sc/source/filter/xml/XMLTableSourceContext.cxx   |2 
 sc/source/filter/xml/XMLTrackedChangesContext.cxx|4 
 sc/source/filter/xml/xmlcelli.cxx|4 
 sc/source/filter/xml/xmldpimp.cxx|4 
 sc/source/filter/xml/xmldrani.cxx|2 
 sc/source/filter/xml/xmlexternaltabi.cxx |4 
 sc/source/filter/xml/xmlsceni.cxx|2 
 sw/source/filter/xml/xmltbli.cxx |   10 
 xmloff/source/chart/SchXMLCalculationSettingsContext.cxx |2 
 xmloff/source/chart/SchXMLPlotAreaContext.cxx|2 
 xmloff/source/draw/animationimport.cxx   |   20 -
 xmloff/source/draw/animimp.cxx   |2 
 xmloff/source/draw/ximp3dscene.cxx   |4 
 xmloff/source/draw/ximpcustomshape.cxx   |   12 -
 xmloff/source/draw/ximpshap.cxx  |6 
 xmloff/source/draw/ximpshow.cxx  |2 
 xmloff/source/style/GradientStyle.cxx|4 
 xmloff/source/style/HatchStyle.cxx   |2 
 xmloff/source/style/xmlnumfi.cxx |2 
 xmloff/source/style/xmltabi.cxx  |4 
 xmloff/source/text/XMLTextFrameContext.cxx   |2 
 xmloff/source/text/XMLTextShapeImportHelper.cxx  |2 
 28 files changed, 244 insertions(+), 80 deletions(-)

New commits:
commit 8e4453c2117b6c3bb15be6b949a0a8a43df66647
Author: Noel Grandin 
AuthorDate: Wed Apr 20 09:14:08 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Apr 20 10:38:02 2022 +0200

use more FastAttributeIter::toView

Change-Id: I8a8ad5456fea349a45fca0aa468313cb04aa02f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133198
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx
index 6f330fa58400..f435244a9504 100644
--- a/include/sax/tools/converter.hxx
+++ b/include/sax/tools/converter.hxx
@@ -222,6 +222,10 @@ public:
 static bool convertDuration(css::util::Duration& rDuration,
 std::u16string_view rString);
 
+/** convert XMLSchema-2 "duration" string to util::Duration */
+static bool convertDuration(css::util::Duration& rDuration,
+std::string_view rString);
+
 /** convert util::Date to XMLSchema-2 "date" string */
 static void convertDate( OUStringBuffer& rBuffer,
 const css::util::Date& rDate,
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 6b6301bac0ff..b882ac076cd9 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -1216,8 +1216,9 @@ readUnsignedNumberMaxDigits(int maxDigits,
 return bOverflow ? R_OVERFLOW : R_SUCCESS;
 }
 
+template
 static bool
-readDurationT(std::u16string_view rString, size_t & io_rnPos)
+readDurationT(V rString, size_t & io_rnPos)
 {
 if ((io_rnPos < rString.size()) &&
 (rString[io_rnPos] == 'T' || rString[io_rnPos] == 't'))
@@ -1228,8 +1229,9 @@ readDurationT(std::u16string_view rString, size_t & 
io_rnPos)
 return false;
 }
 
+template
 static bool
-readDurationComponent(std::u16string_view rString,
+readDurationComponent(V rString,
 size_t & io_rnPos, sal_Int32 & io_rnTemp, bool & io_rbTimePart,
 sal_Int32 & o_rnTarget, const sal_Unicode cLower, const sal_Unicode cUpper)
 {
@@ -1418,6 +1420,165 @@ bool Converter::convertDuration(util::Duration& 
rDuration,
 return bSuccess;
 }
 
+/** convert ISO8601 "duration" string to util::Duration */
+bool Converter::convertDuration(util::Duration& rDuration,
+std::string_view rString)
+{
+std::string_view string = trim(rString);
+size_t nPos(0);
+
+bool bIsNegativeDuration(false);
+if (!string.empty() && ('-' == string[0]))
+{
+bIsNegativeDuration = true;
+++nPos;
+}
+
+if (nPos < string.size()
+&& string[nPos] != 'P' && string[nPos] != 'p') // duration must start 
with "P"
+{
+return false;
+}
+
+++nPos;
+
+/// last read number; -1 == no valid number! always reset after using!
+sal_Int32 nTemp(-1);
+bool bTimePart(false); // have we read 'T'?
+bool bSuccess(false);
+sal_Int32 nYears(0);
+sal_Int32 nMonths(0);
+sal_Int32 nDays(0);
+sal_Int32 nHours(0);
+sal_Int32 nMinutes(0);
+sal_Int32 nSeconds(0);
+

[Libreoffice-commits] core.git: include/sax oox/source sax/source

2022-03-12 Thread Mike Kaganski (via logerrit)
 include/sax/fastattribs.hxx|2 +
 oox/source/core/xmlfilterbase.cxx  |   24 +
 oox/source/drawingml/textfield.cxx |   19 +++--
 oox/source/export/chartexport.cxx  |9 ++--
 oox/source/export/drawingml.cxx|   37 +
 oox/source/export/vmlexport.cxx|   41 +
 sax/source/tools/fastattribs.cxx   |   12 ++
 7 files changed, 66 insertions(+), 78 deletions(-)

New commits:
commit de81df1f3f9b7660db450c638925f90adf9c026b
Author: Mike Kaganski 
AuthorDate: Sat Mar 12 18:52:17 2022 +0300
Commit: Mike Kaganski 
CommitDate: Sat Mar 12 19:44:26 2022 +0100

Introduce FastAttributeList::add(NS) taking std::u16string_view

... and simplify some places removing explicit conversions from
OUString to OString.

Change-Id: I4cdf9f3ee3101b3d00a0bbba53a983ed3bebce4f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131445
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 452280782067..4ac958d882fc 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -89,7 +89,9 @@ public:
 void add( sal_Int32 nToken, const char* pValue );
 void add( sal_Int32 nToken, const char* pValue, size_t nValueLength );
 void add( sal_Int32 nToken, const OString& rValue );
+void add( sal_Int32 nToken, std::u16string_view sValue ); // Converts to 
UTF-8
 void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, const OString& 
rValue );
+void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, 
std::u16string_view sValue );
 // note: rQName is *namespace-prefixed*
 void addUnknown( const OUString& rNamespaceURL, const OString& rQName, 
const OString& value );
 void addUnknown( const OString& rName, const OString& value );
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index fa9811f4e7fa..7c5fe9188b81 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -861,26 +861,24 @@ writeCustomProperties( XmlFilterBase& rSelf, const 
Reference< XDocumentPropertie
 {
 if ( !rProp.Name.isEmpty() )
 {
-// tdf#127864 - export custom document properties using utf8 text 
encoding
-OString aName = OUStringToOString(rProp.Name, 
RTL_TEXTENCODING_UTF8);
 // Skip storing these values in Custom Properties as it will be 
stored in Core/Extended Properties
-if (( aName == "OOXMLCorePropertyCategory" ) || // stored in 
cp:category
-( aName == "OOXMLCorePropertyContentStatus" ) || // stored in 
cp:contentStatus
-( aName == "OOXMLCorePropertyContentType" ) || // stored in 
cp:contentType
-( aName == "OOXMLCorePropertyIdentifier" ) || // stored in 
dc:identifier
-( aName == "OOXMLCorePropertyVersion" ) || // stored in 
cp:version
-( aName == "HyperlinkBase" ) || // stored in Extended File 
Properties
-( aName == "AppVersion" ) || // stored in Extended File 
Properties
-( aName == "DocSecurity" ) || // stored in Extended File 
Properties
-( aName == "Manager" ) || // stored in Extended File Properties
-( aName == "Company" )) // stored in Extended File Properties
+if (( rProp.Name == "OOXMLCorePropertyCategory" ) || // stored in 
cp:category
+( rProp.Name == "OOXMLCorePropertyContentStatus" ) || // 
stored in cp:contentStatus
+( rProp.Name == "OOXMLCorePropertyContentType" ) || // stored 
in cp:contentType
+( rProp.Name == "OOXMLCorePropertyIdentifier" ) || // stored 
in dc:identifier
+( rProp.Name == "OOXMLCorePropertyVersion" ) || // stored in 
cp:version
+( rProp.Name == "HyperlinkBase" ) || // stored in Extended 
File Properties
+( rProp.Name == "AppVersion" ) || // stored in Extended File 
Properties
+( rProp.Name == "DocSecurity" ) || // stored in Extended File 
Properties
+( rProp.Name == "Manager" ) || // stored in Extended File 
Properties
+( rProp.Name == "Company" )) // stored in Extended File 
Properties
 continue;
 
 // pid starts from 2 not from 1 as MS supports pid from 2
 pAppProps->startElement( XML_property ,
 XML_fmtid,  "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
 XML_pid,OString::number(nIndex + 2),
-XML_name,   aName);
+XML_name,   rProp.Name);
 
 switch ( rProp.Value.getValueTypeClass() )
 {
diff --git a/oox/source/drawingml/textfield.cxx 
b/oox/source/drawingml/textfield.cxx
index 405a874d8e57..4fc86776ad1f 100644
--- a/oox/source/drawingml/textfield.cxx
+++ 

[Libreoffice-commits] core.git: include/sax include/xmloff offapi/com sax/source starmath/source xmloff/source

2020-12-25 Thread dante (via logerrit)
 include/sax/fastparser.hxx  |3 +--
 include/xmloff/xmlimp.hxx   |3 +--
 offapi/com/sun/star/xml/sax/XFastParser.idl |4 +++-
 sax/source/fastparser/fastparser.cxx|   23 +++
 starmath/source/mathmlimport.cxx|6 ++
 starmath/source/xparsmlbase.cxx |   14 ++
 starmath/source/xparsmlbase.hxx |   11 +--
 xmloff/source/core/xmlimp.cxx   |5 ++---
 8 files changed, 35 insertions(+), 34 deletions(-)

New commits:
commit 9f6dfd50cb03b6511d4f711d284e1b75783d0b8b
Author: dante 
AuthorDate: Sat Dec 19 18:39:54 2020 +0100
Commit: Noel Grandin 
CommitDate: Sat Dec 26 08:21:58 2020 +0100

Improve handle of custom XML entities

Since 7.1 hasn't been released yet there's still time to change it before 
having to be scared about backguards compatibility.
This way:
 - It is more efficient than passing two arguments
 - On definition it is simpler since both are declarated on same point.
   So it is simpler to not loose sync between lists.
 - Code is less long.
 - Thanks to an idea proposed by Stephan Bergmann on other commit.

Change-Id: I16305a304c98eb8d4e11507c7938002da546778b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108028
Tested-by: Noel Grandin 
Reviewed-by: Noel Grandin 

diff --git a/include/sax/fastparser.hxx b/include/sax/fastparser.hxx
index 5af3ac1d1f57..aebaa4056aa0 100644
--- a/include/sax/fastparser.hxx
+++ b/include/sax/fastparser.hxx
@@ -64,8 +64,7 @@ public:
 virtual void SAL_CALL setEntityResolver( const css::uno::Reference< 
css::xml::sax::XEntityResolver >& Resolver ) override;
 virtual void SAL_CALL setLocale( const css::lang::Locale& rLocale ) 
override;
 virtual void SAL_CALL setNamespaceHandler( const css::uno::Reference< 
css::xml::sax::XFastNamespaceHandler >& Handler) override;
-virtual void SAL_CALL setCustomEntityNames( const ::css::uno::Sequence< 
::rtl::OUString >& names,
-const ::css::uno::Sequence< 
::rtl::OUString >& replacements )  override;
+virtual void SAL_CALL setCustomEntityNames( const ::css::uno::Sequence< 
::css::beans::Pair<::rtl::OUString, ::rtl::OUString> >& replacements )  
override;
 
 // XServiceInfo
 virtual OUString SAL_CALL getImplementationName(  ) override;
diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 9c402f199ffa..494de3cbcd26 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -335,8 +335,7 @@ public:
 virtual void SAL_CALL setEntityResolver( const css::uno::Reference< 
css::xml::sax::XEntityResolver >& Resolver ) override;
 virtual void SAL_CALL setLocale( const css::lang::Locale& rLocale ) 
override;
 virtual void SAL_CALL setNamespaceHandler( const css::uno::Reference< 
css::xml::sax::XFastNamespaceHandler >& Handler) override;
-virtual void SAL_CALL setCustomEntityNames( const ::css::uno::Sequence< 
::rtl::OUString >& names,
-const ::css::uno::Sequence< 
::rtl::OUString >& replacements )  override;
+virtual void SAL_CALL setCustomEntityNames( const ::css::uno::Sequence< 
::css::beans::Pair<::rtl::OUString, ::rtl::OUString> >& replacements )  
override;
 
 // XImporter
 virtual void SAL_CALL setTargetDocument( const css::uno::Reference< 
css::lang::XComponent >& xDoc ) override;
diff --git a/offapi/com/sun/star/xml/sax/XFastParser.idl 
b/offapi/com/sun/star/xml/sax/XFastParser.idl
index 9beefe4aa4d6..9d4439144b27 100644
--- a/offapi/com/sun/star/xml/sax/XFastParser.idl
+++ b/offapi/com/sun/star/xml/sax/XFastParser.idl
@@ -41,6 +41,8 @@
 
 #include 
 
+#include 
+
 
 module com {  module sun {  module star {  module xml {  module sax {
 
@@ -163,7 +165,7 @@ interface XFastParser: com::sun::star::uno::XInterface
   * Will allow to use customized entity references like  .
   * @since LibreOffice 7.1
   */
-void setCustomEntityNames( [in] sequence names, [in] 
sequence replacements);
+void setCustomEntityNames( [in] sequence< beans::Pair > 
replacements);
 };
 
 
diff --git a/sax/source/fastparser/fastparser.cxx 
b/sax/source/fastparser/fastparser.cxx
index 85726599b41c..9d13d25ce385 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -250,7 +250,8 @@ public:
 /// @throws css::uno::RuntimeException
 void setNamespaceHandler( const css::uno::Reference< 
css::xml::sax::XFastNamespaceHandler >& Handler);
 // Fake DTD file
-void setCustomEntityNames( const ::css::uno::Sequence< ::rtl::OUString >& 
names, const ::css::uno::Sequence< ::rtl::OUString >& replacements );
+void setCustomEntityNames(
+   const ::css::uno::Sequence<::css::beans::Pair<::rtl::OUString, 
::rtl::OUString>>& replacements);
 
 // called by the C callbacks of the expat parser
 void 

[Libreoffice-commits] core.git: include/sax include/xmloff sax/source xmloff/inc xmloff/source

2020-12-21 Thread Noel (via logerrit)
 include/sax/tools/converter.hxx |   21 +++
 include/xmloff/xmluconv.hxx |8 +
 sax/source/tools/converter.cxx  |  223 +++-
 xmloff/inc/txtfldi.hxx  |   78 ++---
 xmloff/inc/txtvfldi.hxx |   10 -
 xmloff/source/core/xmluconv.cxx |   24 +++-
 xmloff/source/text/txtfldi.cxx  |  162 ++---
 xmloff/source/text/txtvfldi.cxx |   40 +++
 8 files changed, 395 insertions(+), 171 deletions(-)

New commits:
commit db866805f3eee3a15bc96ffb5ba16aa77a02ddbd
Author: Noel 
AuthorDate: Mon Dec 21 12:34:48 2020 +0200
Commit: Noel Grandin 
CommitDate: Tue Dec 22 08:20:54 2020 +0100

use string_view in ProcessAttribute

Change-Id: I81feb01bf6823d1d8fb5a7da08490959484ef533
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108095
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx
index 07c2fb3207b1..0d3d68ba301c 100644
--- a/include/sax/tools/converter.hxx
+++ b/include/sax/tools/converter.hxx
@@ -206,6 +206,10 @@ public:
 static bool convertDuration(double & rfTime,
 std::u16string_view rString);
 
+/** convert XMLSchema-2 "duration" string to double; negative durations 
allowed */
+static bool convertDuration(double & rfTime,
+std::string_view rString);
+
 /** convert XMLSchema-2 "duration" string to util::Duration */
 static bool convertDuration(css::util::Duration& rDuration,
 std::u16string_view rString);
@@ -229,10 +233,18 @@ public:
 static bool parseDateTime( css::util::DateTime& rDateTime,
std::u16string_view rString );
 
+/** convert XMLSchema-2 "date" or "dateTime" string to util::DateTime */
+static bool parseDateTime( css::util::DateTime& rDateTime,
+   std::string_view rString );
+
 /** convert XMLSchema-2 "time" or "dateTime" string to util::DateTime */
 static bool parseTimeOrDateTime(css::util::DateTime& rDateTime,
  std::u16string_view rString);
 
+/** convert XMLSchema-2 "time" or "dateTime" string to util::DateTime */
+static bool parseTimeOrDateTime(css::util::DateTime& rDateTime,
+ std::string_view rString);
+
 /** convert XMLSchema-2 "date" or "dateTime" string to util::DateTime or
 util::Date */
 static bool parseDateOrDateTime(
@@ -242,6 +254,15 @@ public:
 std::optional * pTimeZoneOffset,
 std::u16string_view rString );
 
+/** convert XMLSchema-2 "date" or "dateTime" string to util::DateTime or
+util::Date */
+static bool parseDateOrDateTime(
+css::util::Date * pDate,
+css::util::DateTime & rDateTime,
+bool & rbDateTime,
+std::optional * pTimeZoneOffset,
+std::string_view rString );
+
 /** gets the position of the first comma after npos in the string
 rStr. Commas inside '"' pairs are not matched */
 static sal_Int32 indexOfComma( std::u16string_view rStr,
diff --git a/include/xmloff/xmluconv.hxx b/include/xmloff/xmluconv.hxx
index 87d2e883be36..a501221c16bb 100644
--- a/include/xmloff/xmluconv.hxx
+++ b/include/xmloff/xmluconv.hxx
@@ -228,6 +228,10 @@ public:
 bool convertDateTime(double& fDateTime,
  std::u16string_view rString);
 
+/** convert ISO Date Time String to double */
+bool convertDateTime(double& fDateTime,
+ std::string_view rString);
+
 /// these 2 functions use tools Date, so they're not yet moved to sax
 
 /** convert double to ISO Date Time String */
@@ -239,6 +243,10 @@ public:
 static bool convertDateTime( double& fDateTime,
 std::u16string_view rString,
 const css::util::Date& aNullDate);
+/** convert ISO Date Time String to double */
+static bool convertDateTime( double& fDateTime,
+std::string_view rString,
+const css::util::Date& aNullDate);
 
 
 /** convert string to ::basegfx::B3DVector */
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index a4a793c0392e..57cbceaaca7c 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -282,7 +282,7 @@ bool Converter::convertMeasure( sal_Int32& rValue,
 sal_Int32 nMin /* = SAL_MIN_INT32 */,
 sal_Int32 nMax /* = SAL_MAX_INT32 */ )
 {
-return lcl_convertMeasure(rValue, rString, 
nTargetUnit, nMin, nMax);
+return lcl_convertMeasure(rValue, rString, nTargetUnit, nMin, nMax);
 }
 
 /** convert string to measure using optional min and max values*/
@@ -292,7 +292,7 @@ 

[Libreoffice-commits] core.git: include/sax include/xmloff offapi/com sax/source xmloff/source

2020-11-29 Thread dante (via logerrit)
 include/sax/fastparser.hxx  |2 +
 include/xmloff/xmlimp.hxx   |2 +
 offapi/com/sun/star/xml/sax/XFastParser.idl |7 
 sax/source/fastparser/fastparser.cxx|   43 +++-
 xmloff/source/core/xmlimp.cxx   |5 +++
 5 files changed, 58 insertions(+), 1 deletion(-)

New commits:
commit f28c8085d14f65aa40da434c1d9d5ae60bfad862
Author: dante 
AuthorDate: Sat Nov 28 14:26:40 2020 +0100
Commit: Noel Grandin 
CommitDate: Sun Nov 29 19:53:20 2020 +0100

Preparing for mathml support of custom entity references.

This should be enough for the starmath mathml project.
It can be reused from other modules for doing custom stuff.
It keeps to minimum changes on generic modules.
My current abilities don't allow me to go much beyond this approach.

Change-Id: If7f157f8a71d6c3bff50fdbcd80bed23c92f40bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106804
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/sax/fastparser.hxx b/include/sax/fastparser.hxx
index a7f1e0c015f9..5af3ac1d1f57 100644
--- a/include/sax/fastparser.hxx
+++ b/include/sax/fastparser.hxx
@@ -64,6 +64,8 @@ public:
 virtual void SAL_CALL setEntityResolver( const css::uno::Reference< 
css::xml::sax::XEntityResolver >& Resolver ) override;
 virtual void SAL_CALL setLocale( const css::lang::Locale& rLocale ) 
override;
 virtual void SAL_CALL setNamespaceHandler( const css::uno::Reference< 
css::xml::sax::XFastNamespaceHandler >& Handler) override;
+virtual void SAL_CALL setCustomEntityNames( const ::css::uno::Sequence< 
::rtl::OUString >& names,
+const ::css::uno::Sequence< 
::rtl::OUString >& replacements )  override;
 
 // XServiceInfo
 virtual OUString SAL_CALL getImplementationName(  ) override;
diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 763e24ae6db9..73f35b90f631 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -335,6 +335,8 @@ public:
 virtual void SAL_CALL setEntityResolver( const css::uno::Reference< 
css::xml::sax::XEntityResolver >& Resolver ) override;
 virtual void SAL_CALL setLocale( const css::lang::Locale& rLocale ) 
override;
 virtual void SAL_CALL setNamespaceHandler( const css::uno::Reference< 
css::xml::sax::XFastNamespaceHandler >& Handler) override;
+virtual void SAL_CALL setCustomEntityNames( const ::css::uno::Sequence< 
::rtl::OUString >& names,
+const ::css::uno::Sequence< 
::rtl::OUString >& replacements )  override;
 
 // XImporter
 virtual void SAL_CALL setTargetDocument( const css::uno::Reference< 
css::lang::XComponent >& xDoc ) override;
diff --git a/offapi/com/sun/star/xml/sax/XFastParser.idl 
b/offapi/com/sun/star/xml/sax/XFastParser.idl
index 6ea4278a2c8d..e9081bbd6235 100644
--- a/offapi/com/sun/star/xml/sax/XFastParser.idl
+++ b/offapi/com/sun/star/xml/sax/XFastParser.idl
@@ -40,6 +40,7 @@
 #include 
 
 #include 
+//#include 
 
 
 module com {  module sun {  module star {  module xml {  module sax {
@@ -157,6 +158,12 @@ interface XFastParser: com::sun::star::uno::XInterface
 
 /** @since LibreOffice 5.3 */
 void setNamespaceHandler( [in] XFastNamespaceHandler Handler);
+
+/**
+  * Simulate a DTD file.
+  * Will allow to use customized entity references like  .
+  */
+void setCustomEntityNames( [in] sequence names, [in] 
sequence replacements);
 };
 
 
diff --git a/sax/source/fastparser/fastparser.cxx 
b/sax/source/fastparser/fastparser.cxx
index e7f21da8e658..a12bd23fc2d5 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -119,7 +119,6 @@ struct SaxContext
 }
 };
 
-
 struct ParserData
 {
 css::uno::Reference< css::xml::sax::XFastDocumentHandler > 
mxDocumentHandler;
@@ -211,6 +210,11 @@ public:
 explicit FastSaxParserImpl();
 ~FastSaxParserImpl();
 
+private:
+::css::uno::Sequence< ::rtl::OUString > mEntityNames;
+::css::uno::Sequence< ::rtl::OUString > mEntityReplacements;
+
+public:
 // XFastParser
 /// @throws css::xml::sax::SAXException
 /// @throws css::io::IOException
@@ -230,6 +234,8 @@ public:
 void setErrorHandler( const css::uno::Reference< 
css::xml::sax::XErrorHandler >& Handler );
 /// @throws css::uno::RuntimeException
 void setNamespaceHandler( const css::uno::Reference< 
css::xml::sax::XFastNamespaceHandler >& Handler);
+// Fake DTD file
+void setCustomEntityNames( const ::css::uno::Sequence< ::rtl::OUString >& 
names, const ::css::uno::Sequence< ::rtl::OUString >& replacements );
 
 // called by the C callbacks of the expat parser
 void callbackStartElement( const xmlChar *localName , const xmlChar* 
prefix, const xmlChar* URI,
@@ -237,6 +243,7 @@ public:
 void callbackEndElement();
 void callbackCharacters( 

[Libreoffice-commits] core.git: include/sax include/xmloff sax/source xmloff/source

2020-11-24 Thread Noel (via logerrit)
 include/sax/tools/converter.hxx  |   32 ++---
 include/xmloff/xmluconv.hxx  |8 -
 sax/source/tools/converter.cxx   |  112 ++-
 xmloff/source/chart/SchXMLPlotAreaContext.cxx|2 
 xmloff/source/chart/SchXMLPlotAreaContext.hxx|2 
 xmloff/source/core/xmluconv.cxx  |8 -
 xmloff/source/draw/ximpcustomshape.cxx   |4 
 xmloff/source/text/XMLChangedRegionImportContext.cxx |2 
 xmloff/source/text/XMLChangedRegionImportContext.hxx |2 
 xmloff/source/xforms/XFormsSubmissionContext.cxx |2 
 10 files changed, 94 insertions(+), 80 deletions(-)

New commits:
commit c8a2550b6a014c05cd4d0ad6a72122f79ce301af
Author: Noel 
AuthorDate: Tue Nov 24 14:33:13 2020 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 25 07:13:26 2020 +0100

use string_view for the parsing in sax utils

Change-Id: Ifd7430501318684fc90dd36c1ca965373947
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106499
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx
index e5e6d5764d0f..6d2347ef289d 100644
--- a/include/sax/tools/converter.hxx
+++ b/include/sax/tools/converter.hxx
@@ -59,7 +59,7 @@ class SAX_DLLPUBLIC Converter
 public:
 /** convert string to measure using optional min and max values*/
 static bool convertMeasure( sal_Int32& rValue,
-const OUString& rString,
+std::u16string_view rString,
 sal_Int16 nTargetUnit = 
css::util::MeasureUnit::MM_100TH,
 sal_Int32 nMin = SAL_MIN_INT32,
 sal_Int32 nMax = SAL_MAX_INT32 );
@@ -72,7 +72,7 @@ public:
 
 /** convert string to boolean */
 static bool convertBool( bool& rBool,
- const OUString& rString );
+ std::u16string_view rString );
 
 /** convert boolean to string */
 static void convertBool( OUStringBuffer& rBuffer,
@@ -80,7 +80,7 @@ public:
 
 /** convert string to percent */
 static bool convertPercent( sal_Int32& rValue,
-const OUString& rString );
+std::u16string_view rString );
 
 /** convert percent to string */
 static void convertPercent( OUStringBuffer& rBuffer,
@@ -88,7 +88,7 @@ public:
 
 /** convert string to pixel measure unite */
 static bool convertMeasurePx( sal_Int32& rValue,
-  const OUString& rString );
+  std::u16string_view rString );
 
 /** convert pixel measure unit to string */
 static void convertMeasurePx( OUStringBuffer& rBuffer,
@@ -96,9 +96,9 @@ public:
 
 /** convert string to rgb color */
 static bool convertColor( sal_Int32& rColor,
-  const OUString );
+  std::u16string_view rValue );
 static bool convertColor( ::Color& rColor,
-  const OUString )
+  std::u16string_view rValue )
 {
 sal_Int32 n(rColor);
 bool b = convertColor( n, rValue );
@@ -139,19 +139,19 @@ public:
 /** convert string to double number (using ::rtl::math) and DO convert from
 source unit to target unit. */
 static bool convertDouble(  double& rValue,
-const OUString& rString,
+std::u16string_view rString,
 sal_Int16 nSourceUnit,
 sal_Int16 nTargetUnit );
 
 /** convert string to double number (using ::rtl::math) without unit 
conversion */
-static bool convertDouble(double& rValue, const OUString& rString);
+static bool convertDouble(double& rValue, std::u16string_view rString);
 
 /** convert number, 10th of degrees with range [0..3600] to SVG angle */
 static void convertAngle(OUStringBuffer& rBuffer, sal_Int16 nAngle,
 SvtSaveOptions::ODFSaneDefaultVersion nVersion);
 
 /** convert SVG angle to number, 10th of degrees with range [0..3600] */
-static bool convertAngle(sal_Int16& rAngle, OUString const& rString,
+static bool convertAngle(sal_Int16& rAngle, std::u16string_view rString,
 bool isWrongOOo10thDegAngle);
 
 /** convert double to XMLSchema-2 "duration" string; negative durations 
allowed */
@@ -164,11 +164,11 @@ public:
 
 /** convert XMLSchema-2 "duration" string to double; negative durations 
allowed */
 static bool convertDuration(double & rfTime,
-const OUString& rString);
+std::u16string_view rString);
 
 /** convert XMLSchema-2 "duration" string to util::Duration */
 static bool 

[Libreoffice-commits] core.git: include/sax sax/source xmloff/source

2020-11-16 Thread Noel (via logerrit)
 include/sax/fastattribs.hxx   |6 +-
 sax/source/tools/fastattribs.cxx  |4 
 xmloff/source/forms/elementimport.cxx |7 ++-
 3 files changed, 11 insertions(+), 6 deletions(-)

New commits:
commit d52f83c7dbeba243aa9cb0f8f129df2fe543a7d3
Author: Noel 
AuthorDate: Mon Nov 16 15:18:15 2020 +0200
Commit: Noel Grandin 
CommitDate: Mon Nov 16 18:07:50 2020 +0100

tdf#138144 Form wizard fails to save

fallout from
commit 3de38e95561ab7ca114d9f3307702ba89c4e3e9a
Date:   Tue Nov 10 19:20:06 2020 +0200
use fastparser in forms

Change-Id: I4691786525132ef0cf98b6b177a2c022c4d7d032
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105932
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index a9bb67e62841..e00452b0aa14 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -69,7 +70,7 @@ class SAX_DLLPUBLIC FastTokenHandlerBase :
 };
 
 
-class SAX_DLLPUBLIC FastAttributeList final : public cppu::WeakImplHelper< 
css::xml::sax::XFastAttributeList >
+class SAX_DLLPUBLIC FastAttributeList final : public cppu::WeakImplHelper< 
css::xml::sax::XFastAttributeList, css::util::XCloneable >
 {
 public:
 FastAttributeList( FastTokenHandlerBase *pTokenHandler );
@@ -113,6 +114,9 @@ public:
 virtual css::uno::Sequence< css::xml::Attribute > SAL_CALL 
getUnknownAttributes(  ) override;
 virtual css::uno::Sequence< css::xml::FastAttribute > SAL_CALL 
getFastAttributes() override;
 
+// XCloneable
+virtual ::css::uno::Reference< ::css::util::XCloneable > SAL_CALL 
createClone() override;
+
 sal_Int32 getAttributeIndex( ::sal_Int32 Token )
 {
 for (size_t i=0; i FastAttributeList::createClone()
+{
+return new FastAttributeList(this);
+}
 
 FastAttributeList::~FastAttributeList()
 {
diff --git a/xmloff/source/forms/elementimport.cxx 
b/xmloff/source/forms/elementimport.cxx
index 3ebd9b765a95..1fac083e463c 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -1763,11 +1763,8 @@ namespace xmloff
 OSL_ENSURE(!m_xOwnAttributes.is(), 
"OColumnWrapperImport::StartElement: already have the cloned list!");
 
 // clone the attributes
-Reference< XCloneable > xCloneList(_rxAttrList, UNO_QUERY);
-OSL_ENSURE(xCloneList.is(), "OColumnWrapperImport::StartElement: 
AttributeList not clonable!");
-if ( xCloneList.is() )
-m_xOwnAttributes.set(xCloneList->createClone(), UNO_QUERY);
-OSL_ENSURE(m_xOwnAttributes.is(), "OColumnWrapperImport::StartElement: 
no cloned list!");
+Reference< XCloneable > xCloneList(_rxAttrList, UNO_QUERY_THROW);
+m_xOwnAttributes.set(xCloneList->createClone(), UNO_QUERY_THROW);
 }
 
 OControlImport* OColumnWrapperImport::implCreateChildContext(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/sax include/xmloff sax/source xmloff/source

2020-11-10 Thread Noel Grandin (via logerrit)
 include/sax/fastattribs.hxx |4 
 include/xmloff/formlayerimport.hxx  |8 
 include/xmloff/xformsimport.hxx |2 
 include/xmloff/xmltoken.hxx |   23 +
 sax/source/tools/fastattribs.cxx|   29 +
 xmloff/source/core/xmltoken.cxx |   23 +
 xmloff/source/forms/controlelement.cxx  |   31 +
 xmloff/source/forms/controlelement.hxx  |9 
 xmloff/source/forms/elementimport.cxx   |  589 ++--
 xmloff/source/forms/elementimport.hxx   |  202 -
 xmloff/source/forms/eventimport.cxx |4 
 xmloff/source/forms/eventimport.hxx |2 
 xmloff/source/forms/formattributes.cxx  |  170 +++-
 xmloff/source/forms/formattributes.hxx  |   56 +-
 xmloff/source/forms/formlayerimport.cxx |   18 
 xmloff/source/forms/layerimport.cxx |  125 ++---
 xmloff/source/forms/layerimport.hxx |9 
 xmloff/source/forms/officeforms.cxx |   24 -
 xmloff/source/forms/officeforms.hxx |   14 
 xmloff/source/forms/property_meta_data.cxx  |9 
 xmloff/source/forms/property_meta_data.hxx  |4 
 xmloff/source/forms/propertyimport.cxx  |   53 +-
 xmloff/source/forms/propertyimport.hxx  |   25 -
 xmloff/source/token/tokens.txt  |   23 +
 xmloff/source/xforms/TokenContext.cxx   |9 
 xmloff/source/xforms/TokenContext.hxx   |3 
 xmloff/source/xforms/XFormsModelContext.cxx |6 
 xmloff/source/xforms/XFormsModelContext.hxx |1 
 xmloff/source/xforms/xformsimport.cxx   |6 
 29 files changed, 927 insertions(+), 554 deletions(-)

New commits:
commit 3de38e95561ab7ca114d9f3307702ba89c4e3e9a
Author: Noel Grandin 
AuthorDate: Tue Nov 10 19:20:06 2020 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 11 06:33:53 2020 +0100

use fastparser in forms

Change-Id: I7d09d64857e24267b4b4baddb563e28ceea92f2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105560
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 8b8138d82e9b..a9bb67e62841 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -73,6 +73,7 @@ class SAX_DLLPUBLIC FastAttributeList final : public 
cppu::WeakImplHelper< css::
 {
 public:
 FastAttributeList( FastTokenHandlerBase *pTokenHandler );
+FastAttributeList( const css::uno::Reference< 
css::xml::sax::XFastAttributeList > & xAttrList );
 virtual ~FastAttributeList() override;
 
 void clear();
@@ -81,6 +82,8 @@ public:
 maAttributeValues.reserve(nNumTokens+1);
 maAttributeTokens.reserve(nNumTokens);
 }
+void add( const FastAttributeList& );
+void add( const css::uno::Reference& );
 void add( sal_Int32 nToken, const char* pValue );
 void add( sal_Int32 nToken, const char* pValue, size_t nValueLength );
 void add( sal_Int32 nToken, const OString& rValue );
@@ -91,6 +94,7 @@ public:
 const std::vector< sal_Int32 >&  getFastAttributeTokens() const { return 
maAttributeTokens; }
 const char* getFastAttributeValue(size_t nIndex) const { return mpChunk + 
maAttributeValues[nIndex]; }
 sal_Int32 AttributeValueLength(size_t i) const { return 
maAttributeValues[i + 1] - maAttributeValues[i] - 1; }
+size_t size() const { return maAttributeValues.size(); }
 
 // performance sensitive shortcuts to avoid allocation ...
 bool getAsInteger( sal_Int32 nToken, sal_Int32 ) const;
diff --git a/include/xmloff/formlayerimport.hxx 
b/include/xmloff/formlayerimport.hxx
index 4834f85d19d9..d9797f0757ec 100644
--- a/include/xmloff/formlayerimport.hxx
+++ b/include/xmloff/formlayerimport.hxx
@@ -29,6 +29,7 @@
 namespace com::sun::star::beans { class XPropertySet; }
 namespace com::sun::star::drawing { class XDrawPage; }
 namespace com::sun::star::xml::sax { class XAttributeList; }
+namespace com::sun::star::xml::sax { class XFastAttributeList; }
 
 class SvXMLImport;
 class SvXMLImportContext;
@@ -68,6 +69,8 @@ namespace xmloff
 SvXMLImport& _rImport,
 sal_uInt16 _nPrefix,
 const OUString& _rLocalName);
+static SvXMLImportContext* createOfficeFormsContext(
+SvXMLImport& _rImport);
 
 /** create an SvXMLImportContext instance which is able to import the 
form:form
 element.
@@ -78,9 +81,8 @@ namespace xmloff
 @see endPage
 */
 SvXMLImportContext* createContext(
-const sal_uInt16 _nPrefix,
-const OUString& _rLocalName,
-const css::uno::Reference< css::xml::sax::XAttributeList >& 
_rxAttribs);
+const sal_Int32 _nElement,
+const css::uno::Reference< css::xml::sax::XFastAttributeList >& 
_rxAttribs);
 
 /** lookup a control given by id.
 
diff --git a/include/xmloff/xformsimport.hxx b/include/xmloff/xformsimport.hxx
index b580af57608b..b6b86044ce1b 100644
--- 

[Libreoffice-commits] core.git: include/sax

2020-07-08 Thread Andrea Gelmini (via logerrit)
 include/sax/fshelper.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0eff4285eff1a5b6a220067adf605fbaaed2ccfe
Author: Andrea Gelmini 
AuthorDate: Tue Jul 7 20:36:43 2020 +0200
Commit: Julien Nabet 
CommitDate: Wed Jul 8 09:21:50 2020 +0200

Fix typo

Change-Id: Ib6c49ad6f8ec29e5ef49a46d4352fd58b182f75a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98296
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index e4b5072345e2..f5d92eed1c50 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -161,7 +161,7 @@ private:
 
 typedef std::shared_ptr< FastSerializerHelper > FSHelperPtr;
 
-// Helpers to make intention to pass optional attributes to *Element finctions 
explicit, instead of
+// Helpers to make intention to pass optional attributes to *Element functions 
explicit, instead of
 // using `(condition) ? value.toUtf8().getStr() : nullptr` syntax.
 inline const char* UseIf(const char* s, bool bUse) { return bUse ? s : 
nullptr; }
 // OString, OUString
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/sax oox/source sc/source sd/source

2020-07-07 Thread Mike Kaganski (via logerrit)
 include/sax/fshelper.hxx  |   41 -
 oox/source/export/drawingml.cxx   |   56 +++---
 oox/source/export/shapes.cxx  |8 ++--
 sc/source/filter/excel/xecontent.cxx  |   15 +++-
 sc/source/filter/excel/xeescher.cxx   |8 ++--
 sc/source/filter/excel/xeextlst.cxx   |4 +-
 sc/source/filter/excel/xestyle.cxx|4 +-
 sd/source/filter/eppt/pptx-animations.cxx |   38 ++--
 sd/source/filter/eppt/pptx-epptooxml.cxx  |8 ++--
 9 files changed, 101 insertions(+), 81 deletions(-)

New commits:
commit b7ed6de51422ca7bc8333e80ae6e9a4d57e07239
Author: Mike Kaganski 
AuthorDate: Mon Jul 6 02:08:33 2020 +0300
Commit: Mike Kaganski 
CommitDate: Tue Jul 7 12:21:27 2020 +0200

Use std::optional to allow optional inclusion of attributes

... instead of converting the O(U)String objects to char*.
Eventually this could allow to drop variants of *Element that take
XFastAttributeListRef.

Change-Id: Ib2748fcd93e655c55a176c00410fdcc7f052930d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98179
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index 235181bf9846..e4b5072345e2 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -58,16 +59,21 @@ public:
 startElement(elementTokenId, std::forward(args)...);
 }
 template
-void startElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
OString& value, Args &&... args)
+void startElement(sal_Int32 elementTokenId, sal_Int32 attribute,
+  const std::optional& value, Args&&... args)
 {
-pushAttributeValue(attribute, value);
+if (value)
+pushAttributeValue(attribute, *value);
 startElement(elementTokenId, std::forward(args)...);
 }
 template
-void startElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
OUString& value, Args&&... args)
+void startElement(sal_Int32 elementTokenId, sal_Int32 attribute,
+  const std::optional& value, Args&&... args)
 {
-// The temporary created by toUtf8() must stay alive until 
startElement() ends using it
-startElement(elementTokenId, attribute, value.toUtf8(), 
std::forward(args)...);
+std::optional opt;
+if (value)
+opt = value->toUtf8();
+startElement(elementTokenId, attribute, opt, 
std::forward(args)...);
 }
 void startElement(sal_Int32 elementTokenId);
 
@@ -87,16 +93,21 @@ public:
 singleElement(elementTokenId, std::forward(args)...);
 }
 template
-void singleElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
OString& value, Args &&... args)
+void singleElement(sal_Int32 elementTokenId, sal_Int32 attribute,
+   const std::optional& value, Args&&... args)
 {
-pushAttributeValue(attribute, value);
+if (value)
+pushAttributeValue(attribute, *value);
 singleElement(elementTokenId, std::forward(args)...);
 }
 template
-void singleElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
OUString& value, Args&&... args)
+void singleElement(sal_Int32 elementTokenId, sal_Int32 attribute,
+   const std::optional& value, Args&&... args)
 {
-// The temporary created by toUtf8() must stay alive until 
singleElement() ends using it
-singleElement(elementTokenId, attribute, value.toUtf8(), 
std::forward(args)...);
+std::optional opt;
+if (value)
+opt = value->toUtf8();
+singleElement(elementTokenId, attribute, opt, 
std::forward(args)...);
 }
 void singleElement(sal_Int32 elementTokenId);
 
@@ -150,6 +161,16 @@ private:
 
 typedef std::shared_ptr< FastSerializerHelper > FSHelperPtr;
 
+// Helpers to make intention to pass optional attributes to *Element finctions 
explicit, instead of
+// using `(condition) ? value.toUtf8().getStr() : nullptr` syntax.
+inline const char* UseIf(const char* s, bool bUse) { return bUse ? s : 
nullptr; }
+// OString, OUString
+template
+std::optional UseIf(const TString& s, bool bUse)
+{
+return bUse ? std::optional(s) : std::optional();
+}
+
 }
 
 #endif // INCLUDED_SAX_FSHELPER_HXX
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 1d52bef4b25c..052ea8f93090 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -860,8 +860,8 @@ void DrawingML::WriteOutline( const 
Reference& rXPropSet, Referenc
 nEmuLineWidth = oox::drawingml::convertHmmToEmu(nLineWidth);
 mpFS->startElementNS( XML_a, XML_ln,
   XML_cap, cap,
-  XML_w, nLineWidth == 0 || (nLineWidth > 1 && 

[Libreoffice-commits] core.git: include/sax oox/source

2020-07-05 Thread Mike Kaganski (via logerrit)
 include/sax/fshelper.hxx |   13 +
 oox/source/export/shapes.cxx |   24 
 2 files changed, 25 insertions(+), 12 deletions(-)

New commits:
commit 57afeb8d9e35933630568a02fc48a00f5582b261
Author: Mike Kaganski 
AuthorDate: Sun Jul 5 17:20:49 2020 +0300
Commit: Mike Kaganski 
CommitDate: Sun Jul 5 22:14:12 2020 +0200

Allow use OUString as attribute value in FastSerializerHelper::*Element

Change-Id: Id34d08787d0188d5c7847dcb75958a511a1fef27
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98143
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index b38689a5927f..235181bf9846 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -62,6 +63,12 @@ public:
 pushAttributeValue(attribute, value);
 startElement(elementTokenId, std::forward(args)...);
 }
+template
+void startElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
OUString& value, Args&&... args)
+{
+// The temporary created by toUtf8() must stay alive until 
startElement() ends using it
+startElement(elementTokenId, attribute, value.toUtf8(), 
std::forward(args)...);
+}
 void startElement(sal_Int32 elementTokenId);
 
 /// Start an element. After the first two arguments there can be a number 
of (attribute, value) pairs.
@@ -85,6 +92,12 @@ public:
 pushAttributeValue(attribute, value);
 singleElement(elementTokenId, std::forward(args)...);
 }
+template
+void singleElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
OUString& value, Args&&... args)
+{
+// The temporary created by toUtf8() must stay alive until 
singleElement() ends using it
+singleElement(elementTokenId, attribute, value.toUtf8(), 
std::forward(args)...);
+}
 void singleElement(sal_Int32 elementTokenId);
 
 /// Create a single element. After the first two arguments there can be a 
number of (attribute, value) pairs.
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 3ea0ae57ba6b..eb5eedff1d89 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -414,7 +414,7 @@ ShapeExport& ShapeExport::WritePolyPolygonShape( const 
Reference< XShape >& xSha
 pFS->startElementNS(mnXmlNamespace, XML_nvSpPr);
 pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
   XML_id, OString::number(GetNewShapeID(xShape)),
-  XML_name, GetShapeName(xShape).toUtf8());
+  XML_name, GetShapeName(xShape));
 }
 pFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr);
 if (GetDocumentType() != DOCUMENT_DOCX)
@@ -475,7 +475,7 @@ ShapeExport& ShapeExport::WriteGroupShape(const 
uno::Reference&
 pFS->startElementNS(mnXmlNamespace, XML_nvGrpSpPr);
 pFS->singleElementNS(mnXmlNamespace, XML_cNvPr,
 XML_id, OString::number(GetNewShapeID(xShape)),
-XML_name, GetShapeName(xShape).toUtf8());
+XML_name, GetShapeName(xShape));
 pFS->singleElementNS(mnXmlNamespace, XML_cNvGrpSpPr);
 WriteNonVisualProperties(xShape );
 pFS->endElementNS(mnXmlNamespace, XML_nvGrpSpPr);
@@ -801,7 +801,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 pFS->startElementNS( mnXmlNamespace, XML_nvSpPr );
 pFS->startElementNS( mnXmlNamespace, XML_cNvPr,
 XML_id, OString::number(GetNewShapeID(xShape)),
-XML_name, GetShapeName(xShape).toUtf8(),
+XML_name, GetShapeName(xShape),
 XML_hidden, isVisible ? nullptr : "1" );
 
 if( GETA( URL ) )
@@ -1049,7 +1049,7 @@ ShapeExport& ShapeExport::WriteEllipseShape( const 
Reference< XShape >& xShape )
 pFS->startElementNS(mnXmlNamespace, XML_nvSpPr);
 pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
 XML_id, OString::number(GetNewShapeID(xShape)),
-XML_name, GetShapeName(xShape).toUtf8());
+XML_name, GetShapeName(xShape));
 pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr );
 WriteNonVisualProperties( xShape );
 pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
@@ -1193,7 +1193,7 @@ void ShapeExport::WriteGraphicObjectShapePart( const 
Reference< XShape >& xShape
 
 pFS->startElementNS( mnXmlNamespace, XML_cNvPr,
   XML_id, OString::number(GetNewShapeID(xShape)),
-  XML_name,   GetShapeName(xShape).toUtf8(),
+  XML_name,   GetShapeName(xShape),
   XML_descr,  bHaveDesc ? sDescr.toUtf8().getStr() : 
nullptr );
 
 // OOXTODO: //cNvPr children: XML_extLst, XML_hlinkHover
@@ -1337,7 

[Libreoffice-commits] core.git: include/sax

2020-07-05 Thread Mike Kaganski (via logerrit)
 include/sax/fshelper.hxx |   32 
 1 file changed, 4 insertions(+), 28 deletions(-)

New commits:
commit 01c58c7d6da0a5671460ba4c0e23a2a04d2eb87e
Author: Mike Kaganski 
AuthorDate: Sat Jul 4 13:07:19 2020 +0300
Commit: Mike Kaganski 
CommitDate: Sun Jul 5 22:00:56 2020 +0200

Simplify FastSerializerHelper::*ElementNS to just call corresponding 
*Element

Change-Id: Idd7ab4961fe5e4871ea5b64e7d837f98743eb301
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97954
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index 7c1f9a2ea1af..b38689a5927f 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -66,21 +66,9 @@ public:
 
 /// Start an element. After the first two arguments there can be a number 
of (attribute, value) pairs.
 template
-void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
sal_Int32 attribute, const char* value, Args &&... args)
+void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
Args &&... args)
 {
-if (value)
-pushAttributeValue(attribute, value);
-startElementNS(namespaceTokenId, elementTokenId, 
std::forward(args)...);
-}
-template
-void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
sal_Int32 attribute, const OString& value, Args &&... args)
-{
-pushAttributeValue(attribute, value);
-startElementNS(namespaceTokenId, elementTokenId, 
std::forward(args)...);
-}
-void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId)
-{
-startElement(FSNS(namespaceTokenId, elementTokenId));
+startElement(FSNS(namespaceTokenId, elementTokenId), 
std::forward(args)...);
 }
 
 /// Create a single element. After the first argument there can be a 
number of (attribute, value) pairs.
@@ -101,21 +89,9 @@ public:
 
 /// Create a single element. After the first two arguments there can be a 
number of (attribute, value) pairs.
 template
-void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
sal_Int32 attribute, const char* value, Args &&... args)
-{
-if (value)
-pushAttributeValue(attribute, value);
-singleElementNS(namespaceTokenId, elementTokenId, 
std::forward(args)...);
-}
-template
-void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
sal_Int32 attribute, const OString& value, Args &&... args)
-{
-pushAttributeValue(attribute, value);
-singleElementNS(namespaceTokenId, elementTokenId, 
std::forward(args)...);
-}
-void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId)
+void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
Args &&... args)
 {
-singleElement(FSNS(namespaceTokenId, elementTokenId));
+singleElement(FSNS(namespaceTokenId, elementTokenId), 
std::forward(args)...);
 }
 
 void endElement(sal_Int32 elementTokenId);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/sax sax/source xmloff/source

2020-05-19 Thread Michael Stahl (via logerrit)
 include/sax/tools/converter.hxx|7 -
 sax/source/tools/converter.cxx |   35 +++--
 xmloff/source/style/GradientStyle.cxx  |   11 +++--
 xmloff/source/style/TransGradientStyle.cxx |   11 +++--
 4 files changed, 46 insertions(+), 18 deletions(-)

New commits:
commit 693cefb59286daf6ff86f1db16f0d64b4b9b4588
Author: Michael Stahl 
AuthorDate: Mon May 18 18:43:51 2020 +0200
Commit: Michael Stahl 
CommitDate: Tue May 19 17:04:33 2020 +0200

tdf#89475 xmloff: ODF import/export: continue fixing draw:angle

Continue what commit aadda5d17f6e422da143ea774f759bfc5f629c5b
started wrt. unit-less draw:angle attributes in ODF >= 1.2:

* ODF 1.3 files don't ever have unit-less draw:angle interpreted as
  10th of degree

* import unit-less draw:angle as degree, except if it's ODF 1.0/1.1 or
  it's ODF 1.2 written by OOo/LO < 7.0, then 10th of degree

* export draw:angle with "deg", which LO 4.4 and newer can read; except
  if exporting ODF 1.0/1.1 or ODF 1.2 Extended (compatibility mode),
  then 10th of degree (unit-less)

The only problem with this is that if you store a file as ODF 1.2
Extended (compatibility mode) and load it with LO 7.0 it will interpret
the angle wrong, but nothing's perfect...

Change-Id: I3771e6571afd40e44b6f7890dacf18c28841610f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94443
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx
index 9f7f5b3df50f..e5e6d5764d0f 100644
--- a/include/sax/tools/converter.hxx
+++ b/include/sax/tools/converter.hxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace com::sun::star {
 namespace uno {
@@ -146,10 +147,12 @@ public:
 static bool convertDouble(double& rValue, const OUString& rString);
 
 /** convert number, 10th of degrees with range [0..3600] to SVG angle */
-static void convertAngle(OUStringBuffer& rBuffer, sal_Int16 nAngle);
+static void convertAngle(OUStringBuffer& rBuffer, sal_Int16 nAngle,
+SvtSaveOptions::ODFSaneDefaultVersion nVersion);
 
 /** convert SVG angle to number, 10th of degrees with range [0..3600] */
-static bool convertAngle(sal_Int16& rAngle, OUString const& rString);
+static bool convertAngle(sal_Int16& rAngle, OUString const& rString,
+bool isWrongOOo10thDegAngle);
 
 /** convert double to XMLSchema-2 "duration" string; negative durations 
allowed */
 static void convertDuration(OUStringBuffer& rBuffer,
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 9c19ef5d0b7d..ac6eba928526 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -623,21 +623,25 @@ bool Converter::convertDouble(double& rValue, const 
OUString& rString)
 }
 
 /** convert number, 10th of degrees with range [0..3600] to SVG angle */
-void Converter::convertAngle(OUStringBuffer& rBuffer, sal_Int16 const nAngle)
+void Converter::convertAngle(OUStringBuffer& rBuffer, sal_Int16 const nAngle,
+SvtSaveOptions::ODFSaneDefaultVersion const nVersion)
 {
-#if 1
-// wrong, but backward compatible with OOo/LO < 4.4
-rBuffer.append(static_cast(nAngle));
-#else
-// maybe in the future... (see other convertAngle)
-double fAngle(double(nAngle) / 10.0);
-::sax::Converter::convertDouble(rBuffer, fAngle);
-rBuffer.append("deg");
-#endif
+if (nVersion < SvtSaveOptions::ODFSVER_012 || nVersion == 
SvtSaveOptions::ODFSVER_012_EXT_COMPAT)
+{
+// wrong, but backward compatible with OOo/LO < 4.4
+rBuffer.append(static_cast(nAngle));
+}
+else
+{ // OFFICE-3774 tdf#89475 write valid ODF 1.2 angle; needs LO 4.4 to 
import
+double fAngle(double(nAngle) / 10.0);
+::sax::Converter::convertDouble(rBuffer, fAngle);
+rBuffer.append("deg");
+}
 }
 
 /** convert SVG angle to number, 10th of degrees with range [0..3600] */
-bool Converter::convertAngle(sal_Int16& rAngle, OUString const& rString)
+bool Converter::convertAngle(sal_Int16& rAngle, OUString const& rString,
+bool const isWrongOOo10thDegAngle)
 {
 // ODF 1.1 leaves it undefined what the number means, but ODF 1.2 says it's
 // degrees, while OOo has historically used 10th of degrees :(
@@ -662,7 +666,14 @@ bool Converter::convertAngle(sal_Int16& rAngle, OUString 
const& rString)
 }
 else // no explicit unit
 {
-nValue = fValue; // wrong, but backward compatible with OOo/LO < 4.4
+if (isWrongOOo10thDegAngle)
+{
+nValue = fValue; // wrong, but backward compatible with OOo/LO < 
7.0
+}
+else
+{
+nValue = fValue * 10.0; // ODF 1.2
+}
 }
 // limit to valid range [0..3600]
 nValue = nValue % 3600;
diff --git a/xmloff/source/style/GradientStyle.cxx 

[Libreoffice-commits] core.git: include/sax remotebridges/source reportdesign/inc reportdesign/source sal/osl sal/qa sal/rtl sal/textenc sax/source sax/test

2019-12-19 Thread Noel Grandin (via logerrit)
 include/sax/fastattribs.hxx  |6 
 remotebridges/source/unourl_resolver/unourl_resolver.cxx |2 
 reportdesign/inc/ReportDefinition.hxx|6 
 reportdesign/inc/conditionalexpression.hxx   |2 
 reportdesign/source/core/api/ReportDefinition.cxx|6 
 reportdesign/source/core/misc/conditionalexpression.cxx  |2 
 reportdesign/source/filter/xml/xmlfilter.cxx |4 
 reportdesign/source/ui/inspection/DefaultInspection.cxx  |2 
 reportdesign/source/ui/misc/UITools.cxx  |6 
 sal/osl/all/compat.cxx   |2 
 sal/osl/unx/file_misc.cxx|   38 +--
 sal/osl/unx/file_stat.cxx|4 
 sal/osl/unx/file_url.cxx |4 
 sal/osl/unx/file_volume.cxx  |4 
 sal/osl/unx/module.cxx   |4 
 sal/osl/unx/pipe.cxx |   12 -
 sal/osl/unx/process.cxx  |   36 +--
 sal/osl/unx/profile.cxx  |  174 +++
 sal/osl/unx/secimpl.hxx  |2 
 sal/osl/unx/security.cxx |   16 -
 sal/osl/unx/socket.cxx   |   64 ++---
 sal/osl/unx/sockimpl.hxx |2 
 sal/osl/unx/uunxapi.cxx  |4 
 sal/osl/w32/file_url.cxx |   26 +-
 sal/osl/w32/module.cxx   |4 
 sal/osl/w32/path_helper.cxx  |8 
 sal/osl/w32/pipe.cxx |4 
 sal/osl/w32/profile.cxx  |  152 ++---
 sal/osl/w32/socket.cxx   |   12 -
 sal/qa/OStringBuffer/rtl_OStringBuffer.cxx   |  152 ++---
 sal/qa/OStringBuffer/rtl_String_Const.h  |  110 -
 sal/qa/osl/file/osl_File.cxx |   22 -
 sal/qa/osl/file/osl_File_Const.h |6 
 sal/qa/osl/pipe/osl_Pipe.cxx |4 
 sal/qa/rtl/ostring/rtl_str.cxx   |   24 +-
 sal/qa/rtl/process/rtl_Process.cxx   |8 
 sal/qa/rtl/strings/test_ostring.cxx  |4 
 sal/qa/rtl/textenc/rtl_tencinfo.cxx  |4 
 sal/qa/rtl/textenc/rtl_textcvt.cxx   |   22 -
 sal/rtl/math.cxx |   22 -
 sal/rtl/strbuf.cxx   |   14 -
 sal/rtl/string.cxx   |   20 -
 sal/rtl/strtmpl.cxx  |   20 -
 sal/rtl/uri.cxx  |2 
 sal/rtl/ustrbuf.cxx  |2 
 sal/rtl/ustring.cxx  |   36 +--
 sal/textenc/convertisciidevangari.cxx|8 
 sal/textenc/convertsinglebytetobmpunicode.cxx|   12 -
 sal/textenc/convertsinglebytetobmpunicode.hxx|4 
 sal/textenc/tencinfo.cxx |8 
 sal/textenc/textcvt.cxx  |4 
 sax/source/expatwrap/xml2utf.cxx |2 
 sax/source/fastparser/fastparser.cxx |4 
 sax/source/tools/converter.cxx   |   24 +-
 sax/source/tools/fastattribs.cxx |8 
 sax/source/tools/fastserializer.cxx  |6 
 sax/test/sax/testsax.cxx |2 
 sax/test/sax/testwriter.cxx  |2 
 sax/test/testcomponent.cxx   |2 
 59 files changed, 583 insertions(+), 583 deletions(-)

New commits:
commit e994b3fc3b2c9b7d39a715fc4d9453e06434d457
Author: Noel Grandin 
AuthorDate: Thu Dec 19 13:29:13 2019 +0200
Commit: Noel Grandin 
CommitDate: Thu Dec 19 19:17:57 2019 +0100

sal_Char->char in remotebridges..sax

Change-Id: I6d32942960a5e997f16eb1301c45495661cd4cea
Reviewed-on: https://gerrit.libreoffice.org/85514
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 7484a2491725..223bd868192d 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -83,8 +83,8 @@ public:
 maAttributeValues.reserve(nNumTokens+1);
 maAttributeTokens.reserve(nNumTokens);
 }
-void add( sal_Int32 nToken, const sal_Char* pValue );
-void add( sal_Int32 nToken, const sal_Char* pValue, size_t nValueLength );
+void add( sal_Int32 nToken, const char* pValue );
+void add( sal_Int32 nToken, const char* pValue, 

[Libreoffice-commits] core.git: include/sax include/sfx2

2019-10-29 Thread Noel Grandin (via logerrit)
 include/sax/fastattribs.hxx   |2 +-
 include/sax/fastparser.hxx|2 +-
 include/sfx2/DocumentMetadataAccess.hxx   |2 +-
 include/sfx2/app.hxx  |4 ++--
 include/sfx2/asyncfunc.hxx|2 +-
 include/sfx2/charmapcontrol.hxx   |2 +-
 include/sfx2/charmappopup.hxx |2 +-
 include/sfx2/charwin.hxx  |7 +++
 include/sfx2/checkin.hxx  |2 +-
 include/sfx2/ctrlitem.hxx |3 +--
 include/sfx2/dinfdlg.hxx  |   17 ++---
 include/sfx2/docfile.hxx  |2 +-
 include/sfx2/dockwin.hxx  |2 +-
 include/sfx2/docstoragemodifylistener.hxx |5 ++---
 include/sfx2/emojicontrol.hxx |2 +-
 include/sfx2/emojipopup.hxx   |2 +-
 include/sfx2/emojiviewitem.hxx|2 +-
 include/sfx2/event.hxx|2 +-
 include/sfx2/evntconf.hxx |2 +-
 include/sfx2/frame.hxx|9 -
 include/sfx2/hintpost.hxx |3 +--
 include/sfx2/infobar.hxx  |6 +++---
 include/sfx2/inputdlg.hxx |2 +-
 include/sfx2/minfitem.hxx |2 +-
 include/sfx2/navigat.hxx  |4 ++--
 include/sfx2/new.hxx  |2 +-
 include/sfx2/newstyle.hxx |2 +-
 include/sfx2/objitem.hxx  |2 +-
 include/sfx2/objsh.hxx|2 +-
 include/sfx2/passwd.hxx   |2 +-
 include/sfx2/printer.hxx  |2 +-
 include/sfx2/printopt.hxx |4 +---
 include/sfx2/prnmon.hxx   |2 +-
 include/sfx2/request.hxx  |2 +-
 include/sfx2/securitypage.hxx |3 +--
 include/sfx2/sfxhelp.hxx  |2 +-
 include/sfx2/sidebar/Accessible.hxx   |2 +-
 include/sfx2/sidebar/AccessibleTitleBar.hxx   |5 ++---
 include/sfx2/sidebar/ControllerItem.hxx   |5 ++---
 include/sfx2/sidebar/Deck.hxx |4 ++--
 include/sfx2/sidebar/DeckTitleBar.hxx |5 ++---
 include/sfx2/sidebar/MenuButton.hxx   |2 +-
 include/sfx2/sidebar/Panel.hxx|2 +-
 include/sfx2/sidebar/PanelTitleBar.hxx|5 ++---
 include/sfx2/sidebar/SidebarChildWindow.hxx   |2 +-
 include/sfx2/sidebar/SidebarDockingWindow.hxx |5 ++---
 include/sfx2/sidebar/TabBar.hxx   |2 +-
 include/sfx2/sidebar/TabItem.hxx  |2 +-
 include/sfx2/sidebar/Theme.hxx|2 +-
 include/sfx2/sidebar/UnoDeck.hxx  |2 +-
 include/sfx2/sidebar/UnoDecks.hxx |2 +-
 include/sfx2/sidebar/UnoPanel.hxx |2 +-
 include/sfx2/sidebar/UnoPanels.hxx|2 +-
 include/sfx2/sidebar/UnoSidebar.hxx   |2 +-
 include/sfx2/tabdlg.hxx   |2 +-
 include/sfx2/templatedlg.hxx  |4 ++--
 include/sfx2/templatelocalview.hxx|5 ++---
 include/sfx2/templdlg.hxx |2 +-
 include/sfx2/tplpitem.hxx |2 +-
 include/sfx2/unoctitm.hxx |2 +-
 include/sfx2/viewfrm.hxx  |2 +-
 include/sfx2/watermarkitem.hxx|2 +-
 62 files changed, 85 insertions(+), 104 deletions(-)

New commits:
commit af7589107e3540d0454965b58e3177f4057ce48c
Author: Noel Grandin 
AuthorDate: Tue Oct 29 12:02:47 2019 +0200
Commit: Noel Grandin 
CommitDate: Tue Oct 29 19:38:31 2019 +0100

loplugin:finalclasses sfx2

Change-Id: I77330d53adb5c6ec66750e57fdc539353b4c9725
Reviewed-on: https://gerrit.libreoffice.org/81657
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index ddbc0a5c1e2f..7484a2491725 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -70,7 +70,7 @@ class SAX_DLLPUBLIC FastTokenHandlerBase
  const char *pStr, size_t nLength );
 };
 
-class SAX_DLLPUBLIC FastAttributeList : public cppu::WeakImplHelper< 
css::xml::sax::XFastAttributeList >
+class SAX_DLLPUBLIC FastAttributeList final : public cppu::WeakImplHelper< 
css::xml::sax::XFastAttributeList >
 {
 public:
 FastAttributeList( const css::uno::Reference< 
css::xml::sax::XFastTokenHandler >& xTokenHandler,
diff --git a/include/sax/fastparser.hxx b/include/sax/fastparser.hxx
index ace7956382fb..f9776c595831 100644
--- a/include/sax/fastparser.hxx
+++ b/include/sax/fastparser.hxx
@@ -41,7 +41,7 @@ namespace sax_fastparser {
 class FastSaxParserImpl;
 
 // This class implements the external Parser 

[Libreoffice-commits] core.git: include/sax oox/source sax/source sc/source

2019-10-04 Thread Mike Kaganski (via logerrit)
 include/sax/fshelper.hxx |1 +
 oox/source/export/vmlexport.cxx  |4 ++--
 sax/source/tools/fshelper.cxx|6 ++
 sc/source/filter/excel/xecontent.cxx |2 +-
 sc/source/filter/excel/xeextlst.cxx  |2 +-
 sc/source/filter/excel/xestream.cxx  |   27 ---
 sc/source/filter/inc/xestream.hxx|   12 +---
 7 files changed, 20 insertions(+), 34 deletions(-)

New commits:
commit 59e5d2c8839ee6bf2bb237c0db4a618cb98b2dd9
Author: Mike Kaganski 
AuthorDate: Fri Oct 4 11:55:05 2019 +0300
Commit: Mike Kaganski 
CommitDate: Fri Oct 4 12:40:06 2019 +0200

Deduplicate some serializer writing code, and simplify writing OString

Change-Id: I391f8cb499a83f1f774fdcaa794169a218bdc7e5
Reviewed-on: https://gerrit.libreoffice.org/80189
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index 8169ce5ea166..773ce6892e26 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -131,6 +131,7 @@ public:
 { startElement( FSNS( namespaceTokenId, elementTokenId ), xAttrList ); 
}
 
 FastSerializerHelper* write(const char* value);
+FastSerializerHelper* write(const OString& value);
 FastSerializerHelper* write(const OUString& value);
 FastSerializerHelper* write(sal_Int32 value);
 FastSerializerHelper* write(sal_Int64 value);
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index eaf761a5d168..0bc408f3ef1c 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -1189,7 +1189,7 @@ sal_Int32 VMLExport::StartShape()
 "\n"
 "\n"
 "");
-m_pSerializer->write(sShapeType.makeStringAndClear().getStr());
+m_pSerializer->write(sShapeType.makeStringAndClear());
 m_aShapeTypeWritten[ m_nShapeType ] = true;
 }
 break;
@@ -1224,7 +1224,7 @@ sal_Int32 VMLExport::StartShape()
 "\n"
 "\n"
 "");
-m_pSerializer->write(sShapeType.makeStringAndClear().getStr());
+m_pSerializer->write(sShapeType.makeStringAndClear());
 m_aShapeTypeWritten[ m_nShapeType ] = true;
 }
 break;
diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx
index 383d4a794bbc..0d265fe36d24 100644
--- a/sax/source/tools/fshelper.cxx
+++ b/sax/source/tools/fshelper.cxx
@@ -81,6 +81,12 @@ FastSerializerHelper* FastSerializerHelper::write(const 
char* value)
 return this;
 }
 
+FastSerializerHelper* FastSerializerHelper::write(const OString& value)
+{
+mpSerializer->write(value);
+return this;
+}
+
 FastSerializerHelper* FastSerializerHelper::write(const OUString& value)
 {
 mpSerializer->write(value);
diff --git a/sc/source/filter/excel/xecontent.cxx 
b/sc/source/filter/excel/xecontent.cxx
index 444b737d038c..c61425647e59 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1507,7 +1507,7 @@ void XclExpDataBar::SaveXml( XclExpXmlStream& rStrm )
 XML_uri, "{B025F937-C7B1-47D3-B67F-A62EFF666E3E}");
 
 rWorksheet->startElementNS( XML_x14, XML_id );
-rWorksheet->write( maGUID.getStr() );
+rWorksheet->write(maGUID);
 rWorksheet->endElementNS( XML_x14, XML_id );
 
 rWorksheet->endElement( XML_ext );
diff --git a/sc/source/filter/excel/xeextlst.cxx 
b/sc/source/filter/excel/xeextlst.cxx
index 2d74db8b25dd..c2764b43da26 100644
--- a/sc/source/filter/excel/xeextlst.cxx
+++ b/sc/source/filter/excel/xeextlst.cxx
@@ -464,7 +464,7 @@ void XclExpExtConditionalFormatting::SaveXml( 
XclExpXmlStream& rStrm )
 
 maCfRules.SaveXml( rStrm );
 rWorksheet->startElementNS(XML_xm, XML_sqref);
-rWorksheet->write(XclXmlUtils::ToOString(maRange).getStr());
+rWorksheet->write(XclXmlUtils::ToOString(maRange));
 
 rWorksheet->endElementNS( XML_xm, XML_sqref );
 
diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index 98444d6ca0b4..937a7d0c8ed2 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -813,33 +813,6 @@ OUString XclXmlUtils::ToOUString( const XclExpString& s )
 return ToOUString( s.GetUnicodeBuffer() );
 }
 
-sax_fastparser::FSHelperPtr XclXmlUtils::WriteElement( 
sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, sal_Int32 nValue )
-{
-pStream->startElement(nElement);
-pStream->write( nValue );
-pStream->endElement( nElement );
-
-return pStream;
-}
-
-sax_fastparser::FSHelperPtr XclXmlUtils::WriteElement( 
sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, sal_Int64 nValue )
-{
-pStream->startElement(nElement);
-pStream->write( nValue );
-pStream->endElement( nElement );
-
-return pStream;
-}
-

[Libreoffice-commits] core.git: include/sax

2019-10-04 Thread Mike Kaganski (via logerrit)
 include/sax/fshelper.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 479151c6e194bdf40a0c15a0676460eb94293601
Author: Mike Kaganski 
AuthorDate: Fri Oct 4 08:44:11 2019 +0200
Commit: Mike Kaganski 
CommitDate: Fri Oct 4 09:39:15 2019 +0200

Convert FSNS macro to constexpr function

Change-Id: I823305cdf746098762b77a53c5b93035cda7ec6f
Reviewed-on: https://gerrit.libreoffice.org/80176
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index 7876e48a6c6c..8169ce5ea166 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -30,7 +30,7 @@
 namespace com { namespace sun { namespace star { namespace io { class 
XOutputStream; } } } }
 namespace sax_fastparser { class FastAttributeList; }
 
-#define FSNS(namespc, element) ((namespc << 16) | element)
+constexpr sal_Int32 FSNS(sal_Int32 namespc, sal_Int32 element) { return 
(namespc << 16) | element; }
 
 namespace sax_fastparser {
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: include/sax sax/source

2019-09-14 Thread Noel Grandin (via logerrit)
 include/sax/fastattribs.hxx  |5 +
 sax/source/fastparser/fastparser.cxx |1 +
 2 files changed, 6 insertions(+)

New commits:
commit 096b91ee15e2686d4eb7118fdb9688ba9dbc44b2
Author: Noel Grandin 
AuthorDate: Sat Sep 14 11:31:19 2019 +0200
Commit: Noel Grandin 
CommitDate: Sat Sep 14 15:30:00 2019 +0200

shave 10% off load time of large docx file

Change-Id: I5aacde7b6886bf47e79d055639e1b911da3be168
Reviewed-on: https://gerrit.libreoffice.org/78900
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 10ca8a2fad1f..ddbc0a5c1e2f 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -78,6 +78,11 @@ public:
 virtual ~FastAttributeList() override;
 
 void clear();
+void reserve( sal_Int32 nNumTokens )
+{
+maAttributeValues.reserve(nNumTokens+1);
+maAttributeTokens.reserve(nNumTokens);
+}
 void add( sal_Int32 nToken, const sal_Char* pValue );
 void add( sal_Int32 nToken, const sal_Char* pValue, size_t nValueLength );
 void add( sal_Int32 nToken, const OString& rValue );
diff --git a/sax/source/fastparser/fastparser.cxx 
b/sax/source/fastparser/fastparser.cxx
index 517f16f7c14a..3a8bbcfb9a62 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -1164,6 +1164,7 @@ void FastSaxParserImpl::callbackStartElement(const 
xmlChar *localName , const xm
 if ( rEntity.mxTokenHandler.is() )
 {
 // #158414# second: fill attribute list with other attributes
+rEvent.mxAttributes->reserve( numAttributes );
 for (int i = 0; i < numAttributes * 5; i += 5)
 {
 // attributes[] is ( localname / prefix / nsURI / valueBegin / 
valueEnd )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: include/sax sax/source sc/source xmloff/source

2019-08-23 Thread Noel Grandin (via logerrit)
 include/sax/fastattribs.hxx|6 +++---
 sax/source/tools/fastattribs.cxx   |2 +-
 sc/source/filter/xml/XMLCalculationSettingsContext.cxx |2 +-
 sc/source/filter/xml/XMLDDELinksContext.cxx|4 ++--
 sc/source/filter/xml/XMLTrackedChangesContext.cxx  |8 
 sc/source/filter/xml/xmlcoli.cxx   |2 +-
 sc/source/filter/xml/xmldpimp.cxx  |4 ++--
 sc/source/filter/xml/xmldrani.cxx  |2 +-
 sc/source/filter/xml/xmlrowi.cxx   |2 +-
 xmloff/source/core/xmlimp.cxx  |2 +-
 10 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit 5e01bae7f4a6f81ff70f328d0289dae37fab01eb
Author: Noel Grandin 
AuthorDate: Fri Aug 23 09:23:20 2019 +0200
Commit: Noel Grandin 
CommitDate: Fri Aug 23 10:37:31 2019 +0200

loplugin:returnconstval in sax

Change-Id: Icf5c337164b71aab10dd960815eee516822c276c
Reviewed-on: https://gerrit.libreoffice.org/77990
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index f8005a65a27a..10ca8a2fad1f 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -190,9 +190,9 @@ public:
 return !strcmp(str, mrList.getFastAttributeValue(mnIdx));
 }
 };
-const FastAttributeIter begin() const { return FastAttributeIter(*this, 
0); }
-const FastAttributeIter end() const { return FastAttributeIter(*this, 
maAttributeTokens.size()); }
-const FastAttributeIter find( sal_Int32 nToken ) const;
+FastAttributeIter begin() const { return FastAttributeIter(*this, 0); }
+FastAttributeIter end() const { return FastAttributeIter(*this, 
maAttributeTokens.size()); }
+FastAttributeIter find( sal_Int32 nToken ) const;
 
 private:
 sal_Char *mpChunk; ///< buffer to store all attribute values - null 
terminated strings
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index 6175c7873882..8aff8569d903 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -253,7 +253,7 @@ Sequence< FastAttribute > 
FastAttributeList::getFastAttributes(  )
 return aSeq;
 }
 
-const FastAttributeList::FastAttributeIter FastAttributeList::find( sal_Int32 
nToken ) const
+FastAttributeList::FastAttributeIter FastAttributeList::find( sal_Int32 nToken 
) const
 {
 for (size_t i = 0; i < maAttributeTokens.size(); ++i)
 if( maAttributeTokens[i] == nToken )
diff --git a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx 
b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
index 1b69a38a34a5..90c59096e300 100644
--- a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
+++ b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
@@ -147,7 +147,7 @@ ScXMLNullDateContext::ScXMLNullDateContext( ScXMLImport& 
rImport,
 {
 if ( rAttrList.is() )
 {
-auto ( rAttrList->find( XML_ELEMENT( TABLE, XML_DATE_VALUE ) ) );
+auto aIter( rAttrList->find( XML_ELEMENT( TABLE, XML_DATE_VALUE ) ) );
 if (aIter != rAttrList->end())
 {
 util::DateTime aDateTime;
diff --git a/sc/source/filter/xml/XMLDDELinksContext.cxx 
b/sc/source/filter/xml/XMLDDELinksContext.cxx
index 7ddf26f920ef..df0ee77f4fe1 100644
--- a/sc/source/filter/xml/XMLDDELinksContext.cxx
+++ b/sc/source/filter/xml/XMLDDELinksContext.cxx
@@ -265,7 +265,7 @@ ScXMLDDEColumnContext::ScXMLDDEColumnContext( ScXMLImport& 
rImport,
 if ( rAttrList.is() )
 {
 sal_Int32 nCols(1);
-auto ( rAttrList->find( XML_ELEMENT( TABLE, 
XML_NUMBER_COLUMNS_REPEATED ) ) );
+auto aIter( rAttrList->find( XML_ELEMENT( TABLE, 
XML_NUMBER_COLUMNS_REPEATED ) ) );
 if (aIter != rAttrList->end())
 nCols = aIter.toInt32();
 
@@ -286,7 +286,7 @@ ScXMLDDERowContext::ScXMLDDERowContext( ScXMLImport& 
rImport,
 {
 if ( rAttrList.is() )
 {
-auto ( rAttrList->find( XML_ELEMENT( TABLE, 
XML_NUMBER_ROWS_REPEATED ) ) );
+auto aIter( rAttrList->find( XML_ELEMENT( TABLE, 
XML_NUMBER_ROWS_REPEATED ) ) );
 if (aIter != rAttrList->end())
 nRows = aIter.toInt32();
 
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx 
b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index 0c75444d925c..5c1e3073067a 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -549,7 +549,7 @@ 
ScXMLCellContentDeletionContext::ScXMLCellContentDeletionContext(  ScXMLImport&
 {
 if ( rAttrList.is() )
 {
-auto ( rAttrList->find( XML_ELEMENT( TABLE, XML_ID ) ) );
+auto aIter( rAttrList->find( XML_ELEMENT( TABLE, XML_ID ) ) );
 if (aIter != rAttrList->end())
 nID = ScXMLChangeTrackingImportHelper::GetIDFromString( 
aIter.toString() );
 }
@@ 

[Libreoffice-commits] core.git: include/sax sax/qa

2019-08-22 Thread Noel Grandin (via logerrit)
 include/sax/tools/documenthandleradapter.hxx |4 ++--
 sax/qa/cppunit/xmlimport.cxx |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 9082e4df0133cdf13d10dac2a8fa293b4405463b
Author: Noel Grandin 
AuthorDate: Wed Aug 21 20:06:54 2019 +0200
Commit: Noel Grandin 
CommitDate: Thu Aug 22 10:34:00 2019 +0200

loplugin:constmethod in sax

Change-Id: I73e8322107d4c3f8890f6c1d059e4853de489d6e
Reviewed-on: https://gerrit.libreoffice.org/77932
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/sax/tools/documenthandleradapter.hxx 
b/include/sax/tools/documenthandleradapter.hxx
index 202bfbcb42a2..0296abfd669e 100644
--- a/include/sax/tools/documenthandleradapter.hxx
+++ b/include/sax/tools/documenthandleradapter.hxx
@@ -86,7 +86,7 @@ namespace sax
 m_handler = delegate;
 }
 const css::uno::Reference< css::xml::sax::XDocumentHandler >&
-getDelegate()
+getDelegate() const
 {
 return m_handler;
 }
@@ -196,7 +196,7 @@ namespace sax
 m_handler = delegate;
 }
 const css::uno::Reference< css::xml::sax::XExtendedDocumentHandler >&
-getDelegate()
+getDelegate() const
 {
 return m_handler;
 }
diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx
index 79f360dce5da..ff560c2625b0 100644
--- a/sax/qa/cppunit/xmlimport.cxx
+++ b/sax/qa/cppunit/xmlimport.cxx
@@ -86,7 +86,7 @@ private:
 
 public:
 TestDocumentHandler() {}
-const OUString & getString() { return m_aStr; }
+const OUString & getString() const { return m_aStr; }
 
 // XDocumentHandler
 virtual void SAL_CALL startDocument() override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: include/sax

2019-04-18 Thread Mike Kaganski (via logerrit)
 include/sax/fshelper.hxx |   44 
 1 file changed, 44 deletions(-)

New commits:
commit cab700c69edc4a0b66a60e80b2852380217163cd
Author: Mike Kaganski 
AuthorDate: Fri Apr 19 00:20:36 2019 +0200
Commit: Mike Kaganski 
CommitDate: Fri Apr 19 06:12:46 2019 +0200

Remove redundant functions from FastSerializerHelper

They are identical to what compiler autogenerates from templated overload

Change-Id: I0b1361a5dae7e6520a1ec21d735fdebbe0c9a76e
Reviewed-on: https://gerrit.libreoffice.org/70959
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index e46a1fab60b7..c5148dcd0b00 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -63,23 +63,12 @@ public:
 pushAttributeValue(attribute, value);
 startElement(elementTokenId, std::forward(args)...);
 }
-void startElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
char* value, FSEND_t)
-{
-if (value)
-pushAttributeValue(attribute, value);
-startElement(elementTokenId, FSEND);
-}
 template
 void startElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
OString& value, Args &&... args)
 {
 pushAttributeValue(attribute, value);
 startElement(elementTokenId, std::forward(args)...);
 }
-void startElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
OString& value, FSEND_t)
-{
-pushAttributeValue(attribute, value);
-startElement(elementTokenId, FSEND);
-}
 void startElement(sal_Int32 elementTokenId, FSEND_t);
 
 /// Start an element. After the first two arguments there can be a number 
of (attribute, value) pairs.
@@ -90,23 +79,12 @@ public:
 pushAttributeValue(attribute, value);
 startElementNS(namespaceTokenId, elementTokenId, 
std::forward(args)...);
 }
-void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
sal_Int32 attribute, const char* value, FSEND_t)
-{
-if (value)
-pushAttributeValue(attribute, value);
-startElementNS(namespaceTokenId, elementTokenId, FSEND);
-}
 template
 void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
sal_Int32 attribute, const OString& value, Args &&... args)
 {
 pushAttributeValue(attribute, value);
 startElementNS(namespaceTokenId, elementTokenId, 
std::forward(args)...);
 }
-void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
sal_Int32 attribute, const OString& value, FSEND_t)
-{
-pushAttributeValue(attribute, value);
-startElementNS(namespaceTokenId, elementTokenId, FSEND);
-}
 void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
FSEND_t)
 {
 startElement(FSNS(namespaceTokenId, elementTokenId), FSEND);
@@ -120,23 +98,12 @@ public:
 pushAttributeValue(attribute, value);
 singleElement(elementTokenId, std::forward(args)...);
 }
-void singleElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
char* value, FSEND_t)
-{
-if (value)
-pushAttributeValue(attribute, value);
-singleElement(elementTokenId, FSEND);
-}
 template
 void singleElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
OString& value, Args &&... args)
 {
 pushAttributeValue(attribute, value);
 singleElement(elementTokenId, std::forward(args)...);
 }
-void singleElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
OString& value, FSEND_t)
-{
-pushAttributeValue(attribute, value);
-singleElement(elementTokenId, FSEND);
-}
 void singleElement(sal_Int32 elementTokenId, FSEND_t);
 
 /// Create a single element. After the first two arguments there can be a 
number of (attribute, value) pairs.
@@ -147,23 +114,12 @@ public:
 pushAttributeValue(attribute, value);
 singleElementNS(namespaceTokenId, elementTokenId, 
std::forward(args)...);
 }
-void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
sal_Int32 attribute, const char* value, FSEND_t)
-{
-if (value)
-pushAttributeValue(attribute, value);
-singleElementNS(namespaceTokenId, elementTokenId, FSEND);
-}
 template
 void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
sal_Int32 attribute, const OString& value, Args &&... args)
 {
 pushAttributeValue(attribute, value);
 singleElementNS(namespaceTokenId, elementTokenId, 
std::forward(args)...);
 }
-void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
sal_Int32 attribute, const OString& value, FSEND_t)
-{
-pushAttributeValue(attribute, value);
-singleElementNS(namespaceTokenId, elementTokenId, FSEND);
- 

[Libreoffice-commits] core.git: include/sax

2019-04-18 Thread Mike Kaganski (via logerrit)
 include/sax/fshelper.hxx |   24 
 1 file changed, 24 deletions(-)

New commits:
commit b56678eaf231d4e8998aef928ab314918c5bd187
Author: Mike Kaganski 
AuthorDate: Thu Apr 18 22:47:52 2019 +0200
Commit: Mike Kaganski 
CommitDate: Fri Apr 19 01:31:03 2019 +0200

SAX_ARGS_ARG macro pack is unused

Change-Id: Icb7dca3456b3b355b68e8cb08f91f97b8504575a
Reviewed-on: https://gerrit.libreoffice.org/70955
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index 159b834a2fe1..e46a1fab60b7 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -39,30 +39,6 @@ struct FSEND_t { FSEND_t() {}; };
 static const FSEND_t FSEND = FSEND_t();
 const sal_Int32 FSEND_internal = -1; // same as XML_TOKEN_INVALID
 
-#define SAX_ARGS_ARG( arg1, arg2, convert, num ) arg1##num, arg2##num convert
-#define SAX_ARGS_ARG1( arg1, arg2, convert ) SAX_ARGS_ARG( arg1, arg2, 
convert, 1 )
-#define SAX_ARGS_ARG2( arg1, arg2, convert ) SAX_ARGS_ARG1( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 2 )
-#define SAX_ARGS_ARG3( arg1, arg2, convert ) SAX_ARGS_ARG2( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 3 )
-#define SAX_ARGS_ARG4( arg1, arg2, convert ) SAX_ARGS_ARG3( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 4 )
-#define SAX_ARGS_ARG5( arg1, arg2, convert ) SAX_ARGS_ARG4( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 5 )
-#define SAX_ARGS_ARG6( arg1, arg2, convert ) SAX_ARGS_ARG5( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 6 )
-#define SAX_ARGS_ARG7( arg1, arg2, convert ) SAX_ARGS_ARG6( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 7 )
-#define SAX_ARGS_ARG8( arg1, arg2, convert ) SAX_ARGS_ARG7( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 8 )
-#define SAX_ARGS_ARG9( arg1, arg2, convert ) SAX_ARGS_ARG8( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 9 )
-#define SAX_ARGS_ARG10( arg1, arg2, convert ) SAX_ARGS_ARG9( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 10 )
-#define SAX_ARGS_ARG11( arg1, arg2, convert ) SAX_ARGS_ARG10( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 11 )
-#define SAX_ARGS_ARG12( arg1, arg2, convert ) SAX_ARGS_ARG11( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 12 )
-#define SAX_ARGS_ARG13( arg1, arg2, convert ) SAX_ARGS_ARG12( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 13 )
-#define SAX_ARGS_ARG14( arg1, arg2, convert ) SAX_ARGS_ARG13( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 14 )
-#define SAX_ARGS_ARG15( arg1, arg2, convert ) SAX_ARGS_ARG14( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 15 )
-#define SAX_ARGS_ARG16( arg1, arg2, convert ) SAX_ARGS_ARG15( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 16 )
-#define SAX_ARGS_ARG17( arg1, arg2, convert ) SAX_ARGS_ARG16( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 17 )
-#define SAX_ARGS_ARG18( arg1, arg2, convert ) SAX_ARGS_ARG17( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 18 )
-#define SAX_ARGS_ARG19( arg1, arg2, convert ) SAX_ARGS_ARG18( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 19 )
-#define SAX_ARGS_ARG20( arg1, arg2, convert ) SAX_ARGS_ARG19( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 20 )
-#define SAX_ARGS_ARG21( arg1, arg2, convert ) SAX_ARGS_ARG20( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 21 )
-#define SAX_ARGS_ARG22( arg1, arg2, convert ) SAX_ARGS_ARG21( arg1, arg2, 
convert ), SAX_ARGS_ARG( arg1, arg2, convert, 22 )
-
 namespace sax_fastparser {
 
 enum class MergeMarks { APPEND = 0, PREPEND = 1, POSTPONE = 2};
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: include/sax sax/source writerfilter/source

2018-07-08 Thread Noel Grandin
 include/sax/fastattribs.hxx|   11 +
 sax/source/fastparser/fastparser.cxx   |   13 ++-
 sax/source/tools/fastattribs.cxx   |   18 +++-
 writerfilter/source/ooxml/OOXMLFactory.cxx |   32 +++--
 4 files changed, 48 insertions(+), 26 deletions(-)

New commits:
commit a2193f8f33565cc896592acb9d3ab65c756d97fb
Author: Noel Grandin 
Date:   Thu Jul 5 12:33:51 2018 +0200

tdf#79878 perf loading docx file, sax improvements

these are the smaller improvements, they make about 5% worth of
difference

- use std::vector instead of std::deque
- use std::move on pendingCharacters instead of copying
- in FastAttributeList::add, when reallocate the buffer, allocate twice
the existing size, instead of increasing to only what we need
- in FastAttributeList, create getAttributeIndex and friends, so
we can avoid iterating the attribute list more often than necessary

Change-Id: I3e3380ea50b77c6845b66e83404e245778ec06eb
Reviewed-on: https://gerrit.libreoffice.org/57021
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index b5fbe225ee28..029f3a12f780 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -93,6 +93,9 @@ public:
 bool getAsInteger( sal_Int32 nToken, sal_Int32 ) const;
 bool getAsDouble( sal_Int32 nToken, double ) const;
 bool getAsChar( sal_Int32 nToken, const char*& rPos ) const;
+sal_Int32 getAsIntegerByIndex( sal_Int32 nTokenIndex ) const;
+const char* getAsCharByIndex( sal_Int32 nTokenIndex ) const;
+OUString getValueByIndex( sal_Int32 nTokenIndex ) const;
 
 // XFastAttributeList
 virtual sal_Bool SAL_CALL hasAttribute( ::sal_Int32 Token ) override;
@@ -103,6 +106,14 @@ public:
 virtual css::uno::Sequence< css::xml::Attribute > SAL_CALL 
getUnknownAttributes(  ) override;
 virtual css::uno::Sequence< css::xml::FastAttribute > SAL_CALL 
getFastAttributes() override;
 
+sal_Int32 getAttributeIndex( ::sal_Int32 Token )
+{
+for (size_t i=0; i& xAttrList )
 {
diff --git a/sax/source/fastparser/fastparser.cxx 
b/sax/source/fastparser/fastparser.cxx
index 2765584a08fc..9477559c12e8 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -178,13 +178,13 @@ struct Entity : public ParserData
 void throwException( const ::rtl::Reference< FastLocatorImpl > 
,
  bool mbDuringParse );
 
-std::stack< NameWithToken >   maNamespaceStack;
+std::stack< NameWithToken, std::vector > maNamespaceStack;
 /* Context for main thread consuming events.
  * startElement() stores the data, which characters() and endElement() uses
  */
-std::stack< SaxContext>   maContextStack;
+std::stack< SaxContext, std::vector >  maContextStack;
 // Determines which elements of maNamespaceDefines are valid in current 
context
-std::stack< sal_uInt32 >  maNamespaceCount;
+std::stack< sal_uInt32, std::vector >  maNamespaceCount;
 std::vector< std::shared_ptr< NamespaceDefine > >
   maNamespaceDefines;
 
@@ -270,7 +270,7 @@ private:
 ParserData maData;  /// Cached parser configuration 
for next call of parseStream().
 
 Entity *mpTop;  /// std::stack::top() is amazingly 
slow => cache this.
-std::stack< Entity > maEntities;  /// Entity stack for each call of 
parseStream().
+std::stack< Entity > maEntities;/// Entity stack for each call of 
parseStream().
 OUString pendingCharacters; /// Data from characters() 
callback that needs to be sent.
 };
 
@@ -674,11 +674,12 @@ sal_Int32 FastSaxParserImpl::GetTokenWithPrefix( const 
xmlChar* pPrefix, int nPr
 sal_uInt32 nNamespace = rEntity.maNamespaceCount.top();
 while( nNamespace-- )
 {
-const OString& rPrefix( 
rEntity.maNamespaceDefines[nNamespace]->maPrefix );
+const auto & rNamespaceDefine = rEntity.maNamespaceDefines[nNamespace];
+const OString& rPrefix( rNamespaceDefine->maPrefix );
 if( (rPrefix.getLength() == nPrefixLen) &&
 (strncmp( rPrefix.getStr(), XML_CAST( pPrefix ), nPrefixLen ) == 0 
) )
 {
-nNamespaceToken = rEntity.maNamespaceDefines[nNamespace]->mnToken;
+nNamespaceToken = rNamespaceDefine->mnToken;
 break;
 }
 
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index a9f0baf7a2c0..30a764368947 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -86,7 +86,7 @@ void FastAttributeList::add( sal_Int32 nToken, const 
sal_Char* pValue, size_t nV
 maAttributeValues.push_back( maAttributeValues.back() + nValueLength + 1 );
 if (maAttributeValues.back() > 

[Libreoffice-commits] core.git: include/sax sax/Library_sax.mk sc/source svx/source sw/source xmloff/source

2018-03-05 Thread Noel Grandin
 include/sax/tools/converter.hxx|   12 
 sax/Library_sax.mk |1 +
 sc/source/filter/xml/xmlcondformat.cxx |   14 --
 sc/source/filter/xml/xmlexprt.cxx  |   12 ++--
 svx/source/dialog/hexcolorcontrol.cxx  |2 +-
 sw/source/filter/xml/xmlexpit.cxx  |4 ++--
 xmloff/source/style/xmlnumfe.cxx   |2 +-
 7 files changed, 27 insertions(+), 20 deletions(-)

New commits:
commit ffee771f8dae50aea716ffc0def4ef5fe5c104d2
Author: Noel Grandin 
Date:   Thu Mar 1 16:14:23 2018 +0200

add some color conversion methods to sax::Converter

to make the call-sites less verbose

Change-Id: Ifddcbb03a454a241bef93f31a8025801b84a66fc
Reviewed-on: https://gerrit.libreoffice.org/50578
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx
index 2dfc33461919..c7fe12f4c100 100644
--- a/include/sax/tools/converter.hxx
+++ b/include/sax/tools/converter.hxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 
 namespace com { namespace sun { namespace star {
@@ -97,10 +98,21 @@ public:
 /** convert string to rgb color */
 static bool convertColor( sal_Int32& rColor,
   const OUString );
+static bool convertColor( ::Color& rColor,
+  const OUString )
+{
+sal_Int32 n(rColor);
+bool b = convertColor( n, rValue );
+if (b) rColor = n;
+return b;
+}
 
 /** convert color to string */
 static void convertColor( OUStringBuffer ,
   sal_Int32 nColor );
+static void convertColor( OUStringBuffer ,
+  ::Color nColor )
+{ convertColor( rBuffer, sal_Int32(nColor) ); }
 
 /** convert string to number with optional min and max values */
 static bool convertNumber( sal_Int32& rValue,
diff --git a/sax/Library_sax.mk b/sax/Library_sax.mk
index d4149d382b66..6ef11645f6f3 100644
--- a/sax/Library_sax.mk
+++ b/sax/Library_sax.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_Library_use_libraries,sax,\
cppu \
cppuhelper \
sal \
+   tl \
 ))
 
 $(eval $(call gb_Library_add_defs,sax,\
diff --git a/sc/source/filter/xml/xmlcondformat.cxx 
b/sc/source/filter/xml/xmlcondformat.cxx
index be215df81d72..3db4904f99ca 100644
--- a/sc/source/filter/xml/xmlcondformat.cxx
+++ b/sc/source/filter/xml/xmlcondformat.cxx
@@ -457,15 +457,13 @@ ScXMLDataBarFormatContext::ScXMLDataBarFormatContext( 
ScXMLImport& rImport,
 
 if(!sPositiveColor.isEmpty())
 {
-sal_Int32 nColor = 0;
-sax::Converter::convertColor( nColor, sPositiveColor );
-mpFormatData->maPositiveColor = Color(nColor);
+sax::Converter::convertColor( mpFormatData->maPositiveColor, 
sPositiveColor );
 }
 
 if(!sNegativeColor.isEmpty())
 {
 // we might check here for 0xff and don't write it
-sal_Int32 nColor = 0;
+Color nColor;
 sax::Converter::convertColor( nColor, sNegativeColor );
 mpFormatData->mpNegativeColor.reset(new Color(nColor));
 }
@@ -482,9 +480,7 @@ ScXMLDataBarFormatContext::ScXMLDataBarFormatContext( 
ScXMLImport& rImport,
 
 if(!sAxisColor.isEmpty())
 {
-sal_Int32 nColor = 0;
-sax::Converter::convertColor( nColor, sAxisColor );
-mpFormatData->maAxisColor = Color(nColor);
+sax::Converter::convertColor( mpFormatData->maAxisColor, sAxisColor );
 }
 
 if(!sShowValue.isEmpty())
@@ -889,9 +885,7 @@ 
ScXMLColorScaleFormatEntryContext::ScXMLColorScaleFormatEntryContext( ScXMLImpor
 }
 }
 
-sal_Int32 nColor;
-sax::Converter::convertColor(nColor, sColor);
-aColor = Color(nColor);
+sax::Converter::convertColor(aColor, sColor);
 
 if(!sVal.isEmpty())
 sax::Converter::convertDouble(nVal, sVal);
diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index d41bc3ba2b5a..baf55bb3213e 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3971,7 +3971,7 @@ void ScXMLExport::WriteScenario()
 if (!(nFlags & ScScenarioFlags::ShowFrame))
 AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY_BORDER, XML_FALSE);
 OUStringBuffer aBuffer;
-::sax::Converter::convertColor(aBuffer, aColor.GetColor());
+::sax::Converter::convertColor(aBuffer, aColor);
 AddAttribute(XML_NAMESPACE_TABLE, XML_BORDER_COLOR, 
aBuffer.makeStringAndClear());
 if (!(nFlags & ScScenarioFlags::TwoWay))
 AddAttribute(XML_NAMESPACE_TABLE, XML_COPY_BACK, XML_FALSE);
@@ -4426,7 +4426,7 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab)
 
 AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, 
getCondFormatEntryType(*it[0]));

[Libreoffice-commits] core.git: include/sax sd/qa xmloff/source

2018-03-01 Thread Michael Stahl
 include/sax/fastattribs.hxx|3 ++-
 sd/qa/unit/data/unknown-attribute.fodp |   26 ++
 sd/qa/unit/export-tests.cxx|   26 ++
 xmloff/source/core/xmlictxt.cxx|1 +
 xmloff/source/core/xmlimp.cxx  |   18 +++---
 5 files changed, 70 insertions(+), 4 deletions(-)

New commits:
commit 700ed27678d688b1afdb4d1759dcd4b078898a3a
Author: Michael Stahl 
Date:   Thu Mar 1 14:39:56 2018 +0100

tdf#115429 xmloff: ODF import: fix handling of unknown attributes

... in SvXMLLegacyToFastDocHandler::startElement(), so that it does not
create invalid "-1" tokens that end up stored as empty-string
attribute names in SvXMLAttrCollection and ultimately exported
as invalid XML.

The maName in struct UnknownAttribute actually stores a QName,
i.e. namespace-prefixed, since commit
bb59a80ee6000d3922fa95262f67e291fd9d8ee2.

The attributes are read and converted again in
SvXMLImportContext::startUnknownElement().

Change-Id: Ia69a4da293f1a84ce30766abc09ca19e2620edbd
Reviewed-on: https://gerrit.libreoffice.org/50580
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 1f343a7235b9..b5fbe225ee28 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -82,7 +82,8 @@ public:
 void add( sal_Int32 nToken, const sal_Char* pValue, size_t nValueLength );
 void add( sal_Int32 nToken, const OString& rValue );
 void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, const OString& 
rValue );
-void addUnknown( const OUString& rNamespaceURL, const OString& rName, 
const OString& value );
+// note: rQName is *namespace-prefixed*
+void addUnknown( const OUString& rNamespaceURL, const OString& rQName, 
const OString& value );
 void addUnknown( const OString& rName, const OString& value );
 const std::vector< sal_Int32 >&  getFastAttributeTokens() const { return 
maAttributeTokens; }
 const char* getFastAttributeValue(size_t nIndex) const { return mpChunk + 
maAttributeValues[nIndex]; }
diff --git a/sd/qa/unit/data/unknown-attribute.fodp 
b/sd/qa/unit/data/unknown-attribute.fodp
new file mode 100644
index ..3aa39b10
--- /dev/null
+++ b/sd/qa/unit/data/unknown-attribute.fodp
@@ -0,0 +1,26 @@
+
+http://www.w3.org/1999/xlink; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:config="urn:oas
 is:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:formx="urn:openoffice:names:
 experimental:ooxml-odf-interop:xmlns:form:1.0" 
xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" 
office:mimetype="application/vnd.oasis.opendocument.presentation">
+  
+
+  
+  
+
+
+  http://example.com/; foo:non-existent-att="bar"
+/>
+
+
+  
+  
+
+
+  
+
+  
+
+
+  
+
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index d1d9e24c7ef4..d1f5a4e2097d 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -82,6 +82,7 @@ public:
 void testTdf97630();
 void testSwappedOutImageExport();
 void testOOoXMLAnimations();
+void testUnknownAttributes();
 void testTdf80020();
 void testLinkedGraphicRT();
 void testImageWithSpecialID();
@@ -103,6 +104,7 @@ public:
 CPPUNIT_TEST(testTdf97630);
 CPPUNIT_TEST(testSwappedOutImageExport);
 

[Libreoffice-commits] core.git: include/sax sal/osl sax/qa sax/source sc/source sfx2/source xmloff/source

2017-10-31 Thread Noel Grandin
 include/sax/tools/converter.hxx  |5 -
 sal/osl/unx/file.cxx |   32 ++--
 sal/osl/unx/file_error_transl.cxx|6 +-
 sal/osl/unx/file_error_transl.hxx|   10 ---
 sal/osl/unx/file_misc.cxx|   39 +++
 sal/osl/unx/file_stat.cxx|   14 ++---
 sal/osl/unx/file_url.cxx |   18 +++---
 sal/osl/unx/file_volume.cxx  |4 -
 sax/qa/cppunit/test_converter.cxx|   12 +---
 sax/source/tools/converter.cxx   |   13 +
 sc/source/filter/oox/revisionfragment.cxx|2 
 sc/source/filter/oox/sheetdatabuffer.cxx |2 
 sc/source/filter/xml/XMLCalculationSettingsContext.cxx   |2 
 sc/source/filter/xml/XMLTrackedChangesContext.cxx|2 
 sfx2/source/bastyp/frmhtmlw.cxx  |4 -
 sfx2/source/doc/SfxDocumentMetaData.cxx  |2 
 xmloff/source/chart/SchXMLCalculationSettingsContext.cxx |2 
 xmloff/source/core/DocumentSettingsContext.cxx   |2 
 xmloff/source/core/xmluconv.cxx  |2 
 xmloff/source/draw/ximppage.cxx  |2 
 xmloff/source/forms/handler/vcl_date_handler.cxx |2 
 xmloff/source/text/XMLChangedRegionImportContext.cxx |2 
 xmloff/source/text/txtflde.cxx   |2 
 xmloff/source/text/txtfldi.cxx   |7 +-
 xmloff/source/xforms/SchemaRestrictionContext.cxx|2 
 25 files changed, 86 insertions(+), 104 deletions(-)

New commits:
commit 0b413caadfbe68b278ca5ba33b6d204687586ea9
Author: Noel Grandin 
Date:   Mon Oct 30 17:10:28 2017 +0200

loplugin:constantparam in sal,sax

Change-Id: I7ca2fd05d1cf61f9038c529a853e72fedb1c9ed0
Reviewed-on: https://gerrit.libreoffice.org/44087
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx
index 095102804ace..b98516a9da87 100644
--- a/include/sax/tools/converter.hxx
+++ b/include/sax/tools/converter.hxx
@@ -170,17 +170,14 @@ public:
 
 /** convert util::DateTime to XMLSchema-2 "time" or "dateTime" string */
 static void convertTimeOrDateTime(OUStringBuffer& rBuffer,
-const css::util::DateTime& rDateTime,
-sal_Int16 const* pTimeZoneOffset);
+const css::util::DateTime& rDateTime);
 
 /** convert XMLSchema-2 "date" or "dateTime" string to util::DateTime */
 static bool parseDateTime( css::util::DateTime& rDateTime,
- boost::optional * pTimeZoneOffset,
  const OUString& rString );
 
 /** convert XMLSchema-2 "time" or "dateTime" string to util::DateTime */
 static bool parseTimeOrDateTime(css::util::DateTime& rDateTime,
- boost::optional * pTimeZoneOffset,
  const OUString& rString);
 
 /** convert XMLSchema-2 "date" or "dateTime" string to util::DateTime or
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index b97e157c29be..de36b3d26a9c 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -299,7 +299,7 @@ oslFileError FileHandle_Impl::setSize(sal_uInt64 uSize)
 if (ftruncate_with_name(m_fd, nSize, m_strFilePath) == -1)
 {
 /* Failure. Save original result. Try fallback algorithm */
-oslFileError result = oslTranslateFileError(OSL_FET_ERROR, errno);
+oslFileError result = oslTranslateFileError(errno);
 
 /* Check against current size. Fail upon 'shrink' */
 if (uSize <= getSize())
@@ -379,7 +379,7 @@ oslFileError FileHandle_Impl::readAt(
 }
 
 if (nBytes == -1)
-return oslTranslateFileError(OSL_FET_ERROR, errno);
+return oslTranslateFileError(errno);
 
 *pBytesRead = nBytes;
 
@@ -402,7 +402,7 @@ oslFileError FileHandle_Impl::writeAt(
 
 ssize_t nBytes = ::pwrite(m_fd, pBuffer, nBytesToWrite, nOffset);
 if (nBytes == -1)
-return oslTranslateFileError(OSL_FET_ERROR, errno);
+return oslTranslateFileError(errno);
 
 m_size = std::max(m_size, sal::static_int_cast< sal_uInt64 >(nOffset + 
nBytes));
 
@@ -422,7 +422,7 @@ oslFileError FileHandle_Impl::readFileAt(
 // not seekable (pipe)
 ssize_t nBytes = ::read(m_fd, pBuffer, nBytesRequested);
 if (nBytes == -1)
-return oslTranslateFileError(OSL_FET_ERROR, errno);
+return oslTranslateFileError(errno);
 
 *pBytesRead = nBytes;
 
@@ -503,7 +503,7 @@ oslFileError FileHandle_Impl::writeFileAt(
 // not seekable (pipe)

[Libreoffice-commits] core.git: include/sax include/tools l10ntools/inc sax/inc sax/source svx/source tools/source UnoControls/inc

2017-10-25 Thread Noel Grandin
 UnoControls/inc/basecontrol.hxx |   12 ++--
 include/sax/fshelper.hxx|2 +-
 include/tools/b3dtrans.hxx  |2 +-
 include/tools/datetime.hxx  |2 +-
 include/tools/poly.hxx  |2 +-
 include/tools/stream.hxx|4 ++--
 include/tools/urlobj.hxx|4 ++--
 include/tools/zcodec.hxx|4 ++--
 l10ntools/inc/cfgmerge.hxx  |4 ++--
 l10ntools/inc/xrmmerge.hxx  |4 ++--
 sax/inc/xml2utf.hxx |2 +-
 sax/source/fastparser/fastparser.cxx|2 +-
 sax/source/tools/fastserializer.cxx |2 +-
 sax/source/tools/fastserializer.hxx |2 +-
 sax/source/tools/fshelper.cxx   |2 +-
 svx/source/customshapes/EnhancedCustomShapeFontWork.cxx |4 ++--
 tools/source/datetime/datetime.cxx  |2 +-
 tools/source/fsys/urlobj.cxx|4 ++--
 tools/source/generic/poly.cxx   |2 +-
 tools/source/stream/stream.cxx  |2 +-
 tools/source/stream/strmunx.cxx |2 +-
 tools/source/zcodec/zcodec.cxx  |2 +-
 22 files changed, 34 insertions(+), 34 deletions(-)

New commits:
commit 83fd71e041f2c0520c4cc213e238c7f3c674c5a3
Author: Noel Grandin 
Date:   Tue Oct 24 14:07:42 2017 +0200

loplugin:constmethod in tools,sax,UnoControls

Change-Id: Ie05e44e2a4019e2549843961ebfa04fef7b7aeb4
Reviewed-on: https://gerrit.libreoffice.org/43767
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/UnoControls/inc/basecontrol.hxx b/UnoControls/inc/basecontrol.hxx
index 6967a3ff1085..7f81e13335f2 100644
--- a/UnoControls/inc/basecontrol.hxx
+++ b/UnoControls/inc/basecontrol.hxx
@@ -346,15 +346,15 @@ public:
 protected:
 using OComponentHelper::disposing;
 
-const css::uno::Reference< css::uno::XComponentContext >& 
impl_getComponentContext() { return m_xComponentContext;}
+const css::uno::Reference< css::uno::XComponentContext >& 
impl_getComponentContext() const { return m_xComponentContext;}
 
-const css::uno::Reference< css::awt::XWindow >& impl_getPeerWindow() { 
return m_xPeerWindow;}
+const css::uno::Reference< css::awt::XWindow >& impl_getPeerWindow() const 
{ return m_xPeerWindow;}
 
-const css::uno::Reference< css::awt::XGraphics >& impl_getGraphicsPeer() { 
return m_xGraphicsPeer;}
+const css::uno::Reference< css::awt::XGraphics >& impl_getGraphicsPeer() 
const { return m_xGraphicsPeer;}
 
-const sal_Int32& impl_getWidth() { return m_nWidth;}
+sal_Int32 impl_getWidth() const { return m_nWidth;}
 
-const sal_Int32& impl_getHeight() { return m_nHeight;}
+sal_Int32 impl_getHeight() const { return m_nHeight;}
 
 virtual css::awt::WindowDescriptor* impl_getWindowDescriptor(
 const css::uno::Reference< css::awt::XWindowPeer >& xParentPeer
@@ -366,7 +366,7 @@ protected:
 
 virtual void impl_recalcLayout( const css::awt::WindowEvent& aEvent );
 
-const css::uno::Reference< css::uno::XInterface >& impl_getDelegator() { 
return m_xDelegator;}
+const css::uno::Reference< css::uno::XInterface >& impl_getDelegator() 
const { return m_xDelegator;}
 
 private:
 
diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index c393240d212a..6b3dc1e68318 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -211,7 +211,7 @@ public:
 
 FastSerializerHelper* writeId(sal_Int32 tokenId);
 
-css::uno::Reference< css::io::XOutputStream > getOutputStream();
+css::uno::Reference< css::io::XOutputStream > getOutputStream() const;
 
 static FastAttributeList *createAttrList();
 
diff --git a/include/tools/b3dtrans.hxx b/include/tools/b3dtrans.hxx
index 64d273bcbfc0..97b353f0c941 100644
--- a/include/tools/b3dtrans.hxx
+++ b/include/tools/b3dtrans.hxx
@@ -99,7 +99,7 @@ public:
 // Texture
 
 // aspect ratio accessors and the defined method of keeping defined aspect 
ratio
-double GetRatio() { return mfRatio; }
+double GetRatio() const { return mfRatio; }
 void SetRatio(double fNew);
 
 // Parameters of ViewportTransformation
diff --git a/include/tools/datetime.hxx b/include/tools/datetime.hxx
index fd48e2314c27..02729e6a0e1a 100644
--- a/include/tools/datetime.hxx
+++ b/include/tools/datetime.hxx
@@ -98,7 +98,7 @@ public:
 DateTime&   operator =( const DateTime& rDateTime );
 DateTime&   operator =( const css::util::DateTime& rUDateTime );
 
-voidGetWin32FileDateTime( sal_uInt32 & rLower, sal_uInt32 & 

[Libreoffice-commits] core.git: include/sax sc/source

2017-08-12 Thread Mohammed Abdul Azeem
 include/sax/fastattribs.hxx  |   11 +
 sc/source/filter/xml/xmlcelli.cxx|4 +-
 sc/source/filter/xml/xmlexternaltabi.cxx |2 -
 sc/source/filter/xml/xmlimprt.cxx|   59 +++
 sc/source/filter/xml/xmlimprt.hxx|5 --
 5 files changed, 51 insertions(+), 30 deletions(-)

New commits:
commit dfac13b483ba38ce6f61cd0a1e5757c6a08ab296
Author: Mohammed Abdul Azeem 
Date:   Wed Aug 9 21:36:12 2017 +0530

Avoiding unnecessary OUString allocation:

Using direct strcmp instead of mapping. This is one
of the hotspots and will help improve performance.

Change-Id: I97a452984d53a6746f477ffe4be2806d9e89eee4
Reviewed-on: https://gerrit.libreoffice.org/40928
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 8b669fe26a17..0a7d8712fb17 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -162,7 +162,16 @@ public:
 mrList.AttributeValueLength(mnIdx),
 RTL_TEXTENCODING_UTF8);
 }
-
+const char* toCString() const
+{
+assert(mnIdx < mrList.maAttributeTokens.size());
+return mrList.getFastAttributeValue(mnIdx);
+}
+sal_Int32 getLength() const
+{
+assert(mnIdx < mrList.maAttributeTokens.size());
+return mrList.AttributeValueLength(mnIdx);
+}
 bool isString(const char *str) const
 {
 assert(mnIdx < mrList.maAttributeTokens.size());
diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index c3edfdbeac03..9de47677dd1a 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -196,14 +196,14 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( 
ScXMLImport& rImport,
 std::max( it.toInt32(), 
static_cast(1) ) ));
 break;
 case XML_ELEMENT( OFFICE, XML_VALUE_TYPE ):
-nCellType = GetScImport().GetCellType(it.toString());
+nCellType = ScXMLImport::GetCellType(it.toCString(), 
it.getLength());
 bIsEmpty = false;
 break;
 case XML_ELEMENT( CALC_EXT, XML_VALUE_TYPE ):
 if(it.isString( "error" ) )
 mbErrorValue = true;
 else
-nCellType = GetScImport().GetCellType(it.toString());
+nCellType = ScXMLImport::GetCellType(it.toCString(), 
it.getLength());
 bIsEmpty = false;
 mbNewValueType = true;
 break;
diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx 
b/sc/source/filter/xml/xmlexternaltabi.cxx
index 70fc010667f2..57cbbfda420d 100644
--- a/sc/source/filter/xml/xmlexternaltabi.cxx
+++ b/sc/source/filter/xml/xmlexternaltabi.cxx
@@ -271,7 +271,7 @@ ScXMLExternalRefCellContext::ScXMLExternalRefCellContext(
 break;
 case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE_TYPE:
 {
-mnCellType = mrScImport.GetCellType( it.toString() );
+mnCellType = ScXMLImport::GetCellType( it.toCString(), 
it.getLength() );
 }
 break;
 case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE:
diff --git a/sc/source/filter/xml/xmlimprt.cxx 
b/sc/source/filter/xml/xmlimprt.cxx
index 339b433dc919..2893c9e354e1 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -809,23 +809,6 @@ ScXMLImport::ScXMLImport(
 GetXMLToken( XML_NP_PRESENTATION ),
 GetXMLToken( XML_N_PRESENTATION ),
 XML_NAMESPACE_PRESENTATION );
-
-// initialize cell type map.
-const struct { XMLTokenEnum  _token; sal_Int16 _type; } aCellTypePairs[] =
-{
-{ XML_FLOAT,util::NumberFormat::NUMBER },
-{ XML_STRING,   util::NumberFormat::TEXT },
-{ XML_TIME, util::NumberFormat::TIME },
-{ XML_DATE, util::NumberFormat::DATETIME },
-{ XML_PERCENTAGE,   util::NumberFormat::PERCENT },
-{ XML_CURRENCY, util::NumberFormat::CURRENCY },
-{ XML_BOOLEAN,  util::NumberFormat::LOGICAL }
-};
-for (const auto & aCellTypePair : aCellTypePairs)
-{
-aCellTypeMap.emplace(
-GetXMLToken(aCellTypePair._token), aCellTypePair._type);
-}
 }
 
 ScXMLImport::~ScXMLImport() throw()
@@ -1021,13 +1004,45 @@ ScDocumentImport& ScXMLImport::GetDoc()
 return *mpDocImport;
 }
 
-sal_Int16 ScXMLImport::GetCellType(const OUString& rStrValue) const
+sal_Int16 ScXMLImport::GetCellType(const char* rStrValue, const sal_Int32 
nStrLength)
 {
-CellTypeMap::const_iterator itr = 

[Libreoffice-commits] core.git: include/sax oox/source sc/source writerfilter/source xmloff/source

2017-07-11 Thread Mohammed Abdul Azeem
 include/sax/fastattribs.hxx|7 +++
 oox/source/helper/attributelist.cxx|3 +--
 sc/source/filter/xml/XMLCalculationSettingsContext.cxx |2 +-
 sc/source/filter/xml/XMLConsolidationContext.cxx   |2 +-
 sc/source/filter/xml/XMLTrackedChangesContext.cxx  |2 +-
 sc/source/filter/xml/datastreamimport.cxx  |2 +-
 sc/source/filter/xml/xmlbodyi.cxx  |2 +-
 sc/source/filter/xml/xmlcelli.cxx  |2 +-
 sc/source/filter/xml/xmldrani.cxx  |2 +-
 sc/source/filter/xml/xmlexternaltabi.cxx   |9 ++---
 sc/source/filter/xml/xmlrowi.cxx   |4 ++--
 sc/source/filter/xml/xmltabi.cxx   |2 +-
 writerfilter/source/ooxml/OOXMLFactory.cxx |5 ++---
 xmloff/source/core/xmlictxt.cxx|2 +-
 xmloff/source/core/xmlimp.cxx  |2 +-
 15 files changed, 28 insertions(+), 20 deletions(-)

New commits:
commit b401896a56149aa2871b65a330a6f601a9830ccd
Author: Mohammed Abdul Azeem 
Date:   Sun Jul 9 17:02:06 2017 +0530

Helper function to cast to FastAttributeList:

Refactoring codes that cast XFastAttributeList reference
to FastAttributeList pointer using the helper function.

Change-Id: Iecf4b815d6556b0992d638b633260fbd459c0dc4
Reviewed-on: https://gerrit.libreoffice.org/39723
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index c813fcf6944d..4147ac978f44 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -102,6 +102,13 @@ public:
 virtual css::uno::Sequence< css::xml::Attribute > SAL_CALL 
getUnknownAttributes(  ) override;
 virtual css::uno::Sequence< css::xml::FastAttribute > SAL_CALL 
getFastAttributes() override;
 
+static FastAttributeList* castToFastAttributeList(
+const css::uno::Reference< 
css::xml::sax::XFastAttributeList >& xAttrList )
+{
+assert( dynamic_cast  ( xAttrList.get() ) != 
nullptr );
+return ( static_cast  ( xAttrList.get() ) );
+}
+
 /// Use for fast iteration and conversion of attributes
 class FastAttributeIter {
 const FastAttributeList 
diff --git a/oox/source/helper/attributelist.cxx 
b/oox/source/helper/attributelist.cxx
index 70abbc1e521f..e3f365cd8960 100644
--- a/oox/source/helper/attributelist.cxx
+++ b/oox/source/helper/attributelist.cxx
@@ -116,8 +116,7 @@ sax_fastparser::FastAttributeList 
*AttributeList::getAttribList() const
 {
 if( mpAttribList == nullptr )
 {
-assert( dynamic_cast< sax_fastparser::FastAttributeList *>( 
mxAttribs.get() ) != nullptr );
-mpAttribList = static_cast< sax_fastparser::FastAttributeList *>( 
mxAttribs.get() );
+mpAttribList = 
sax_fastparser::FastAttributeList::castToFastAttributeList( mxAttribs );
 }
 return mpAttribList;
 }
diff --git a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx 
b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
index e885d737de33..1347c299ff29 100644
--- a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
+++ b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
@@ -51,7 +51,7 @@ 
ScXMLCalculationSettingsContext::ScXMLCalculationSettingsContext( ScXMLImport& r
 if( xAttrList.is() )
 {
 sax_fastparser::FastAttributeList *pAttribList =
-static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() 
);
+sax_fastparser::FastAttributeList::castToFastAttributeList( 
xAttrList );
 
 for( auto  : *pAttribList )
 {
diff --git a/sc/source/filter/xml/XMLConsolidationContext.cxx 
b/sc/source/filter/xml/XMLConsolidationContext.cxx
index 092f561cec99..30b863395e81 100644
--- a/sc/source/filter/xml/XMLConsolidationContext.cxx
+++ b/sc/source/filter/xml/XMLConsolidationContext.cxx
@@ -42,7 +42,7 @@ ScXMLConsolidationContext::ScXMLConsolidationContext(
 if( xAttrList.is() )
 {
 sax_fastparser::FastAttributeList *pAttribList =
-static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() 
);
+sax_fastparser::FastAttributeList::castToFastAttributeList( 
xAttrList );
 
 for( auto  : *pAttribList )
 {
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx 
b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index e680128eb643..22fc26b133eb 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -395,7 +395,7 @@ ScXMLTrackedChangesContext::ScXMLTrackedChangesContext( 
ScXMLImport& rImport,
 if( xAttrList.is() )
 {
 sax_fastparser::FastAttributeList *pAttribList =
-static_cast< sax_fastparser::FastAttributeList *>( 

[Libreoffice-commits] core.git: include/sax sax/source sc/source xmloff/source

2017-06-29 Thread Mohammed Abdul Azeem
 include/sax/fastattribs.hxx  |1 +
 sax/source/tools/fastattribs.cxx |8 
 sc/source/filter/xml/xmlrowi.cxx |   10 ++
 xmloff/source/core/xmlimp.cxx|   24 +++-
 4 files changed, 30 insertions(+), 13 deletions(-)

New commits:
commit b3b6ce3febbf3073dd9e16d908137e41ab473dca
Author: Mohammed Abdul Azeem 
Date:   Thu Jun 29 13:49:18 2017 +0530

Added find function to FastAttributeList:

It returns a FastAttributeIter, which can be used to
obtain value in different formats directly. Also, avoids
one unnecessary iteration.

Change-Id: Ic28e0177100738bbd71a3a89634cae9f1f7ee996
Reviewed-on: https://gerrit.libreoffice.org/39380
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 70ddc4c8bb85..c813fcf6944d 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -164,6 +164,7 @@ public:
 };
 const FastAttributeIter begin() const { return FastAttributeIter(*this, 
0); }
 const FastAttributeIter end() const { return FastAttributeIter(*this, 
maAttributeTokens.size()); }
+const FastAttributeIter find( sal_Int32 nToken ) const;
 
 private:
 sal_Char *mpChunk; ///< buffer to store all attribute values - null 
terminated strings
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index 985293ff0caf..564f71d27b81 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -230,6 +230,14 @@ Sequence< FastAttribute > 
FastAttributeList::getFastAttributes(  )
 return aSeq;
 }
 
+const FastAttributeList::FastAttributeIter FastAttributeList::find( sal_Int32 
nToken ) const
+{
+for (size_t i = 0; i < maAttributeTokens.size(); ++i)
+if( maAttributeTokens[i] == nToken )
+return FastAttributeIter(*this, i);
+return end();
+}
+
 sal_Int32 FastTokenHandlerBase::getTokenFromChars(
 const css::uno::Reference< css::xml::sax::XFastTokenHandler > 
,
 FastTokenHandlerBase *pTokenHandler,
diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx
index ab5fdf5eefa2..8903287504ac 100644
--- a/sc/source/filter/xml/xmlrowi.cxx
+++ b/sc/source/filter/xml/xmlrowi.cxx
@@ -227,11 +227,13 @@ ScXMLTableRowsContext::ScXMLTableRowsContext( 
ScXMLImport& rImport,
 {
 nGroupStartRow = rImport.GetTables().GetCurrentRow();
 ++nGroupStartRow;
-if ( xAttrList.is() &&
-xAttrList->hasAttribute( XML_ELEMENT( TABLE, XML_DISPLAY ) ) )
+if ( xAttrList.is() )
 {
-bGroupDisplay = IsXMLToken( xAttrList->getValue(
-XML_ELEMENT( TABLE, XML_DISPLAY ) ), XML_TRUE 
);
+sax_fastparser::FastAttributeList *pAttribList =
+static_cast< sax_fastparser::FastAttributeList *>( 
xAttrList.get() );
+auto ( pAttribList->find( XML_ELEMENT( TABLE, XML_DISPLAY ) 
) );
+if( aIter != pAttribList->end() )
+bGroupDisplay = IsXMLToken( aIter.toCString(), XML_TRUE );
 }
 }
 }
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 5d9d1de5123e..92836d1af191 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -788,17 +788,23 @@ void SAL_CALL SvXMLImport::setDocumentLocator( const 
uno::Reference< xml::sax::X
 void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element,
 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
 {
-if ( Attribs.is() && Attribs->hasAttribute( XML_ELEMENT( OFFICE, 
XML_VERSION ) ) )
+if ( Attribs.is() )
 {
-mpImpl->aODFVersion = Attribs->getValue( XML_ELEMENT( OFFICE, 
XML_VERSION ) );
-
-// the ODF version in content.xml and manifest.xml must be the same 
starting from ODF1.2
-if ( mpImpl->mStreamName == "content.xml" && !IsODFVersionConsistent( 
mpImpl->aODFVersion ) )
+sax_fastparser::FastAttributeList *pAttribList =
+static_cast< sax_fastparser::FastAttributeList *>( Attribs.get() );
+auto ( pAttribList->find( XML_ELEMENT( OFFICE, XML_VERSION ) ) );
+if( aIter != pAttribList->end() )
 {
-throw xml::sax::SAXException("Inconsistent ODF versions in 
content.xml and manifest.xml!",
-uno::Reference< uno::XInterface >(),
-uno::makeAny(
-packages::zip::ZipIOException("Inconsistent ODF 
versions in content.xml and manifest.xml!" ) ) );
+mpImpl->aODFVersion = aIter.toString();
+
+// the ODF version in content.xml and manifest.xml must be the 
same starting from ODF1.2
+if ( mpImpl->mStreamName == "content.xml" && 
!IsODFVersionConsistent( mpImpl->aODFVersion ) )
+{
+throw 

[Libreoffice-commits] core.git: include/sax sc/source xmloff/source

2017-06-28 Thread Mohammed Abdul Azeem
 include/sax/fastattribs.hxx  |   17 +++--
 sc/source/filter/xml/xmlbodyi.cxx|7 +++
 sc/source/filter/xml/xmlcelli.cxx|7 +++
 sc/source/filter/xml/xmlexternaltabi.cxx |6 +++---
 sc/source/filter/xml/xmlrowi.cxx |7 +++
 sc/source/filter/xml/xmltabi.cxx |7 +++
 xmloff/source/core/xmlictxt.cxx  |   14 +-
 7 files changed, 31 insertions(+), 34 deletions(-)

New commits:
commit d6da9e495d7ca32de6cda1a94cb4c8cd26b240cc
Author: Mohammed Abdul Azeem 
Date:   Wed Jun 28 21:45:39 2017 +0530

Using range-for instead of iterator loop:

It's much easier to write and looks cleaner. And
this doesn't affect performance, I think.

Change-Id: Ia946b068979b9cef04ac2479c9179a70b6775dea
Reviewed-on: https://gerrit.libreoffice.org/39370
Tested-by: Jenkins 
Reviewed-by: Mohammed Abdul Azeem 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 958899015372..70ddc4c8bb85 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -123,22 +123,27 @@ public:
 return mnIdx != rhs.mnIdx;
 }
 
-sal_Int32 getToken()
+const FastAttributeIter& operator*() const
+{
+return *this;
+}
+
+sal_Int32 getToken() const
 {
 assert(mnIdx < mrList.maAttributeTokens.size());
 return mrList.maAttributeTokens[mnIdx];
 }
-bool isEmpty()
+bool isEmpty() const
 {
 assert(mnIdx < mrList.maAttributeTokens.size());
 return mrList.AttributeValueLength(mnIdx) < 1;
 }
-sal_Int32 toInt32()
+sal_Int32 toInt32() const
 {
 assert(mnIdx < mrList.maAttributeTokens.size());
 return rtl_str_toInt32(mrList.getFastAttributeValue(mnIdx), 10);
 }
-OUString toString()
+OUString toString() const
 {
 assert(mnIdx < mrList.maAttributeTokens.size());
 return OUString(mrList.getFastAttributeValue(mnIdx),
@@ -146,12 +151,12 @@ public:
 RTL_TEXTENCODING_UTF8);
 }
 
-const char* toCString()
+const char* toCString() const
 {
 assert(mnIdx < mrList.maAttributeTokens.size());
 return mrList.getFastAttributeValue(mnIdx);
 }
-bool isString(const char *str)
+bool isString(const char *str) const
 {
 assert(mnIdx < mrList.maAttributeTokens.size());
 return !strcmp(str, mrList.getFastAttributeValue(mnIdx));
diff --git a/sc/source/filter/xml/xmlbodyi.cxx 
b/sc/source/filter/xml/xmlbodyi.cxx
index 2a21d52899f9..4aec839b76e7 100644
--- a/sc/source/filter/xml/xmlbodyi.cxx
+++ b/sc/source/filter/xml/xmlbodyi.cxx
@@ -92,11 +92,10 @@ ScXMLBodyContext::ScXMLBodyContext( ScXMLImport& rImport,
 if( !xAttrList.is() )
 return;
 
-sax_fastparser::FastAttributeList *pAttribList;
-assert( dynamic_cast< sax_fastparser::FastAttributeList *>( 
xAttrList.get() ) != nullptr );
-pAttribList = static_cast< sax_fastparser::FastAttributeList *>( 
xAttrList.get() );
+sax_fastparser::FastAttributeList *pAttribList =
+static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
 
-for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
+for( auto  : *pAttribList )
 {
 sal_Int32 nToken = it.getToken();
 if( NAMESPACE_TOKEN( XML_NAMESPACE_TABLE ) == ( nToken & NMSP_MASK ) )
diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index 0de5664fcba2..d7e9f3107b75 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -159,11 +159,10 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( 
ScXMLImport& rImport,
 std::unique_ptr xCurrencySymbol;
 if( xAttrList.is() )
 {
-sax_fastparser::FastAttributeList *pAttribList;
-assert( dynamic_cast< sax_fastparser::FastAttributeList *>( 
xAttrList.get() ) != nullptr );
-pAttribList = static_cast< sax_fastparser::FastAttributeList *>( 
xAttrList.get() );
+sax_fastparser::FastAttributeList *pAttribList =
+static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() 
);
 
-for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
+for( auto  : *pAttribList )
 {
 switch ( it.getToken() )
 {
diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx 
b/sc/source/filter/xml/xmlexternaltabi.cxx
index e8c0ef5db247..e6edaa66461b 100644
--- a/sc/source/filter/xml/xmlexternaltabi.cxx
+++ b/sc/source/filter/xml/xmlexternaltabi.cxx
@@ -54,7 +54,7 @@ 
ScXMLExternalRefTabSourceContext::ScXMLExternalRefTabSourceContext(
 {
 sax_fastparser::FastAttributeList 

[Libreoffice-commits] core.git: include/sax sax/source

2017-06-01 Thread Noel Grandin
 include/sax/fshelper.hxx  |  172 ++
 sax/source/tools/fshelper.cxx |   45 ++
 2 files changed, 118 insertions(+), 99 deletions(-)

New commits:
commit d43fc40718217d89cc95cc3c0bc0b8e7926abcc0
Author: Noel Grandin 
Date:   Thu Jun 1 10:50:49 2017 +0200

convert SAX_ARGS_ARG macros to varargs template methods

Leave the macros in place for now, because there is still more of this
stuff in sc/../xestream.hxx

Change-Id: I633e12ee572010823e0a223b529a07b00e707b78
Reviewed-on: https://gerrit.libreoffice.org/38295
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index 25c31550a079..c393240d212a 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -75,41 +75,119 @@ public:
 ~FastSerializerHelper();
 
 /// Start an element. After the first argument there can be a number of 
(attribute, value) pairs.
-void startElement(sal_Int32 elementTokenId, FSEND_t)
-{ startElementInternal( elementTokenId, FSEND_internal ); }
-/// overload
+template
+void startElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
char* value, Args... args)
+{
+if (value)
+pushAttributeValue(attribute, value);
+startElement(elementTokenId, args...);
+}
 void startElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
char* value, FSEND_t)
-{ startElementInternal( elementTokenId, attribute, value, 
FSEND_internal ); }
-/// overload
+{
+if (value)
+pushAttributeValue(attribute, value);
+startElement(elementTokenId, FSEND);
+}
+template
+void startElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
OString& value, Args... args)
+{
+pushAttributeValue(attribute, value);
+startElement(elementTokenId, args...);
+}
 void startElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
OString& value, FSEND_t)
-{ startElementInternal( elementTokenId, attribute, value.getStr(), 
FSEND_internal ); }
-/// Create a single element. After the first argument there can be a 
number of (attribute, value) pairs.
-void singleElement(sal_Int32 elementTokenId, FSEND_t)
-{ singleElementInternal( elementTokenId, FSEND_internal ); }
-/// overload
-void singleElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
char* value, FSEND_t)
-{ singleElementInternal( elementTokenId, attribute, value, 
FSEND_internal ); }
-/// overload
-void singleElement(sal_Int32 elementTokenId, sal_Int32 attribute, const 
OString& value, FSEND_t)
-{ singleElementInternal( elementTokenId, attribute, value.getStr(), 
FSEND_internal ); }
+{
+pushAttributeValue(attribute, value);
+startElement(elementTokenId, FSEND);
+}
+void startElement(sal_Int32 elementTokenId, FSEND_t);
+
 /// Start an element. After the first two arguments there can be a number 
of (attribute, value) pairs.
-void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
FSEND_t)
-{ startElementInternal( FSNS( namespaceTokenId, elementTokenId), 
FSEND_internal ); }
-/// overload
+template
+void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
sal_Int32 attribute, const char* value, Args... args)
+{
+if (value)
+pushAttributeValue(attribute, value);
+startElementNS(namespaceTokenId, elementTokenId, args...);
+}
 void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
sal_Int32 attribute, const char* value, FSEND_t)
-{ startElementInternal( FSNS( namespaceTokenId, elementTokenId), 
attribute, value, FSEND_internal ); }
-/// overload
+{
+if (value)
+pushAttributeValue(attribute, value);
+startElementNS(namespaceTokenId, elementTokenId, FSEND);
+}
+template
+void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
sal_Int32 attribute, const OString& value, Args... args)
+{
+pushAttributeValue(attribute, value);
+startElementNS(namespaceTokenId, elementTokenId, args...);
+}
 void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
sal_Int32 attribute, const OString& value, FSEND_t)
-{ startElementInternal( FSNS( namespaceTokenId, elementTokenId), 
attribute, value.getStr(), FSEND_internal ); }
+{
+pushAttributeValue(attribute, value);
+startElementNS(namespaceTokenId, elementTokenId, FSEND);
+}
+void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, 
FSEND_t)
+{
+startElement(FSNS(namespaceTokenId, elementTokenId), FSEND);
+}
+
+/// Create a single element. After the first argument there can be a 
number of 

[Libreoffice-commits] core.git: include/sax include/xmloff sc/source xmloff/source

2017-02-10 Thread Mohammed Abdul Azeem
 include/sax/fastattribs.hxx   |6 ++
 include/xmloff/xmltoken.hxx   |4 
 sc/source/filter/xml/xmlbodyi.cxx |2 +-
 sc/source/filter/xml/xmlcelli.cxx |7 +++
 sc/source/filter/xml/xmltabi.cxx  |4 ++--
 xmloff/source/core/xmltoken.cxx   |   11 +++
 6 files changed, 27 insertions(+), 7 deletions(-)

New commits:
commit 32c0ab80aa0dbe105be15c5feee4e3bd7cc5ee25
Author: Mohammed Abdul Azeem 
Date:   Thu Feb 9 20:33:15 2017 +0530

Further modifications to FastAttributeIter:

attempt to further reduce unnecessary allocation and
freeing of OUString.

Change-Id: I85169cfcd2311a5e6a96dc0292ce0686d1b0e43d
Reviewed-on: https://gerrit.libreoffice.org/34092
Reviewed-by: Michael Meeks 
Tested-by: Jenkins 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 112e678..9588990 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -145,6 +145,12 @@ public:
 mrList.AttributeValueLength(mnIdx),
 RTL_TEXTENCODING_UTF8);
 }
+
+const char* toCString()
+{
+assert(mnIdx < mrList.maAttributeTokens.size());
+return mrList.getFastAttributeValue(mnIdx);
+}
 bool isString(const char *str)
 {
 assert(mnIdx < mrList.maAttributeTokens.size());
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 989fa33..70b57d1 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3291,6 +3291,10 @@ namespace xmloff { namespace token {
 XMLOFF_DLLPUBLIC bool IsXMLToken(
 const OUString& rString,
 enum XMLTokenEnum eToken );
+
+XMLOFF_DLLPUBLIC bool IsXMLToken(
+const char* pCString,
+enum XMLTokenEnum eToken );
 } }
 
 #endif
diff --git a/sc/source/filter/xml/xmlbodyi.cxx 
b/sc/source/filter/xml/xmlbodyi.cxx
index bb6ba3f..dcddb22 100644
--- a/sc/source/filter/xml/xmlbodyi.cxx
+++ b/sc/source/filter/xml/xmlbodyi.cxx
@@ -104,7 +104,7 @@ ScXMLBodyContext::ScXMLBodyContext( ScXMLImport& rImport,
 {
 const sal_Int32 nLocalToken = nToken & TOKEN_MASK;
 if( nLocalToken == XML_STRUCTURE_PROTECTED )
-bProtected = IsXMLToken( it.toString(), XML_TRUE );
+bProtected = IsXMLToken( it.toCString(), XML_TRUE );
 else if ( nLocalToken == XML_PROTECTION_KEY )
 sPassword = it.toString();
 else if (  nLocalToken == XML_PROTECTION_KEY_DIGEST_ALGORITHM )
diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index 70b5b74..f5e2ee1 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -258,13 +258,12 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( 
ScXMLImport& rImport,
 {
 if (!it.isEmpty())
 {
-const OUString sValue = it.toString();
-if ( IsXMLToken(sValue, XML_TRUE) )
+if ( IsXMLToken( it.toCString(), XML_TRUE ) )
 fValue = 1.0;
-else if ( IsXMLToken(sValue, XML_FALSE) )
+else if ( IsXMLToken( it.toCString(), XML_FALSE ) )
 fValue = 0.0;
 else
-::sax::Converter::convertDouble(fValue, sValue);
+::sax::Converter::convertDouble(fValue, 
it.toString() );
 bIsEmpty = false;
 }
 }
diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx
index 065ee00..668fbee 100644
--- a/sc/source/filter/xml/xmltabi.cxx
+++ b/sc/source/filter/xml/xmltabi.cxx
@@ -162,7 +162,7 @@ ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport,
 sStyleName = it.toString();
 break;
 case XML_TOK_TABLE_PROTECTED:
-aProtectData.mbProtected = IsXMLToken( it.toString(), 
XML_TRUE );
+aProtectData.mbProtected = IsXMLToken( it.toCString(), 
XML_TRUE );
 break;
 case XML_TOK_TABLE_PRINT_RANGES:
 sPrintRanges = it.toString();
@@ -178,7 +178,7 @@ ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport,
 break;
 case XML_TOK_TABLE_PRINT:
 {
-if (IsXMLToken( it.toString(), XML_FALSE) )
+if (IsXMLToken( it.toCString(), XML_FALSE) )
 bPrintEntireSheet = false;
 }
 break;
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 9aefba0..813c864 100644
--- 

[Libreoffice-commits] core.git: include/sax sc/source

2017-02-08 Thread Mohammed Abdul Azeem
 include/sax/fastattribs.hxx   |   52 
 sc/source/filter/xml/xmlbodyi.cxx |   17 ---
 sc/source/filter/xml/xmlcelli.cxx |   54 ++
 sc/source/filter/xml/xmlrowi.cxx  |   17 ---
 sc/source/filter/xml/xmltabi.cxx  |   23 +++-
 5 files changed, 102 insertions(+), 61 deletions(-)

New commits:
commit 9b724094873d0808f0bd8ddab24adc372ae4e41c
Author: Mohammed Abdul Azeem 
Date:   Tue Feb 7 23:53:43 2017 +0530

Adding an iterator for fastattributes:

This helps to avoid the expensive allocation and
freeing of OUString at some places.

Change-Id: I7d49974ce13799fcf62b989ce5d3c61b01316190
Reviewed-on: https://gerrit.libreoffice.org/34011
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index eeb4064..112e678 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -102,6 +102,58 @@ public:
 virtual css::uno::Sequence< css::xml::Attribute > SAL_CALL 
getUnknownAttributes(  ) override;
 virtual css::uno::Sequence< css::xml::FastAttribute > SAL_CALL 
getFastAttributes() override;
 
+/// Use for fast iteration and conversion of attributes
+class FastAttributeIter {
+const FastAttributeList 
+size_t mnIdx;
+
+public:
+FastAttributeIter(const FastAttributeList , size_t nIdx)
+: mrList(rList), mnIdx(nIdx)
+{
+}
+
+FastAttributeIter& operator++ ()
+{
+mnIdx++;
+return *this;
+}
+bool operator!=( const FastAttributeIter& rhs ) const
+{
+return mnIdx != rhs.mnIdx;
+}
+
+sal_Int32 getToken()
+{
+assert(mnIdx < mrList.maAttributeTokens.size());
+return mrList.maAttributeTokens[mnIdx];
+}
+bool isEmpty()
+{
+assert(mnIdx < mrList.maAttributeTokens.size());
+return mrList.AttributeValueLength(mnIdx) < 1;
+}
+sal_Int32 toInt32()
+{
+assert(mnIdx < mrList.maAttributeTokens.size());
+return rtl_str_toInt32(mrList.getFastAttributeValue(mnIdx), 10);
+}
+OUString toString()
+{
+assert(mnIdx < mrList.maAttributeTokens.size());
+return OUString(mrList.getFastAttributeValue(mnIdx),
+mrList.AttributeValueLength(mnIdx),
+RTL_TEXTENCODING_UTF8);
+}
+bool isString(const char *str)
+{
+assert(mnIdx < mrList.maAttributeTokens.size());
+return !strcmp(str, mrList.getFastAttributeValue(mnIdx));
+}
+};
+const FastAttributeIter begin() const { return FastAttributeIter(*this, 
0); }
+const FastAttributeIter end() const { return FastAttributeIter(*this, 
maAttributeTokens.size()); }
+
 private:
 sal_Char *mpChunk; ///< buffer to store all attribute values - null 
terminated strings
 sal_Int32 mnChunkLength; ///< size of allocated memory for mpChunk
diff --git a/sc/source/filter/xml/xmlbodyi.cxx 
b/sc/source/filter/xml/xmlbodyi.cxx
index 486cea5..bb6ba3f 100644
--- a/sc/source/filter/xml/xmlbodyi.cxx
+++ b/sc/source/filter/xml/xmlbodyi.cxx
@@ -97,28 +97,25 @@ ScXMLBodyContext::ScXMLBodyContext( ScXMLImport& rImport,
 assert( dynamic_cast< sax_fastparser::FastAttributeList *>( 
xAttrList.get() ) != nullptr );
 pAttribList = static_cast< sax_fastparser::FastAttributeList *>( 
xAttrList.get() );
 
-const std::vector< sal_Int32 >& rAttrList = 
pAttribList->getFastAttributeTokens();
-for ( size_t i = 0; i < rAttrList.size(); i++ )
+for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
 {
-sal_Int32 nToken = rAttrList[ i ];
-const OUString sValue = OUString(pAttribList->getFastAttributeValue(i),
-pAttribList->AttributeValueLength(i), 
RTL_TEXTENCODING_UTF8);
+sal_Int32 nToken = it.getToken();
 if( NAMESPACE_TOKEN( XML_NAMESPACE_TABLE ) == ( nToken & NMSP_MASK ) )
 {
 const sal_Int32 nLocalToken = nToken & TOKEN_MASK;
 if( nLocalToken == XML_STRUCTURE_PROTECTED )
-bProtected = IsXMLToken(sValue, XML_TRUE);
+bProtected = IsXMLToken( it.toString(), XML_TRUE );
 else if ( nLocalToken == XML_PROTECTION_KEY )
-sPassword = sValue;
+sPassword = it.toString();
 else if (  nLocalToken == XML_PROTECTION_KEY_DIGEST_ALGORITHM )
-meHash1 = ScPassHashHelper::getHashTypeFromURI( sValue );
+meHash1 = ScPassHashHelper::getHashTypeFromURI( it.toString() 
);
 else if (  nLocalToken == 

[Libreoffice-commits] core.git: include/sax include/xmloff include/xmlscript

2016-12-06 Thread Jochen Nitschke
 include/sax/fastattribs.hxx  |4 ++--
 include/xmloff/XMLEmbeddedObjectExportFilter.hxx |4 ++--
 include/xmloff/fasttokenhandler.hxx  |4 ++--
 include/xmloff/xmlexp.hxx|4 ++--
 include/xmloff/xmlictxt.hxx  |4 ++--
 include/xmloff/xmlimp.hxx|4 ++--
 include/xmloff/xmlmetae.hxx  |4 ++--
 include/xmlscript/xml_helper.hxx |4 ++--
 8 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit bd3402ba43c6e028e90d6bf6d829ebc72d6ebcd4
Author: Jochen Nitschke 
Date:   Tue Dec 6 14:24:17 2016 +0100

tdf#88206 replace cppu::WeakImplHelper* in sax and xml*

Change-Id: I75f4000a17155fbdff96fe0733dc0225b20cd4d2
Reviewed-on: https://gerrit.libreoffice.org/31678
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 0349ebd..3b17dee 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -25,7 +25,7 @@
 #include 
 #include 
 
-#include 
+#include 
 #include 
 
 #include 
@@ -70,7 +70,7 @@ class SAX_DLLPUBLIC FastTokenHandlerBase
  const char *pStr, size_t nLength );
 };
 
-class SAX_DLLPUBLIC FastAttributeList : public ::cppu::WeakImplHelper1< 
css::xml::sax::XFastAttributeList >
+class SAX_DLLPUBLIC FastAttributeList : public cppu::WeakImplHelper< 
css::xml::sax::XFastAttributeList >
 {
 public:
 FastAttributeList( const css::uno::Reference< 
css::xml::sax::XFastTokenHandler >& xTokenHandler,
diff --git a/include/xmloff/XMLEmbeddedObjectExportFilter.hxx 
b/include/xmloff/XMLEmbeddedObjectExportFilter.hxx
index 5a90419..57354bb 100644
--- a/include/xmloff/XMLEmbeddedObjectExportFilter.hxx
+++ b/include/xmloff/XMLEmbeddedObjectExportFilter.hxx
@@ -23,9 +23,9 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
-class XMLEmbeddedObjectExportFilter : public ::cppu::WeakImplHelper3<
+class XMLEmbeddedObjectExportFilter : public cppu::WeakImplHelper<
  css::xml::sax::XExtendedDocumentHandler,
  css::lang::XServiceInfo,
  css::lang::XInitialization>
diff --git a/include/xmloff/fasttokenhandler.hxx 
b/include/xmloff/fasttokenhandler.hxx
index ec6ac79..92ce6e1 100644
--- a/include/xmloff/fasttokenhandler.hxx
+++ b/include/xmloff/fasttokenhandler.hxx
@@ -11,7 +11,7 @@
 #define INCLUDED_XMLOFF_FASTTOKENHANDLER_HXX
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -59,7 +59,7 @@ private:
 
 struct StaticTokenMap : public rtl::Static< TokenMap, StaticTokenMap > {};
 
-class XMLOFF_DLLPUBLIC FastTokenHandler : public cppu::WeakImplHelper1<
+class XMLOFF_DLLPUBLIC FastTokenHandler : public cppu::WeakImplHelper<
 css::xml::sax::XFastTokenHandler >,
 public sax_fastparser::FastTokenHandlerBase
 {
diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx
index 29022f4..96a1ded 100644
--- a/include/xmloff/xmlexp.hxx
+++ b/include/xmloff/xmlexp.hxx
@@ -57,7 +57,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -108,7 +108,7 @@ namespace o3tl
 template<> struct typed_flags : 
is_typed_flags {};
 }
 
-class XMLOFF_DLLPUBLIC SvXMLExport : public ::cppu::WeakImplHelper6<
+class XMLOFF_DLLPUBLIC SvXMLExport : public cppu::WeakImplHelper<
  css::document::XFilter,
  css::lang::XServiceInfo,
  css::document::XExporter,
diff --git a/include/xmloff/xmlictxt.hxx b/include/xmloff/xmlictxt.hxx
index 6d24112..d7a1caf 100644
--- a/include/xmloff/xmlictxt.hxx
+++ b/include/xmloff/xmlictxt.hxx
@@ -27,14 +27,14 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
 class SvXMLNamespaceMap;
 class SvXMLImport;
 
-class XMLOFF_DLLPUBLIC SvXMLImportContext : public ::cppu::WeakImplHelper1< 
::css::xml::sax::XFastContextHandler >
+class XMLOFF_DLLPUBLIC SvXMLImportContext : public cppu::WeakImplHelper< 
css::xml::sax::XFastContextHandler >
 {
 friend class SvXMLImport;
 
diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index f4ed9fd..e4b7cd5 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -50,7 +50,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -136,7 +136,7 @@ public:
 };
 
 
-class XMLOFF_DLLPUBLIC SvXMLImport : public ::cppu::WeakImplHelper8<
+class XMLOFF_DLLPUBLIC SvXMLImport : public cppu::WeakImplHelper<
  css::xml::sax::XExtendedDocumentHandler,
  css::xml::sax::XFastDocumentHandler,
  css::lang::XServiceInfo,
diff --git a/include/xmloff/xmlmetae.hxx b/include/xmloff/xmlmetae.hxx
index 7cb1813..684163f 100644
--- a/include/xmloff/xmlmetae.hxx
+++ b/include/xmloff/xmlmetae.hxx
@@ -24,7 +24,7 @@
 #include 
 #include 
 
-#include 
+#include 

[Libreoffice-commits] core.git: include/sax sax/source sw/qa sw/source

2016-10-28 Thread Tamás Zolnai
 include/sax/fshelper.hxx  |2 +-
 sax/source/tools/fastserializer.cxx   |6 +-
 sw/qa/extras/ooxmlexport/data/tdf103544.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx |   15 +++
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |4 ++--
 sw/source/filter/ww8/docxattributeoutput.cxx  |5 +
 6 files changed, 20 insertions(+), 12 deletions(-)

New commits:
commit b927c1f4b334f80d2c2965e5b7327d6b6a685105
Author: Tamás Zolnai 
Date:   Fri Oct 28 15:24:51 2016 +

tdf#103544: DOCX exp.: Image loss when have a frame anchored to the same 
para.

Regression from:
83d51e5e52688c4c9bc0ad70a511458bb06a242d

Partly revert the commit causes this regression.
I checked the related bugs (tdf#78590,tdf#80748)
intended to be fixed by this commit and reverting
this part does not bring back the corruption.
I guess something changed in frames' and text boxes'
import in the meantime, because this MergeMarks::IGNORE
is useless now.

Change-Id: If17776e8628561961c7ce2a2994e3fc609f75639
Reviewed-on: https://gerrit.libreoffice.org/30351
Reviewed-by: Tamás Zolnai 
Tested-by: Tamás Zolnai 

diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index badbc29..fd9b856 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -60,7 +60,7 @@ const sal_Int32 FSEND_internal = -1; // same as 
XML_TOKEN_INVALID
 
 namespace sax_fastparser {
 
-enum class MergeMarks { APPEND = 0, PREPEND = 1, POSTPONE = 2, IGNORE = 3 };
+enum class MergeMarks { APPEND = 0, PREPEND = 1, POSTPONE = 2};
 
 typedef css::uno::Reference< css::xml::sax::XFastAttributeList > 
XFastAttributeListRef;
 
diff --git a/sax/source/tools/fastserializer.cxx 
b/sax/source/tools/fastserializer.cxx
index 49ed24b..620fe68 100644
--- a/sax/source/tools/fastserializer.cxx
+++ b/sax/source/tools/fastserializer.cxx
@@ -405,7 +405,7 @@ namespace sax_fastparser {
 // flush, so that we get everything in getData()
 maCachedOutputStream.flush();
 
-if (maMarkStack.size() == 1 && eMergeType != MergeMarks::IGNORE)
+if (maMarkStack.size() == 1)
 {
 #ifdef DBG_UTIL
 while (!maMarkStack.top()->m_DebugEndedElements.empty())
@@ -469,8 +469,6 @@ namespace sax_fastparser {
 topDebugEndedElements,
 topDebugStartedElements);
 break;
-case MergeMarks::IGNORE:
-break;
 }
 #endif
 if (maMarkStack.empty())
@@ -488,8 +486,6 @@ namespace sax_fastparser {
 case MergeMarks::APPEND:   maMarkStack.top()->append( aMerge );   
break;
 case MergeMarks::PREPEND:  maMarkStack.top()->prepend( aMerge );  
break;
 case MergeMarks::POSTPONE: maMarkStack.top()->postpone( aMerge ); 
break;
-case MergeMarks::IGNORE:   break;
-
 }
 }
 
diff --git a/sw/qa/extras/ooxmlexport/data/tdf103544.docx 
b/sw/qa/extras/ooxmlexport/data/tdf103544.docx
new file mode 100644
index 000..2e18f21
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf103544.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 7800cd3..5ee0ff4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 
 class Test : public SwModelTestBase
 {
@@ -68,6 +69,20 @@ DECLARE_OOXMLEXPORT_TEST(testTdf84678, "tdf84678.docx")
 // This was 0, left margin inside a shape+text wasn't imported from DOCX.
 // 36 EMU, but layout uses twips.
 CPPUNIT_ASSERT_EQUAL(static_cast(567), 
parseDump("/root/page/body/txt/anchored/fly/infos/prtBounds", 
"left").toInt32());
+
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf103544, "tdf103544.docx")
+{
+// We have two shapes: a frame and an image
+uno::Reference xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xDrawPage = 
xDrawPageSupplier->getDrawPage();
+CPPUNIT_ASSERT_EQUAL(static_cast(2), xDrawPage->getCount());
+
+// Image was lost because of the frame export
+uno::Reference xImage(getShape(1), uno::UNO_QUERY);
+auto xGraphic = getProperty(xImage, 
"Graphic");
+CPPUNIT_ASSERT(xGraphic.is());
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 39a2274..fa5f9df 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -498,8 +498,8 @@ DECLARE_OOXMLEXPORT_TEST(testFDO78590, "FDO78590.docx")
 return;
 
 // This is to ensure that the fld starts and ends inside a hyperlink...
-assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:framePr", "w", 
"9851" );
-

[Libreoffice-commits] core.git: include/sax sax/qa sax/source

2016-07-19 Thread Mohammed Abdul Azeem
 include/sax/fastparser.hxx |   10 +++-
 sax/qa/cppunit/xmlimport.cxx   |   33 +++--
 sax/qa/data/manifestwithnsdecl.xml |   12 ++
 sax/qa/data/manifestwithoutnsdecl.xml  |   12 ++
 sax/source/fastparser/fastparser.cxx   |   25 -
 sax/source/fastparser/legacyfastparser.cxx |5 +++-
 6 files changed, 90 insertions(+), 7 deletions(-)

New commits:
commit 3aa52d36824d11b8774de15708fdfcbb93cd9dc3
Author: Mohammed Abdul Azeem 
Date:   Mon Jul 18 13:17:19 2016 +0530

GSOC - Handling namespace declaration missing case:

initialization parameter to FastParser will turn off
the namespace declaration missing exception. Test cases
have also been given to verify the same.

Change-Id: I4c3e02c7ad92d50e279f895ced53c78fc8f49b91
Reviewed-on: https://gerrit.libreoffice.org/27278
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/include/sax/fastparser.hxx b/include/sax/fastparser.hxx
index 3ddba58..85eaf30 100644
--- a/include/sax/fastparser.hxx
+++ b/include/sax/fastparser.hxx
@@ -22,7 +22,9 @@
 
 #include 
 #include 
-#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -42,7 +44,8 @@ class FastSaxParserImpl;
 
 // This class implements the external Parser interface
 class FASTSAX_DLLPUBLIC FastSaxParser
-: public ::cppu::WeakImplHelper2<
+: public ::cppu::WeakImplHelper<
+css::lang::XInitialization,
 css::xml::sax::XFastParser,
 css::lang::XServiceInfo >
 {
@@ -52,6 +55,9 @@ public:
 FastSaxParser();
 virtual ~FastSaxParser();
 
+// css::lang::XInitialization:
+virtual void SAL_CALL initialize(css::uno::Sequence const& 
rArguments) throw (css::uno::RuntimeException, css::uno::Exception, 
std::exception) override;
+
 // XFastParser
 virtual void SAL_CALL parseStream( const css::xml::sax::InputSource& 
aInputSource ) throw (css::xml::sax::SAXException, css::io::IOException, 
css::uno::RuntimeException, std::exception) override;
 virtual void SAL_CALL setFastDocumentHandler( const css::uno::Reference< 
css::xml::sax::XFastDocumentHandler >& Handler ) throw 
(css::uno::RuntimeException, std::exception) override;
diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx
index c0320fc..f7fcd73 100644
--- a/sax/qa/cppunit/xmlimport.cxx
+++ b/sax/qa/cppunit/xmlimport.cxx
@@ -278,10 +278,12 @@ public:
 
 XMLImportTest() : BootstrapFixture(true, false) {}
 void parse();
+void testMissingNamespaceDeclaration();
 void testIllegalNamespaceUse();
 
 CPPUNIT_TEST_SUITE( XMLImportTest );
 CPPUNIT_TEST( parse );
+CPPUNIT_TEST( testMissingNamespaceDeclaration );
 CPPUNIT_TEST( testIllegalNamespaceUse );
 CPPUNIT_TEST_SUITE_END();
 };
@@ -317,11 +319,11 @@ void XMLImportTest::parse()
 
 source.aInputStream = createStreamFromFile( m_sDirPath + fileNames[i] 
);
 m_xParser->parseStream(source);
-const OUString& rParserStr = m_xDocumentHandler->getString();
+const OUString rParserStr = m_xDocumentHandler->getString();
 
 source.aInputStream = createStreamFromFile( m_sDirPath + fileNames[i] 
);
 m_xLegacyFastParser->parseStream(source);
-const OUString& rLegacyFastParserStr = m_xDocumentHandler->getString();
+const OUString rLegacyFastParserStr = m_xDocumentHandler->getString();
 
 CPPUNIT_ASSERT_EQUAL( rParserStr, rLegacyFastParserStr );
 // OString o = OUStringToOString( Str, RTL_TEXTENCODING_ASCII_US );
@@ -329,6 +331,33 @@ void XMLImportTest::parse()
 }
 }
 
+void XMLImportTest::testMissingNamespaceDeclaration()
+{
+OUString fileNames[] = { "manifestwithnsdecl.xml", 
"manifestwithoutnsdecl.xml" };
+
+uno::Reference const xInit(m_xLegacyFastParser,
+uno::UNO_QUERY_THROW);
+uno::Sequence args(1);
+args[0] <<= OUString("IgnoreMissingNSDecl");
+xInit->initialize( args );
+
+for (sal_uInt16 i = 0; i < sizeof( fileNames ) / sizeof( OUString ); i++)
+{
+InputSource source;
+source.sSystemId= "internal";
+
+source.aInputStream = createStreamFromFile( m_sDirPath + fileNames[i] 
);
+m_xParser->parseStream(source);
+const OUString rParserStr = m_xDocumentHandler->getString();
+
+source.aInputStream = createStreamFromFile( m_sDirPath + fileNames[i] 
);
+m_xLegacyFastParser->parseStream(source);
+const OUString rLegacyFastParserStr = m_xDocumentHandler->getString();
+
+CPPUNIT_ASSERT_EQUAL( rParserStr, rLegacyFastParserStr );
+}
+}
+
 void XMLImportTest::testIllegalNamespaceUse()
 {
 rtl::Reference< NSDocumentHandler > m_xNSDocumentHandler;
diff --git a/sax/qa/data/manifestwithnsdecl.xml 

[Libreoffice-commits] core.git: include/sax sax/source sw/source

2014-07-03 Thread Rohit Deshmukh
 include/sax/fshelper.hxx |2 
 sax/source/tools/fastserializer.cxx  |4 +
 sw/source/filter/ww8/docxattributeoutput.cxx |   81 +--
 sw/source/filter/ww8/docxattributeoutput.hxx |2 
 4 files changed, 57 insertions(+), 32 deletions(-)

New commits:
commit 83d51e5e52688c4c9bc0ad70a511458bb06a242d
Author: Rohit Deshmukh rohit.deshm...@synerzip.com
Date:   Tue Jul 1 21:24:24 2014 +0530

fdo#80748: Fix for file corruption due to framePr

 -For framePr Unit test is there in ooxmlexport.cxx

-http://opengrok.libreoffice.org/xref/core/sw/qa/extras/ooxmlexport/ooxmlexport.cxx#3578

Change-Id: Ic1fd4c7a863d8ab57c6495e20bff6863eb941688
Reviewed-on: https://gerrit.libreoffice.org/10045
Reviewed-by: Miklos Vajna vmik...@collabora.co.uk
Tested-by: Miklos Vajna vmik...@collabora.co.uk

diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index e3d3f05..8a9f1cc 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -62,7 +62,7 @@ const sal_Int32 FSEND_internal = -1; // same as 
XML_TOKEN_INVALID
 
 namespace sax_fastparser {
 
-enum MergeMarksEnum { MERGE_MARKS_APPEND = 0, MERGE_MARKS_PREPEND = 1, 
MERGE_MARKS_POSTPONE = 2 };
+enum MergeMarksEnum { MERGE_MARKS_APPEND = 0, MERGE_MARKS_PREPEND = 1, 
MERGE_MARKS_POSTPONE = 2, MERGE_MARKS_IGNORE = 3 };
 
 typedef ::com::sun::star::uno::Reference 
::com::sun::star::xml::sax::XFastAttributeList  XFastAttributeListRef;
 
diff --git a/sax/source/tools/fastserializer.cxx 
b/sax/source/tools/fastserializer.cxx
index 1eea16e..fbce18a 100644
--- a/sax/source/tools/fastserializer.cxx
+++ b/sax/source/tools/fastserializer.cxx
@@ -291,7 +291,7 @@ namespace sax_fastparser {
 if ( maMarkStack.empty() )
 return;
 
-if ( maMarkStack.size() == 1 )
+if ( maMarkStack.size() == 1   eMergeType != MERGE_MARKS_IGNORE)
 {
 mxOutputStream-writeBytes( maMarkStack.top()-getData() );
 maMarkStack.pop();
@@ -306,6 +306,8 @@ namespace sax_fastparser {
 case MERGE_MARKS_APPEND:   maMarkStack.top()-append( aMerge );   
break;
 case MERGE_MARKS_PREPEND:  maMarkStack.top()-prepend( aMerge );  
break;
 case MERGE_MARKS_POSTPONE: maMarkStack.top()-postpone( aMerge ); 
break;
+case MERGE_MARKS_IGNORE  :  break;
+
 }
 }
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1ff9d84..ebe556d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -329,11 +329,9 @@ void DocxAttributeOutput::PopulateFrameProperties(const 
SwFrmFmt* pFrmFmt, const
 relativeFromV = page;
 break;
 case text::RelOrientation::FRAME:
-relativeFromV = paragraph;
-break;
 case text::RelOrientation::TEXT_LINE:
 default:
-relativeFromV = line;
+relativeFromV = text;
 break;
 }
 
@@ -346,19 +344,31 @@ void DocxAttributeOutput::PopulateFrameProperties(const 
SwFrmFmt* pFrmFmt, const
 relativeFromH = page;
 break;
 case text::RelOrientation::CHAR:
-relativeFromH = character;
-break;
 case text::RelOrientation::PAGE_RIGHT:
-relativeFromH = page;
-break;
 case text::RelOrientation::FRAME:
 default:
-relativeFromH = column;
+relativeFromH = text;
 break;
 }
+
+switch (pFrmFmt-GetSurround().GetValue())
+{
+case SURROUND_NONE:
+attrList-add( FSNS( XML_w, XML_wrap), none);
+break;
+case SURROUND_THROUGHT:
+attrList-add( FSNS( XML_w, XML_wrap), through);
+break;
+case SURROUND_PARALLEL:
+attrList-add( FSNS( XML_w, XML_wrap), notBeside);
+break;
+case SURROUND_IDEAL:
+default:
+attrList-add( FSNS( XML_w, XML_wrap), auto);
+break;
+}
 attrList-add( FSNS( XML_w, XML_vAnchor), relativeFromV);
 attrList-add( FSNS( XML_w, XML_hAnchor), relativeFromH);
-attrList-add( FSNS( XML_w, XML_wrap), notBeside);
 attrList-add( FSNS( XML_w, XML_hRule), exact);
 
 sax_fastparser::XFastAttributeListRef xAttrList(attrList);
@@ -399,7 +409,7 @@ void DocxAttributeOutput::EndParagraph( 
ww8::WW8TableNodeInfoInner::Pointer_t pT
 {
 // write the paragraph properties + the run, already in the correct order
 m_pSerializer-mergeTopMarks();
-
+std::vector  boost::shared_ptr sw::Frame  aFramePrTextbox;
 // Write the anchored frame if any
 // Word can't handle nested text boxes, so write them on the same level.
 ++m_nTextFrameLevel;
@@ -411,12 +421,11 @@ void DocxAttributeOutput::EndParagraph( 
ww8::WW8TableNodeInfoInner::Pointer_t pT
 {
 m_bParagraphFrameOpen = true;
 sw::Frame aFrame = 

[Libreoffice-commits] core.git: include/sax sax/source

2013-12-02 Thread Kohei Yoshida
 include/sax/fastparser.hxx   |  121 -
 sax/source/fastparser/fastparser.cxx |  424 ++-
 2 files changed, 330 insertions(+), 215 deletions(-)

New commits:
commit 4afa538b7b02b0591bba129051a0a516a70fef31
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Mon Dec 2 23:02:05 2013 -0500

Hide the implementation.

Change-Id: Ibfd9bf626a40c3ec4eb18d09944e8943163595c8

diff --git a/include/sax/fastparser.hxx b/include/sax/fastparser.hxx
index 217893c..578b114 100644
--- a/include/sax/fastparser.hxx
+++ b/include/sax/fastparser.hxx
@@ -20,91 +20,31 @@
 #ifndef INCLUDED_SAX_FASTPARSER_HXX
 #define INCLUDED_SAX_FASTPARSER_HXX
 
-#include queue
-#include vector
-#include stack
-#include boost/optional.hpp
-#include boost/shared_ptr.hpp
-#include boost/unordered_map.hpp
-#include osl/conditn.hxx
-#include rtl/ref.hxx
-#include com/sun/star/xml/sax/XFastContextHandler.hpp
-#include com/sun/star/xml/sax/XFastDocumentHandler.hpp
 #include com/sun/star/xml/sax/XFastParser.hpp
-#include com/sun/star/xml/sax/XFastTokenHandler.hpp
 #include com/sun/star/lang/XServiceInfo.hpp
 #include cppuhelper/implbase2.hxx
 
-#include expat.h
 #include saxdllapi.h
 
-#include sax/fastattribs.hxx
+namespace com { namespace sun { namespace star { namespace xml { namespace sax 
{
 
-namespace sax_fastparser {
-
-struct Event;
-class FastLocatorImpl;
-struct NamespaceDefine;
-struct Entity;
-
-typedef ::boost::shared_ptr NamespaceDefine  NamespaceDefineRef;
-
-typedef ::boost::unordered_map OUString, sal_Int32,
-OUStringHash, ::std::equal_to OUString   NamespaceMap;
-
-struct SAX_DLLPUBLIC NameWithToken
-{
-OUString msName;
-sal_Int32 mnToken;
-
-NameWithToken(const OUString sName, const sal_Int32 nToken);
-};
+class XFastContextHandler;
+class XFastDocumentHandler;
+class XFastTokenHandler;
 
-typedef std::vectorEvent EventList;
+}
 
-enum CallbackType { INVALID, START_ELEMENT, END_ELEMENT, CHARACTERS, DONE, 
EXCEPTION };
-
-struct Event
-{
-OUString msChars;
-sal_Int32 mnElementToken;
-OUString msNamespace;
-OUString msElementName;
-rtl::Reference FastAttributeList  mxAttributes;
-CallbackType maType;
-};
-
-// 
-
-struct SaxContext
-{
-::com::sun::star::uno::Reference 
::com::sun::star::xml::sax::XFastContextHandler  mxContext;
-sal_Int32   mnElementToken;
-boost::optional OUString  maNamespace;
-boost::optional OUString  maElementName;
-SaxContext( sal_Int32 nElementToken, const OUString aNamespace, const 
OUString aElementName );
-};
+namespace sax_fastparser {
 
 // 
 
-struct SAX_DLLPUBLIC ParserData
-{
-::com::sun::star::uno::Reference 
::com::sun::star::xml::sax::XFastDocumentHandler  mxDocumentHandler;
-::com::sun::star::uno::Reference 
::com::sun::star::xml::sax::XFastTokenHandler mxTokenHandler;
-FastTokenHandlerBase *mpTokenHandler;
-::com::sun::star::uno::Reference 
::com::sun::star::xml::sax::XErrorHandler mxErrorHandler;
-::com::sun::star::uno::Reference 
::com::sun::star::xml::sax::XEntityResolver   mxEntityResolver;
-::com::sun::star::lang::Locale  maLocale;
-
-ParserData();
-~ParserData();
-};
-
-// 
+class FastSaxParserImpl;
 
 // This class implements the external Parser interface
 class SAX_DLLPUBLIC FastSaxParser : public ::cppu::WeakImplHelper2 
::com::sun::star::xml::sax::XFastParser, ::com::sun::star::lang::XServiceInfo 
 {
+FastSaxParserImpl* mpImpl;
+
 public:
 FastSaxParser();
 virtual ~FastSaxParser();
@@ -127,50 +67,7 @@ public:
 virtual sal_Bool SAL_CALL supportsService( const OUString ServiceName ) 
throw (::com::sun::star::uno::RuntimeException);
 virtual ::com::sun::star::uno::Sequence OUString  SAL_CALL 
getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
 
-// called by the C callbacks of the expat parser
-void callbackStartElement( const XML_Char* name, const XML_Char** atts );
-void callbackEndElement( const XML_Char* name );
-void callbackCharacters( const XML_Char* s, int nLen );
-int  callbackExternalEntityRef( XML_Parser parser, const XML_Char 
*openEntityNames, const XML_Char *base, const XML_Char *systemId, const 
XML_Char *publicId);
-void callbackEntityDecl(const XML_Char *entityName, int 
is_parameter_entity,
-const XML_Char *value, int value_length, const XML_Char *base,
-const XML_Char *systemId, const XML_Char *publicId,
-const XML_Char *notationName);
-
-void pushEntity( const Entity rEntity );
-void popEntity();
-Entity getEntity();
-const Entity getEntity() const;
-void parse();
-void produce( CallbackType aType );
-
 bool hasNamespaceURL( const 

[Libreoffice-commits] core.git: include/sax sax/source

2013-11-27 Thread Michael Meeks
 include/sax/fastattribs.hxx  |2 +-
 sax/source/tools/fastattribs.cxx |5 +
 2 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit bc90fb9e3072d751158a8ea0ca0a893d271b8973
Author: Michael Meeks michael.me...@collabora.com
Date:   Wed Nov 27 09:47:40 2013 +

fastparser: Outline virtual destructor to please MSVC++.

Change-Id: I8368698e80e5ebe339b822a9e0e767e8ba867e07

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index f1f64dd..bb1b93d 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -53,7 +53,7 @@ typedef std::vector UnknownAttribute  UnknownAttributeList;
 class SAX_DLLPUBLIC FastTokenHandlerBase
 {
 public:
-virtual ~FastTokenHandlerBase() {}
+virtual ~FastTokenHandlerBase();
 virtual sal_Int32 getTokenDirect( const char *pToken, sal_Int32 
nLength ) const = 0;
 };
 
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index bc63b3e..595c736 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -27,6 +27,11 @@ using namespace ::com::sun::star::xml::sax;
 namespace sax_fastparser
 {
 
+// wasteage to keep MSVC happy vs. an in-line {}
+FastTokenHandlerBase::FastTokenHandlerBase()
+{
+}
+
 UnknownAttribute::UnknownAttribute( const OUString rNamespaceURL, const 
OString rName, const sal_Char* pValue )
 : maNamespaceURL( rNamespaceURL ), maName( rName ), maValue( pValue )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/sax sax/source

2013-11-19 Thread Michael Meeks
 include/sax/fastattribs.hxx  |   13 
 sax/source/fastparser/fastparser.cxx |   27 -
 sax/source/fastparser/fastparser.hxx |4 --
 sax/source/tools/fastattribs.cxx |   55 +--
 4 files changed, 62 insertions(+), 37 deletions(-)

New commits:
commit fc25afaa048033940d9e1d22ec8ba31c5b3e9289
Author: Michael Meeks michael.me...@collabora.com
Date:   Tue Nov 19 20:51:35 2013 +

fastparser: accelerate value tokenisation as well.

Change-Id: I99a39e91c684adb1fc92cdb466477cfa90104961

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index f4a9392..c780603 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -49,6 +49,18 @@ struct UnknownAttribute
 
 typedef std::vector UnknownAttribute  UnknownAttributeList;
 
+/// avoid constantly allocating and freeing sequences.
+class SAX_DLLPUBLIC FastTokenLookup
+{
+static const int mnUtf8BufferSize = 128;
+::css::uno::Sequence sal_Int8  maUtf8Buffer;
+public:
+FastTokenLookup();
+sal_Int32 getTokenFromChars(
+const ::css::uno::Reference ::css::xml::sax::XFastTokenHandler  
mxTokenHandler,
+const char *pStr, size_t nLength = 0 );
+};
+
 class SAX_DLLPUBLIC FastAttributeList : public ::cppu::WeakImplHelper1 
::com::sun::star::xml::sax::XFastAttributeList 
 {
 public:
@@ -83,6 +95,7 @@ private:
 std::vector sal_Int32  maAttributeTokens;
 UnknownAttributeList maUnknownAttributes;
 ::com::sun::star::uno::Reference 
::com::sun::star::xml::sax::XFastTokenHandler  mxTokenHandler;
+FastTokenLookup maTokenLookup;
 };
 
 }
diff --git a/sax/source/fastparser/fastparser.cxx 
b/sax/source/fastparser/fastparser.cxx
index 5d64a10..8f68051 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -348,7 +348,6 @@ Event Entity::getEvent( CallbackType aType )
 FastSaxParser::FastSaxParser()
 {
 mxDocumentLocator.set( new FastLocatorImpl( this ) );
-maUtf8Buffer.realloc( mnUtf8BufferSize );
 }
 
 // 
@@ -381,31 +380,7 @@ void FastSaxParser::DefineNamespace( const OString 
rPrefix, const sal_Char* pNa
 
 sal_Int32 FastSaxParser::GetToken( const sal_Char* pToken, sal_Int32 nLen /* = 
0 */ )
 {
-sal_Int32 nRet;
-
-if( !nLen )
-nLen = strlen( pToken );
-
-if ( nLen  mnUtf8BufferSize )
-{
-// Get intimiate with the underlying sequence cf. sal/types.h
-sal_Sequence *pSeq = maUtf8Buffer.get();
-
-sal_Int32 nPreRefCount = pSeq-nRefCount;
-
-pSeq-nElements = nLen;
-memcpy( pSeq-elements, pToken, nLen );
-nRet = getEntity().mxTokenHandler-getTokenFromUTF8( maUtf8Buffer );
-
-(void)nPreRefCount; // for non-debug mode.
-assert( pSeq-nRefCount == nPreRefCount ); // callee must not take ref.
-}
-else
-{
-Sequence sal_Int8  aSeq( (sal_Int8*)pToken, nLen ); // heap allocate 
 free
-nRet = getEntity().mxTokenHandler-getTokenFromUTF8( aSeq );
-}
-return nRet;
+return maTokenLookup.getTokenFromChars( getEntity().mxTokenHandler, 
pToken, nLen );
 }
 
 // 
diff --git a/sax/source/fastparser/fastparser.hxx 
b/sax/source/fastparser/fastparser.hxx
index 972ce07..35deb0c 100644
--- a/sax/source/fastparser/fastparser.hxx
+++ b/sax/source/fastparser/fastparser.hxx
@@ -222,9 +222,7 @@ private:
 
 ParserData maData;  /// Cached parser configuration 
for next call of parseStream().
 ::std::stack Entity  maEntities;  /// Entity stack for each call of 
parseStream().
-
-static const int mnUtf8BufferSize = 128;
-::css::uno::Sequence sal_Int8  maUtf8Buffer; /// avoid constantly 
re-allocating this
+FastTokenLookup maTokenLookup;
 };
 
 }
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index 3ebab23..c0a92a1 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -114,10 +114,9 @@ sal_Int32 FastAttributeList::getValueToken( ::sal_Int32 
Token ) throw (SAXExcept
 {
 for (size_t i = 0; i  maAttributeTokens.size(); ++i)
 if (maAttributeTokens[i] == Token)
-{
-Sequence sal_Int8  aSeq( (sal_Int8*) mpChunk + 
maAttributeValues[i], AttributeValueLength(i) );
-return mxTokenHandler-getTokenFromUTF8( aSeq );
-}
+return maTokenLookup.getTokenFromChars( mxTokenHandler,
+mpChunk + 
maAttributeValues[ i ],
+AttributeValueLength( i ) 
);
 
 throw SAXException();
 }
@@ -126,10 +125,9 @@ sal_Int32 FastAttributeList::getOptionalValueToken( 
::sal_Int32 Token, ::sal_Int
 {
 for (size_t i = 0; i  maAttributeTokens.size(); ++i)
 if (maAttributeTokens[i] == Token)
-{
-   

[Libreoffice-commits] core.git: include/sax sax/source unusedcode.easy

2013-07-21 Thread Julien Nabet
 include/sax/tools/converter.hxx |6 --
 sax/source/tools/converter.cxx  |   12 
 unusedcode.easy |2 --
 3 files changed, 20 deletions(-)

New commits:
commit 958556ff3cfbfa1cc1022477af1e2bd635cba153
Author: Julien Nabet serval2...@yahoo.fr
Date:   Sun Jul 21 13:03:27 2013 +0200

Remove unused convertDateTimeTZ and convertDateTZ

Change-Id: I177584f6988cf3cb31c5508262d3907ef6be23d7

diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx
index 7d253f3..7126f15 100644
--- a/include/sax/tools/converter.hxx
+++ b/include/sax/tools/converter.hxx
@@ -166,12 +166,6 @@ public:
  sal_Int16 const* pTimeZoneOffset,
bool bAddTimeIf0AM = false );
 
-static void convertDateTZ( OUStringBuffer rBuffer,
-com::sun::star::util::DateWithTimezone const rDate );
-
-static void convertDateTimeTZ( OUStringBuffer rBuffer,
-com::sun::star::util::DateTimeWithTimezone const rDateTime );
-
 /** convert ISO date or dateTime string to util::DateTime */
 static bool parseDateTime( com::sun::star::util::DateTime rDateTime,
  boost::optionalsal_Int16 * pTimeZoneOffset,
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 3954f97..da3d3f1 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -1223,18 +1223,6 @@ lcl_AppendTimezone(OUStringBuffer  i_rBuffer, sal_Int16 
const nOffset)
 }
 }
 
-void Converter::convertDateTZ( OUStringBuffer rBuffer,
-com::sun::star::util::DateWithTimezone const rDate)
-{
-convertDate(rBuffer, rDate.DateInTZ, rDate.Timezone);
-}
-
-void Converter::convertDateTimeTZ( OUStringBuffer rBuffer,
-com::sun::star::util::DateTimeWithTimezone const rDateTime)
-{
-convertDateTime(rBuffer, rDateTime.DateTimeInTZ, rDateTime.Timezone);
-}
-
 /** convert util::Date to ISO date string */
 void Converter::convertDate(
 OUStringBuffer i_rBuffer,
diff --git a/unusedcode.easy b/unusedcode.easy
index 6f80115..243136e 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -153,8 +153,6 @@ 
oox::xls::SheetDataBuffer::writeXfIdRangeListProperties(int, int, oox::xls::ApiC
 oox::xls::StylesBuffer::writeStyleXfToPropertySet(oox::PropertySet, int) const
 oox::xls::WorksheetGlobals::getColumns(oox::ValueRange const) const
 oox::xls::WorksheetGlobals::getRows(oox::ValueRange const) const
-sax::Converter::convertDateTZ(rtl::OUStringBuffer, 
com::sun::star::util::DateWithTimezone const)
-sax::Converter::convertDateTimeTZ(rtl::OUStringBuffer, 
com::sun::star::util::DateTimeWithTimezone const)
 sc::CellTextAttr::CellTextAttr(unsigned short, unsigned char)
 sc::sidebar::CellLineStyleValueSet::GetSelItem()
 sc::sidebar::CellLineStyleValueSet::SetCusEnable(bool)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/sax sax/source

2013-07-15 Thread Michael Stahl
 include/sax/tools/converter.hxx |8 
 sax/source/tools/converter.cxx  |8 
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 4ce40c0b06888cff6bc593669d0fb94139485620
Author: Michael Stahl mst...@redhat.com
Date:   Mon Jul 15 17:56:56 2013 +0200

sax: more s/TimeZone/Timezone/

Change-Id: I9b50e53b131fc835e792c52de6560d77ac454be9

diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx
index 1e89d2c..7d253f3 100644
--- a/include/sax/tools/converter.hxx
+++ b/include/sax/tools/converter.hxx
@@ -38,8 +38,8 @@ namespace com { namespace sun { namespace star {
 namespace util {
 struct Date;
 struct DateTime;
-struct DateWithTimeZone;
-struct DateTimeWithTimeZone;
+struct DateWithTimezone;
+struct DateTimeWithTimezone;
 struct Duration;
 }
 } } }
@@ -167,10 +167,10 @@ public:
bool bAddTimeIf0AM = false );
 
 static void convertDateTZ( OUStringBuffer rBuffer,
-com::sun::star::util::DateWithTimeZone const rDate );
+com::sun::star::util::DateWithTimezone const rDate );
 
 static void convertDateTimeTZ( OUStringBuffer rBuffer,
-com::sun::star::util::DateTimeWithTimeZone const rDateTime );
+com::sun::star::util::DateTimeWithTimezone const rDateTime );
 
 /** convert ISO date or dateTime string to util::DateTime */
 static bool parseDateTime( com::sun::star::util::DateTime rDateTime,
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 911de8a..3954f97 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -22,8 +22,8 @@
 #include com/sun/star/i18n/UnicodeType.hpp
 #include com/sun/star/util/DateTime.hpp
 #include com/sun/star/util/Date.hpp
-#include com/sun/star/util/DateTimeWithTimeZone.hpp
-#include com/sun/star/util/DateWithTimeZone.hpp
+#include com/sun/star/util/DateTimeWithTimezone.hpp
+#include com/sun/star/util/DateWithTimezone.hpp
 #include com/sun/star/util/Duration.hpp
 #include com/sun/star/util/Time.hpp
 #include com/sun/star/uno/Sequence.hxx
@@ -1224,13 +1224,13 @@ lcl_AppendTimezone(OUStringBuffer  i_rBuffer, 
sal_Int16 const nOffset)
 }
 
 void Converter::convertDateTZ( OUStringBuffer rBuffer,
-com::sun::star::util::DateWithTimeZone const rDate)
+com::sun::star::util::DateWithTimezone const rDate)
 {
 convertDate(rBuffer, rDate.DateInTZ, rDate.Timezone);
 }
 
 void Converter::convertDateTimeTZ( OUStringBuffer rBuffer,
-com::sun::star::util::DateTimeWithTimeZone const rDateTime)
+com::sun::star::util::DateTimeWithTimezone const rDateTime)
 {
 convertDateTime(rBuffer, rDateTime.DateTimeInTZ, rDateTime.Timezone);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits