[Libreoffice-commits] core.git: filter/inc filter/source

2018-03-26 Thread Mohammed Abdul Azeem
 filter/inc/svgreader.hxx|7 +++
 filter/source/svg/svgreader.cxx |   10 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit d5903802e2c40d6fccbc322c49b5f9a311551b9b
Author: Mohammed Abdul Azeem 
Date:   Sun Mar 25 12:50:34 2018 +0530

tdf#116467: fix for SVG files being imported as blank

Any SAX-to-SAX transformation, like in this case should
use SvXMLLegacyToFastDocHandler on the left end, as right
end of the pipe is moved to fast Contexts.

Used delegating constructor here, since m_xDocumentHandler
is constant in SVGReader class.

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

diff --git a/filter/inc/svgreader.hxx b/filter/inc/svgreader.hxx
index 29ff6ab4d7e9..3149e1770158 100644
--- a/filter/inc/svgreader.hxx
+++ b/filter/inc/svgreader.hxx
@@ -15,16 +15,23 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace svgi
 {
 
 class SVGReader
 {
+private:
 const css::uno::Reference< css::uno::XComponentContext >m_xContext;
 const css::uno::Reference< css::io::XInputStream >  
m_xInputStream;
 const css::uno::Reference< css::xml::sax::XDocumentHandler >
m_xDocumentHandler;
 
+SVGReader( const css::uno::Reference&  
xContext,
+   const css::uno::Reference< css::io::XInputStream >& 
  xInputStream,
+   const css::uno::Reference< css::xml::sax::XDocumentHandler >& 
xDocumentHandler,
+   SvXMLImport *pFastHandler);
+
 public:
 FILTER_DLLPUBLIC SVGReader( const 
css::uno::Reference&  xContext,
const css::uno::Reference< css::io::XInputStream >& 
  xInputStream,
diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx
index 5227bd072b50..bc78d0cce10a 100644
--- a/filter/source/svg/svgreader.cxx
+++ b/filter/source/svg/svgreader.cxx
@@ -2081,9 +2081,17 @@ static void dumpTree( const 
uno::Reference xElem )
 SVGReader::SVGReader(const uno::Reference& 
xContext,
  const uno::Reference&   
xInputStream,
  const uno::Reference& 
xDocumentHandler) :
+SVGReader(xContext, xInputStream, xDocumentHandler, 
dynamic_cast(xDocumentHandler.get()))
+{
+}
+
+SVGReader::SVGReader(const uno::Reference& 
xContext,
+ const uno::Reference&   
xInputStream,
+ const uno::Reference& 
xDocumentHandler,
+ SvXMLImport *pFastHandler) :
 m_xContext( xContext ),
 m_xInputStream( xInputStream ),
-m_xDocumentHandler( xDocumentHandler )
+m_xDocumentHandler( pFastHandler != nullptr ? new 
SvXMLLegacyToFastDocHandler(pFastHandler) : xDocumentHandler )
 {
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/source

2018-03-20 Thread Mohammed Abdul Azeem
 svx/source/xml/xmlexport.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 2dadf90aa7bb03d895abc05ec93ca116eb9bacbd
Author: Mohammed Abdul Azeem 
Date:   Tue Mar 20 23:52:47 2018 +0530

tdf#116482: Fix for Crash on drawing

Making the drawing layer import to use fastParser.

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

diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx
index 5af7d92cb36d..26574eb02c09 100644
--- a/svx/source/xml/xmlexport.cxx
+++ b/svx/source/xml/xmlexport.cxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -204,6 +205,8 @@ bool SvxDrawingLayerImport( SdrModel* pModel, const 
uno::Reference xFilter( 
xContext->getServiceManager()->createInstanceWithArgumentsAndContext( 
OUString::createFromAscii( pImportService ), aFilterArgs, xContext), UNO_QUERY 
);
+uno::Reference< xml::sax::XFastParser > xFastParser = dynamic_cast<
+xml::sax::XFastParser* >( xFilter.get() );
 DBG_ASSERT( xFilter.is(), "Can't instantiate filter component." );
 
 bRet = false;
@@ -217,7 +220,10 @@ bool SvxDrawingLayerImport( SdrModel* pModel, const 
uno::ReferencesetTargetDocument( xTargetDocument );
 
 // finally, parser the stream
-xParser->parseStream( aParserInput );
+if( xFastParser.is() )
+xFastParser->parseStream( aParserInput );
+else
+xParser->parseStream( aParserInput );
 
 bRet = true;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/xmloff offapi/com reportdesign/source sc/source sdext/CppunitTest_sdext_pdfimport.mk sdext/Executable_pdf2xml.mk sdext/Executable_pdfunzip.mk sdext/Library_pdfi

2018-03-14 Thread Mohammed Abdul Azeem
 include/xmloff/xmlimp.hxx |5 
 include/xmloff/xmlmetai.hxx   |   16 -
 offapi/com/sun/star/xml/dom/XSAXDocumentBuilder2.idl  |4 
 reportdesign/source/filter/xml/xmlfilter.cxx  |   25 +
 reportdesign/source/filter/xml/xmlfilter.hxx  |5 
 sc/source/filter/xml/xmlimprt.cxx |   92 +--
 sc/source/filter/xml/xmlimprt.hxx |8 
 sd/source/filter/xml/sdxmlwrp.cxx |   10 
 sdext/CppunitTest_sdext_pdfimport.mk  |1 
 sdext/Executable_pdf2xml.mk   |1 
 sdext/Executable_pdfunzip.mk  |1 
 sdext/Library_pdfimport.mk|1 
 sdext/source/pdfimport/sax/emitcontext.cxx|3 
 sfx2/source/doc/SfxDocumentMetaData.cxx   |8 
 starmath/source/mathmlimport.cxx  |  124 ++---
 starmath/source/mathmlimport.hxx  |3 
 sw/source/filter/xml/swxml.cxx|8 
 sw/source/filter/xml/xmlimp.cxx   |   90 ---
 sw/source/filter/xml/xmlimp.hxx   |5 
 sw/source/filter/xml/xmlmeta.cxx  |8 
 unoxml/Library_unoxml.mk  |1 
 unoxml/source/dom/saxbuilder.cxx  |  231 +-
 unoxml/source/dom/saxbuilder.hxx  |   25 -
 xmloff/inc/SchXMLImport.hxx   |3 
 xmloff/source/chart/SchXMLImport.cxx  |   41 ++-
 xmloff/source/chart/contexts.cxx  |   44 ++-
 xmloff/source/chart/contexts.hxx  |   17 -
 xmloff/source/core/XMLEmbeddedObjectImportContext.cxx |3 
 xmloff/source/core/xmlimp.cxx |   37 ++
 xmloff/source/draw/sdxmlimp.cxx   |  138 ++
 xmloff/source/draw/sdxmlimp_impl.hxx  |   11 
 xmloff/source/meta/MetaImportComponent.cxx|   21 -
 xmloff/source/meta/xmlmetai.cxx   |  121 -
 33 files changed, 637 insertions(+), 474 deletions(-)

New commits:
commit bf46b46a1d734348096936284fb8a76e977936d0
Author: Mohammed Abdul Azeem 
Date:   Sun Oct 1 14:11:11 2017 +0530

Moving XSAXDocumentBuilder2 to use XFastDocumentHandler:

This is used in parsing of meta Contexts across different
modules. This also involved moving to XFastParser for
parsing xml filters in sw, sd, starmath.

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

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 364411681aa8..77b620a3f1df 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -55,6 +55,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -225,6 +227,7 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public 
cppu::WeakImplHelper<
 css::uno::Reference< css::xml::sax::XFastDocumentHandler > 
mxFastDocumentHandler;
 static css::uno::Reference< css::xml::sax::XFastTokenHandler > 
xTokenHandler;
 static std::unordered_map< sal_Int32, std::pair< OUString, OUString > > 
aNamespaceMap;
+static std::unordered_map< OUString, OUString, OUStringHash > 
aNamespaceURIPrefixMap;
 static bool bIsNSMapsInitialized;
 
 static void initializeNamespaceMaps();
@@ -378,6 +381,8 @@ public:
 
 static const OUString getNameFromToken( sal_Int32 nToken );
 static const OUString getNamespacePrefixFromToken( sal_Int32 nToken );
+static const OUString getNamespaceURIFromToken( sal_Int32 nToken );
+static const OUString getNamespacePrefixFromURI( const OUString& rURI );
 
 SvXMLNamespaceMap& GetNamespaceMap() { return *mpNamespaceMap; }
 const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; 
}
diff --git a/include/xmloff/xmlmetai.hxx b/include/xmloff/xmlmetai.hxx
index 2b9160251bc0..9b9f59da7f10 100644
--- a/include/xmloff/xmlmetai.hxx
+++ b/include/xmloff/xmlmetai.hxx
@@ -40,22 +40,20 @@ private:
 css::uno::Reference< css::xml::dom::XSAXDocumentBuilder2> mxDocBuilder;
 
 public:
-SvXMLMetaDocumentContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
-const OUString& rLName,
-const css::uno::Reference< css::document::XDocumentProperties>& 
xDocProps);
-
 SvXMLMetaDocumentContext(SvXMLImport& rImport,
 const css::uno::Reference< css::document::XDocumentProperties>& 
xDocProps);
 
 virtual ~SvXMLMetaDocumentContext() override;
 
-virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix,
-const OUString& rLocalName,
-const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList ) 
override;
+

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

2018-01-04 Thread Mohammed Abdul Azeem
 include/xmloff/xmlimp.hxx  |3 +
 oox/source/crypto/DocumentDecryption.cxx   |   33 +++-
 sax/source/fastparser/fastparser.cxx   |   30 +-
 sax/source/fastparser/legacyfastparser.cxx |   47 -
 xmloff/source/core/xmlictxt.cxx|   41 -
 xmloff/source/core/xmlimp.cxx  |2 +
 6 files changed, 79 insertions(+), 77 deletions(-)

New commits:
commit bb59a80ee6000d3922fa95262f67e291fd9d8ee2
Author: Mohammed Abdul Azeem 
Date:   Sun Dec 24 23:40:39 2017 +0530

Modifying the impl. of startUnknownElement of FastParser:

Modifying it to emit the namespace URI instead of
prefix and qualified name instead of local name.
This will be useful for handling arbitrary elements
in the fast contexts.

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

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 7cc0d76f5c90..339b8cdf7a54 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -519,6 +519,9 @@ public:
 **/
 bool getBuildIds( sal_Int32& rUPD, sal_Int32& rBuild ) const;
 
+static const OUString aDefaultNamespace;
+static const OUString aNamespaceSeparator;
+
 static const sal_uInt16 OOo_1x = 10;
 static const sal_uInt16 OOo_2x = 20;
 static const sal_uInt16 OOo_30x = 30;
diff --git a/oox/source/crypto/DocumentDecryption.cxx 
b/oox/source/crypto/DocumentDecryption.cxx
index 7c646877c425..5f5940ad01db 100644
--- a/oox/source/crypto/DocumentDecryption.cxx
+++ b/oox/source/crypto/DocumentDecryption.cxx
@@ -81,11 +81,13 @@ public:
 
 void SAL_CALL startUnknownElement( const OUString& /*aNamespace*/, const 
OUString& rName, const Reference< XFastAttributeList >& aAttributeList ) 
override
 {
-if (rName == "keyData")
+const auto& localname = [](const OUString &a) { return 
a.copy(a.indexOf(":") + 1); };
+const OUString& rLocalName = localname(rName);
+if (rLocalName == "keyData")
 {
 for (const Attribute& rAttribute : 
aAttributeList->getUnknownAttributes())
 {
-if (rAttribute.Name == "saltValue")
+if (localname(rAttribute.Name) == "saltValue")
 {
 Sequence keyDataSalt;
 ::sax::Converter::decodeBase64(keyDataSalt, 
rAttribute.Value);
@@ -93,61 +95,62 @@ public:
 }
 }
 }
-else if (rName == "encryptedKey")
+else if (rLocalName == "encryptedKey")
 {
 for (const Attribute& rAttribute : 
aAttributeList->getUnknownAttributes())
 {
-if (rAttribute.Name == "spinCount")
+const OUString& rAttrLocalName = localname(rAttribute.Name);
+if (rAttrLocalName == "spinCount")
 {
 ::sax::Converter::convertNumber(mInfo.spinCount, 
rAttribute.Value);
 }
-else if (rAttribute.Name == "saltSize")
+else if (rAttrLocalName == "saltSize")
 {
 ::sax::Converter::convertNumber(mInfo.saltSize, 
rAttribute.Value);
 }
-else if (rAttribute.Name == "blockSize")
+else if (rAttrLocalName == "blockSize")
 {
 ::sax::Converter::convertNumber(mInfo.blockSize, 
rAttribute.Value);
 }
-else if (rAttribute.Name == "keyBits")
+else if (rAttrLocalName == "keyBits")
 {
 ::sax::Converter::convertNumber(mInfo.keyBits, 
rAttribute.Value);
 }
-else if (rAttribute.Name == "hashSize")
+else if (rAttrLocalName == "hashSize")
 {
 ::sax::Converter::convertNumber(mInfo.hashSize, 
rAttribute.Value);
 }
-else if (rAttribute.Name == "cipherAlgorithm")
+else if (rAttrLocalName == "cipherAlgorithm")
 {
 mInfo.cipherAlgorithm = rAttribute.Value;
 }
-else if (rAttribute.Name == "cipherChaining")
+else if (rAttrLocalName == "cipherChaining")
 {
 mInfo.cipherChaining = rAttribute.Value;
 }
-else if (rAttribute.Name == "hashAlgorithm")
+else if (rAttrLocalName == "hashAlgorithm")
 {
  

[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - include/xmloff xmloff/source

2017-10-23 Thread Mohammed Abdul Azeem
 include/xmloff/xmltoken.hxx |9 +
 xmloff/source/core/fasttokenhandler.cxx |2 +-
 xmloff/source/core/xmltoken.cxx |9 +
 xmloff/source/token/tokens.txt  |9 +
 4 files changed, 28 insertions(+), 1 deletion(-)

New commits:
commit 000fbca705166237645bccf0b1c28164b076c043
Author: Mohammed Abdul Azeem 
Date:   Sat Oct 21 16:24:50 2017 +0530

tdf#110431: Fixed losing listbos entries on opening .ods file

For some reason, XML_TOKEN_INVALID was taking wrong value
in windows, causing to fail imports with unknown entries.

I've also added some of the tokens I found from several
test files to the list.

Change-Id: Idd2e7db165b9b4b5a2d8c7a837786fde252fe938
Reviewed-on: https://gerrit.libreoffice.org/43677
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
(cherry picked from commit 931c84e697dc69745d1c07c40f810638f9f71eda)
Reviewed-on: https://gerrit.libreoffice.org/43710

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index d746ae78c5d0..2fee08b63871 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -266,6 +266,7 @@ namespace xmloff { namespace token {
 XML_AUTHOR_INITIALS,
 XML_AUTHOR_NAME,
 XML_AUTO,
+XML_AUTO_COMPLETE,
 XML_AUTO_GROW_HEIGHT,
 XML_AUTO_GROW_WIDTH,
 XML_AUTO_RELOAD,
@@ -348,6 +349,7 @@ namespace xmloff { namespace token {
 XML_BOTTOM_VALUES,
 XML_BOTTOMARC,
 XML_BOTTOMCIRCLE,
+XML_BOUND_COLUMN,
 XML_BREAK_AFTER,
 XML_BREAK_BEFORE,
 XML_BREAK_INSIDE,
@@ -605,6 +607,7 @@ namespace xmloff { namespace token {
 XML_DEFAULT_STYLE_NAME,
 XML_DEGREE,
 XML_DELAY,
+XML_DELAY_FOR_REPEAT,
 XML_DELETE_COLUMNS,
 XML_DELETE_ROWS,
 XML_DELETION,
@@ -668,6 +671,7 @@ namespace xmloff { namespace token {
 XML_DRAWING,
 XML_DRAWINGS,
 XML_DRAWPOOL,
+XML_DROPDOWN,
 XML_DROP_CAP,
 XML_DYNAMIC,
 XML_EDGE_ROUNDING,
@@ -1135,6 +1139,7 @@ namespace xmloff { namespace token {
 XML_LINENUMBERING_SEPARATOR,
 XML_LINES,
 XML_LINES_USED,
+XML_LINKED_CELL,
 XML_LINK_TO_SOURCE_DATA,
 XML_LIST,
 XML_LIST_BLOCK,
@@ -1145,6 +1150,7 @@ namespace xmloff { namespace token {
 XML_LIST_LEVEL_STYLE_BULLET,
 XML_LIST_LEVEL_STYLE_IMAGE,
 XML_LIST_LEVEL_STYLE_NUMBER,
+XML_LIST_LINKAGE_TYPE,
 XML_LIST_NAME,
 XML_LIST_STYLE,
 XML_LIST_STYLE_NAME,
@@ -1354,6 +1360,7 @@ namespace xmloff { namespace token {
 XML_OPERATION,
 XML_OPERATOR,
 XML_OPTIMAL,
+XML_OPTION,
 XML_OR,
 XML_ORDER,
 XML_ORDERED_LIST,
@@ -1751,6 +1758,7 @@ namespace xmloff { namespace token {
 XML_STDEV,
 XML_STDEVP,
 XML_STEPS,
+XML_STEP_SIZE,
 XML_STOCK,
 XML_STOCK_UPDOWN_BARS,
 XML_STOCK_WITH_VOLUME,
@@ -1830,6 +1838,7 @@ namespace xmloff { namespace token {
 XML_TAN,
 XML_TANH,
 XML_TARGET_CELL_ADDRESS,
+XML_TARGET_FRAME,
 XML_TARGET_FRAME_NAME,
 XML_TARGET_RANGE_ADDRESS,
 XML_TB_RL,
diff --git a/xmloff/source/core/fasttokenhandler.cxx 
b/xmloff/source/core/fasttokenhandler.cxx
index 22a1606b44b1..712555fc9d0c 100644
--- a/xmloff/source/core/fasttokenhandler.cxx
+++ b/xmloff/source/core/fasttokenhandler.cxx
@@ -58,7 +58,7 @@ TokenMap::~TokenMap()
 sal_Int32 TokenMap::getTokenPerfectHash( const char *pStr, sal_Int32 nLength )
 {
 const struct xmltoken *pToken = Perfect_Hash::in_word_set( pStr, nLength );
-return pToken ? pToken->nToken : XML_TOKEN_INVALID;
+return pToken ? pToken->nToken : xmloff::XML_TOKEN_INVALID;
 }
 
 FastTokenHandler::FastTokenHandler() :
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index a7d242b366dd..d19c66de0a08 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -267,6 +267,7 @@ namespace xmloff { namespace token {
 TOKEN( "author-initials", XML_AUTHOR_INITIALS ),
 TOKEN( "author-name", XML_AUTHOR_NAME ),
 TOKEN( "auto",XML_AUTO ),
+TOKEN( "auto-complete",   XML_AUTO_COMPLETE ),
 TOKEN( "auto-grow-height",XML_AUTO_GROW_HEIGHT ),
 TOKEN( "auto-grow-width", XML_AUTO_GROW_WIDTH ),
 TOKEN( "auto-reload", XML_AUTO_RELOAD ),
@@ -349,6 +350,7 @@ namespace xmloff { namespace token {
 TOKEN( "bottom values",   XML_BOTTOM_VALUES ),
 TOKEN( "bottom-arc",  XML_BOTTOMARC ),

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

2017-10-23 Thread Mohammed Abdul Azeem
 include/xmloff/xmltoken.hxx |9 +
 xmloff/source/core/fasttokenhandler.cxx |2 +-
 xmloff/source/core/xmltoken.cxx |9 +
 xmloff/source/token/tokens.txt  |9 +
 4 files changed, 28 insertions(+), 1 deletion(-)

New commits:
commit 931c84e697dc69745d1c07c40f810638f9f71eda
Author: Mohammed Abdul Azeem 
Date:   Sat Oct 21 16:24:50 2017 +0530

tdf#110431: Fixed losing listbos entries on opening .ods file

For some reason, XML_TOKEN_INVALID was taking wrong value
in windows, causing to fail imports with unknown entries.

I've also added some of the tokens I found from several
test files to the list.

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

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index e1c0c4d58aac..175187ae6897 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -267,6 +267,7 @@ namespace xmloff { namespace token {
 XML_AUTHOR_INITIALS,
 XML_AUTHOR_NAME,
 XML_AUTO,
+XML_AUTO_COMPLETE,
 XML_AUTO_GROW_HEIGHT,
 XML_AUTO_GROW_WIDTH,
 XML_AUTO_RELOAD,
@@ -349,6 +350,7 @@ namespace xmloff { namespace token {
 XML_BOTTOM_VALUES,
 XML_BOTTOMARC,
 XML_BOTTOMCIRCLE,
+XML_BOUND_COLUMN,
 XML_BREAK_AFTER,
 XML_BREAK_BEFORE,
 XML_BREAK_INSIDE,
@@ -606,6 +608,7 @@ namespace xmloff { namespace token {
 XML_DEFAULT_STYLE_NAME,
 XML_DEGREE,
 XML_DELAY,
+XML_DELAY_FOR_REPEAT,
 XML_DELETE_COLUMNS,
 XML_DELETE_ROWS,
 XML_DELETION,
@@ -669,6 +672,7 @@ namespace xmloff { namespace token {
 XML_DRAWING,
 XML_DRAWINGS,
 XML_DRAWPOOL,
+XML_DROPDOWN,
 XML_DROP_CAP,
 XML_DYNAMIC,
 XML_EDGE_ROUNDING,
@@ -1136,6 +1140,7 @@ namespace xmloff { namespace token {
 XML_LINENUMBERING_SEPARATOR,
 XML_LINES,
 XML_LINES_USED,
+XML_LINKED_CELL,
 XML_LINK_TO_SOURCE_DATA,
 XML_LIST,
 XML_LIST_BLOCK,
@@ -1146,6 +1151,7 @@ namespace xmloff { namespace token {
 XML_LIST_LEVEL_STYLE_BULLET,
 XML_LIST_LEVEL_STYLE_IMAGE,
 XML_LIST_LEVEL_STYLE_NUMBER,
+XML_LIST_LINKAGE_TYPE,
 XML_LIST_NAME,
 XML_LIST_STYLE,
 XML_LIST_STYLE_NAME,
@@ -1355,6 +1361,7 @@ namespace xmloff { namespace token {
 XML_OPERATION,
 XML_OPERATOR,
 XML_OPTIMAL,
+XML_OPTION,
 XML_OR,
 XML_ORDER,
 XML_ORDERED_LIST,
@@ -1752,6 +1759,7 @@ namespace xmloff { namespace token {
 XML_STDEV,
 XML_STDEVP,
 XML_STEPS,
+XML_STEP_SIZE,
 XML_STOCK,
 XML_STOCK_UPDOWN_BARS,
 XML_STOCK_WITH_VOLUME,
@@ -1831,6 +1839,7 @@ namespace xmloff { namespace token {
 XML_TAN,
 XML_TANH,
 XML_TARGET_CELL_ADDRESS,
+XML_TARGET_FRAME,
 XML_TARGET_FRAME_NAME,
 XML_TARGET_RANGE_ADDRESS,
 XML_TB_RL,
diff --git a/xmloff/source/core/fasttokenhandler.cxx 
b/xmloff/source/core/fasttokenhandler.cxx
index b5fa379c9de7..e7eeb0803717 100644
--- a/xmloff/source/core/fasttokenhandler.cxx
+++ b/xmloff/source/core/fasttokenhandler.cxx
@@ -60,7 +60,7 @@ TokenMap::~TokenMap()
 sal_Int32 TokenMap::getTokenPerfectHash( const char *pStr, sal_Int32 nLength )
 {
 const struct xmltoken *pToken = Perfect_Hash::in_word_set( pStr, nLength );
-return pToken ? pToken->nToken : XML_TOKEN_INVALID;
+return pToken ? pToken->nToken : xmloff::XML_TOKEN_INVALID;
 }
 
 FastTokenHandler::FastTokenHandler() :
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 521e304cf3e1..3d33a489493a 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -267,6 +267,7 @@ namespace xmloff { namespace token {
 TOKEN( "author-initials", XML_AUTHOR_INITIALS ),
 TOKEN( "author-name", XML_AUTHOR_NAME ),
 TOKEN( "auto",XML_AUTO ),
+TOKEN( "auto-complete",   XML_AUTO_COMPLETE ),
 TOKEN( "auto-grow-height",XML_AUTO_GROW_HEIGHT ),
 TOKEN( "auto-grow-width", XML_AUTO_GROW_WIDTH ),
 TOKEN( "auto-reload", XML_AUTO_RELOAD ),
@@ -349,6 +350,7 @@ namespace xmloff { namespace token {
 TOKEN( "bottom values",   XML_BOTTOM_VALUES ),
 TOKEN( "bottom-arc",  XML_BOTTOMARC ),
 TOKEN( "bottom-circle",   XML_BOTTOMCIRCLE ),
+TOKEN( "bound-column",   

[Libreoffice-commits] core.git: 2 commits - download.lst external/pdfium sc/source

2017-08-30 Thread Mohammed Abdul Azeem
 download.lst   |4 
 external/pdfium/Library_pdfium.mk  |  108 ---
 external/pdfium/ubsan.patch|4 
 external/pdfium/visibility.patch.1 |   16 -
 sc/source/filter/xml/XMLCalculationSettingsContext.cxx |   49 +--
 sc/source/filter/xml/XMLCalculationSettingsContext.hxx |   12 
 sc/source/filter/xml/XMLCellRangeSourceContext.cxx |9 
 sc/source/filter/xml/XMLCellRangeSourceContext.hxx |2 
 sc/source/filter/xml/XMLConsolidationContext.cxx   |   11 
 sc/source/filter/xml/XMLConsolidationContext.hxx   |2 
 sc/source/filter/xml/XMLDDELinksContext.cxx|   54 +--
 sc/source/filter/xml/XMLDDELinksContext.hxx|8 
 sc/source/filter/xml/XMLDetectiveContext.cxx   |   24 -
 sc/source/filter/xml/XMLDetectiveContext.hxx   |4 
 sc/source/filter/xml/XMLTableSourceContext.cxx |9 
 sc/source/filter/xml/XMLTableSourceContext.hxx |2 
 sc/source/filter/xml/XMLTrackedChangesContext.cxx  |  237 ++---
 sc/source/filter/xml/XMLTrackedChangesContext.hxx  |2 
 sc/source/filter/xml/datastreamimport.cxx  |9 
 sc/source/filter/xml/datastreamimport.hxx  |2 
 sc/source/filter/xml/xmlbodyi.cxx  |   23 -
 sc/source/filter/xml/xmlbodyi.hxx  |2 
 sc/source/filter/xml/xmlcelli.cxx  |   13 
 sc/source/filter/xml/xmlcelli.hxx  |2 
 sc/source/filter/xml/xmlcoli.cxx   |   30 --
 sc/source/filter/xml/xmlcoli.hxx   |4 
 sc/source/filter/xml/xmlcondformat.cxx |   94 +++---
 sc/source/filter/xml/xmlcondformat.hxx |   14 -
 sc/source/filter/xml/xmlcvali.cxx  |   56 +---
 sc/source/filter/xml/xmldpimp.cxx  |  222 ++-
 sc/source/filter/xml/xmldpimp.hxx  |   36 +-
 sc/source/filter/xml/xmldrani.cxx  |  141 +++---
 sc/source/filter/xml/xmldrani.hxx  |   30 --
 sc/source/filter/xml/xmlexternaltabi.cxx   |   50 +--
 sc/source/filter/xml/xmlexternaltabi.hxx   |   14 -
 sc/source/filter/xml/xmlfilti.cxx  |   73 ++---
 sc/source/filter/xml/xmlfilti.hxx  |   10 
 sc/source/filter/xml/xmlimprt.cxx  |8 
 sc/source/filter/xml/xmlimprt.hxx  |2 
 sc/source/filter/xml/xmllabri.cxx  |   19 -
 sc/source/filter/xml/xmllabri.hxx  |7 
 sc/source/filter/xml/xmlmappingi.cxx   |   25 -
 sc/source/filter/xml/xmlmappingi.hxx   |7 
 sc/source/filter/xml/xmlnexpi.cxx  |   36 --
 sc/source/filter/xml/xmlnexpi.hxx  |   10 
 sc/source/filter/xml/xmlrowi.cxx   |   37 +-
 sc/source/filter/xml/xmlrowi.hxx   |4 
 sc/source/filter/xml/xmlsceni.cxx  |   15 -
 sc/source/filter/xml/xmlsceni.hxx  |5 
 sc/source/filter/xml/xmlsorti.cxx  |   23 -
 sc/source/filter/xml/xmlsorti.hxx  |4 
 sc/source/filter/xml/xmltabi.cxx   |   50 +--
 sc/source/filter/xml/xmltabi.hxx   |4 
 53 files changed, 690 insertions(+), 948 deletions(-)

New commits:
commit da8cf43b4f2af008df231f5e0629c71bd7f2b762
Author: Mohammed Abdul Azeem 
Date:   Wed Aug 16 22:51:05 2017 +0530

Refactoring fastcontexts code:

Moved all the casts inside ::createFastChildContext and
used reference to it as an argument in the constructors. This
avoids spreading the cast statements all over the place.

Also removed some of the empty createFastChildContext(), they are
unnecessary as the parent class already has it.

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

diff --git a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx 
b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
index 896e2e12b8ab..de707ce661a9 100644
--- a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
+++ b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
@@ -32,7 +32,7 @@ using namespace com::sun::star;
 using namespace xmloff::token;
 
 ScXMLCalculationSettingsContext::ScXMLCalculationSettingsContext( ScXMLImport& 
rImport,
-  const css::uno::Reference< 
css::xml::sax::XFastAttributeList>& xAttrList) :
+  const 
rtl::Reference& rAttrList ) :
 ScXMLImportContext( rImport ),
 fIterationEpsilon(0.001),
 nIterationCount(100)

[GSoC] Migrating from legacy Parser to FastParser - Final Report

2017-08-28 Thread Mohammed Abdul Azeem
Hi,

After more than 12 weeks of coding, I think we've achieved what we set out
to do.

We started with an aim to move existing legacy parser contexts in sc/ and
other modules to fast contexts and to offload unzipping and reading into a
different thread. I've covered most of the details in weekly reports. I'll
just brief what we did, what we couldn't, just so that I can use this as a
link to my project submission.

*Done*:
- Moved unzipping into a new thread.
- Moved all the independent contexts to use fast tokens (rest of them
requires touching other modules)
- Lots of optimizations and refactoring.
- Fixed some bugs.

*In progress*:
- Moving XSAXDocumentBuilder2 to use XFastDocumentHandler. It involved
multiple modules(sc, sw, starmath, sd, etc.) and resulted in failing lots
of test cases. I'm still working on this, which will help anybody following
this up easy to do the rest of the conversions.

*Not done*:
- I observed lots of small issues, which I could write test cases for.
Hopefully, I will do this whenever I get time in future.
- Conversions of the rest of the legacy contexts.

*Patches*:
https://gerrit.libreoffice.org/38135
https://gerrit.libreoffice.org/38563
https://gerrit.libreoffice.org/38661
https://gerrit.libreoffice.org/38708
https://gerrit.libreoffice.org/38784
https://gerrit.libreoffice.org/38881
https://gerrit.libreoffice.org/38964
https://gerrit.libreoffice.org/39275
https://gerrit.libreoffice.org/39374
https://gerrit.libreoffice.org/39380
https://gerrit.libreoffice.org/39370
https://gerrit.libreoffice.org/39397
https://gerrit.libreoffice.org/39665
https://gerrit.libreoffice.org/39730
https://gerrit.libreoffice.org/39723
https://gerrit.libreoffice.org/39927
https://gerrit.libreoffice.org/40012
https://gerrit.libreoffice.org/40160
https://gerrit.libreoffice.org/40246
https://gerrit.libreoffice.org/40320
https://gerrit.libreoffice.org/40326
https://gerrit.libreoffice.org/40540
https://gerrit.libreoffice.org/40553
https://gerrit.libreoffice.org/40561
https://gerrit.libreoffice.org/40791
https://gerrit.libreoffice.org/40846
https://gerrit.libreoffice.org/41063
https://gerrit.libreoffice.org/41364
https://gerrit.libreoffice.org/40928
https://gerrit.libreoffice.org/41178 (not merged)


I would like to thank all people who helped me during the project and
special thanks to my mentors Michael Meeks and Markus Mohrhard for
supporting me and giving me ample time to work at my own pace. It's been a
great time working with LibreOffice.

Cheers,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [GSoC] Migrating from legacy Parser to FastParser - Weekly Report

2017-08-23 Thread Mohammed Abdul Azeem
Hi,

*Week 11 and week 12*

I worked last couple of weeks on converting some of the contexts in sc/ as
before. I spent most of my time looking to improve some performance in the
codes we've written by avoiding unnecessary string allocations. Also, I did
some refactoring of those codes to get better readability.

*Patches:*
https://gerrit.libreoffice.org/40791
https://gerrit.libreoffice.org/40846
https://gerrit.libreoffice.org/41063
https://gerrit.libreoffice.org/41364
https://gerrit.libreoffice.org/40928

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: package/source

2017-08-20 Thread Mohammed Abdul Azeem
 package/source/zipapi/XBufferedThreadedStream.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit aff5951e7b4fa549882f4d4c4cfda99f3966a9d9
Author: Mohammed Abdul Azeem 
Date:   Sun Aug 20 21:25:12 2017 +0530

Fixing threadedStream produce loop condition:

hasBytes() is for the consuming thread, produce loop should
be stopped as soon as we've read as much as size of the stream.

Change-Id: I0d857cc9cbcc4dd7d4a43cddbc4c457e8280353f
Reviewed-on: https://gerrit.libreoffice.org/41364
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/package/source/zipapi/XBufferedThreadedStream.cxx 
b/package/source/zipapi/XBufferedThreadedStream.cxx
index c7fd3dbacd36..11428e076d44 100644
--- a/package/source/zipapi/XBufferedThreadedStream.cxx
+++ b/package/source/zipapi/XBufferedThreadedStream.cxx
@@ -76,6 +76,7 @@ XBufferedThreadedStream::~XBufferedThreadedStream()
 void XBufferedThreadedStream::produce()
 {
 Buffer pProducedBuffer;
+sal_Int64 nTotalBytesRead(0);
 std::unique_lock aGuard( maBufferProtector );
 do
 {
@@ -86,7 +87,7 @@ void XBufferedThreadedStream::produce()
 }
 
 aGuard.unlock();
-mxSrcStream->readBytes( pProducedBuffer, nBufferSize );
+nTotalBytesRead += mxSrcStream->readBytes( pProducedBuffer, 
nBufferSize );
 
 aGuard.lock();
 maPendingBuffers.push( pProducedBuffer );
@@ -95,7 +96,7 @@ void XBufferedThreadedStream::produce()
 if (!mbTerminateThread)
 maBufferProduceResume.wait( aGuard, [&]{return canProduce(); } );
 
-} while( !mbTerminateThread && hasBytes() );
+} while( !mbTerminateThread && nTotalBytesRead < mnStreamSize );
 }
 
 /**
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[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 = aCellTypeMap.find(rStrValue);
-if (itr != aCellTypeMap

Re: [GSoC] Migrating from legacy Parser to FastParser - Weekly Report

2017-08-08 Thread Mohammed Abdul Azeem
Hi,

*Week 9 and week 10*

I continued to work on converting legacy contexts in sc/ module to fast
contexts. We've converted almost all the legacy contexts in sc/ module,
except for few which are dependent on the contexts in xmloff. We would need
to convert contexts across all the other modules, before we start
converting the ones in xmloff. Now, I'm working on avoiding allocation of
OUString for attribute values wherever possible.

*Patches*:
https://gerrit.libreoffice.org/40320
https://gerrit.libreoffice.org/40326
https://gerrit.libreoffice.org/40540
https://gerrit.libreoffice.org/40553
https://gerrit.libreoffice.org/40561

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2017-08-07 Thread Mohammed Abdul Azeem
 include/sax/fastattribs.hxx|5 
 sc/source/filter/xml/XMLCalculationSettingsContext.cxx |4 
 sc/source/filter/xml/XMLDDELinksContext.cxx|2 
 sc/source/filter/xml/XMLTrackedChangesContext.cxx  |2 
 sc/source/filter/xml/xmlcelli.cxx  |4 
 sc/source/filter/xml/xmldpimp.cxx  |6 
 sc/source/filter/xml/xmlexternaltabi.cxx   |2 
 sc/source/filter/xml/xmlfilti.cxx  |  366 +++--
 sc/source/filter/xml/xmlfilti.hxx  |   93 +---
 sc/source/filter/xml/xmlsorti.cxx  |   73 +--
 sc/source/filter/xml/xmlsorti.hxx  |   16 
 11 files changed, 241 insertions(+), 332 deletions(-)

New commits:
commit 855af7f3260705faf7c33be36efc1610354336f0
Author: Mohammed Abdul Azeem 
Date:   Sun Aug 6 16:40:55 2017 +0530

Avoiding unnecessary memory allocation:

Added a method to directly convert fast attribute values
to double.

Change-Id: Ia0c415530d6d7c7f767a2e0c88983429bc966210
Reviewed-on: https://gerrit.libreoffice.org/40846
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 9c1db656e36c..8b669fe26a17 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -150,6 +150,11 @@ public:
 assert(mnIdx < mrList.maAttributeTokens.size());
 return rtl_str_toInt32(mrList.getFastAttributeValue(mnIdx), 10);
 }
+double toDouble() const
+{
+assert(mnIdx < mrList.maAttributeTokens.size());
+return rtl_str_toDouble(mrList.getFastAttributeValue(mnIdx));
+}
 OUString toString() const
 {
 assert(mnIdx < mrList.maAttributeTokens.size());
diff --git a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx 
b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
index 0617d2654b14..81fc1744ab4c 100644
--- a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
+++ b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
@@ -200,9 +200,7 @@ ScXMLIterationContext::ScXMLIterationContext( ScXMLImport& 
rImport,
 pCalcSet->SetIterationCount(aIter.toInt32());
 break;
 case XML_ELEMENT( TABLE, XML_MAXIMUM_DIFFERENCE ):
-double fDif;
-::sax::Converter::convertDouble(fDif, aIter.toString());
-pCalcSet->SetIterationEpsilon(fDif);
+pCalcSet->SetIterationEpsilon( aIter.toDouble() );
 break;
 }
 }
diff --git a/sc/source/filter/xml/XMLDDELinksContext.cxx 
b/sc/source/filter/xml/XMLDDELinksContext.cxx
index 59b9fbb5df66..faaab9888728 100644
--- a/sc/source/filter/xml/XMLDDELinksContext.cxx
+++ b/sc/source/filter/xml/XMLDDELinksContext.cxx
@@ -370,7 +370,7 @@ ScXMLDDECellContext::ScXMLDDECellContext( ScXMLImport& 
rImport,
 bString2 = true;
 break;
 case XML_ELEMENT( OFFICE, XML_VALUE ):
-::sax::Converter::convertDouble(fValue, aIter.toString());
+fValue = aIter.toDouble();
 bEmpty = false;
 bString2 = false;
 break;
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx 
b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index 1657ea40687f..ff843fa7df51 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -887,7 +887,7 @@ ScXMLChangeCellContext::ScXMLChangeCellContext( 
ScXMLImport& rImport,
 }
 break;
 case XML_ELEMENT( OFFICE, XML_VALUE ):
-::sax::Converter::convertDouble(fValue, aIter.toString());
+fValue = aIter.toDouble();
 bEmpty = false;
 break;
 case XML_ELEMENT( OFFICE, XML_DATE_VALUE ):
diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index 043190f41bbf..c3edfdbeac03 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -211,7 +211,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( 
ScXMLImport& rImport,
 {
 if (!it.isEmpty())
 {
-::sax::Converter::convertDouble(fValue, it.toString());
+fValue = it.toDouble();
 bIsEmpty = false;
 
 //if office:value="0", let's get the text:p in case 
this is
@@ -259,7 +259,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( 
ScXMLImport& rImport,
 else if ( IsXMLToken( it, XML_FALSE ) )
 fValue = 0.0;
 else
-   

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

2017-07-30 Thread Mohammed Abdul Azeem
 sc/source/filter/xml/xmlcondformat.cxx |  365 +++--
 sc/source/filter/xml/xmlcondformat.hxx |   66 ++---
 2 files changed, 194 insertions(+), 237 deletions(-)

New commits:
commit 6d327ffeb12134e28b975b1894b03870fcddf31d
Author: Mohammed Abdul Azeem 
Date:   Sun Jul 30 12:39:19 2017 +0530

Moving legacy contexts to FastContexts:

ScXMLConditionalFormatContext
ScXMLColorScaleFormatContext
ScXMLDataBarFormatContext
ScXMLIconSetFormatContext
ScXMLColorScaleFormatEntryContext
ScXMLFormattingEntryContext
ScXMLCondContext
ScXMLDateContext

Change-Id: If2980e87198b934b4f8e95a6278f4026c092896d
Reviewed-on: https://gerrit.libreoffice.org/40561
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/filter/xml/xmlcondformat.cxx 
b/sc/source/filter/xml/xmlcondformat.cxx
index 921fe8d8e233..04411dc529e6 100644
--- a/sc/source/filter/xml/xmlcondformat.cxx
+++ b/sc/source/filter/xml/xmlcondformat.cxx
@@ -10,6 +10,7 @@
 #include 
 #include "xmlcondformat.hxx"
 #include 
+#include 
 
 #include "colorscale.hxx"
 #include "conditio.hxx"
@@ -21,6 +22,8 @@
 #include "XMLConverter.hxx"
 #include "stylehelper.hxx"
 
+using namespace xmloff::token;
+
 ScXMLConditionalFormatsContext::ScXMLConditionalFormatsContext( ScXMLImport& 
rImport, sal_Int32 /*nElement*/ ):
 ScXMLImportContext( rImport )
 {
@@ -28,17 +31,14 @@ 
ScXMLConditionalFormatsContext::ScXMLConditionalFormatsContext( ScXMLImport& rIm
 GetScImport().GetDocument()->SetCondFormList(new 
ScConditionalFormatList(), GetScImport().GetTables().GetCurrentSheet());
 }
 
-SvXMLImportContext* ScXMLConditionalFormatsContext::CreateChildContext( 
sal_uInt16 nPrefix,
-const OUString& rLocalName,
-const css::uno::Reference& xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL 
ScXMLConditionalFormatsContext::createFastChildContext(
+sal_Int32 nElement, const css::uno::Reference< 
css::xml::sax::XFastAttributeList >& xAttrList )
 {
-const SvXMLTokenMap& rTokenMap = GetScImport().GetCondFormatsTokenMap();
-sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLocalName);
 SvXMLImportContext* pContext = nullptr;
-switch (nToken)
+switch (nElement)
 {
-case XML_TOK_CONDFORMATS_CONDFORMAT:
-pContext = new ScXMLConditionalFormatContext( GetScImport(), 
nPrefix, rLocalName, xAttrList );
+case XML_ELEMENT( CALC_EXT, XML_CONDITIONAL_FORMAT ):
+pContext = new ScXMLConditionalFormatContext( GetScImport(), 
nElement, xAttrList );
 break;
 }
 
@@ -56,29 +56,27 @@ void SAL_CALL 
ScXMLConditionalFormatsContext::endFastElement( sal_Int32 /*nEleme
 SAL_WARN_IF(bDeleted, "sc", "conditional formats have been deleted because 
they contained empty range info");
 }
 
-ScXMLConditionalFormatContext::ScXMLConditionalFormatContext( ScXMLImport& 
rImport, sal_uInt16 nPrfx,
-const OUString& rLName, const css::uno::Reference< 
css::xml::sax::XAttributeList>& xAttrList):
-ScXMLImportContext( rImport, nPrfx, rLName )
+ScXMLConditionalFormatContext::ScXMLConditionalFormatContext( ScXMLImport& 
rImport, sal_Int32 /*nElement*/,
+const css::uno::Reference< 
css::xml::sax::XFastAttributeList>& xAttrList):
+ScXMLImportContext( rImport )
 {
 OUString sRange;
 
-sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
-const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetCondFormatAttrMap();
-for( sal_Int16 i=0; i < nAttrCount; ++i )
+if ( xAttrList.is() )
 {
-const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-OUString aLocalName;
-sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
-sAttrName, &aLocalName ));
-const OUString& sValue(xAttrList->getValueByIndex( i ));
+sax_fastparser::FastAttributeList *pAttribList =
+sax_fastparser::FastAttributeList::castToFastAttributeList( 
xAttrList );
 
-switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+for (auto &aIter : *pAttribList)
 {
-case XML_TOK_CONDFORMAT_TARGET_RANGE:
-sRange = sValue;
-break;
-default:
+switch (aIter.getToken())
+{
+case XML_ELEMENT( CALC_EXT, XML_TARGET_RANGE_ADDRESS ):
+sRange = aIter.toString();
 break;
+default:
+break;
+}
 }
 }
 
@@ -89,29 +87,26 @@ 
ScXMLConditionalFormatContext::ScXMLConditionalFormatContext( ScXMLImport& rImpo
 mxFormat->SetRange(maRange);
 }
 
-SvXMLImportContext* ScXMLConditionalFormatContext::CreateChildCo

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

2017-07-30 Thread Mohammed Abdul Azeem
 sc/source/filter/xml/XMLCellRangeSourceContext.cxx |  109 +++-
 sc/source/filter/xml/XMLCellRangeSourceContext.hxx |   12 
 sc/source/filter/xml/XMLDetectiveContext.cxx   |  145 --
 sc/source/filter/xml/XMLDetectiveContext.hxx   |   36 --
 sc/source/filter/xml/celltextparacontext.cxx   |  284 -
 sc/source/filter/xml/celltextparacontext.hxx   |   74 ++---
 sc/source/filter/xml/xmlcelli.cxx  |   73 +++--
 sc/source/filter/xml/xmlcelli.hxx  |3 
 8 files changed, 309 insertions(+), 427 deletions(-)

New commits:
commit b6076ea5ce60bc1c971db502af3c963da51d8f82
Author: Mohammed Abdul Azeem 
Date:   Sat Jul 29 22:24:20 2017 +0530

Moving legacy contexts to FastContexts:

ScXMLCellRangeSourceContext
ScXMLDetectiveHighlightedContext
ScXMLDetectiveOperationContext
ScXMLCellTextParaContext
ScXMLCellTextSpanContext
ScXMLCellFieldSheetNameContext
ScXMLCellFieldDateContext
ScXMLCellFieldTitleContext
ScXMLCellFieldURLContext
ScXMLCellFieldSContext

Change-Id: I605e83064a7c0ec8dc0c78a93d2fec0ebdbce565
Reviewed-on: https://gerrit.libreoffice.org/40553
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/filter/xml/XMLCellRangeSourceContext.cxx 
b/sc/source/filter/xml/XMLCellRangeSourceContext.cxx
index 624d6f902af3..60a718196f1c 100644
--- a/sc/source/filter/xml/XMLCellRangeSourceContext.cxx
+++ b/sc/source/filter/xml/XMLCellRangeSourceContext.cxx
@@ -23,8 +23,10 @@
 
 #include 
 #include "xmlimprt.hxx"
+#include 
 
 using namespace ::com::sun::star;
+using namespace xmloff::token;
 
 ScMyImpCellRangeSource::ScMyImpCellRangeSource() :
 nColumns( 0 ),
@@ -35,63 +37,58 @@ ScMyImpCellRangeSource::ScMyImpCellRangeSource() :
 
 ScXMLCellRangeSourceContext::ScXMLCellRangeSourceContext(
 ScXMLImport& rImport,
-sal_uInt16 nPrfx,
-const OUString& rLName,
-const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+sal_Int32 /*nElement*/,
+const uno::Reference< xml::sax::XFastAttributeList >& xAttrList,
 ScMyImpCellRangeSource* pCellRangeSource ) :
-ScXMLImportContext( rImport, nPrfx, rLName )
+ScXMLImportContext( rImport )
 {
-if( !xAttrList.is() ) return;
-
-sal_Int16   nAttrCount  = xAttrList->getLength();
-const SvXMLTokenMap&rAttrTokenMap   = 
GetScImport().GetTableCellRangeSourceAttrTokenMap();
-
-for( sal_Int16 nIndex = 0; nIndex < nAttrCount; ++nIndex )
+if ( xAttrList.is() )
 {
-const OUString& sAttrName(xAttrList->getNameByIndex( nIndex ));
-const OUString& sValue(xAttrList->getValueByIndex( nIndex ));
-OUString aLocalName;
-sal_uInt16 nPrefix  = 
GetScImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+sax_fastparser::FastAttributeList *pAttribList =
+sax_fastparser::FastAttributeList::castToFastAttributeList( 
xAttrList );
 
-switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+for (auto &aIter : *pAttribList)
 {
-case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_NAME:
-pCellRangeSource->sSourceStr = sValue;
-break;
-case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_FILTER_NAME:
-pCellRangeSource->sFilterName = sValue;
-break;
-case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_FILTER_OPTIONS:
-pCellRangeSource->sFilterOptions = sValue;
-break;
-case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_HREF:
-pCellRangeSource->sURL = 
GetScImport().GetAbsoluteReference(sValue);
-break;
-case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_LAST_COLUMN:
-{
-sal_Int32 nValue;
-if (::sax::Converter::convertNumber( nValue, sValue, 1 ))
-pCellRangeSource->nColumns = nValue;
-else
-pCellRangeSource->nColumns = 1;
-}
-break;
-case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_LAST_ROW:
-{
-sal_Int32 nValue;
-if (::sax::Converter::convertNumber( nValue, sValue, 1 ))
-pCellRangeSource->nRows = nValue;
-else
-pCellRangeSource->nRows = 1;
-}
-break;
-case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_REFRESH_DELAY:
+switch (aIter.getToken())
 {
-double fTime;
-if (::sax::Converter::convertDuration( fTime, sValue ))
-pCellRangeSource->nRefresh = std::max( (sal_Int32)(fTime * 
86400.0), (sal_Int32)0 );
+case XML_ELEMENT( TABLE, XML_NAME ):
+pCellRangeSource->sSourceStr =

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

2017-07-28 Thread Mohammed Abdul Azeem
 sc/source/filter/xml/XMLConsolidationContext.cxx |8 
 sc/source/filter/xml/XMLConsolidationContext.hxx |5 
 sc/source/filter/xml/XMLDDELinksContext.cxx  |  302 +--
 sc/source/filter/xml/XMLDDELinksContext.hxx  |   74 +
 4 files changed, 143 insertions(+), 246 deletions(-)

New commits:
commit 81164892e16f7f014e32403f63ed78ba41950aec
Author: Mohammed Abdul Azeem 
Date:   Fri Jul 28 23:00:25 2017 +0530

Moving legacy contexts to FastContexts:

ScXMLDDELinkContext
ScXMLDDESourceContext
ScXMLDDETableContext
ScXMLDDEColumnContext
ScXMLDDERowContext
ScXMLDDECellContext

Change-Id: I8f272ea395e125316268d2ec77e4be44389e5542
Reviewed-on: https://gerrit.libreoffice.org/40540
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/filter/xml/XMLConsolidationContext.cxx 
b/sc/source/filter/xml/XMLConsolidationContext.cxx
index 30b863395e81..cf4c16e4a9ae 100644
--- a/sc/source/filter/xml/XMLConsolidationContext.cxx
+++ b/sc/source/filter/xml/XMLConsolidationContext.cxx
@@ -77,14 +77,6 @@ ScXMLConsolidationContext::~ScXMLConsolidationContext()
 GetScImport().UnlockSolarMutex();
 }
 
-SvXMLImportContext *ScXMLConsolidationContext::CreateChildContext(
-sal_uInt16 nPrefix,
-const OUString& rLName,
-const uno::Reference< xml::sax::XAttributeList>& /* xAttrList */ )
-{
-return new SvXMLImportContext( GetImport(), nPrefix, rLName );
-}
-
 void SAL_CALL ScXMLConsolidationContext::endFastElement( sal_Int32 
/*nElement*/ )
 {
 if (bTargetAddr)
diff --git a/sc/source/filter/xml/XMLConsolidationContext.hxx 
b/sc/source/filter/xml/XMLConsolidationContext.hxx
index 3a7ebf272331..cfc0097182d4 100644
--- a/sc/source/filter/xml/XMLConsolidationContext.hxx
+++ b/sc/source/filter/xml/XMLConsolidationContext.hxx
@@ -45,11 +45,6 @@ public:
 );
 virtual ~ScXMLConsolidationContext() override;
 
-virtual SvXMLImportContext* CreateChildContext(
-sal_uInt16 nPrefix,
-const OUString& rLocalName,
-const css::uno::Reference< 
css::xml::sax::XAttributeList >& xAttrList
-) override;
 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 };
 
diff --git a/sc/source/filter/xml/XMLDDELinksContext.cxx 
b/sc/source/filter/xml/XMLDDELinksContext.cxx
index dc179e1c1451..59b9fbb5df66 100644
--- a/sc/source/filter/xml/XMLDDELinksContext.cxx
+++ b/sc/source/filter/xml/XMLDDELinksContext.cxx
@@ -45,26 +45,24 @@ ScXMLDDELinksContext::~ScXMLDDELinksContext()
 GetScImport().UnlockSolarMutex();
 }
 
-SvXMLImportContext *ScXMLDDELinksContext::CreateChildContext( sal_uInt16 
nPrefix,
-const OUString& rLName,
-const 
css::uno::Reference& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL 
ScXMLDDELinksContext::createFastChildContext(
+sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& 
xAttrList )
 {
 SvXMLImportContext *pContext = nullptr;
 
-if ((nPrefix == XML_NAMESPACE_TABLE) && IsXMLToken(rLName, XML_DDE_LINK))
-pContext = new ScXMLDDELinkContext(GetScImport(), nPrefix, rLName, 
xAttrList);
+if ( nElement == XML_ELEMENT( TABLE, XML_DDE_LINK) )
+pContext = new ScXMLDDELinkContext(GetScImport(), nElement, xAttrList);
 
 if( !pContext )
-pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+pContext = new SvXMLImportContext( GetImport() );
 
 return pContext;
 }
 
 ScXMLDDELinkContext::ScXMLDDELinkContext( ScXMLImport& rImport,
-  sal_uInt16 nPrfx,
-  const OUString& rLName,
-  const 
css::uno::Reference& /* xAttrList */ ) :
-ScXMLImportContext( rImport, nPrfx, rLName ),
+  sal_Int32 /*nElement*/,
+  const 
css::uno::Reference& /* xAttrList */ ) :
+ScXMLImportContext( rImport ),
 aDDELinkTable(),
 aDDELinkRow(),
 sApplication(),
@@ -82,19 +80,23 @@ ScXMLDDELinkContext::~ScXMLDDELinkContext()
 {
 }
 
-SvXMLImportContext *ScXMLDDELinkContext::CreateChildContext( sal_uInt16 
nPrefix,
-const OUString& rLName,
-const 
css::uno::Reference& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL 
ScXMLDDELinkContext::createFastChildContext(
+sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& 
xAttrList )
 {
 SvXMLImportContext *pContext = nullptr;
 
-if ((nPrefix == XML_NAM

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

2017-07-27 Thread Mohammed Abdul Azeem
 sc/source/filter/xml/xmldpimp.cxx | 1384 --
 sc/source/filter/xml/xmldpimp.hxx |  208 +
 sc/source/filter/xml/xmlfilti.cxx |   75 --
 sc/source/filter/xml/xmlfilti.hxx |7 
 4 files changed, 690 insertions(+), 984 deletions(-)

New commits:
commit e89548c16b39cd716925cc23f2eb9e54748233c7
Author: Mohammed Abdul Azeem 
Date:   Sun Jul 23 20:04:33 2017 +0530

Moving legacy contexts to FastContexts:

ScXMLDataPilotTableContext
ScXMLDPSourceSQLContext
ScXMLDPSourceTableContext
ScXMLDPSourceQueryContext
ScXMLSourceServiceContext
ScXMLDataPilotGrandTotalContext
ScXMLSourceCellRangeContext
ScXMLDataPilotFieldContext
ScXMLDataPilotFieldReferenceContext
ScXMLDataPilotLevelContext
ScXMLDataPilotDisplayInfoContext
ScXMLDataPilotSortInfoContext
ScXMLDataPilotLayoutInfoContext
ScXMLDataPilotSubTotalsContext
ScXMLDataPilotSubTotalContext
ScXMLDataPilotMembersContext
ScXMLDataPilotMemberContext
ScXMLDataPilotGroupsContext
ScXMLDataPilotGroupContext
ScXMLDataPilotGroupMemberContext
ScXMLDPFilterContext

Change-Id: Ie01ddb0f740a1b41a44e4abc9fe1bea3ab32cb12
Reviewed-on: https://gerrit.libreoffice.org/40326
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/filter/xml/xmldpimp.cxx 
b/sc/source/filter/xml/xmldpimp.cxx
index f6fb88942fc8..27dfb894a7dd 100644
--- a/sc/source/filter/xml/xmldpimp.cxx
+++ b/sc/source/filter/xml/xmldpimp.cxx
@@ -69,25 +69,22 @@ ScXMLDataPilotTablesContext::~ScXMLDataPilotTablesContext()
 GetScImport().UnlockSolarMutex();
 }
 
-SvXMLImportContext *ScXMLDataPilotTablesContext::CreateChildContext( 
sal_uInt16 nPrefix,
-const OUString& rLName,
-const 
css::uno::Reference& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL 
ScXMLDataPilotTablesContext::createFastChildContext(
+sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& 
xAttrList )
 {
 SvXMLImportContext *pContext = nullptr;
 
-const SvXMLTokenMap& rTokenMap = 
GetScImport().GetDataPilotTablesElemTokenMap();
-switch( rTokenMap.Get( nPrefix, rLName ) )
+switch (nElement)
 {
-case XML_TOK_DATA_PILOT_TABLE :
+case XML_ELEMENT( TABLE, XML_DATA_PILOT_TABLE ) :
 {
-pContext = new ScXMLDataPilotTableContext( GetScImport(), nPrefix,
-  rLName, xAttrList);
+pContext = new ScXMLDataPilotTableContext( GetScImport(), 
nElement, xAttrList);
 }
 break;
 }
 
 if( !pContext )
-pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+pContext = new SvXMLImportContext( GetImport() );
 
 return pContext;
 }
@@ -96,10 +93,9 @@ ScXMLDataPilotTableContext::GrandTotalItem::GrandTotalItem() 
:
 mbVisible(true) {}
 
 ScXMLDataPilotTableContext::ScXMLDataPilotTableContext( ScXMLImport& rImport,
-  sal_uInt16 nPrfx,
-  const OUString& rLName,
-  const 
css::uno::Reference& xAttrList) :
-ScXMLImportContext( rImport, nPrfx, rLName ),
+  sal_Int32 /*nElement*/,
+  const 
css::uno::Reference& xAttrList) :
+ScXMLImportContext( rImport ),
 pDoc(GetScImport().GetDocument()),
 pDPObject(nullptr),
 pDPDimSaveData(nullptr),
@@ -120,88 +116,86 @@ ScXMLDataPilotTableContext::ScXMLDataPilotTableContext( 
ScXMLImport& rImport,
 bDrillDown(true),
 bHeaderGridLayout(false)
 {
-sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-const SvXMLTokenMap& rAttrTokenMap = 
GetScImport().GetDataPilotTableAttrTokenMap();
-for( sal_Int16 i=0; i < nAttrCount; ++i )
+if ( xAttrList.is() )
 {
-const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-OUString aLocalName;
-sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
-sAttrName, &aLocalName );
-const OUString& sValue(xAttrList->getValueByIndex( i ));
+sax_fastparser::FastAttributeList *pAttribList =
+sax_fastparser::FastAttributeList::castToFastAttributeList( 
xAttrList );
 
-switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+for (auto &aIter : *pAttribList)
 {
-case XML_TOK_DATA_PILOT_TABLE_ATTR_NAME :
-{
-sDataPilotTableName = sValue;
-}
-break;
-case XML_TOK_DATA_PILOT_TABLE_ATTR_APPLICATION_DATA :
+switch (aIter.getToken())
 {
-sApplicationData = sValue;
-}

Re: [GSoC] Migrating from legacy Parser to FastParser - Weekly Report

2017-07-25 Thread Mohammed Abdul Azeem
Hi,

*Week 7 and week 8*

We've continued to convert legacy contexts in sc/ module to fast contexts.
I also fixed a bug tdf#108835 (Writer was freezing when adding autocorrect
entry, due to synchronisation problems in package/ code).

*Patches*:
https://gerrit.libreoffice.org/39723
https://gerrit.libreoffice.org/39927
https://gerrit.libreoffice.org/40012
https://gerrit.libreoffice.org/40160
https://gerrit.libreoffice.org/40246

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2017-07-24 Thread Mohammed Abdul Azeem
 sc/source/filter/xml/xmldrani.cxx |  480 +++---
 sc/source/filter/xml/xmldrani.hxx |  101 +++
 sc/source/filter/xml/xmlfilti.cxx |   74 ++---
 sc/source/filter/xml/xmlfilti.hxx |7 
 sc/source/filter/xml/xmlnexpi.cxx |  152 
 sc/source/filter/xml/xmlnexpi.hxx |   27 --
 sc/source/filter/xml/xmlsorti.cxx |  100 ---
 sc/source/filter/xml/xmlsorti.hxx |7 
 8 files changed, 398 insertions(+), 550 deletions(-)

New commits:
commit 316ea4a15826df71fad9fe0fe80c9feb49511f13
Author: Mohammed Abdul Azeem 
Date:   Sun Jul 23 11:52:59 2017 +0530

Moving legacy contexts to FastContexts:

ScXMLSourceSQLContext
ScXMLSourceTableContext
ScXMLSourceQueryContext
ScXMLConResContext
ScXMLSubTotalRulesContext
ScXMLSortGroupsContext
ScXMLSubTotalRuleContext
ScXMLSubTotalFieldContext
ScXMLFilterContext
ScXMLNamedRangeContext
ScXMLNamedExpressionContext
ScXMLSortContext

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

diff --git a/sc/source/filter/xml/xmldrani.cxx 
b/sc/source/filter/xml/xmldrani.cxx
index fd9e6f6d74f6..22860afdf71d 100644
--- a/sc/source/filter/xml/xmldrani.cxx
+++ b/sc/source/filter/xml/xmldrani.cxx
@@ -204,57 +204,50 @@ ScXMLDatabaseRangeContext::~ScXMLDatabaseRangeContext()
 {
 }
 
-SvXMLImportContext *ScXMLDatabaseRangeContext::CreateChildContext( sal_uInt16 
nPrefix,
-const OUString& rLName,
-const 
css::uno::Reference& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL 
ScXMLDatabaseRangeContext::createFastChildContext(
+sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& 
xAttrList )
 {
 SvXMLImportContext *pContext = nullptr;
 
-const SvXMLTokenMap& rTokenMap = 
GetScImport().GetDatabaseRangeElemTokenMap();
-switch( rTokenMap.Get( nPrefix, rLName ) )
+switch (nElement)
 {
-case XML_TOK_DATABASE_RANGE_SOURCE_SQL :
+case XML_ELEMENT( TABLE, XML_DATABASE_SOURCE_SQL ):
 {
-pContext = new ScXMLSourceSQLContext( GetScImport(), nPrefix,
-  rLName, xAttrList, 
this);
+pContext = new ScXMLSourceSQLContext( GetScImport(), nElement, 
xAttrList, this);
 }
 break;
-case XML_TOK_DATABASE_RANGE_SOURCE_TABLE :
+case XML_ELEMENT( TABLE, XML_DATABASE_SOURCE_TABLE ):
 {
-pContext = new ScXMLSourceTableContext( GetScImport(), nPrefix,
-  rLName, xAttrList, 
this);
+pContext = new ScXMLSourceTableContext( GetScImport(), nElement, 
xAttrList, this);
 }
 break;
-case XML_TOK_DATABASE_RANGE_SOURCE_QUERY :
+case XML_ELEMENT( TABLE, XML_DATABASE_SOURCE_QUERY ):
 {
-pContext = new ScXMLSourceQueryContext( GetScImport(), nPrefix,
-  rLName, xAttrList, 
this);
+pContext = new ScXMLSourceQueryContext( GetScImport(), nElement, 
xAttrList, this);
 }
 break;
-case XML_TOK_FILTER :
+case XML_ELEMENT( TABLE, XML_FILTER ):
 {
 pContext = new ScXMLFilterContext(
-GetScImport(), nPrefix, rLName, xAttrList, *mpQueryParam, 
this);
+GetScImport(), nElement, xAttrList, *mpQueryParam, this);
 }
 break;
-case XML_TOK_SORT :
+case XML_ELEMENT( TABLE, XML_SORT ):
 {
 bContainsSort = true;
-pContext = new ScXMLSortContext( GetScImport(), nPrefix,
-  rLName, xAttrList, 
this);
+pContext = new ScXMLSortContext( GetScImport(), nElement, 
xAttrList, this);
 }
 break;
-case XML_TOK_DATABASE_RANGE_SUBTOTAL_RULES :
+case XML_ELEMENT( TABLE, XML_SUBTOTAL_RULES ):
 {
 bContainsSubTotal = true;
-pContext = new ScXMLSubTotalRulesContext( GetScImport(), nPrefix,
-  rLName, xAttrList, 
this);
+pContext = new ScXMLSubTotalRulesContext( GetScImport(), nElement, 
xAttrList, this);
 }
 break;
 }
 
 if( !pContext )
-pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+pContext = new SvXMLImportContext( GetImport() );
 
 return pContext;
 }
@@ -462,40 +455,31 @@ void SAL_CALL ScXMLDatabaseRangeContext::endFastElement( 
sal_Int32 /*nElement*/
 }
 
 ScXMLSourceSQLContext::ScXMLSourceSQLContext( ScXMLImport& rImport,
-  sal_uInt16 nPrfx,
-

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

2017-07-20 Thread Mohammed Abdul Azeem
 sc/source/filter/xml/XMLTableShapesContext.cxx |   11 --
 sc/source/filter/xml/XMLTableShapesContext.hxx |7 -
 sc/source/filter/xml/XMLTableSourceContext.cxx |   65 +---
 sc/source/filter/xml/XMLTableSourceContext.hxx |   12 --
 sc/source/filter/xml/xmlcoli.cxx   |  106 ---
 sc/source/filter/xml/xmlcoli.hxx   |   24 +---
 sc/source/filter/xml/xmlcondformat.cxx |7 -
 sc/source/filter/xml/xmlcondformat.hxx |5 
 sc/source/filter/xml/xmllabri.cxx  |   67 +---
 sc/source/filter/xml/xmllabri.hxx  |   23 ++--
 sc/source/filter/xml/xmlsceni.cxx  |  109 
 sc/source/filter/xml/xmlsceni.hxx  |   12 --
 sc/source/filter/xml/xmltabi.cxx   |  135 +++--
 sc/source/filter/xml/xmltabi.hxx   |   12 --
 14 files changed, 259 insertions(+), 336 deletions(-)

New commits:
commit a9588baca8137f51e2ca72e40b1f448b0e1885d1
Author: Mohammed Abdul Azeem 
Date:   Fri Jul 21 00:42:03 2017 +0530

Moving legacy contexts to FastContexts:

ScXMLTableShapesContext
ScXMLTableSourceContext
ScXMLTableColContext
ScXMLTableColsContext
ScXMLConditionalFormatsContext
ScXMLTableProtectionContext

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

diff --git a/sc/source/filter/xml/XMLTableShapesContext.cxx 
b/sc/source/filter/xml/XMLTableShapesContext.cxx
index 4aa69c0b65cd..35ca7bace2a9 100644
--- a/sc/source/filter/xml/XMLTableShapesContext.cxx
+++ b/sc/source/filter/xml/XMLTableShapesContext.cxx
@@ -25,10 +25,9 @@
 using namespace com::sun::star;
 
 ScXMLTableShapesContext::ScXMLTableShapesContext( ScXMLImport& rImport,
-  sal_uInt16 nPrfx,
-  const OUString& rLName,
-  const 
css::uno::Reference& /* xAttrList */ ) :
-ScXMLImportContext( rImport, nPrfx, rLName )
+  sal_Int32 /*nElement*/,
+  const 
css::uno::Reference& /* xAttrList */ ) :
+ScXMLImportContext( rImport )
 {
 // here are no attributes
 }
@@ -59,8 +58,4 @@ SvXMLImportContext 
*ScXMLTableShapesContext::CreateChildContext( sal_uInt16 nPre
 return pContext;
 }
 
-void ScXMLTableShapesContext::EndElement()
-{
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/XMLTableShapesContext.hxx 
b/sc/source/filter/xml/XMLTableShapesContext.hxx
index db9a3f3b2f20..93d85e3a47d6 100644
--- a/sc/source/filter/xml/XMLTableShapesContext.hxx
+++ b/sc/source/filter/xml/XMLTableShapesContext.hxx
@@ -27,17 +27,14 @@
 class ScXMLTableShapesContext : public ScXMLImportContext
 {
 public:
-ScXMLTableShapesContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-const OUString& rLName,
-const 
css::uno::Reference& xAttrList);
+ScXMLTableShapesContext( ScXMLImport& rImport, sal_Int32 nElement,
+const 
css::uno::Reference& xAttrList);
 
 virtual ~ScXMLTableShapesContext() override;
 
 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
  const OUString& rLocalName,
  const 
css::uno::Reference& xAttrList ) override;
-
-virtual void EndElement() override;
 };
 
 #endif
diff --git a/sc/source/filter/xml/XMLTableSourceContext.cxx 
b/sc/source/filter/xml/XMLTableSourceContext.cxx
index 8909adb7f0b4..7d0c936a0346 100644
--- a/sc/source/filter/xml/XMLTableSourceContext.cxx
+++ b/sc/source/filter/xml/XMLTableSourceContext.cxx
@@ -32,10 +32,9 @@ using namespace com::sun::star;
 using namespace xmloff::token;
 
 ScXMLTableSourceContext::ScXMLTableSourceContext( ScXMLImport& rImport,
-  sal_uInt16 nPrfx,
-  const OUString& rLName,
-  const 
css::uno::Reference& xAttrList) :
-ScXMLImportContext( rImport, nPrfx, rLName ),
+  sal_Int32 /*nElement*/,
+  const 
css::uno::Reference& xAttrList) :
+ScXMLImportContext( rImport ),
 sLink(),
 sTableName(),
 sFilterName(),
@@ -43,37 +42,36 @@ ScXMLTableSourceContext::ScXMLTableSourceContext( 
ScXMLImport& rImport,
 nRefresh(0),
 nMode(sheet::SheetLinkMode_NORMAL)
 {
-sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
-for( sal_Int16 i=0; i < nAttrCount; ++i )
+if ( xAttrList.is() )
 {
-const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-OUString aLocalName;

[Libreoffice-commits] core.git: package/inc package/source

2017-07-19 Thread Mohammed Abdul Azeem
 package/inc/ZipFile.hxx|4 +++-
 package/inc/ZipPackageStream.hxx   |2 +-
 package/source/zipapi/ZipFile.cxx  |   11 ---
 package/source/zippackage/ZipPackageStream.cxx |8 
 4 files changed, 16 insertions(+), 9 deletions(-)

New commits:
commit def6f7f749dd0a175427e51d8620b1406084d553
Author: Mohammed Abdul Azeem 
Date:   Wed Jul 19 00:34:43 2017 +0530

tdf#108835 Fixed writer crash on adding Autocorrect Entry:

ZipPackageStream::saveChild seeks and reads on the same
stream, so it cannot be done parallely. Also, read on
BufferedStream tries to aquire the same mutes, which is
already aquired by the calling method resulting in
deadlock. Using UnbufferedStream here should solve both.

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

diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx
index 1ca47f43b19c..021493d64459 100644
--- a/package/inc/ZipFile.hxx
+++ b/package/inc/ZipFile.hxx
@@ -71,6 +71,7 @@ class ZipFile
 const ::rtl::Reference < EncryptionData > &rData,
 sal_Int8 nStreamMode,
 bool bDecrypt,
+const bool bUseBufferedStream = true,
 const OUString& aMediaType = OUString() );
 
 bool hasValidPassword ( ZipEntry & rEntry, const rtl::Reference < 
EncryptionData > &rData );
@@ -108,7 +109,8 @@ public:
 ZipEntry& rEntry,
 const ::rtl::Reference < EncryptionData > &rData,
 bool bDecrypt,
-const rtl::Reference& aMutexHolder );
+const rtl::Reference& aMutexHolder,
+const bool bUseBufferedStream = true );
 
 static css::uno::Reference< css::xml::crypto::XDigestContext > 
StaticGetDigestContextForChecksum(
 const css::uno::Reference< css::uno::XComponentContext >& 
xArgContext,
diff --git a/package/inc/ZipPackageStream.hxx b/package/inc/ZipPackageStream.hxx
index 5930e300898b..228b5c08618d 100644
--- a/package/inc/ZipPackageStream.hxx
+++ b/package/inc/ZipPackageStream.hxx
@@ -74,7 +74,7 @@ private:
 /// Check that m_xStream implements io::XSeekable and return it
 css::uno::Reference< css::io::XInputStream > const & GetOwnSeekStream();
 /// @throws css::uno::RuntimeException
-css::uno::Reference< css::io::XInputStream > SAL_CALL getRawData();
+css::uno::Reference< css::io::XInputStream > SAL_CALL getRawData( const 
bool bUseBufferedStream = true );
 
 public:
 bool IsPackageMember () const { return m_nStreamMode == 
PACKAGE_STREAM_PACKAGEMEMBER;}
diff --git a/package/source/zipapi/ZipFile.cxx 
b/package/source/zipapi/ZipFile.cxx
index 12c0c5ff86d1..817a0e2798bb 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -609,6 +609,7 @@ uno::Reference< XInputStream > 
ZipFile::createStreamForZipEntry(
 const ::rtl::Reference< EncryptionData > &rData,
 sal_Int8 nStreamMode,
 bool bIsEncrypted,
+const bool bUseBufferedStream,
 const OUString& aMediaType )
 {
 ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
@@ -616,6 +617,9 @@ uno::Reference< XInputStream > 
ZipFile::createStreamForZipEntry(
 rtl::Reference< XUnbufferedStream > xSrcStream = new XUnbufferedStream(
 m_xContext, aMutexHolder, rEntry, xStream, rData, nStreamMode, 
bIsEncrypted, aMediaType, bRecoveryMode);
 
+if (!bUseBufferedStream)
+return xSrcStream.get();
+
 uno::Reference xBufStream;
 static const sal_Int32 nThreadingThreshold = 1;
 
@@ -698,14 +702,15 @@ uno::Reference< XInputStream > ZipFile::getDataStream( 
ZipEntry& rEntry,
 uno::Reference< XInputStream > ZipFile::getRawData( ZipEntry& rEntry,
 const ::rtl::Reference< EncryptionData >& rData,
 bool bIsEncrypted,
-const rtl::Reference& aMutexHolder )
+const rtl::Reference& aMutexHolder,
+const bool bUseBufferedStream )
 {
 ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
 
 if ( rEntry.nOffset <= 0 )
 readLOC( rEntry );
 
-return createStreamForZipEntry ( aMutexHolder, rEntry, rData, 
UNBUFF_STREAM_RAW, bIsEncrypted );
+return createStreamForZipEntry ( aMutexHolder, rEntry, rData, 
UNBUFF_STREAM_RAW, bIsEncrypted, bUseBufferedStream );
 }
 
 uno::Reference< XInputStream > ZipFile::getWrappedRawStream(
@@ -722,7 +727,7 @@ uno::Reference< XInputStream > ZipFile::getWrappedRawStream(
 if ( rEntry.nOffset <= 0 )
 readLOC( rEntry );
 
-return createStreamForZipEntry ( aMutexHolder, rEntry, rData, 
UNBUFF_STREAM_WRAPPEDRAW, true, aMediaType );
+return createStreamForZipEntry ( aMutexHold

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

2017-07-18 Thread Mohammed Abdul Azeem
 sc/source/filter/xml/XMLCalculationSettingsContext.cxx |  107 ++-
 sc/source/filter/xml/XMLCalculationSettingsContext.hxx |   29 -
 sc/source/filter/xml/xmlcvali.cxx  |  258 -
 sc/source/filter/xml/xmlcvali.hxx  |5 
 4 files changed, 179 insertions(+), 220 deletions(-)

New commits:
commit 42c8000e68ab9d04f12a71bdaacb3718cb35bbd3
Author: Mohammed Abdul Azeem 
Date:   Sun Jul 16 23:18:02 2017 +0530

Moving legacy contexts to FastContexts:

ScXMLNullDateContext
ScXMLIterationContext
ScXMLContentValidationContext
ScXMLHelpMessageContext
ScXMLErrorMessageContext
ScXMLErrorMacroContext

Change-Id: Ic2a4f038891aefbb94b1d9ada96da7c139c6c9fe
Reviewed-on: https://gerrit.libreoffice.org/40012
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Reviewed-by: Michael Meeks 

diff --git a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx 
b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
index 1347c299ff29..0617d2654b14 100644
--- a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
+++ b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
@@ -96,22 +96,18 @@ 
ScXMLCalculationSettingsContext::~ScXMLCalculationSettingsContext()
 {
 }
 
-SvXMLImportContext *ScXMLCalculationSettingsContext::CreateChildContext( 
sal_uInt16 nPrefix,
-const OUString& rLName,
-const css::uno::Reference< 
css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL 
ScXMLCalculationSettingsContext::createFastChildContext(
+sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& 
xAttrList )
 {
 SvXMLImportContext *pContext = nullptr;
 
-if (nPrefix == XML_NAMESPACE_TABLE)
-{
-if (IsXMLToken(rLName, XML_NULL_DATE))
-pContext = new ScXMLNullDateContext(GetScImport(), nPrefix, 
rLName, xAttrList, this);
-else if (IsXMLToken(rLName, XML_ITERATION))
-pContext = new ScXMLIterationContext(GetScImport(), nPrefix, 
rLName, xAttrList, this);
-}
+if (nElement == XML_ELEMENT( TABLE, XML_NULL_DATE ))
+pContext = new ScXMLNullDateContext(GetScImport(), nElement, 
xAttrList, this);
+else if (nElement == XML_ELEMENT( TABLE, XML_ITERATION ))
+pContext = new ScXMLIterationContext(GetScImport(), nElement, 
xAttrList, this);
 
 if( !pContext )
-pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+pContext = new SvXMLImportContext( GetImport() );
 
 return pContext;
 }
@@ -147,25 +143,21 @@ void SAL_CALL 
ScXMLCalculationSettingsContext::endFastElement( sal_Int32 /*nElem
 }
 
 ScXMLNullDateContext::ScXMLNullDateContext( ScXMLImport& rImport,
-  sal_uInt16 nPrfx,
-  const OUString& rLName,
-  const css::uno::Reference< 
css::xml::sax::XAttributeList>& xAttrList,
+  sal_Int32 /*nElement*/,
+  const css::uno::Reference< 
css::xml::sax::XFastAttributeList>& xAttrList,
   ScXMLCalculationSettingsContext* 
pCalcSet) :
-ScXMLImportContext( rImport, nPrfx, rLName )
+ScXMLImportContext( rImport )
 {
-sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-for( sal_Int16 i=0; i < nAttrCount; ++i )
+if ( xAttrList.is() )
 {
-const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-OUString aLocalName;
-sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
-sAttrName, &aLocalName );
-const OUString& sValue(xAttrList->getValueByIndex( i ));
+sax_fastparser::FastAttributeList *pAttribList =
+sax_fastparser::FastAttributeList::castToFastAttributeList( 
xAttrList );
 
-if (nPrefix == XML_NAMESPACE_TABLE && IsXMLToken(aLocalName, 
XML_DATE_VALUE))
+auto &aIter( pAttribList->find( XML_ELEMENT( TABLE, XML_DATE_VALUE ) ) 
);
+if (aIter != pAttribList->end())
 {
 util::DateTime aDateTime;
-::sax::Converter::parseDateTime(aDateTime, nullptr, sValue);
+::sax::Converter::parseDateTime(aDateTime, nullptr, 
aIter.toString());
 util::Date aDate;
 aDate.Day = aDateTime.Day;
 aDate.Month = aDateTime.Month;
@@ -179,53 +171,39 @@ ScXMLNullDateContext::~ScXMLNullDateContext()
 {
 }
 
-SvXMLImportContext *ScXMLNullDateContext::CreateChildContext( sal_uInt16 
nPrefix,
-const OUString& rLName,
-const css::uno::Reference< 
css::xml::sax::

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

2017-07-13 Thread Mohammed Abdul Azeem
 sc/source/filter/xml/XMLTrackedChangesContext.cxx | 1071 +-
 sc/source/filter/xml/XMLTrackedChangesContext.hxx |5 
 2 files changed, 480 insertions(+), 596 deletions(-)

New commits:
commit 85ff2eafc692f6f0d33ac611600935a96058f20a
Author: Mohammed Abdul Azeem 
Date:   Thu Jul 13 23:32:46 2017 +0530

Moving legacy contexts to FastContexts:

ScXMLTrackedChangesContext
ScXMLChangeInfoContext
ScXMLBigRangeContext
ScXMLCellContentDeletionContext
ScXMLDependenceContext
ScXMLDependingsContext
ScXMLChangeDeletionContext
ScXMLDeletionsContext
ScXMLChangeCellContext
ScXMLPreviousContext
ScXMLContentChangeContext
ScXMLInsertionContext
ScXMLDeletionContext
ScXMLMovementContext
ScXMLRejectionContext

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

diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx 
b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index 22fc26b133eb..ffe7085ee1f0 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -49,15 +49,15 @@ class ScXMLChangeInfoContext : public ScXMLImportContext
 sal_uInt32  nParagraphCount;
 
 public:
-ScXMLChangeInfoContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const 
OUString& rLName,
-  const 
css::uno::Reference& xAttrList,
+ScXMLChangeInfoContext( ScXMLImport& rImport, sal_Int32 nElement,
+  const 
css::uno::Reference& xAttrList,
   ScXMLChangeTrackingImportHelper* 
pChangeTrackingImportHelper);
 
 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
 const OUString& rLocalName,
 const 
css::uno::Reference& xAttrList ) override;
 
-virtual void EndElement() override;
+virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 };
 
 class ScXMLBigRangeContext : public ScXMLImportContext
@@ -65,15 +65,12 @@ class ScXMLBigRangeContext : public ScXMLImportContext
 ScBigRange& rBigRange;
 
 public:
-ScXMLBigRangeContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const 
OUString& rLName,
-  const 
css::uno::Reference& xAttrList,
+ScXMLBigRangeContext( ScXMLImport& rImport, sal_Int32 nElement,
+  const 
css::uno::Reference& xAttrList,
   ScBigRange& rBigRange);
 
-virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-const OUString& rLocalName,
-const 
css::uno::Reference& xAttrList ) override;
-
-virtual void EndElement() override;
+virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL 
createFastChildContext(
+sal_Int32 nElement, const css::uno::Reference< 
css::xml::sax::XFastAttributeList >& xAttrList ) override;
 };
 
 class ScXMLCellContentDeletionContext : public ScXMLImportContext
@@ -94,15 +91,14 @@ class ScXMLCellContentDeletionContext : public 
ScXMLImportContext
 ScMatrixModenMatrixFlag;
 
 public:
-ScXMLCellContentDeletionContext( ScXMLImport& rImport, sal_uInt16 nPrfx, 
const OUString& rLName,
-  const 
css::uno::Reference& xAttrList,
+ScXMLCellContentDeletionContext( ScXMLImport& rImport, sal_Int32 nElement,
+  const 
css::uno::Reference& xAttrList,
   ScXMLChangeTrackingImportHelper* 
pChangeTrackingImportHelper);
 
-virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-const OUString& rLocalName,
-const 
css::uno::Reference& xAttrList ) override;
+virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL 
createFastChildContext(
+sal_Int32 nElement, const css::uno::Reference< 
css::xml::sax::XFastAttributeList >& xAttrList ) override;
 
-virtual void EndElement() override;
+virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 };
 
 class ScXMLDependenceContext : public ScXMLImportContext
@@ -110,15 +106,12 @@ class ScXMLDependenceContext : public ScXMLImportContext
 ScXMLChangeTrackingImportHelper*pChangeTrackingImportHelper;
 
 public:
-ScXMLDependenceContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const 
OUString& rLName,
- 

Re: [GSoC] Migrating from legacy Parser to FastParser - Weekly Report

2017-07-12 Thread Mohammed Abdul Azeem
Hi,

*Week 5 and week 6*

We continued to work on converting legacy contexts to new contexts, along
with some refactoring of code related to FastAttributeIter to make the code
using them more readable. Besides, Michael helped me in solving the bug
tdf#108821 (https://gerrit.libreoffice.org/39374).

*Patches*:
https://gerrit.libreoffice.org/39380
https://gerrit.libreoffice.org/39370
https://gerrit.libreoffice.org/39397
https://gerrit.libreoffice.org/39665
https://gerrit.libreoffice.org/39730



Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[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 &mrList;
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 &aIter : *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 &aIter : *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::

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

2017-07-10 Thread Mohammed Abdul Azeem
 include/xmloff/xmltoken.hxx|5 +
 sc/source/filter/xml/XMLCalculationSettingsContext.cxx |   12 ++--
 sc/source/filter/xml/XMLConsolidationContext.cxx   |2 +-
 sc/source/filter/xml/datastreamimport.cxx  |4 ++--
 sc/source/filter/xml/xmlbodyi.cxx  |2 +-
 sc/source/filter/xml/xmlcelli.cxx  |4 ++--
 sc/source/filter/xml/xmldrani.cxx  |   14 +++---
 sc/source/filter/xml/xmlexternaltabi.cxx   |2 +-
 sc/source/filter/xml/xmlrowi.cxx   |2 +-
 sc/source/filter/xml/xmltabi.cxx   |4 ++--
 xmloff/source/core/xmltoken.cxx|   11 +++
 11 files changed, 39 insertions(+), 23 deletions(-)

New commits:
commit 5364990831a7d5773ddbc2f35842c7b3a8d5534a
Author: Mohammed Abdul Azeem 
Date:   Sun Jul 9 22:37:00 2017 +0530

Adding an overloaded IsXMLToken method:

Passing FastAttributeIter to the method makes the
code much cleaner and easy to read.

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

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index d746ae78c5d0..976ffeea583f 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /**
  * Handling of tokens in XML:
@@ -3302,6 +3303,10 @@ namespace xmloff { namespace token {
 XMLOFF_DLLPUBLIC bool IsXMLToken(
 const char* pCString,
 enum XMLTokenEnum eToken );
+
+XMLOFF_DLLPUBLIC bool IsXMLToken(
+const sax_fastparser::FastAttributeList::FastAttributeIter& aIter,
+enum XMLTokenEnum eToken );
 } }
 
 #endif
diff --git a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx 
b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
index f39ccebe5eb6..e885d737de33 100644
--- a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
+++ b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
@@ -58,19 +58,19 @@ 
ScXMLCalculationSettingsContext::ScXMLCalculationSettingsContext( ScXMLImport& r
 switch( aIter.getToken() )
 {
 case XML_ELEMENT( TABLE, XML_CASE_SENSITIVE ):
-if( IsXMLToken( aIter.toCString(), XML_FALSE ) )
+if( IsXMLToken( aIter, XML_FALSE ) )
 bIgnoreCase = true;
 break;
 case XML_ELEMENT( TABLE, XML_PRECISION_AS_SHOWN ):
-if( IsXMLToken( aIter.toCString(), XML_TRUE ) )
+if( IsXMLToken( aIter, XML_TRUE ) )
 bCalcAsShown = true;
 break;
 case XML_ELEMENT( TABLE, 
XML_SEARCH_CRITERIA_MUST_APPLY_TO_WHOLE_CELL ):
-if( IsXMLToken( aIter.toCString(), XML_FALSE ) )
+if( IsXMLToken( aIter, XML_FALSE ) )
 bMatchWholeCell = false;
 break;
 case XML_ELEMENT( TABLE, XML_AUTOMATIC_FIND_LABELS ):
-if( IsXMLToken( aIter.toCString(), XML_FALSE ) )
+if( IsXMLToken( aIter, XML_FALSE ) )
 bLookUpLabels = false;
 break;
 case XML_ELEMENT( TABLE, XML_NULL_YEAR ):
@@ -80,11 +80,11 @@ 
ScXMLCalculationSettingsContext::ScXMLCalculationSettingsContext( ScXMLImport& r
 break;
 case XML_ELEMENT( TABLE, XML_USE_REGULAR_EXPRESSIONS ):
 // Overwrite only the default (regex true) value, not wildcard.
-if( eSearchType == utl::SearchParam::SearchType::Regexp && 
IsXMLToken( aIter.toCString(), XML_FALSE ) )
+if( eSearchType == utl::SearchParam::SearchType::Regexp && 
IsXMLToken( aIter, XML_FALSE ) )
 eSearchType = utl::SearchParam::SearchType::Normal;
 break;
 case XML_ELEMENT( TABLE, XML_USE_WILDCARDS ):
-if( IsXMLToken( aIter.toCString(), XML_TRUE ) )
+if( IsXMLToken( aIter, XML_TRUE ) )
 eSearchType = utl::SearchParam::SearchType::Wildcard;
 break;
 }
diff --git a/sc/source/filter/xml/XMLConsolidationContext.cxx 
b/sc/source/filter/xml/XMLConsolidationContext.cxx
index 8e27b573de7b..092f561cec99 100644
--- a/sc/source/filter/xml/XMLConsolidationContext.cxx
+++ b/sc/source/filter/xml/XMLConsolidationContext.cxx
@@ -65,7 +65,7 @@ ScXMLConsolidationContext::ScXMLConsolidationContext(
 sUseLabel = aIter.toString();
 break;
 case XML_ELEMENT( TABLE, XML_LINK_TO_SOURCE_DATA ):
-bLinkToSource = IsXMLToken( aIter.toCString(), XML_TRUE );
+bLinkToSource = IsXMLToken( aIter, XML_TRUE );
 break;
 

[Libreoffice-commits] core.git: package/source

2017-07-07 Thread Mohammed Abdul Azeem
 package/source/zipapi/XBufferedThreadedStream.cxx |4 ++--
 package/source/zipapi/XBufferedThreadedStream.hxx |2 +-
 package/source/zipapi/XUnbufferedStream.cxx   |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit a62507eb405961c27ebf79d6b9bdd7a106d06123
Author: Mohammed Abdul Azeem 
Date:   Fri Jul 7 00:01:03 2017 +0530

tdf#108821 - fix for overflow of variables on opening huge files

This should fix the issue, as well as restrict available
to return only non-negative values.

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

diff --git a/package/source/zipapi/XBufferedThreadedStream.cxx 
b/package/source/zipapi/XBufferedThreadedStream.cxx
index 87b7349cccba..c7fd3dbacd36 100644
--- a/package/source/zipapi/XBufferedThreadedStream.cxx
+++ b/package/source/zipapi/XBufferedThreadedStream.cxx
@@ -145,7 +145,7 @@ sal_Int32 SAL_CALL XBufferedThreadedStream::readBytes( 
Sequence< sal_Int8 >& rDa
 if( !hasBytes() )
 return 0;
 
-const sal_Int32 nAvailableSize = std::min( nBytesToRead, 
remainingSize() );
+const sal_Int32 nAvailableSize = static_cast< sal_Int32 > ( std::min< 
sal_Int64 >( nBytesToRead, remainingSize() ) );
 rData.realloc( nAvailableSize );
 sal_Int32 i = 0, nPendingBytes = nAvailableSize;
 
@@ -188,7 +188,7 @@ sal_Int32 SAL_CALL XBufferedThreadedStream::available()
 if( !hasBytes() )
 return 0;
 
-return remainingSize();
+return static_cast< sal_Int32 > ( std::min< sal_Int64 >( SAL_MAX_INT32, 
remainingSize() ) );
 }
 
 void SAL_CALL XBufferedThreadedStream::closeInput()
diff --git a/package/source/zipapi/XBufferedThreadedStream.hxx 
b/package/source/zipapi/XBufferedThreadedStream.hxx
index 9ba908e01f5e..c28bb049de16 100644
--- a/package/source/zipapi/XBufferedThreadedStream.hxx
+++ b/package/source/zipapi/XBufferedThreadedStream.hxx
@@ -44,7 +44,7 @@ private:
 static const size_t nBufferSize = 32 * 1024;
 
 const Buffer& getNextBlock();
-size_t remainingSize() const { return mnStreamSize - mnPos; }
+sal_Int64 remainingSize() const { return mnStreamSize - mnPos; }
 bool hasBytes() const { return mnPos < mnStreamSize; }
 
 bool canProduce() const
diff --git a/package/source/zipapi/XUnbufferedStream.cxx 
b/package/source/zipapi/XUnbufferedStream.cxx
index e82e720795d3..d1f65b29b7aa 100644
--- a/package/source/zipapi/XUnbufferedStream.cxx
+++ b/package/source/zipapi/XUnbufferedStream.cxx
@@ -310,7 +310,7 @@ void SAL_CALL XUnbufferedStream::skipBytes( sal_Int32 
nBytesToSkip )
 sal_Int32 SAL_CALL XUnbufferedStream::available(  )
 {
 //available size must include the prepended header in case of wrapped raw 
stream
-return static_cast < sal_Int32 > ( mnZipSize + mnHeaderToRead - 
mnMyCurrent );
+return static_cast< sal_Int32 > ( std::min< sal_Int64 >( SAL_MAX_INT32, 
(mnZipSize + mnHeaderToRead - mnMyCurrent) ) );
 }
 
 void SAL_CALL XUnbufferedStream::closeInput(  )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-06-30 Thread Mohammed Abdul Azeem
 sc/source/filter/xml/XMLCalculationSettingsContext.cxx |   69 +++
 sc/source/filter/xml/XMLCalculationSettingsContext.hxx |7 
 sc/source/filter/xml/XMLConsolidationContext.cxx   |   64 +++---
 sc/source/filter/xml/XMLConsolidationContext.hxx   |7 
 sc/source/filter/xml/XMLDDELinksContext.cxx|   11 -
 sc/source/filter/xml/XMLDDELinksContext.hxx|7 
 sc/source/filter/xml/XMLTrackedChangesContext.cxx  |   36 +--
 sc/source/filter/xml/XMLTrackedChangesContext.hxx  |5 
 sc/source/filter/xml/datastreamimport.cxx  |   68 +++
 sc/source/filter/xml/datastreamimport.hxx  |6 
 sc/source/filter/xml/importcontext.cxx |6 
 sc/source/filter/xml/importcontext.hxx |4 
 sc/source/filter/xml/xmlbodyi.cxx  |  109 ---
 sc/source/filter/xml/xmlbodyi.hxx  |4 
 sc/source/filter/xml/xmlcvali.cxx  |   11 -
 sc/source/filter/xml/xmlcvali.hxx  |7 
 sc/source/filter/xml/xmldpimp.cxx  |   11 -
 sc/source/filter/xml/xmldpimp.hxx  |7 
 sc/source/filter/xml/xmldrani.cxx  |  164 +++--
 sc/source/filter/xml/xmldrani.hxx  |   20 --
 sc/source/filter/xml/xmllabri.cxx  |   11 -
 sc/source/filter/xml/xmllabri.hxx  |6 
 sc/source/filter/xml/xmlnexpi.cxx  |   12 -
 sc/source/filter/xml/xmlnexpi.hxx  |6 
 sc/source/filter/xml/xmltabi.cxx   |   16 -
 25 files changed, 284 insertions(+), 390 deletions(-)

New commits:
commit 4b5f5f868fa6a7c86535d251e77d8a6d956f2fa4
Author: Mohammed Abdul Azeem 
Date:   Thu Jun 29 23:39:07 2017 +0530

Moving legacy contexts to FastContexts:

ScXMLTrackedChangesContext
ScXMLCalculationSettingsContext
ScXMLContentValidationsContext
ScXMLLabelRangesContext
ScXMLNamedExpressionsContext
ScXMLDatabaseRangesContext
ScXMLDatabaseRangeContext
ScXMLDataPilotTablesContext
ScXMLConsolidationContext
ScXMLDDELinksContext
ScXMLDataStreamContext

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

diff --git a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx 
b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
index 452cd3f97836..f39ccebe5eb6 100644
--- a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
+++ b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
@@ -32,10 +32,9 @@ using namespace com::sun::star;
 using namespace xmloff::token;
 
 ScXMLCalculationSettingsContext::ScXMLCalculationSettingsContext( ScXMLImport& 
rImport,
-  sal_uInt16 nPrfx,
-  const OUString& rLName,
-  const css::uno::Reference< 
css::xml::sax::XAttributeList>& xAttrList) :
-ScXMLImportContext( rImport, nPrfx, rLName ),
+  sal_Int32 /*nElement*/,
+  const css::uno::Reference< 
css::xml::sax::XFastAttributeList>& xAttrList) :
+ScXMLImportContext( rImport ),
 fIterationEpsilon(0.001),
 nIterationCount(100),
 nYear2000(1930),
@@ -49,53 +48,45 @@ 
ScXMLCalculationSettingsContext::ScXMLCalculationSettingsContext( ScXMLImport& r
 aNullDate.Day = 30;
 aNullDate.Month = 12;
 aNullDate.Year = 1899;
-sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-for( sal_Int16 i=0; i < nAttrCount; ++i )
+if( xAttrList.is() )
 {
-const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-OUString aLocalName;
-sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
-sAttrName, &aLocalName );
-const OUString& sValue(xAttrList->getValueByIndex( i ));
+sax_fastparser::FastAttributeList *pAttribList =
+static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() 
);
 
-if (nPrefix == XML_NAMESPACE_TABLE)
+for( auto &aIter : *pAttribList )
 {
-if (IsXMLToken(aLocalName, XML_CASE_SENSITIVE))
+switch( aIter.getToken() )
 {
-if (IsXMLToken(sValue, XML_FALSE))
+case XML_ELEMENT( TABLE, XML_CASE_SENSITIVE ):
+if( IsXMLToken( aIter.toCString(), XML_FALSE ) )
 bIgnoreCase = true;
-}
-else if (IsXMLToken(aLocalName, XML_PRECISION_AS_SHOWN))
-{
-if (IsXMLToken(sValue, XML_TRUE))
+break;
+case XML_ELEMENT( TABLE, XML_PRECISION_AS_SHO

Re: [GSoC] Migrating from legacy Parser to FastParser - Weekly Report

2017-06-30 Thread Mohammed Abdul Azeem
Hi,

*Week 4*

We worked on making FastAttributeIter of
sax_fastparser::FastAttributeList cleaner
and better, including some aesthetic changes. Majority of my time this week
went in chasing tdf#108643 bug, which I realized was happening due to a
change by Caolán McNamara and was later fixed by him, I believe. Also I've
started working on adapting contexts from sc/source/filter/xml to work with
fast parser, few at a time.

*Patches*:
https://gerrit.libreoffice.org/38881
https://gerrit.libreoffice.org/38964
https://gerrit.libreoffice.org/39275

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[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 > 
&xTokenHandler,
 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 &aIter( 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 &aIter( 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" &

[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 &it : *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 &it : *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(
 {
  

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

2017-06-27 Thread Mohammed Abdul Azeem
 include/xmloff/xmlimp.hxx  |1 
 sc/source/filter/xml/xmlbodyi.cxx  |8 +
 sc/source/filter/xml/xmlcelli.cxx  |   36 ++-
 sc/source/filter/xml/xmlexternaltabi.cxx   |8 ++---
 sc/source/filter/xml/xmlimprt.cxx  |   15 -
 sc/source/filter/xml/xmlrowi.cxx   |   35 ++
 sc/source/filter/xml/xmltabi.cxx   |   45 ++---
 xmloff/source/core/xmlimp.cxx  |4 +-
 xmloff/source/style/GradientStyle.cxx  |2 -
 xmloff/source/style/HatchStyle.cxx |2 -
 xmloff/source/style/TransGradientStyle.cxx |2 -
 11 files changed, 75 insertions(+), 83 deletions(-)

New commits:
commit c44d9f9e627eb074367cc47ae4742aedea44c370
Author: Mohammed Abdul Azeem 
Date:   Tue Jun 27 00:46:25 2017 +0530

Using fast tokens directly:

Replacing integer-to-integer mapped tokens with
fast Tokens direcly for branching.
Adding a macro XML_ELEMENT that combines namespace
and element tokens.

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

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 8ac87d820c88..1521dd93b0cd 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -64,6 +64,7 @@
 #include 
 
 #define NAMESPACE_TOKEN( prefixToken ) ( ( sal_Int32( prefixToken + 1 ) ) << 
NMSP_SHIFT )
+#define XML_ELEMENT( prefix, name ) ( NAMESPACE_TOKEN( XML_NAMESPACE_##prefix 
) | name )
 
 const size_t NMSP_SHIFT = 16;
 const sal_Int32 TOKEN_MASK = 0x;
diff --git a/sc/source/filter/xml/xmlbodyi.cxx 
b/sc/source/filter/xml/xmlbodyi.cxx
index d55049298f9d..2a21d52899f9 100644
--- a/sc/source/filter/xml/xmlbodyi.cxx
+++ b/sc/source/filter/xml/xmlbodyi.cxx
@@ -111,8 +111,7 @@ ScXMLBodyContext::ScXMLBodyContext( ScXMLImport& rImport,
 else if (  nLocalToken == XML_PROTECTION_KEY_DIGEST_ALGORITHM_2 )
 meHash2 = ScPassHashHelper::getHashTypeFromURI( it.toString() 
);
 }
-else if ( nToken == ( NAMESPACE_TOKEN( XML_NAMESPACE_LO_EXT ) |
-XML_PROTECTION_KEY_DIGEST_ALGORITHM_2 
) )
+else if ( nToken == XML_ELEMENT( LO_EXT, 
XML_PROTECTION_KEY_DIGEST_ALGORITHM_2 ) )
 {
 meHash2 = ScPassHashHelper::getHashTypeFromURI( it.toString() );
 }
@@ -205,10 +204,9 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
 
 SvXMLImportContext *pContext = nullptr;
 
-const SvXMLTokenMap& rTokenMap = GetScImport().GetBodyElemTokenMap();
-switch( rTokenMap.Get( nElement ) )
+switch( nElement )
 {
-case XML_TOK_BODY_TABLE:
+case XML_ELEMENT( TABLE, XML_TABLE ):
 if (GetScImport().GetTables().GetCurrentSheet() >= MAXTAB)
 {
 GetScImport().SetRangeOverflowType(SCWARN_IMPORT_SHEET_OVERFLOW);
diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index 56cbe3ba9462..e6224c11f842 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -158,7 +158,6 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( 
ScXMLImport& rImport,
 
 std::unique_ptr xStyleName;
 std::unique_ptr xCurrencySymbol;
-const SvXMLTokenMap& rTokenMap = rImport.GetTableRowCellAttrTokenMap();
 if( xAttrList.is() )
 {
 sax_fastparser::FastAttributeList *pAttribList;
@@ -167,43 +166,42 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( 
ScXMLImport& rImport,
 
 for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
 {
-sal_uInt16 nToken = rTokenMap.Get( it.getToken() );
-switch ( nToken )
+switch ( it.getToken() )
 {
-case XML_TOK_TABLE_ROW_CELL_ATTR_STYLE_NAME:
+case XML_ELEMENT( TABLE, XML_STYLE_NAME ):
 xStyleName.reset( new OUString( it.toString() ) );
 mbHasStyle = true;
 break;
-case XML_TOK_TABLE_ROW_CELL_ATTR_CONTENT_VALIDATION_NAME:
+case XML_ELEMENT( TABLE, XML_CONTENT_VALIDATION_NAME ):
 OSL_ENSURE(!maContentValidationName, "here should be only 
one Validation Name");
 if (!it.isEmpty())
 maContentValidationName.reset(it.toString());
 break;
-case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_ROWS:
+case XML_ELEMENT( TABLE, XML_NUMBER_ROWS_SPANNED ):
 bIsMerged = true;
 nMergedRows = static_cast(it.toInt32());
 break;
-case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_COLS:
+case XML_ELEMENT( TABLE, XML_NUMBER_COLUMNS_SPANNED ):

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

2017-06-19 Thread Mohammed Abdul Azeem
 sc/source/filter/xml/xmlexternaltabi.cxx |  277 ++-
 sc/source/filter/xml/xmlexternaltabi.hxx |   80 
 sc/source/filter/xml/xmltabi.cxx |   39 ++--
 3 files changed, 189 insertions(+), 207 deletions(-)

New commits:
commit e3b4987450b9bd39bb68fa3d9c9efa03b059f12a
Author: Mohammed Abdul Azeem 
Date:   Mon Jun 19 18:43:18 2017 +0530

Moving legacy contexts to FastContexts:

ScXMLExternalRefTabSourceContext
ScXMLExternalRefRowsContext
ScXMLExternalRefRowContext
ScXMLExternalRefCellContext
ScXMLExternalRefCellTextContext

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

diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx 
b/sc/source/filter/xml/xmlexternaltabi.cxx
index 9193c491fd61..964b13a4410d 100644
--- a/sc/source/filter/xml/xmlexternaltabi.cxx
+++ b/sc/source/filter/xml/xmlexternaltabi.cxx
@@ -37,39 +37,34 @@
 #include 
 
 using namespace ::com::sun::star;
+using namespace ::com::sun::star::xml::sax;
 
 using ::com::sun::star::uno::Reference;
-using ::com::sun::star::xml::sax::XAttributeList;
 
 ScXMLExternalRefTabSourceContext::ScXMLExternalRefTabSourceContext(
-ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName,
-const Reference& xAttrList, ScXMLExternalTabData& rRefInfo 
) :
-SvXMLImportContext( rImport, nPrefix, rLName ),
+ScXMLImport& rImport, sal_Int32 /*nElement*/,
+const Reference& xAttrList, ScXMLExternalTabData& 
rRefInfo ) :
+ScXMLImportContext( rImport ),
 mrScImport(rImport),
 mrExternalRefInfo(rRefInfo)
 {
 using namespace ::xmloff::token;
 
-sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-for (sal_Int16 i = 0; i < nAttrCount; ++i)
+if( xAttrList.is() )
 {
-const OUString& sAttrName = xAttrList->getNameByIndex(i);
-OUString aLocalName;
-sal_uInt16 nAttrPrefix = 
mrScImport.GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
-const OUString& sValue = xAttrList->getValueByIndex(i);
-if (nAttrPrefix == XML_NAMESPACE_XLINK)
-{
-if (IsXMLToken(aLocalName, XML_HREF))
-maRelativeUrl = sValue;
-}
-else if (nAttrPrefix == XML_NAMESPACE_TABLE)
+sax_fastparser::FastAttributeList *pAttribList = static_cast< 
sax_fastparser::FastAttributeList *>( xAttrList.get() );
+
+for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
 {
-if (IsXMLToken(aLocalName, XML_TABLE_NAME))
-maTableName = sValue;
-else if (IsXMLToken(aLocalName, XML_FILTER_NAME))
-maFilterName = sValue;
-else if (IsXMLToken(aLocalName, XML_FILTER_OPTIONS))
-maFilterOptions = sValue;
+sal_Int32 nAttrToken = it.getToken();
+if ( nAttrToken == ( NAMESPACE_TOKEN( XML_NAMESPACE_XLINK ) | 
XML_HREF ) )
+maRelativeUrl = it.toString();
+else if ( nAttrToken == ( NAMESPACE_TOKEN( XML_NAMESPACE_TABLE ) | 
XML_TABLE_NAME ) )
+maTableName = it.toString();
+else if ( nAttrToken == ( NAMESPACE_TOKEN( XML_NAMESPACE_TABLE ) | 
XML_FILTER_NAME ) )
+maFilterName = it.toString();
+else if ( nAttrToken == ( NAMESPACE_TOKEN( XML_NAMESPACE_TABLE ) | 
XML_FILTER_OPTIONS ) )
+maFilterOptions = it.toString();
 }
 }
 }
@@ -78,10 +73,10 @@ 
ScXMLExternalRefTabSourceContext::~ScXMLExternalRefTabSourceContext()
 {
 }
 
-SvXMLImportContext* ScXMLExternalRefTabSourceContext::CreateChildContext(
-sal_uInt16 nPrefix, const OUString& rLocalName, const 
Reference& /*xAttrList*/ )
+Reference< XFastContextHandler > SAL_CALL 
ScXMLExternalRefTabSourceContext::createFastChildContext(
+sal_Int32/* nElement */, const Reference< XFastAttributeList >&/* 
xAttrList */ )
 {
-return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
+return new SvXMLImportContext( GetImport() );
 }
 
 /**
@@ -110,7 +105,7 @@ static bool lcl_isValidRelativeURL(const OUString& rUrl)
 return true;
 }
 
-void ScXMLExternalRefTabSourceContext::EndElement()
+void SAL_CALL ScXMLExternalRefTabSourceContext::endFastElement( sal_Int32 
/*nElement*/ )
 {
 ScDocument* pDoc = mrScImport.GetDocument();
 if (!pDoc)
@@ -123,9 +118,9 @@ void ScXMLExternalRefTabSourceContext::EndElement()
 }
 
 ScXMLExternalRefRowsContext::ScXMLExternalRefRowsContext(
-ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName,
-const Reference& /* xAttrList */, ScXMLExternalTabData& 
rRefInfo ) :
-SvXMLImportContext( rImport, nPrefix, rLName ),
+ScXMLImport& rImport, sal_Int32 /* nElement */,
+const Reference&a

Re: [GSoC] Migrating from legacy Parser to FastParser - Weekly Report

2017-06-19 Thread Mohammed Abdul Azeem
Hi,

*Week 3*

We've started using BufferedStream ( size < 10k ) or BufferedThreadedStream
for unzipping instead of UnbufferedStream ( It resulted in a failure of
some unit tests, which was fixed in
https://gerrit.libreoffice.org/#/c/38661/ ).

Also, I've started to adopt the string based contexts in
sc/source/filter/xml/ to token based contexts. Also, we thought it's best
to implement processingInstruction callback event for XFastDocumentHandler
API, which makes it easier for this to take legacy APIs place. Also, I've
added some static methods in SvXMLImport, that reverse maps fast tokens to
Namespace and element name strings.

*Patches*:
https://gerrit.libreoffice.org/38661
https://gerrit.libreoffice.org/38708
https://gerrit.libreoffice.org/38784


Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: offapi/com

2017-06-19 Thread Mohammed Abdul Azeem
 offapi/com/sun/star/xml/sax/XFastDocumentHandler.idl  |1 +
 offapi/com/sun/star/xml/sax/XFastNamespaceHandler.idl |   14 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit bef2bc59fa6656cbf13922cbc0e5347238156b5e
Author: Mohammed Abdul Azeem 
Date:   Mon Jun 19 18:25:17 2017 +0530

Add comments to sax APIs:

for processingInstruction method in XFastDocumentHandler
and for XFastNamespaceHandler API.

Change-Id: Ie0fd8ceb42e7ffbce041796b98edaa7f232dbb62
Reviewed-on: https://gerrit.libreoffice.org/38964
Reviewed-by: Mohammed Abdul Azeem 
Tested-by: Mohammed Abdul Azeem 

diff --git a/offapi/com/sun/star/xml/sax/XFastDocumentHandler.idl 
b/offapi/com/sun/star/xml/sax/XFastDocumentHandler.idl
index bdabf6d51701..27c68e221d22 100644
--- a/offapi/com/sun/star/xml/sax/XFastDocumentHandler.idl
+++ b/offapi/com/sun/star/xml/sax/XFastDocumentHandler.idl
@@ -51,6 +51,7 @@ interface XFastDocumentHandler: XFastContextHandler
 
 
 /** receives notification of a processing instruction.
+@since LibreOffice 6.0
  */
 void processingInstruction( [in] string aTarget, [in] string aData )
 raises( com::sun::star::xml::sax::SAXException );
diff --git a/offapi/com/sun/star/xml/sax/XFastNamespaceHandler.idl 
b/offapi/com/sun/star/xml/sax/XFastNamespaceHandler.idl
index 3a109b91d5bf..c427325f0980 100644
--- a/offapi/com/sun/star/xml/sax/XFastNamespaceHandler.idl
+++ b/offapi/com/sun/star/xml/sax/XFastNamespaceHandler.idl
@@ -23,12 +23,24 @@
 
 module com {  module sun {  module star {  module xml {  module sax {
 
-/** @since LibreOffice 5.3 */
+/** Stores and manages namespace declarations of a sax
+document parsed by XFastParser.
+
+@since LibreOffice 5.3
+ */
 interface XFastNamespaceHandler: com::sun::star::uno::XInterface
 {
+
+/** receives notification of namespace declarations
+from a XFastParser.
+ */
 void registerNamespace( [in] string NamespacePrefix, [in] string 
NamespaceURI );
 
+
+/** retrieves the namespace URI of a namespace prefix
+ */
 string getNamespaceURI( [in] string NamespacePrefix );
+
 };
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/oox offapi/com oox/source sax/qa sax/source unoxml/qa writerfilter/source

2017-06-15 Thread Mohammed Abdul Azeem
 include/oox/core/filterdetect.hxx  |1 
 include/oox/core/fragmenthandler.hxx   |1 
 offapi/com/sun/star/xml/sax/XFastDocumentHandler.idl   |6 ++
 oox/source/core/filterdetect.cxx   |4 +
 oox/source/core/fragmenthandler.cxx|4 +
 oox/source/crypto/DocumentDecryption.cxx   |2 
 oox/source/docprop/docprophandler.cxx  |4 +
 oox/source/docprop/docprophandler.hxx  |1 
 sax/qa/cppunit/xmlimport.cxx   |3 -
 sax/qa/data/nestedns.xml   |2 
 sax/source/fastparser/fastparser.cxx   |   48 -
 sax/source/fastparser/legacyfastparser.cxx |7 ++
 unoxml/qa/unit/domtest.cxx |4 +
 writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx |4 +
 writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx |1 
 15 files changed, 90 insertions(+), 2 deletions(-)

New commits:
commit 420cecf55878a2d652a61540ddc37a7faaf4cc46
Author: Mohammed Abdul Azeem 
Date:   Wed Jun 14 18:16:41 2017 +0530

[API CHANGE] Add processingInstruction event to XFastDocumentHandler:

Also made changes in FastParser impl. to emit this event. I've made use
of existing namespace and element name strings to store target
and data for this event.

Change-Id: I6f00cd1172552dd9a74ec22190bef3d2289ae515
Reviewed-on: https://gerrit.libreoffice.org/38784
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/include/oox/core/filterdetect.hxx 
b/include/oox/core/filterdetect.hxx
index f5932eab8af6..44f0363187c9 100644
--- a/include/oox/core/filterdetect.hxx
+++ b/include/oox/core/filterdetect.hxx
@@ -67,6 +67,7 @@ public:
 // XFastDocumentHandler
 virtual void SAL_CALL startDocument() override;
 virtual void SAL_CALL endDocument() override;
+virtual void SAL_CALL processingInstruction( const OUString& rTarget, 
const OUString& rData ) override;
 virtual void SAL_CALL setDocumentLocator( const css::uno::Reference< 
css::xml::sax::XLocator >& xLocator ) override;
 
 // XFastContextHandler
diff --git a/include/oox/core/fragmenthandler.hxx 
b/include/oox/core/fragmenthandler.hxx
index 7ab4261c5901..e8107a1dae82 100644
--- a/include/oox/core/fragmenthandler.hxx
+++ b/include/oox/core/fragmenthandler.hxx
@@ -101,6 +101,7 @@ public:
 
 virtual void SAL_CALL startDocument() override;
 virtual void SAL_CALL endDocument() override;
+virtual void SAL_CALL processingInstruction( const OUString& rTarget, 
const OUString& rData ) override;
 virtual void SAL_CALL setDocumentLocator( const css::uno::Reference< 
css::xml::sax::XLocator >& rxLocator ) override;
 
 // com.sun.star.xml.sax.XFastContextHandler interface -
diff --git a/offapi/com/sun/star/xml/sax/XFastDocumentHandler.idl 
b/offapi/com/sun/star/xml/sax/XFastDocumentHandler.idl
index 61cb668c00c7..bdabf6d51701 100644
--- a/offapi/com/sun/star/xml/sax/XFastDocumentHandler.idl
+++ b/offapi/com/sun/star/xml/sax/XFastDocumentHandler.idl
@@ -50,6 +50,12 @@ interface XFastDocumentHandler: XFastContextHandler
 raises( com::sun::star::xml::sax::SAXException );
 
 
+/** receives notification of a processing instruction.
+ */
+void processingInstruction( [in] string aTarget, [in] string aData )
+raises( com::sun::star::xml::sax::SAXException );
+
+
 /** receives an object for locating the origin of SAX document events.
  */
 void setDocumentLocator( [in] com::sun::star::xml::sax::XLocator xLocator )
diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx
index 991b3d86a585..13d3fed8a773 100644
--- a/oox/source/core/filterdetect.cxx
+++ b/oox/source/core/filterdetect.cxx
@@ -72,6 +72,10 @@ void SAL_CALL FilterDetectDocHandler::endDocument()
 {
 }
 
+void SAL_CALL FilterDetectDocHandler::processingInstruction( const OUString& 
/*rTarget*/, const OUString& /*rData*/ )
+{
+}
+
 void SAL_CALL FilterDetectDocHandler::setDocumentLocator( const 
Reference& /*xLocator*/ )
 {
 }
diff --git a/oox/source/core/fragmenthandler.cxx 
b/oox/source/core/fragmenthandler.cxx
index 564306e647fb..58c5d7ab1093 100644
--- a/oox/source/core/fragmenthandler.cxx
+++ b/oox/source/core/fragmenthandler.cxx
@@ -59,6 +59,10 @@ void FragmentHandler::endDocument()
 {
 }
 
+void FragmentHandler::processingInstruction( const OUString& /*rTarget*/, 
const OUString& /*rData*/ )
+{
+}
+
 void FragmentHandler::setDocumentLocator( const Reference< XLocator >& 
rxLocator )
 {
 implSetLocator( rxLocator );
diff --git a/oox/source/crypto/DocumentDecryption.cxx 
b/oox/source/crypto/DocumentDecryption.cxx
index 0209f3d24ba5..f06516c51757 100644
--- a/oox/source/crypto/DocumentDecryption.cxx
+++ b/oox/source/crypto/DocumentDecrypti

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

2017-06-13 Thread Mohammed Abdul Azeem
 include/xmloff/xmlimp.hxx   |   14 +-
 include/xmloff/xmlnmspe.hxx |   81 
 xmloff/source/core/xmlictxt.cxx |   12 +-
 xmloff/source/core/xmlimp.cxx   |  199 
 4 files changed, 199 insertions(+), 107 deletions(-)

New commits:
commit ffc2e936c6a9f3fd597b64b88785edb0f78d7564
Author: Mohammed Abdul Azeem 
Date:   Mon Jun 12 22:56:10 2017 +0530

Reverse mapping fastToken to NamespaceURI:

Made those methods static, so that it is easy
to use them outside the module.
Also updated the Namespace-constants list.

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

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 37b1d1589d88..8ac87d820c88 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -225,12 +225,12 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public 
cppu::WeakImplHelper<
 rtl::Reference < comphelper::AttributeList > maAttrList;
 rtl::Reference < comphelper::AttributeList > maNamespaceAttrList;
 css::uno::Reference< css::xml::sax::XFastDocumentHandler > 
mxFastDocumentHandler;
-css::uno::Reference< css::xml::sax::XFastTokenHandler > mxTokenHandler;
-std::unordered_map< sal_Int32, OUString > maNamespaceMap;
-const OUString getNameFromToken( sal_Int32 nToken );
-const OUString getNamespacePrefixFromToken( sal_Int32 nToken );
+static css::uno::Reference< css::xml::sax::XFastTokenHandler > 
xTokenHandler;
+static std::unordered_map< sal_Int32, std::pair< OUString, OUString > > 
aNamespaceMap;
+static bool bIsNSMapsInitialized;
+
+static void initializeNamespaceMaps();
 void registerNamespaces();
-void registerNSHelper(sal_Int32 nToken, sal_Int32 nPrefix, sal_Int32 
nNamespace );
 std::unique_ptr processNSAttributes(
 const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList);
 void Characters(const OUString& aChars);
@@ -375,6 +375,10 @@ public:
 // get import helper for events
 XMLEventImportHelper& GetEventImport();
 
+static const OUString getNameFromToken( sal_Int32 nToken );
+static const OUString getNamespacePrefixFromToken( sal_Int32 nToken );
+static const OUString getNamespaceURIFromToken( sal_Int32 nToken );
+
 SvXMLNamespaceMap& GetNamespaceMap() { return *mpNamespaceMap; }
 const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; 
}
 const SvXMLUnitConverter& GetMM100UnitConverter() const { return 
*mpUnitConv; }
diff --git a/include/xmloff/xmlnmspe.hxx b/include/xmloff/xmlnmspe.hxx
index 7675b556ed5c..3153ad0f83fd 100644
--- a/include/xmloff/xmlnmspe.hxx
+++ b/include/xmloff/xmlnmspe.hxx
@@ -27,6 +27,8 @@ const sal_uInt16 XML_NAMESPACE_##prefix = key; \
 const sal_uInt16 XML_NAMESPACE_##prefix##_IDX   = key;
 
 #define XML_OLD_NAMESPACE( prefix, index ) \
+const sal_uInt16 XML_OLD_NAMESPACE_##prefix = \
+(XML_OLD_NAMESPACE_BASE+index); \
 const sal_uInt16 XML_OLD_NAMESPACE_##prefix##_IDX = \
 (XML_OLD_NAMESPACE_BASE+index);
 
@@ -70,30 +72,75 @@ XML_NAMESPACE( REPORT,  33U )
 XML_NAMESPACE( OF,  34U )   // OpenFormula aka ODFF
 XML_NAMESPACE( XHTML,   35U )
 XML_NAMESPACE( GRDDL,   36U )
+XML_NAMESPACE( VERSIONS_LIST,   37U )
 
 // namespaces for odf extended formats
 
-#define XML_NAMESPACE_EXT( prefix, key ) \
-const sal_uInt16 XML_NAMESPACE_##prefix##_EXT   = key; \
-const sal_uInt16 XML_NAMESPACE_##prefix##_EXT_IDX   = key;
+#define XML_NAMESPACE_EXT_BASE 38U
+#define XML_NAMESPACE_EXT( prefix, index ) \
+const sal_uInt16 XML_NAMESPACE_##prefix##_EXT   = 
(XML_NAMESPACE_EXT_BASE+index); \
+const sal_uInt16 XML_NAMESPACE_##prefix##_EXT_IDX   = 
(XML_NAMESPACE_EXT_BASE+index);
 
-XML_NAMESPACE_EXT( OFFICE,  37U )
-XML_NAMESPACE_EXT( TABLE,   38U )
-XML_NAMESPACE_EXT( CHART,   39U )
-XML_NAMESPACE_EXT( DRAW,40U )
-XML_NAMESPACE_EXT( CALC,41U )
-XML_NAMESPACE_EXT( LO,  42U )
+XML_NAMESPACE_EXT( OFFICE,   0U )
+XML_NAMESPACE_EXT( TABLE,1U )
+XML_NAMESPACE_EXT( CHART,2U )
+XML_NAMESPACE_EXT( DRAW, 3U )
+XML_NAMESPACE_EXT( CALC, 4U )
+XML_NAMESPACE_EXT( LO,   5U )
 
-#define XML_OLD_NAMESPACE_BASE 43U
+// namespaces for OOo formats
+
+#define XML_NAMESPACE_OOO_BASE 44U
+#define XML_NAMESPACE_OOO( prefix, index ) \
+const sal_uInt16 XML_NAMESPACE_##prefix##_OOO   = 
(XML_NAMESPACE_OOO_BASE+index); \
+const sal_uInt16 XML_NAMESPACE_##prefix##_OOO_IDX   = 
(XML_NAMESPACE_OOO_BASE+index);
+
+XML_NAMESPACE_OOO( OFFICE, 0U )
+XML_NAMESPACE_OOO( META,   1U )
+XML_NAMESPACE_OOO( STYLE,  2U )
+XML_NAMESPACE_OOO( NUMBER, 3U )
+XML_NAMESPACE_OOO( TEXT,   4U )
+XML_NAMESPACE_OOO(

[Libreoffice-commits] core.git: comphelper/source include/comphelper oox/source package/inc package/qa package/source

2017-06-12 Thread Mohammed Abdul Azeem
 comphelper/source/misc/storagehelper.cxx|   20 ++--
 include/comphelper/storagehelper.hxx|6 ++
 oox/source/helper/zipstorage.cxx|4 ++--
 package/inc/ZipFile.hxx |3 ---
 package/qa/cppunit/test_package.cxx |4 +---
 package/source/xstor/xfactory.cxx   |3 +--
 package/source/xstor/xstorage.cxx   |3 +--
 package/source/zipapi/XUnbufferedStream.cxx |3 ++-
 package/source/zipapi/ZipFile.cxx   |   10 --
 package/source/zippackage/ZipPackage.cxx|6 --
 package/source/zippackage/zipfileaccess.cxx |6 --
 11 files changed, 11 insertions(+), 57 deletions(-)

New commits:
commit 7260bb7160fe58ac63b6b5dd9a322805b1eacab4
Author: Mohammed Abdul Azeem 
Date:   Sun Jun 11 17:20:15 2017 +0530

Setting Buffered(threaded)Stream as default:

Also cleaning up bUseBufferedStream parameter.

Change-Id: Ibf9c9fcefbdcd229ffaa1d3b169ff87f00e91ceb
Reviewed-on: https://gerrit.libreoffice.org/38661
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/comphelper/source/misc/storagehelper.cxx 
b/comphelper/source/misc/storagehelper.cxx
index 4aec70aebb83..91374b1712a8 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -286,7 +286,7 @@ uno::Reference< embed::XStorage > 
OStorageHelper::GetStorageOfFormatFromInputStr
 const OUString& aFormat,
 const uno::Reference < io::XInputStream >& xStream,
 const uno::Reference< uno::XComponentContext >& rxContext,
-bool bRepairStorage, bool bUseBufferedStream )
+bool bRepairStorage )
 {
 uno::Sequence< beans::PropertyValue > aProps( 1 );
 sal_Int32 nPos = 0;
@@ -301,14 +301,6 @@ uno::Reference< embed::XStorage > 
OStorageHelper::GetStorageOfFormatFromInputStr
 ++nPos;
 }
 
-if (bUseBufferedStream)
-{
-aProps.realloc(nPos+1);
-aProps[nPos].Name = "UseBufferedStream";
-aProps[nPos].Value <<= bUseBufferedStream;
-++nPos;
-}
-
 uno::Sequence< uno::Any > aArgs( 3 );
 aArgs[0] <<= xStream;
 aArgs[1] <<= embed::ElementModes::READ;
@@ -325,7 +317,7 @@ uno::Reference< embed::XStorage > 
OStorageHelper::GetStorageOfFormatFromStream(
 const uno::Reference < io::XStream >& xStream,
 sal_Int32 nStorageMode,
 const uno::Reference< uno::XComponentContext >& rxContext,
-bool bRepairStorage, bool bUseBufferedStream )
+bool bRepairStorage )
 {
 uno::Sequence< beans::PropertyValue > aProps( 1 );
 sal_Int32 nPos = 0;
@@ -340,14 +332,6 @@ uno::Reference< embed::XStorage > 
OStorageHelper::GetStorageOfFormatFromStream(
 ++nPos;
 }
 
-if (bUseBufferedStream)
-{
-aProps.realloc(nPos+1);
-aProps[nPos].Name = "UseBufferedStream";
-aProps[nPos].Value <<= bUseBufferedStream;
-++nPos;
-}
-
 uno::Sequence< uno::Any > aArgs( 3 );
 aArgs[0] <<= xStream;
 aArgs[1] <<= nStorageMode;
diff --git a/include/comphelper/storagehelper.hxx 
b/include/comphelper/storagehelper.hxx
index d852cb718f58..18b12178eb29 100644
--- a/include/comphelper/storagehelper.hxx
+++ b/include/comphelper/storagehelper.hxx
@@ -156,8 +156,7 @@ public:
 const css::uno::Reference < css::io::XInputStream >& xStream,
 const css::uno::Reference< css::uno::XComponentContext >& rxContext
 = css::uno::Reference< css::uno::XComponentContext 
>(),
-bool bRepairStorage = false,
-bool bUseBufferedStream = false );
+bool bRepairStorage = false );
 
 /// @throws css::uno::Exception
 static css::uno::Reference< css::embed::XStorage >
@@ -167,8 +166,7 @@ public:
 sal_Int32 nStorageMode = css::embed::ElementModes::READWRITE,
 const css::uno::Reference< css::uno::XComponentContext >& rxContext
 = css::uno::Reference< css::uno::XComponentContext 
>(),
-bool bRepairStorage = false,
-bool bUseBufferedStream = false );
+bool bRepairStorage = false );
 
 static css::uno::Sequence< css::beans::NamedValue >
 CreatePackageEncryptionData(
diff --git a/oox/source/helper/zipstorage.cxx b/oox/source/helper/zipstorage.cxx
index c0d454d14e19..b4b883c2c471 100644
--- a/oox/source/helper/zipstorage.cxx
+++ b/oox/source/helper/zipstorage.cxx
@@ -58,7 +58,7 @@ ZipStorage::ZipStorage( const Reference< XComponentContext >& 
rxContext, const R
 implementation of relations handling.
  */
 mxStorage =

[GSoC] Migrating from legacy Parser to FastParser - Weekly Report

2017-06-10 Thread Mohammed Abdul Azeem
Hi,

*Week 1 and week 2*

Michael Meeks and I have been working on moving the unzipping into new
thread for over a month now. It took a couple of weeks to structure it
right and then a couple more weeks to debug our way through the bugs.
Meanwhile we discovered that there were some synchronisation problems in
package/ code which was causing intermittent stream open failure and we've
fixed it now.

*Patches*:
https://gerrit.libreoffice.org/#/c/38135/
https://gerrit.libreoffice.org/#/c/38563/

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: package/Library_package2.mk package/qa package/source

2017-06-08 Thread Mohammed Abdul Azeem
 package/Library_package2.mk   |2 
 package/qa/cppunit/test_package.cxx   |  116 +---
 package/source/zipapi/XBufferedThreadedStream.cxx |  200 ++
 package/source/zipapi/XBufferedThreadedStream.hxx |   79 
 package/source/zipapi/ZipFile.cxx |   10 -
 5 files changed, 373 insertions(+), 34 deletions(-)

New commits:
commit 0632208977a204195a4f5b9e727aed511ece075f
Author: Mohammed Abdul Azeem 
Date:   Sat May 27 13:17:04 2017 +0530

First cut at moving unzipping into new thread:

XBufferedThreadedStream class buffers data in a new thread,
which will be available to be read from parent thread.

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

diff --git a/package/Library_package2.mk b/package/Library_package2.mk
index 3096a976601f..0ff715e031c1 100644
--- a/package/Library_package2.mk
+++ b/package/Library_package2.mk
@@ -31,6 +31,7 @@ $(eval $(call gb_Library_use_libraries,package2,\
sal \
sax \
ucbhelper \
+   salhelper \
 ))
 
 $(eval $(call gb_Library_use_externals,package2,\
@@ -51,6 +52,7 @@ $(eval $(call gb_Library_add_exception_objects,package2,\
package/source/zipapi/Deflater \
package/source/zipapi/Inflater \
package/source/zipapi/sha1context \
+   package/source/zipapi/XBufferedThreadedStream \
package/source/zipapi/XUnbufferedStream \
package/source/zipapi/ZipEnumeration \
package/source/zipapi/ZipFile \
diff --git a/package/qa/cppunit/test_package.cxx 
b/package/qa/cppunit/test_package.cxx
index 335f490ddaba..0e1f4778184d 100644
--- a/package/qa/cppunit/test_package.cxx
+++ b/package/qa/cppunit/test_package.cxx
@@ -27,19 +27,55 @@ namespace
 public:
 PackageTest() {}
 
+virtual void setUp() override;
+
 virtual bool load(const OUString &,
 const OUString &rURL, const OUString &,
 SfxFilterFlags, SotClipboardFormatId, unsigned int) override;
 
 void test();
 void testThreadedStreams();
+void testBufferedThreadedStreams();
 
 CPPUNIT_TEST_SUITE(PackageTest);
 CPPUNIT_TEST(test);
 CPPUNIT_TEST(testThreadedStreams);
+CPPUNIT_TEST(testBufferedThreadedStreams);
 CPPUNIT_TEST_SUITE_END();
+
+private:
+uno::Reference mxNA;
+void verifyStreams( std::vector> &aBuffers );
 };
 
+void PackageTest::setUp()
+{
+BootstrapFixtureBase::setUp();
+OUString aURL = 
m_directories.getURLFromSrc("/package/qa/cppunit/data/a2z.zip");
+
+uno::Sequence aNVs(2);
+aNVs[0].Name = "URL";
+aNVs[0].Value <<= aURL;
+aNVs[1].Name = "UseBufferedStream";
+aNVs[1].Value <<= true;
+
+uno::Sequence aArgs(1);
+aArgs[0] <<= aNVs;
+
+uno::Reference xCxt = 
comphelper::getProcessComponentContext();
+uno::Reference xSvcMgr = 
xCxt->getServiceManager();
+
+uno::Reference xZip(
+xSvcMgr->createInstanceWithArgumentsAndContext(
+"com.sun.star.packages.zip.ZipFileAccess", aArgs, xCxt),
+uno::UNO_QUERY);
+
+CPPUNIT_ASSERT(xZip.is());
+
+mxNA = uno::Reference(xZip, uno::UNO_QUERY);
+CPPUNIT_ASSERT(mxNA.is());
+}
+
 bool PackageTest::load(const OUString &,
 const OUString &rURL, const OUString &,
 SfxFilterFlags, SotClipboardFormatId, unsigned int)
@@ -62,6 +98,20 @@ namespace
 m_directories.getURLFromSrc("/package/qa/cppunit/data/"));
 }
 
+void PackageTest::verifyStreams( std::vector> &aBuffers )
+{
+CPPUNIT_ASSERT_EQUAL(size_t(26), aBuffers.size());
+auto itBuf = aBuffers.begin();
+
+for (char c = 'a'; c <= 'z'; ++c, ++itBuf)
+{
+const std::vector& rBuf = *itBuf;
+CPPUNIT_ASSERT_EQUAL(size_t(1048576), rBuf.size()); // 1 MB 
each.
+for (char check : rBuf)
+CPPUNIT_ASSERT_EQUAL(c, check);
+}
+}
+
 // TODO : This test currently doesn't fail even when you set
 // UseBufferedStream to false. Look into this and replace it with a better
 // test that actually fails when the aforementioned flag is set to false.
@@ -95,30 +145,6 @@ namespace
 }
 };
 
-OUString aURL = 
m_directories.getURLFromSrc("/package/qa/cppunit/data/a2z.zip");
-
-uno::Sequence aNVs(2);
-aNVs[0].Name = "URL";
-aNVs[0].Value <<= aURL;
-aNVs[1].Name = "UseBufferedStream";
-aNVs[1].Value <<= true;
-
-uno::Sequence aArgs(1);
-a

[Libreoffice-commits] core.git: package/inc package/source

2017-06-08 Thread Mohammed Abdul Azeem
 package/inc/ZipFile.hxx|9 +++--
 package/source/zipapi/XUnbufferedStream.cxx|5 +-
 package/source/zipapi/XUnbufferedStream.hxx|1 
 package/source/zipapi/ZipFile.cxx  |   45 +++--
 package/source/zippackage/ZipPackage.cxx   |4 +-
 package/source/zippackage/ZipPackageStream.cxx |2 -
 package/source/zippackage/zipfileaccess.cxx|1 
 7 files changed, 41 insertions(+), 26 deletions(-)

New commits:
commit d21a675d3a7deff37fd66adc993d0179d3a39ed7
Author: Mohammed Abdul Azeem 
Date:   Thu Jun 8 13:32:42 2017 +0530

Fixing loose ends for multithread Sync in package/:

Mutexes in different classes operate exclusively, which might
cause sync problem when multithreads are involved. This
patch shares the mutex across all classes that share
the underlying stream.

Change-Id: I57e549fb7c375f93955bf54886b91b1892db1e27
Reviewed-on: https://gerrit.libreoffice.org/38563
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx
index e84ace2abd11..4aafaad77e6a 100644
--- a/package/inc/ZipFile.hxx
+++ b/package/inc/ZipFile.hxx
@@ -55,7 +55,7 @@ class ZipEnumeration;
 
 class ZipFile
 {
-::osl::Mutexm_aMutex;
+rtl::Reference m_aMutexHolder;
 
 EntryHash   aEntries;
 ByteGrabber aGrabber;
@@ -90,11 +90,13 @@ class ZipFile
 
 public:
 
-ZipFile( css::uno::Reference < css::io::XInputStream > &xInput,
+ZipFile( const rtl::Reference& aMutexHolder,
+ css::uno::Reference < css::io::XInputStream > &xInput,
  const css::uno::Reference < css::uno::XComponentContext > 
&rxContext,
  bool bInitialise );
 
-ZipFile( css::uno::Reference < css::io::XInputStream > &xInput,
+ZipFile( const rtl::Reference& aMutexHolder,
+ css::uno::Reference < css::io::XInputStream > &xInput,
  const css::uno::Reference < css::uno::XComponentContext > 
&rxContext,
  bool bInitialise,
  bool bForceRecover );
@@ -136,6 +138,7 @@ public:
  const css::uno::Reference < 
css::io::XInputStream >& rStream );
 
 static css::uno::Reference< css::io::XInputStream > 
StaticGetDataFromRawStream(
+const rtl::Reference& aMutexHolder,
 const css::uno::Reference< css::uno::XComponentContext >& 
rxContext,
 const css::uno::Reference< css::io::XInputStream >& xStream,
 const ::rtl::Reference < EncryptionData > &rData );
diff --git a/package/source/zipapi/XUnbufferedStream.cxx 
b/package/source/zipapi/XUnbufferedStream.cxx
index 8992e227b24d..a7465e397e24 100644
--- a/package/source/zipapi/XUnbufferedStream.cxx
+++ b/package/source/zipapi/XUnbufferedStream.cxx
@@ -48,7 +48,7 @@ XUnbufferedStream::XUnbufferedStream(
   bool bIsEncrypted,
   const OUString& aMediaType,
   bool bRecoveryMode )
-: maMutexHolder( aMutexHolder.is() ? aMutexHolder : 
rtl::Reference( new SotMutexHolder ) )
+: maMutexHolder( aMutexHolder )
 , mxZipStream ( xNewZipStream )
 , mxZipSeek ( xNewZipStream, UNO_QUERY )
 , maEntry ( rEntry )
@@ -108,9 +108,10 @@ XUnbufferedStream::XUnbufferedStream(
 // allows to read package raw stream
 XUnbufferedStream::XUnbufferedStream(
 const uno::Reference< uno::XComponentContext >& 
/*xContext*/,
+const rtl::Reference& aMutexHolder,
 const Reference < XInputStream >& xRawStream,
 const ::rtl::Reference< EncryptionData >& rData )
-: maMutexHolder( new SotMutexHolder )
+: maMutexHolder( aMutexHolder )
 , mxZipStream ( xRawStream )
 , mxZipSeek ( xRawStream, UNO_QUERY )
 , mnBlockSize( 1 )
diff --git a/package/source/zipapi/XUnbufferedStream.hxx 
b/package/source/zipapi/XUnbufferedStream.hxx
index 02fe87f598de..d46320eac21d 100644
--- a/package/source/zipapi/XUnbufferedStream.hxx
+++ b/package/source/zipapi/XUnbufferedStream.hxx
@@ -77,6 +77,7 @@ public:
 // allows to read package raw stream
 XUnbufferedStream(
  const css::uno::Reference< css::uno::XComponentContext >& 
xContext,
+ const rtl::Reference& aMutexHolder,
  const css::uno::Reference < css::io::XInputStream >& 
xRawStream,
  const ::rtl::Reference< EncryptionData >& rData );
 
diff --git a/package/source/zipapi/ZipFile.cxx 
b/package/source/zipapi/ZipFile.cxx
index 14b536db3ada..ba41d5f10d1d 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -70,8 +70,12 @@ using ZipUtils::Inflater;
 
 /** This class is used to read entries from a zip file
  */
-ZipFile::ZipFile( 

Re: a few more comments ...

2017-06-06 Thread Mohammed Abdul Azeem
Hi Michael,

On Tue, Jun 6, 2017 at 12:10 AM, Michael Meeks 
wrote:

> Hi Mohammed,
>
> Now I read it again, I'm rather skeptical that:
>
> +if( !maUsedBuffers.empty() )
> +{
> +pProducedBuffer = maUsedBuffers.front();
> +maUsedBuffers.pop();
> +}
>
> is helpful. I'm not sure that we can re-use these buffers
> efficiently
> here - perhaps its better just to allocate new ones in the stream read
> method; can you profile with and without that (would love to get rid of
> the extra complexity if possible).
>
> Here you go.

with UsedBuffers:
https://demo.collaboracloudsuite.com/tdf/index.php/s/Hbsp5rI8FE7CHmF
without UsedBuffers:
https://demo.collaboracloudsuite.com/tdf/index.php/s/PIcWD261zVcwpWj

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2017-05-22 Thread Mohammed Abdul Azeem
 include/xmloff/xmlimp.hxx   |2 ++
 xmloff/source/core/xmlictxt.cxx |   16 +++-
 xmloff/source/core/xmlimp.cxx   |   10 +++---
 3 files changed, 20 insertions(+), 8 deletions(-)

New commits:
commit a7bfced28c526ca603cde3c1ac74ea842320bd7c
Author: Mohammed Abdul Azeem 
Date:   Sat Feb 11 01:50:34 2017 +0530

Optimizations:

This avoids a lot of repeated allocation and freeing
of memory for AttributeList.

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

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index f7137715ced3..37b1d1589d88 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -222,6 +222,8 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public 
cppu::WeakImplHelper<
 bool isFastContext;
 css::uno::Reference< css::xml::sax::XFastParser > mxParser;
 rtl::Reference< SvXMLImportFastNamespaceHandler > maNamespaceHandler;
+rtl::Reference < comphelper::AttributeList > maAttrList;
+rtl::Reference < comphelper::AttributeList > maNamespaceAttrList;
 css::uno::Reference< css::xml::sax::XFastDocumentHandler > 
mxFastDocumentHandler;
 css::uno::Reference< css::xml::sax::XFastTokenHandler > mxTokenHandler;
 std::unordered_map< sal_Int32, OUString > maNamespaceMap;
diff --git a/xmloff/source/core/xmlictxt.cxx b/xmloff/source/core/xmlictxt.cxx
index 63025083d78f..9a1d5bc0ea62 100644
--- a/xmloff/source/core/xmlictxt.cxx
+++ b/xmloff/source/core/xmlictxt.cxx
@@ -78,8 +78,14 @@ void SAL_CALL SvXMLImportContext::startUnknownElement(const 
OUString & rPrefix,
 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
 {
 OUString elementName;
-rtl::Reference < comphelper::AttributeList > rAttrList = new 
comphelper::AttributeList;
-mrImport.maNamespaceHandler->addNSDeclAttributes( rAttrList );
+
+if ( mrImport.maAttrList.is() )
+mrImport.maAttrList->Clear();
+else
+mrImport.maAttrList = new comphelper::AttributeList;
+
+mrImport.maNamespaceHandler->addNSDeclAttributes( mrImport.maAttrList );
+
 if ( !rPrefix.isEmpty() )
 elementName =  rPrefix + ":" + rLocalName;
 else
@@ -102,7 +108,7 @@ void SAL_CALL SvXMLImportContext::startUnknownElement(const 
OUString & rPrefix,
 if ( !rAttrNamespacePrefix.isEmpty() )
 sAttrName = rAttrNamespacePrefix + ":" + sAttrName;
 
-rAttrList->AddAttribute( sAttrName, "CDATA", rAttrValue );
+mrImport.maAttrList->AddAttribute( sAttrName, "CDATA", rAttrValue 
);
 }
 
 uno::Sequence< xml::Attribute > unknownAttribs = 
Attribs->getUnknownAttributes();
@@ -115,11 +121,11 @@ void SAL_CALL 
SvXMLImportContext::startUnknownElement(const OUString & rPrefix,
 if ( !rAttrNamespacePrefix.isEmpty() )
 sAttrName = rAttrNamespacePrefix + ":" + sAttrName;
 
-rAttrList->AddAttribute( sAttrName, "CDATA", rAttrValue );
+mrImport.maAttrList->AddAttribute( sAttrName, "CDATA", rAttrValue 
);
 }
 }
 
-mrImport.startElement( elementName, rAttrList.get() );
+mrImport.startElement( elementName, mrImport.maAttrList.get() );
 }
 
 void SAL_CALL SvXMLImportContext::endFastElement(sal_Int32 nElement)
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index eba9d2ad21b6..2d489bc1cdb4 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -818,10 +818,14 @@ void SAL_CALL SvXMLImport::startFastElement (sal_Int32 
Element,
 
 if ( isFastContext )
 {
-rtl::Reference < comphelper::AttributeList > rAttrList = new 
comphelper::AttributeList;
-maNamespaceHandler->addNSDeclAttributes( rAttrList );
+if ( maNamespaceAttrList.is() )
+maNamespaceAttrList->Clear();
+else
+maNamespaceAttrList = new comphelper::AttributeList;
+
+maNamespaceHandler->addNSDeclAttributes( maNamespaceAttrList );
 std::unique_ptr pRewindMap(
-processNSAttributes(rAttrList.get()));
+processNSAttributes( maNamespaceAttrList.get() ));
 SvXMLImportContext *pContext = dynamic_cast( 
xContext.get() );
 if( pContext && pRewindMap )
 pContext->PutRewindMap(std::move(pRewindMap));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


GSoC'17 Introduction - Mohammed Abdul Azeem - Migrating from legacy Parser to FastParser

2017-05-09 Thread Mohammed Abdul Azeem
Hi,

I'm Mohammed Abdul Azeem, an Engineering Undergraduate from India.

I'm excited to be part of this community again and to work with Michael
Meeks and Markus Mohrhard.
I've got accepted for a GSoC 2017 project 'Migrating from legacy Parser to
FastParser', details can be found here:
https://summerofcode.withgoogle.com/projects/#4624279755816960

Looking forward to a productive summer.

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Interested in contributing to LibreOffice for GSoC 2017

2017-03-29 Thread Mohammed Abdul Azeem
Hi,
I'm an undergrad final year student from National Institute Of Technology
Karnataka, India and I've successfully completed a GSoC project (
'Implementing legacy SAX parser Interface with FastParser' ) last year
mentored by Michael Meeks and Noel Grandin.

We've been working on 'Migrating from legacy Parser to FastParser' ever
since, but rather slowly. I think this is a great opportunity to wind this
up and make some performance improvements for loading ODF documents. I've
talked to Michael about this and he is willing to mentor me again this year.

And all my merged patches can be found here:
https://gerrit.libreoffice.org/#/q/owner:azeemmysore%2540gmail.com+status:merged

I've shared a draft of my proposal in GSoC Page and please feel free to
suggest changes.

Cheers,
Azeem
email: azeemmys...@gmail.com
IRC Nick: Azorpid
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2017-03-21 Thread Mohammed Abdul Azeem
 include/xmloff/xmltoken.hxx |2 ++
 xmloff/source/core/xmlimp.cxx   |   14 ++
 xmloff/source/core/xmltoken.cxx |2 ++
 xmloff/source/token/tokens.txt  |2 ++
 4 files changed, 20 insertions(+)

New commits:
commit 0a0f205775807d63e7f6dd910de368bb12b11a49
Author: Mohammed Abdul Azeem 
Date:   Sat Mar 18 23:24:26 2017 +0530

tdf#105686 - fixed wrongly imported named expressions:

It is necessary to extract and set ODF version for fast
events also.
While debugging I found a couple of tokens which were
not in the list, and added them (not needed for bug fix).

Change-Id: I7aaab99688a067ee2fd2c9814deec1a359a758ab
Reviewed-on: https://gerrit.libreoffice.org/35410
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 70b57d1b0f8d..4430d298d63b 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -245,6 +245,7 @@ namespace xmloff { namespace token {
 XML_APPLICATION_DATA,
 XML_APPLICATION_XML,
 XML_APPLY,
+XML_APPLY_DESIGN_MODE,
 XML_APPLY_STYLE_NAME,
 XML_AQUA,
 XML_ARC,
@@ -275,6 +276,7 @@ namespace xmloff { namespace token {
 XML_AUTO_UPDATE,
 XML_AUTOMATIC,
 XML_AUTOMATIC_FIND_LABELS,
+XML_AUTOMATIC_FOCUS,
 XML_AUTOMATIC_ORDER,
 XML_AUTOMATIC_STYLES,
 XML_AUTOMATIC_UPDATE,
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 36de2638a874..c213c05b053a 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -783,6 +783,20 @@ 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( NAMESPACE_TOKEN( 
XML_NAMESPACE_OFFICE ) | XML_VERSION ) )
+{
+mpImpl->aODFVersion = Attribs->getValue( NAMESPACE_TOKEN( 
XML_NAMESPACE_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 ) )
+{
+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!" ) ) );
+}
+}
+
 //Namespace handling is unnecessary. It is done by the fastparser itself.
 uno::Reference xContext;
 if (!maFastContexts.empty())
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 813c864ca264..5ee0ce8dfa84 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -247,6 +247,7 @@ namespace xmloff { namespace token {
 TOKEN( "application-data",XML_APPLICATION_DATA ),
 TOKEN( "application-xml", XML_APPLICATION_XML ),
 TOKEN( "apply",   XML_APPLY ),
+TOKEN( "apply-design-mode",   XML_APPLY_DESIGN_MODE ),
 TOKEN( "apply-style-name",XML_APPLY_STYLE_NAME ),
 TOKEN( "aqua",XML_AQUA ),
 TOKEN( "arc", XML_ARC ),
@@ -277,6 +278,7 @@ namespace xmloff { namespace token {
 TOKEN( "auto-update", XML_AUTO_UPDATE ),
 TOKEN( "automatic",   XML_AUTOMATIC ),
 TOKEN( "automatic-find-labels",   XML_AUTOMATIC_FIND_LABELS ),
+TOKEN( "automatic-focus", XML_AUTOMATIC_FOCUS ),
 TOKEN( "automatic-order", XML_AUTOMATIC_ORDER ),
 TOKEN( "automatic-styles",XML_AUTOMATIC_STYLES ),
 TOKEN( "automatic-update",XML_AUTOMATIC_UPDATE ),
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index 3c9d08360b12..e8878d8ec6c1 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -169,6 +169,7 @@ applet-name
 application-data
 application-xml
 apply
+apply-design-mode
 apply-style-name
 aqua
 arc
@@ -199,6 +200,7 @@ auto-text-indent
 auto-update
 automatic
 automatic-find-labels
+automatic-focus
 automatic-order
 automatic-styles
 automatic-update
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-03-21 Thread Mohammed Abdul Azeem
 include/xmloff/xmlimp.hxx  |   29 +
 writerperfect/source/common/DocumentHandler.cxx|5 -
 xmloff/source/core/xmlimp.cxx  |   84 +
 xmloff/source/transform/ChartPlotAreaOASISTContext.cxx |4 
 xmloff/source/transform/ControlOASISTContext.cxx   |4 
 xmloff/source/transform/ControlOOoTContext.cxx |4 
 xmloff/source/transform/EventOOoTContext.cxx   |4 
 xmloff/source/transform/FormPropOASISTContext.cxx  |4 
 xmloff/source/transform/FormPropOOoTContext.cxx|4 
 xmloff/source/transform/FrameOASISTContext.cxx |4 
 xmloff/source/transform/FrameOOoTContext.cxx   |4 
 xmloff/source/transform/MetaTContext.cxx   |6 -
 xmloff/source/transform/NotesTContext.cxx  |4 
 xmloff/source/transform/OOo2Oasis.cxx  |   12 +-
 xmloff/source/transform/Oasis2OOo.cxx  |4 
 xmloff/source/transform/PersAttrListTContext.cxx   |4 
 xmloff/source/transform/ProcAddAttrTContext.cxx|2 
 xmloff/source/transform/ProcAttrTContext.cxx   |4 
 xmloff/source/transform/RenameElemTContext.cxx |4 
 xmloff/source/transform/StyleOASISTContext.cxx |8 -
 xmloff/source/transform/StyleOOoTContext.cxx   |8 -
 xmloff/source/transform/TransformerBase.cxx|   59 +--
 xmloff/source/transform/TransformerBase.hxx|   15 ---
 xmloff/source/transform/TransformerContext.cxx |4 
 24 files changed, 168 insertions(+), 116 deletions(-)

New commits:
commit 9f9e861c6d168e8318b9cdc761a387b0d650e5c0
Author: Mohammed Abdul Azeem 
Date:   Wed Mar 15 10:20:06 2017 +0530

Old-to-new mapping of attributes is moved into a Module:

This should make it easy to reuse the mapping code wherever
necessary and restores the loading of writerperfect documents.

Change-Id: I505bffa47fe37270b0430d9ae5afec5072762b4c
Reviewed-on: https://gerrit.libreoffice.org/35263
Tested-by: Jenkins 
Reviewed-by: David Tardon 

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index c53b9c1bebac..72939eaced1f 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -53,6 +53,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -133,6 +134,33 @@ public:
 virtual OUString SAL_CALL getNamespaceURI( const OUString& 
rNamespacePrefix ) override;
 };
 
+class XMLOFF_DLLPUBLIC SvXMLLegacyToFastDocHandler : public 
::cppu::WeakImplHelper<
+ css::xml::sax::XDocumentHandler,
+ css::document::XImporter >
+{
+private:
+rtl::Reference< SvXMLImport > mrImport;
+rtl::Reference< sax_fastparser::FastAttributeList > mxFastAttributes;
+
+public:
+SvXMLLegacyToFastDocHandler( const rtl::Reference< SvXMLImport > & rImport 
);
+
+// XImporter
+virtual void SAL_CALL setTargetDocument( const css::uno::Reference< 
css::lang::XComponent >& xDoc ) override;
+
+// css::xml::sax::XDocumentHandler
+virtual void SAL_CALL startDocument() override;
+virtual void SAL_CALL endDocument() override;
+virtual void SAL_CALL startElement(const OUString& aName,
+const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs) 
override;
+virtual void SAL_CALL endElement(const OUString& aName) override;
+virtual void SAL_CALL characters(const OUString& aChars) override;
+virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces) 
override;
+virtual void SAL_CALL processingInstruction(const OUString& aTarget,
+const OUString& aData) 
override;
+virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< 
css::xml::sax::XLocator > & xLocator) override;
+};
+
 
 class XMLOFF_DLLPUBLIC SvXMLImport : public cppu::WeakImplHelper<
  css::xml::sax::XExtendedDocumentHandler,
@@ -145,6 +173,7 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public 
cppu::WeakImplHelper<
  css::xml::sax::XFastParser>
 {
 friend class SvXMLImportContext;
+friend class SvXMLLegacyToFastDocHandler;
 
 css::uno::Reference< css::xml::sax::XLocator > mxLocator;
 css::uno::Reference< css::frame::XModel > mxModel;
diff --git a/writerperfect/source/common/DocumentHandler.cxx 
b/writerperfect/source/common/DocumentHandler.cxx
index 3ea4d053e4a6..29788200b6de 100644
--- a/writerperfect/source/common/DocumentHandler.cxx
+++ b/writerperfect/source/common/DocumentHandler.cxx
@@ -16,6 +16,7 @@
 #include 
 
 #include 
+#include 
 
 namespace writerperfect
 {
@@ -110,8 +111,10 @@ using com::sun::star::xml::sax::XAttributeList;
 using com::sun::star::xml::sax::XDocumentHandler;
 
 DocumentHandler::DocumentHandler(Reference < XDocumentHandler > &xHandler) :
- 

Re: How to enable interactive environment using visual studio and dr. memory

2017-03-19 Thread Mohammed Abdul Azeem
Hi Shoaib,

On Sun, Mar 19, 2017 at 11:12 PM, shoaibnoor95 
wrote:

> How to enable interactive debugging with visual studio and drmemory
> I am facing this issue continuously
> 
> Could any one please tell on what particular file it is pointing on or
> where
> to find that particular line
>
> "CppunitItrace=True"
> its target source and edit it
> Regards
> Shoaib Noor
>

What I gather from the screenshot is that one of the test cases has failed.
If it's the first time you are building the project, perhaps it is because
the master was broken when you last pulled from repository, in that case do
'git pull -r' and then 'make' again.

If you've already build before and this is happening after you made certain
modifications, you can run:
make CppunitTest_sal_osl_security CPPUNITTRACE=TRUE
to get the stack trace and what is going wrong and where.

Or run:
   CppunitTest_sal_osl_security CPPUNITTRACE="drmemory
 -free_max_frames_20"
for interactive debugging in Visual Studio.

This is just what I gather from the screenshot. I've never used Visual
Studio, not am an expert in this. Most of the developers won't be available
during weekends, so I suggest you wait a couple of days for them to respond.

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[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
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xm

[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 &mrList;
+size_t mnIdx;
+
+public:
+FastAttributeIter(const FastAttributeList &rList, 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 

[Libreoffice-commits] core.git: filter/source include/xmloff sc/source xmloff/Library_xof.mk xmloff/source

2017-01-25 Thread Mohammed Abdul Azeem
 filter/source/odfflatxml/OdfFlatXml.cxx|8 
 filter/source/xsltfilter/XSLTFilter.cxx|8 
 include/xmloff/xmlimp.hxx  |1 
 include/xmloff/xmlmetai.hxx|3 
 include/xmloff/xmltoken.hxx|4 
 sc/source/filter/xml/XMLEmptyContext.cxx   |   18 -
 sc/source/filter/xml/XMLEmptyContext.hxx   |   12 
 sc/source/filter/xml/importcontext.cxx |   20 +
 sc/source/filter/xml/importcontext.hxx |   12 
 sc/source/filter/xml/xmlbodyi.cxx  |  108 +--
 sc/source/filter/xml/xmlbodyi.hxx  |   19 +
 sc/source/filter/xml/xmlcelli.cxx  |  231 -
 sc/source/filter/xml/xmlcelli.hxx  |8 
 sc/source/filter/xml/xmlimprt.cxx  |  197 --
 sc/source/filter/xml/xmlimprt.hxx  |9 
 sc/source/filter/xml/xmlrowi.cxx   |  146 +-
 sc/source/filter/xml/xmlrowi.hxx   |   31 +-
 sc/source/filter/xml/xmltabi.cxx   |  145 ++
 sc/source/filter/xml/xmltabi.hxx   |   13 
 sc/source/filter/xml/xmlwrap.cxx   |8 
 xmloff/Library_xof.mk  |4 
 xmloff/source/core/xmlictxt.cxx|6 
 xmloff/source/core/xmltoken.cxx|4 
 xmloff/source/meta/xmlmetai.cxx|   13 
 xmloff/source/token/tokens.txt |4 
 xmloff/source/transform/ChartPlotAreaOASISTContext.cxx |4 
 xmloff/source/transform/ControlOASISTContext.cxx   |4 
 xmloff/source/transform/ControlOOoTContext.cxx |4 
 xmloff/source/transform/EventOOoTContext.cxx   |5 
 xmloff/source/transform/FormPropOASISTContext.cxx  |4 
 xmloff/source/transform/FormPropOOoTContext.cxx|5 
 xmloff/source/transform/FrameOASISTContext.cxx |5 
 xmloff/source/transform/FrameOOoTContext.cxx   |4 
 xmloff/source/transform/MetaTContext.cxx   |6 
 xmloff/source/transform/NotesTContext.cxx  |4 
 xmloff/source/transform/OOo2Oasis.cxx  |   12 
 xmloff/source/transform/Oasis2OOo.cxx  |4 
 xmloff/source/transform/PersAttrListTContext.cxx   |4 
 xmloff/source/transform/ProcAddAttrTContext.cxx|2 
 xmloff/source/transform/ProcAttrTContext.cxx   |4 
 xmloff/source/transform/RenameElemTContext.cxx |4 
 xmloff/source/transform/StyleOASISTContext.cxx |   10 
 xmloff/source/transform/StyleOOoTContext.cxx   |9 
 xmloff/source/transform/TransformerBase.cxx|   57 
 xmloff/source/transform/TransformerBase.hxx|   15 +
 xmloff/source/transform/TransformerContext.cxx |4 
 46 files changed, 789 insertions(+), 413 deletions(-)

New commits:
commit 8154953add163554c00935486a1cf5677cef2609
Author: Mohammed Abdul Azeem 
Date:   Mon Sep 5 14:38:30 2016 +0530

ScXMLTableRowCellContext implements fast interfaces:

Implementation of fast interfaces for contexts in path from
ScXMLImport::CreateFastContext to ScXMLTableRowCellContext.
FastParser is enabled and duplicates are avoided at all
possible places.
OOoXML filters still need those legacy paths we removed,
so I had to temporarily map them to fast elements, which
would increase their load time, but hopefully it should
help us in the long run.

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

diff --git a/filter/source/odfflatxml/OdfFlatXml.cxx 
b/filter/source/odfflatxml/OdfFlatXml.cxx
index f8744ee..f39fc00 100644
--- a/filter/source/odfflatxml/OdfFlatXml.cxx
+++ b/filter/source/odfflatxml/OdfFlatXml.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -142,6 +143,8 @@ OdfFlatXml::importer(
 inputSource.sSystemId = url;
 inputSource.sPublicId = url;
 inputSource.aInputStream = inputStream;
+css::uno::Reference< css::xml::sax::XFastParser > xFastParser = 
dynamic_cast<
+css::xml::sax::XFastParser* >( docHandler.get() );
 saxParser->setDocumentHandler(docHandler);
 try
 {
@@ -149,7 +152,10 @@ OdfFlatXml::importer(
 if ( xSeekable.is() )
 xSeekable->seek( 0 );
 
-saxParser->parseStream(inputSource);
+if( xFastParser.is() )
+xFastParser->parseStream( inputSource );
+else
+saxParser->parseStream(inputSource);
 }
 catch (const Exception &exc)
 {
diff --git a/filter/source/xsltfilter/

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

2016-09-25 Thread Mohammed Abdul Azeem
 include/xmloff/xmlimp.hxx |1 +
 xmloff/source/core/xmlimp.cxx |   10 --
 2 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 5678bc99fb685fe09191e8419a1121e565f97f80
Author: Mohammed Abdul Azeem 
Date:   Sun Sep 25 11:06:32 2016 +0530

tdf#101935 and tdf#102201:

This fixes both the bugs.

Change-Id: I7a64abc0cb12b5195a3b955549ce4f72f3530d57
Reviewed-on: https://gerrit.libreoffice.org/29263
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 87634e7..93c5f25 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -194,6 +194,7 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public 
::cppu::WeakImplHelper8<
 bool isFastContext;
 css::uno::Reference< css::xml::sax::XFastParser > mxParser;
 rtl::Reference< SvXMLImportFastNamespaceHandler > maNamespaceHandler;
+css::uno::Reference< css::xml::sax::XFastDocumentHandler > 
mxFastDocumentHandler;
 css::uno::Reference< css::xml::sax::XFastTokenHandler > mxTokenHandler;
 std::unordered_map< sal_Int32, OUString > maNamespaceMap;
 const OUString getNameFromToken( sal_Int32 nToken );
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 715ddb9..66e6075 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -431,6 +431,7 @@ SvXMLImport::SvXMLImport(
 mnErrorFlags(SvXMLErrorFlags::NO),
 isFastContext( false ),
 maNamespaceHandler( new SvXMLImportFastNamespaceHandler() ),
+mxFastDocumentHandler( nullptr ),
 mxTokenHandler( new FastTokenHandler() ),
 mbIsFormsSupported( true ),
 mbIsTableShapeSupported( false ),
@@ -439,7 +440,6 @@ SvXMLImport::SvXMLImport(
 SAL_WARN_IF( !xContext.is(), "xmloff.core", "got no service manager" );
 InitCtor_();
 mxParser = xml::sax::FastParser::create( xContext );
-setFastDocumentHandler( this );
 setNamespaceHandler( maNamespaceHandler.get() );
 setTokenHandler( mxTokenHandler  );
 registerNamespaces();
@@ -478,13 +478,19 @@ sal_Int64 SAL_CALL SvXMLImport::getSomething( const 
uno::Sequence< sal_Int8 >& r
 void SAL_CALL SvXMLImport::parseStream( const xml::sax::InputSource& 
aInputSource )
 throw (xml::sax::SAXException, io::IOException, uno::RuntimeException, 
std::exception)
 {
+if ( mxFastDocumentHandler.is() )
+mxParser->setFastDocumentHandler( mxFastDocumentHandler );
+else
+mxParser->setFastDocumentHandler( this );
+
 mxParser->parseStream( aInputSource );
+mxParser->setFastDocumentHandler( nullptr );
 }
 
 void SAL_CALL SvXMLImport::setFastDocumentHandler( const uno::Reference< 
xml::sax::XFastDocumentHandler >& Handler )
 throw (uno::RuntimeException, std::exception)
 {
-mxParser->setFastDocumentHandler( Handler );
+mxFastDocumentHandler = Handler;
 }
 
 void SAL_CALL SvXMLImport::setTokenHandler( const uno::Reference< 
xml::sax::XFastTokenHandler >& Handler )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-09-05 Thread Mohammed Abdul Azeem
 include/xmloff/xmlimp.hxx   |6 +++-
 include/xmloff/xmltkmap.hxx |2 -
 xmloff/source/core/xmlictxt.cxx |   60 
 xmloff/source/core/xmlimp.cxx   |   47 ++-
 4 files changed, 82 insertions(+), 33 deletions(-)

New commits:
commit 67ef208b2b586603e205105a384231645d7f6712
Author: Mohammed Abdul Azeem 
Date:   Fri Sep 2 01:18:53 2016 +0530

Fixes for migrating SvXMLImport to use FastParser:

These are necessary for implementing fast interfaces
for the contexts.

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

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index c673dfc..415ca40 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -61,7 +61,7 @@
 #include 
 #include 
 
-#define NAMESPACE_TOKEN( prefixToken ) ( ( prefixToken + 1 ) << NMSP_SHIFT )
+#define NAMESPACE_TOKEN( prefixToken ) ( ( sal_Int32( prefixToken + 1 ) ) << 
NMSP_SHIFT )
 
 const size_t NMSP_SHIFT = 16;
 const sal_Int32 TOKEN_MASK = 0x;
@@ -191,6 +191,7 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public 
::cppu::WeakImplHelper8<
 SvXMLImportFlags  mnImportFlags;
 SvXMLErrorFlags  mnErrorFlags;
 std::set< OUString > embeddedFontUrlsKnown;
+bool isFastContext;
 css::uno::Reference< css::xml::sax::XFastParser > mxParser;
 rtl::Reference< SvXMLImportFastNamespaceHandler > maNamespaceHandler;
 css::uno::Reference< css::xml::sax::XFastTokenHandler > mxTokenHandler;
@@ -199,6 +200,9 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public 
::cppu::WeakImplHelper8<
 const OUString getNamespacePrefixFromToken( sal_Int32 nToken );
 void registerNamespaces();
 void registerNSHelper(sal_Int32 nToken, sal_Int32 nPrefix, sal_Int32 
nNamespace );
+void processNSAttributes( const css::uno::Reference< 
css::xml::sax::XAttributeList >& xAttrList,
+SvXMLNamespaceMap *pRewindMap );
+void Characters(const OUString& aChars);
 
 protected:
 
diff --git a/include/xmloff/xmltkmap.hxx b/include/xmloff/xmltkmap.hxx
index 89cfd65..c9f0bee 100644
--- a/include/xmloff/xmltkmap.hxx
+++ b/include/xmloff/xmltkmap.hxx
@@ -44,7 +44,7 @@ struct SvXMLTokenMapEntry
 nPrefixKey( nPrefix ),
 eLocalName( eName ),
 nToken( nTok ),
-nFastToken( sal_uInt32( nPrefixKey + 1 ) << 16 | eLocalName )
+nFastToken( ( sal_Int32( nPrefixKey + 1 ) ) << 16 | eLocalName )
 {
 if ( nFastTok ) // alternative value for duplicate/dummy tokens
 nFastToken = nFastTok;
diff --git a/xmloff/source/core/xmlictxt.cxx b/xmloff/source/core/xmlictxt.cxx
index f3e27e5..2fb80c5 100644
--- a/xmloff/source/core/xmlictxt.cxx
+++ b/xmloff/source/core/xmlictxt.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -69,6 +70,7 @@ void SvXMLImportContext::Characters( const OUString& )
 void SAL_CALL SvXMLImportContext::startFastElement(sal_Int32 nElement, const 
uno::Reference< xml::sax::XFastAttributeList > & Attribs)
 throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
+mrImport.isFastContext = false;
 startUnknownElement( mrImport.getNamespacePrefixFromToken( nElement ),
  mrImport.getNameFromToken( nElement ), Attribs );
 }
@@ -85,38 +87,47 @@ void SAL_CALL SvXMLImportContext::startUnknownElement(const 
OUString & rPrefix,
 else
 elementName = rLocalName;
 
-uno::Sequence< xml::FastAttribute > fastAttribs = 
Attribs->getFastAttributes();
-sal_uInt16 len = fastAttribs.getLength();
-for (sal_uInt16 i = 0; i < len; i++)
+if ( Attribs.is() )
 {
-OUString& rAttrValue = fastAttribs[i].Value;
-sal_Int32 nToken = fastAttribs[i].Token;
-const OUString& rAttrNamespacePrefix = 
mrImport.getNamespacePrefixFromToken( nToken );
-OUString sAttrName = mrImport.getNameFromToken( nToken );
-if ( !rAttrNamespacePrefix.isEmpty() )
-sAttrName = rAttrNamespacePrefix + ":" + sAttrName;
-
-rAttrList->AddAttribute( sAttrName, "CDATA", rAttrValue );
+sax_fastparser::FastAttributeList *pAttribList;
+assert( dynamic_cast< sax_fastparser::FastAttributeList *>( 
Attribs.get() ) != nullptr );
+pAttribList = static_cast< sax_fastparser::FastAttributeList *>( 
Attribs.get() );
+
+const std::vector< sal_Int32 >& rAttrTokenList = 
pAttribList->getFastAttributeTokens();
+for ( size_t i = 0; i < rAttrTokenList.size(); i++ )
+{
+const OUString& rAttrValue = 
OUString(pAttribList->getFastAttributeValue(i),
+   

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

2016-09-02 Thread Mohammed Abdul Azeem
 xmloff/source/core/xmlimp.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit f7513f0f53f2d074c08610a68fb787bb379c31d4
Author: Mohammed Abdul Azeem 
Date:   Thu Sep 1 08:26:59 2016 +0530

tdf101725 - fixed missing autotexts from Standard

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

diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index cc59e91..f234cee 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -842,13 +842,13 @@ rName
 void SAL_CALL SvXMLImport::characters( const OUString& rChars )
 throw(xml::sax::SAXException, uno::RuntimeException, std::exception)
 {
-if( !mpContexts->empty() )
+if ( !mpFastContexts->empty() )
 {
-mpContexts->back()->Characters( rChars );
+mpFastContexts->back()->characters( rChars );
 }
-else if ( !mpFastContexts->empty() )
+else if( !mpContexts->empty() )
 {
-mpFastContexts->back()->characters( rChars );
+mpContexts->back()->Characters( rChars );
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-08-28 Thread Mohammed Abdul Azeem
 include/xmloff/xmlimp.hxx  |2 
 include/xmloff/xmltkmap.hxx|   11 +--
 xmloff/source/core/xmltkmap.cxx|   95 +
 xmloff/source/style/GradientStyle.cxx  |4 -
 xmloff/source/style/HatchStyle.cxx |4 -
 xmloff/source/style/TransGradientStyle.cxx |4 -
 xmloff/source/token/tokens.txt |2 
 7 files changed, 62 insertions(+), 60 deletions(-)

New commits:
commit 41b3fd8ca54eff7e71c69bb0b60e63016f1ac8c2
Author: Mohammed Abdul Azeem 
Date:   Fri Aug 26 23:32:23 2016 +0530

Make SvXMLTokenMap compatible with FastTokens:

Added seperate map for fastToken and Token, to get
token using only fastToken. Default values are derived
for fastTokens from prefixKey and localName. Duplicate/
dummy tokens need to be overidden with different values.

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

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index a1152c4..c673dfc 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -61,6 +61,8 @@
 #include 
 #include 
 
+#define NAMESPACE_TOKEN( prefixToken ) ( ( prefixToken + 1 ) << NMSP_SHIFT )
+
 const size_t NMSP_SHIFT = 16;
 const sal_Int32 TOKEN_MASK = 0x;
 const sal_Int32 NMSP_MASK = 0x;
diff --git a/include/xmloff/xmltkmap.hxx b/include/xmloff/xmltkmap.hxx
index c54d801..2953dac 100644
--- a/include/xmloff/xmltkmap.hxx
+++ b/include/xmloff/xmltkmap.hxx
@@ -28,7 +28,6 @@
 
 
 class SvXMLTokenMap_Impl;
-class SvXMLTokenMapEntry_Impl;
 
 #define XML_TOK_UNKNOWN 0xU
 #define XML_TOKEN_MAP_END { 0xU, xmloff::token::XML_TOKEN_INVALID, 0U, 0 }
@@ -41,19 +40,21 @@ struct SvXMLTokenMapEntry
 sal_Int32 nFastToken;
 
 SvXMLTokenMapEntry( sal_uInt16 nPrefix, xmloff::token::XMLTokenEnum eName,
-sal_uInt16 nTok = XML_TOK_UNKNOWN, sal_Int32 nFastTok 
= 0 ) :
+sal_uInt16 nTok, sal_Int32 nFastTok = 0 ) :
 nPrefixKey( nPrefix ),
 eLocalName( eName ),
 nToken( nTok ),
-nFastToken( nFastTok )
-{}
+nFastToken( ( nPrefixKey + 1 ) << 16 | eLocalName )
+{
+if ( nFastTok ) // alternative value for duplicate/dummy tokens
+nFastToken = nFastTok;
+}
 };
 
 class XMLOFF_DLLPUBLIC SvXMLTokenMap
 {
 private:
 std::unique_ptr  m_pImpl;
-sal_uInt16 Get( const SvXMLTokenMapEntry_Impl& rEntry ) const;
 
 public:
 
diff --git a/xmloff/source/core/xmltkmap.cxx b/xmloff/source/core/xmltkmap.cxx
index 6888b62..1aca389 100644
--- a/xmloff/source/core/xmltkmap.cxx
+++ b/xmloff/source/core/xmltkmap.cxx
@@ -21,52 +21,63 @@
 #include 
 #include 
 
-#include 
+#include 
+#include 
 
 using namespace ::xmloff::token;
 
-class SvXMLTokenMapEntry_Impl
+class SvXMLTokenMap_Impl
 {
-sal_uInt16  nPrefixKey;
-OUStringsLocalName;
-sal_uInt16  nToken;
-sal_Int32   nFastToken;
+private:
+struct PairHash
+{
+std::size_t operator()(const std::pair &pair) 
const
+{
+return static_cast( pair.first | 
pair.second.hashCode() );
+}
+};
+std::unordered_map< std::pair,
+sal_uInt16, PairHash> m_aPrefixAndNameToTokenMap;
+std::unordered_map< sal_Int32, sal_uInt16> m_aFastTokenToTokenMap;
 
 public:
+void insert( const SvXMLTokenMapEntry& rEntry );
+sal_uInt16 get( sal_uInt16 nKeyPrefix, const OUString& rLName ) const;
+sal_uInt16 get( sal_Int32 nFastTok ) const;
+};
 
-sal_uInt16 GetToken() const { return nToken; }
-
-SvXMLTokenMapEntry_Impl( sal_uInt16 nPrefix, const OUString& rLName,
- sal_uInt16 nTok = XML_TOK_UNKNOWN, sal_Int32 
nFastTok = 0 ) :
-nPrefixKey( nPrefix ),
-sLocalName( rLName  ),
-nToken( nTok ),
-nFastToken( nFastTok )
-{}
-
-explicit SvXMLTokenMapEntry_Impl( const SvXMLTokenMapEntry& rEntry ) :
-nPrefixKey( rEntry.nPrefixKey ),
-sLocalName( GetXMLToken( rEntry.eLocalName ) ),
-nToken( rEntry.nToken ),
-nFastToken( rEntry.nFastToken )
-{}
+void SvXMLTokenMap_Impl::insert( const SvXMLTokenMapEntry& rEntry )
+{
+m_aPrefixAndNameToTokenMap.insert( std::make_pair( std::make_pair( 
rEntry.nPrefixKey,
+   GetXMLToken( rEntry.eLocalName ) ), 
rEntry.nToken ) );
+if( rEntry.nFastToken )
+m_aFastTokenToTokenMap.insert( std::make_pair( rEntry.nFastToken, 
rEntry.nToken ) );
+}
 
-bool operator<( const SvXMLTokenMapEntry_Impl& r ) const
-{
-return nPrefixKey < r.nPrefixKey ||
-   ( nPrefixKey == r.nPrefixKey &&
- sLocalName < r.sLocalName);
-}
-};
+sal_uInt16 SvXMLTokenMap_Impl::get( 

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

2016-08-23 Thread Mohammed Abdul Azeem
 include/xmloff/xmlimp.hxx   |   55 +-
 xmloff/source/core/xmlictxt.cxx |   57 +-
 xmloff/source/core/xmlimp.cxx   |  218 +++-
 3 files changed, 318 insertions(+), 12 deletions(-)

New commits:
commit 4ccd991f6a6ca680ac2b7513ab3853e1ba9c71a3
Author: Mohammed Abdul Azeem 
Date:   Tue Aug 16 23:37:28 2016 +0530

GSoC - First cut at migrating xmloff/ to use FastParser:

This lays the foundation for using fast parser and contexts.
Tokens are detokenized and made to emit events just like
legacy parser interfaces.

Change-Id: I11659be68026e112fdd06f8a847f3f2c876dae35
Reviewed-on: https://gerrit.libreoffice.org/28175
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 97bbf6c..740f313 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -48,8 +49,9 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
+#include 
 
 #include 
 
@@ -59,6 +61,10 @@
 #include 
 #include 
 
+const size_t NMSP_SHIFT = 16;
+const sal_Int32 TOKEN_MASK = 0x;
+const sal_Int32 NMSP_MASK = 0x;
+
 namespace com { namespace sun { namespace star {
 namespace frame { class XModel; }
 namespace io { class XOutputStream; }
@@ -103,15 +109,39 @@ namespace o3tl
 template<> struct typed_flags : 
is_typed_flags {};
 }
 
+class SvXMLImportFastNamespaceHandler : public ::cppu::WeakImplHelper< 
css::xml::sax::XFastNamespaceHandler >
+{
+private:
+struct NamespaceDefine
+{
+OUStringm_aPrefix;
+OUStringm_aNamespaceURI;
 
-class XMLOFF_DLLPUBLIC SvXMLImport : public ::cppu::WeakImplHelper7<
+NamespaceDefine( const OUString& rPrefix, const OUString& 
rNamespaceURI ) : m_aPrefix( rPrefix ), m_aNamespaceURI( rNamespaceURI ) {}
+};
+std::vector< std::unique_ptr< NamespaceDefine > > m_aNamespaceDefines;
+
+public:
+SvXMLImportFastNamespaceHandler();
+void addNSDeclAttributes( rtl::Reference < comphelper::AttributeList >& 
rAttrList );
+
+//XFastNamespaceHandler
+virtual void SAL_CALL registerNamespace( const OUString& rNamespacePrefix, 
const OUString& rNamespaceURI )
+throw (css::uno::RuntimeException, std::exception) 
override;
+virtual OUString SAL_CALL getNamespaceURI( const OUString& 
rNamespacePrefix )
+throw (css::uno::RuntimeException, std::exception) 
override;
+};
+
+
+class XMLOFF_DLLPUBLIC SvXMLImport : public ::cppu::WeakImplHelper8<
  css::xml::sax::XExtendedDocumentHandler,
  css::xml::sax::XFastDocumentHandler,
  css::lang::XServiceInfo,
  css::lang::XInitialization,
  css::document::XImporter,
  css::document::XFilter,
- css::lang::XUnoTunnel>
+ css::lang::XUnoTunnel,
+ css::xml::sax::XFastParser>
 {
 friend class SvXMLImportContext;
 
@@ -159,6 +189,14 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public 
::cppu::WeakImplHelper7<
 SvXMLImportFlags  mnImportFlags;
 SvXMLErrorFlags  mnErrorFlags;
 std::set< OUString > embeddedFontUrlsKnown;
+css::uno::Reference< css::xml::sax::XFastParser > mxParser;
+rtl::Reference< SvXMLImportFastNamespaceHandler > maNamespaceHandler;
+css::uno::Reference< css::xml::sax::XFastTokenHandler > mxTokenHandler;
+std::unordered_map< sal_Int32, OUString > maNamespaceMap;
+const OUString getNameFromToken( sal_Int32 nToken );
+const OUString getNamespacePrefixFromToken( sal_Int32 nToken );
+void registerNamespaces();
+void registerNSHelper(sal_Int32 nToken, sal_Int32 nPrefix, sal_Int32 
nNamespace );
 
 protected:
 
@@ -268,6 +306,17 @@ public:
 virtual void SAL_CALL unknown(const OUString& sString)
 throw( css::xml::sax::SAXException, css::uno::RuntimeException, 
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;
+virtual void SAL_CALL setTokenHandler( const css::uno::Reference< 
css::xml::sax::XFastTokenHandler >& Handler ) throw 
(css::uno::RuntimeException, std::exception) override;
+virtual void SAL_CALL registerNamespace( const OUString& NamespaceURL, 
sal_Int32 NamespaceToken ) throw (css::lang::IllegalArgumentException, 
css::uno::RuntimeException, std::exception) override;
+virtual 

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

2016-08-23 Thread Mohammed Abdul Azeem
 xmloff/qa/unit/tokenmap-test.cxx |   30 
 xmloff/source/token/tokens.txt   | 2348 +--
 2 files changed, 1320 insertions(+), 1058 deletions(-)

New commits:
commit 090e3fe4165aff11f557c7da2536fec44639607e
Author: Mohammed Abdul Azeem 
Date:   Wed Aug 17 09:03:18 2016 +0530

GSoC - Keeping both token lists in xmloff/ consistent:

Added dummy tokens to keep the lists consistent and
a test case to check the same.

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

diff --git a/xmloff/qa/unit/tokenmap-test.cxx b/xmloff/qa/unit/tokenmap-test.cxx
index b2948c9..0144ded 100644
--- a/xmloff/qa/unit/tokenmap-test.cxx
+++ b/xmloff/qa/unit/tokenmap-test.cxx
@@ -14,6 +14,7 @@
 
 #include "xmloff/fasttokenhandler.hxx"
 #include "xmloff/token/tokens.hxx"
+#include 
 
 using namespace std;
 using namespace com::sun::star::uno;
@@ -27,10 +28,13 @@ public:
 TokenmapTest();
 
 void test_roundTrip();
+void test_listEquality();
 
 CPPUNIT_TEST_SUITE(TokenmapTest);
 
 CPPUNIT_TEST(test_roundTrip);
+CPPUNIT_TEST(test_listEquality);
+
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -55,6 +59,32 @@ void TokenmapTest::test_roundTrip()
 }
 }
 
+void TokenmapTest::test_listEquality()
+{
+//make sure the two token lists stay in sync
+for ( sal_Int32 nToken = 0; nToken < XML_TOKEN_COUNT; ++nToken )
+{
+Sequence< sal_Int8 > rUtf8Name = pTokenMap->getUtf8TokenName(nToken);
+const OUString& rName = OUString( reinterpret_cast< const char* >(
+rUtf8Name.getConstArray() ), rUtf8Name.getLength(), 
RTL_TEXTENCODING_UTF8 );
+if ( rName.endsWith("_DUMMY") )
+continue;
+const OUString& rTokenName = GetXMLToken( 
static_cast(nToken) );
+CPPUNIT_ASSERT_EQUAL(rName, rTokenName);
+}
+
+for ( sal_Int32 nToken = xmloff::token::XMLTokenEnum::XML_TOKEN_START + 1;
+nToken < xmloff::token::XMLTokenEnum::XML_TOKEN_END; ++nToken )
+{
+const OUString& rTokenName = GetXMLToken( 
static_cast(nToken) );
+Sequence< sal_Int8 > rUtf8Name = pTokenMap->getUtf8TokenName(nToken);
+const OUString& rName = OUString( reinterpret_cast< const char* >(
+rUtf8Name.getConstArray() ), rUtf8Name.getLength(), 
RTL_TEXTENCODING_UTF8 );
+if ( !rName.endsWith("_DUMMY") )
+CPPUNIT_ASSERT_EQUAL(rTokenName, rName);
+}
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(TokenmapTest);
 
 }
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index 051f587..d93d50a 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -1,34 +1,141 @@
+TOKEN_START_DUMMY
+CDATA
+WS_DUMMY
+xml
+xmlns
+XML_PI_DUMMY
+XML_DOCTYPE_PREFIX_DUMMY
+XML_DOCTYPE_SUFFIX_DUMMY
+N_XML_DUMMY
+office
+N_OFFICE_DUMMY
+N_OFFICE_OLD_DUMMY
+NP_META_DUMMY
+N_META_DUMMY
+N_META_OLD_DUMMY
+NP_STYLE_DUMMY
+N_STYLE_DUMMY
+N_STYLE_OLD_DUMMY
+NP_NUMBER_DUMMY
+N_NUMBER_DUMMY
+N_NUMBER_OLD_DUMMY
+NP_TEXT_DUMMY
+N_TEXT_DUMMY
+N_TEXT_OLD_DUMMY
+NP_TABLE_DUMMY
+N_TABLE_DUMMY
+N_TABLE_OLD_DUMMY
+NP_DRAW_DUMMY
+N_DRAW_DUMMY
+dr3d
+N_DR3D_DUMMY
+N_DRAW_OLD_DUMMY
+NP_PRESENTATION_DUMMY
+N_PRESENTATION_DUMMY
+N_PRESENTATION_OLD_DUMMY
+NP_CHART_DUMMY
+N_CHART_DUMMY
+config
+N_CONFIG_DUMMY
+N_CHART_OLD_DUMMY
+fo
+N_FO_OLD_DUMMY
+N_FO_DUMMY
+xlink
+N_XLINK_DUMMY
+N_XLINK_OLD_DUMMY
+dc
+N_DC_DUMMY
+svg
+N_SVG_DUMMY
+NP_FORM_DUMMY
+N_FORM_DUMMY
+NP_SCRIPT_DUMMY
+N_SCRIPT_DUMMY
+xforms
+N_XFORMS_1_0_DUMMY
+xsd
+N_XSD_DUMMY
+xsi
+N_XSI_DUMMY
+NP_BLOCK_LIST_DUMMY
+N_BLOCK_LIST_DUMMY
+NP_MATH_DUMMY
+N_MATH_DUMMY
+VL_DUMMY
+N_VERSIONS_LIST_DUMMY
+of
+N_OF_DUMMY
+xhtml
+N_XHTML_DUMMY
+grddl
+N_GRDDL_DUMMY
+officeooo
+N_OFFICE_EXT_DUMMY
+formx
+N_FORMX_DUMMY
+tableooo
+N_TABLE_EXT_DUMMY
+drawooo
+N_DRAW_EXT_DUMMY
+css3t
+N_CSS3TEXT_DUMMY
+calcext
+N_CALC_EXT_DUMMY
+loext
+N_LO_EXT_DUMMY
+UNIT_MM_DUMMY
+m
+UNIT_KM_DUMMY
+UNIT_CM_DUMMY
+pt
+pc
+ft
+UNIT_MILES_DUMMY
+UNIT_INCH_DUMMY
+1
+10
+2
+3
+4
+5
+6
+7
+8
+9
+A
+I
+IBM437
+IBM850
+IBM860
+IBM861
+IBM863
+IBM865
+ISO-8859-1
+ole2
+_COLON_DUMMY
+_EMPTY_DUMMY
+_unknown_
 a
 abbreviated-name
-about
 above
 abs
-accelerate
 accent
 accentunder
 acceptance-state
 accepted
-accumulate
-across
 action
 active
 active-split-range
 active-table
 actuate
-add-empty-lines
 add-in
 add-in-name
-additional-column-statement
-additive
 address
 adjustment
-after-effect
-after-previous
-after-section
 algorithm
 align
 all
-all-pages
 allow-empty-cell
 alphabetical-index
 alphabetical-index-auto-mark-file
@@ -39,20 +146,11 @@ alphabetical-index-mark-start
 alphabetical-index-source
 alphabetical-separators
 alternate
-always
 am-pm
 ambient-color
 anchor-page-number
 anch

GSoC Project - Implementing legacy SAX parser Interface with FastParser

2016-08-21 Thread Mohammed Abdul Azeem
Hi,

I'd like to summarize all the work that's been done over the past three
months here.

We started with implementing a bridge (LegacyFastParser) between legacy
parser interfaces and XFastParser for the unknown elements  along with the
tests. We created a new interface XFastNamespaceHandler, which emits
namespace information for the unknown(not tokenized) elements.

https://gerrit.libreoffice.org/#/c/24883/
https://gerrit.libreoffice.org/#/c/25468/
https://gerrit.libreoffice.org/#/c/25935/
https://gerrit.libreoffice.org/#/c/26229/
https://gerrit.libreoffice.org/#/c/26661/
https://gerrit.libreoffice.org/#/c/26982/
https://gerrit.libreoffice.org/#/c/27222/
https://gerrit.libreoffice.org/#/c/27278/
https://gerrit.libreoffice.org/#/c/27593/
https://gerrit.libreoffice.org/#/c/27649/

Then we made LegacyFastParser to work with a combination of tokenized and
untokenized elements and attributes.
https://gerrit.libreoffice.org/#/c/27849/

Now to move xmloff/ to use FastParser, we needed a token mapping of all the
elements and attributes and a global token handler for odf-tokens.
https://gerrit.libreoffice.org/#/c/28073/ (This is picked from Daniel's
work in feature/fastparser branch, but it is relevant to the project).
https://gerrit.libreoffice.org/#/c/28183/

We need to make SvXMLImport to implement XFastParser interface and to lay a
foundation for using FastParser interfaces.
https://gerrit.libreoffice.org/#/c/28175/

As a final step(yet to be done), we need convert the XML tree context
handlers to fast contexts from the leaves upwards(some of the work is
already done in feature/fastparser branch, which we can pick with slight
modifications).

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2016-08-16 Thread Mohammed Abdul Azeem
 xmloff/source/core/fasttokenhandler.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 84d9a3642c62d930f4064536659c76a48b9f337e
Author: Mohammed Abdul Azeem 
Date:   Tue Aug 16 22:48:42 2016 +0200

GSoC - fix build of fasttokenhandler

Change-Id: If561895da71e08bd9e58fce281c412d9f9206cad

diff --git a/xmloff/source/core/fasttokenhandler.cxx 
b/xmloff/source/core/fasttokenhandler.cxx
index 0b9125d..722584c 100644
--- a/xmloff/source/core/fasttokenhandler.cxx
+++ b/xmloff/source/core/fasttokenhandler.cxx
@@ -14,18 +14,18 @@
 namespace xmloff {
 
 namespace {
+// include auto-generated Perfect_Hash
 #if defined __clang__
-#if __has_warning("-Wdeprecated-register")
 #pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
+#if __has_warning("-Wdeprecated-register")
 #pragma GCC diagnostic ignored "-Wdeprecated-register"
 #endif
 #endif
 #include "tokenhash.inc"
 #if defined __clang__
-#if __has_warning("-Wdeprecated-register")
 #pragma GCC diagnostic pop
 #endif
-#endif
 } // namespace
 
 namespace token {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: GSoC Progress

2016-08-14 Thread Mohammed Abdul Azeem
Hi,

Sorry, I haven't written in two weeks.

*Progress for week10 and 11:*
We made a seperate path for unknown elements and skipped tokenizing when
token handler is not set ( https://gerrit.libreoffice.org/#/c/27593/ ) and
then we moved the load of clearing the attribute list to the consumer
thread ( https://gerrit.libreoffice.org/#/c/27649/ ). Then we made the
legacyfastparser to take a blend of tokenized and non-tokenized elements
and attributes and used mapping to get back the string (
https://gerrit.libreoffice.org/#/c/27849/ ). We have added a
dummytokenhandler and registered few namespaces on the test cases in
sax/qa/cppunit/xmlimport.cxx to test the correctness.

Now, for the past week I've been working on implementing XFastParser
interface and the proxying onwards to
the legacy interface inside the SvXMLImport class. But we need to implement
a tokenhandler (for complete ODF tokens) and namespace token mapping. Once
this is done, I think we can convert XML tree context handlers to use
fastcontext directly from the leaves upwards.

Regards,
Thanks
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2016-08-10 Thread Mohammed Abdul Azeem
 sax/qa/cppunit/xmlimport.cxx   |   89 +++
 sax/source/fastparser/fastparser.cxx   |   77 ++-
 sax/source/fastparser/legacyfastparser.cxx |   94 +
 3 files changed, 206 insertions(+), 54 deletions(-)

New commits:
commit 18edd88edc0c45d9c3b8f6faa45bab481ec078f5
Author: Mohammed Abdul Azeem 
Date:   Wed Aug 3 17:27:48 2016 +0530

GSoC - Making legacyfastparser to use tokens:

This tokenizes some elements, de-tokenize while consuming
and emits elements through legacy interface. DummyTokenHandler
is just to test the correctness.

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

diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx
index f7fcd73..c50a674 100644
--- a/sax/qa/cppunit/xmlimport.cxx
+++ b/sax/qa/cppunit/xmlimport.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -40,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -264,6 +266,73 @@ void SAL_CALL NSDocumentHandler::startElement( const 
OUString& aName, const Refe
 CPPUNIT_ASSERT(false);
 }
 
+class DummyTokenHandler : public cppu::WeakImplHelper< XFastTokenHandler >,
+  public sax_fastparser::FastTokenHandlerBase
+{
+public:
+const static OUString tokens[];
+const static OUString namespaceURIs[];
+const static OUString namespacePrefixes[];
+
+// XFastTokenHandler
+virtual Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 nToken )
+throw (css::uno::RuntimeException, std::exception) override;
+virtual sal_Int32 SAL_CALL getTokenFromUTF8( const css::uno::Sequence< 
sal_Int8 >& Identifier )
+throw (css::uno::RuntimeException, std::exception) override;
+//FastTokenHandlerBase
+virtual sal_Int32 getTokenDirect( const char *pToken, sal_Int32 nLength ) 
const override;
+};
+
+const OUString DummyTokenHandler::tokens[] = { "Signature", 
"CanonicalizationMethod", "Algorithm", "Type",
+  "DigestMethod", "Reference", 
"document",
+  "spacing", "Player", "Height" };
+
+const OUString DummyTokenHandler::namespaceURIs[] = { 
"http://www.w3.org/2000/09/xmldsig#";,
+  
"http://schemas.openxmlformats.org/wordprocessingml/2006/main/";,
+  
"xyzsports.com/players/football/" };
+
+const OUString DummyTokenHandler::namespacePrefixes[] = { "", "w", "Player" };
+
+Sequence< sal_Int8 > DummyTokenHandler::getUTF8Identifier( sal_Int32 nToken )
+throw (uno::RuntimeException, std::exception)
+{
+OString aUtf8Token;
+if ( ( ( nToken & 0x ) != 0 ) ) //namespace
+{
+sal_uInt32 nNamespaceToken = ( nToken >> 16 ) - 1;
+if ( nNamespaceToken < sizeof( namespacePrefixes ) / sizeof( OUString 
) )
+aUtf8Token = OUStringToOString( namespacePrefixes[ nNamespaceToken 
], RTL_TEXTENCODING_UTF8 );
+}
+else //element or attribute
+{
+sal_uInt32 nElementToken = nToken & 0x;
+if ( nElementToken < sizeof( tokens ) / sizeof( OUString ) )
+aUtf8Token = OUStringToOString( tokens[ nElementToken ], 
RTL_TEXTENCODING_UTF8 );
+}
+Sequence< sal_Int8 > aSeq = Sequence< sal_Int8 >( reinterpret_cast< const 
sal_Int8* >(
+aUtf8Token.getStr() ), aUtf8Token.getLength() );
+return aSeq;
+}
+
+sal_Int32 DummyTokenHandler::getTokenFromUTF8( const uno::Sequence< sal_Int8 
>& rIdentifier )
+throw (uno::RuntimeException, std::exception)
+{
+return getTokenDirect( reinterpret_cast< const char* >(
+rIdentifier.getConstArray() ), rIdentifier.getLength() );
+}
+
+sal_Int32 DummyTokenHandler::getTokenDirect( const char* pToken, sal_Int32 
nLength ) const
+{
+OUString sToken( pToken, nLength, RTL_TEXTENCODING_UTF8 );
+for( sal_uInt16  i = 0; i < sizeof(tokens)/sizeof(OUString); i++ )
+{
+if ( tokens[i] == sToken )
+return (sal_Int32)i;
+}
+return FastToken::DONTKNOW;
+}
+
+
 class XMLImportTest : public test::BootstrapFixture
 {
 private:
@@ -298,6 +367,26 @@ void XMLImportTest::setUp()
 m_xLegacyFastParser.set( 
xContext->getServiceManager()->createInstanceWithContext
 ( "com.sun.star.xml.sax.LegacyFastParser", xContext ), 
UNO_QUERY );
 m_xLegacyFastParser->setDocumentHandler( m_xDocumentHandler.get() );
+
+Reference< XFastTok

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

2016-07-29 Thread Mohammed Abdul Azeem
 sax/source/fastparser/fastparser.cxx |   50 +--
 1 file changed, 42 insertions(+), 8 deletions(-)

New commits:
commit 916a11d26cb74da9dd534e07b35737def6cbf54a
Author: Mohammed Abdul Azeem 
Date:   Thu Jul 28 23:10:12 2016 +0530

GSoC - moving FastAttributeList::clear to consumer thread:

this shares the load of clearing the attributes list with
the consumer when producer is busy.

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

diff --git a/sax/source/fastparser/fastparser.cxx 
b/sax/source/fastparser/fastparser.cxx
index ab324a1..8fa9223 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -70,7 +70,11 @@ struct Entity;
 typedef std::unordered_map< OUString, sal_Int32,
 OUStringHash > NamespaceMap;
 
-typedef std::vector EventList;
+struct EventList
+{
+std::vector maEvents;
+bool mbIsAttributesEmpty;
+};
 
 enum CallbackType { INVALID, START_ELEMENT, END_ELEMENT, CHARACTERS, DONE, 
EXCEPTION };
 
@@ -531,7 +535,7 @@ EventList* Entity::getEventList()
 if (!mpProducedEvents)
 {
 mpProducedEvents = new EventList();
-mpProducedEvents->resize(mnEventListSize);
+mpProducedEvents->maEvents.resize(mnEventListSize);
 mnProducedEventsSize = 0;
 }
 }
@@ -544,7 +548,7 @@ Event& Entity::getEvent( CallbackType aType )
 return maSharedEvent;
 
 EventList* pEventList = getEventList();
-Event& rEvent = (*pEventList)[mnProducedEventsSize++];
+Event& rEvent = pEventList->maEvents[mnProducedEventsSize++];
 rEvent.maType = aType;
 return rEvent;
 }
@@ -783,6 +787,24 @@ void FastSaxParserImpl::parseStream(const InputSource& 
maStructSource)
 done = true;
 
 aGuard.reset(); // lock
+
+if ( rEntity.maPendingEvents.size() <= 
rEntity.mnEventLowWater )
+{
+aGuard.clear();
+for (auto aEventIt = pEventList->maEvents.begin();
+aEventIt != pEventList->maEvents.end(); ++aEventIt)
+{
+if (aEventIt->mxAttributes.is())
+{
+aEventIt->mxAttributes->clear();
+if( rEntity.mxNamespaceHandler.is() )
+aEventIt->mxDeclAttributes->clear();
+}
+pEventList->mbIsAttributesEmpty = true;
+}
+aGuard.reset();
+}
+
 rEntity.maUsedEvents.push(pEventList);
 }
 } while (!done);
@@ -926,8 +948,9 @@ void FastSaxParserImpl::produce( bool bForceFlush )
 bool FastSaxParserImpl::consume(EventList *pEventList)
 {
 Entity& rEntity = getEntity();
-for (EventList::iterator aEventIt = pEventList->begin();
- aEventIt != pEventList->end(); ++aEventIt)
+pEventList->mbIsAttributesEmpty = false;
+for (auto aEventIt = pEventList->maEvents.begin();
+ aEventIt != pEventList->maEvents.end(); ++aEventIt)
 {
 switch ((*aEventIt).maType)
 {
@@ -1042,17 +1065,28 @@ void FastSaxParserImpl::callbackStartElement(const 
xmlChar *localName , const xm
 }
 
 // create attribute map and process namespace instructions
-Event& rEvent = getEntity().getEvent( START_ELEMENT );
+Event& rEvent = rEntity.getEvent( START_ELEMENT );
+bool bIsAttributesEmpty = false;
+if ( rEntity.mbEnableThreads )
+bIsAttributesEmpty = rEntity.getEventList()->mbIsAttributesEmpty;
+
 if (rEvent.mxAttributes.is())
-rEvent.mxAttributes->clear();
+{
+if( !bIsAttributesEmpty )
+rEvent.mxAttributes->clear();
+}
 else
 rEvent.mxAttributes.set(
 new FastAttributeList( rEntity.mxTokenHandler,
rEntity.mpTokenHandler ) );
+
 if( rEntity.mxNamespaceHandler.is() )
 {
 if (rEvent.mxDeclAttributes.is())
-rEvent.mxDeclAttributes->clear();
+{
+if( !bIsAttributesEmpty )
+rEvent.mxDeclAttributes->clear();
+}
 else
 rEvent.mxDeclAttributes.set(
 new FastAttributeList( rEntity.mxTokenHandler,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: GSoC Progress

2016-07-27 Thread Mohammed Abdul Azeem
Hi,

*Progress for week8 and 9:*
We managed to fix those issues which occured while trying to use
LegacyFastParser in place of XParser (
https://gerrit.libreoffice.org/#/c/27222/ and
https://gerrit.libreoffice.org/#/c/27278/ ).

Since then I've been trying to see if there is a performance gain in using
LegacyFastParser over XParser. But XParser still has better wall-clock time
for importing documents than our new parser. We are looking at couple of
places where our threaded approach is taking more time and trying to remove
all unnecessary overheads and optimize this path of unknown elements and
attributes.

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2016-07-27 Thread Mohammed Abdul Azeem
 sax/source/fastparser/fastparser.cxx   |  109 +
 sax/source/fastparser/legacyfastparser.cxx |   16 
 2 files changed, 67 insertions(+), 58 deletions(-)

New commits:
commit 84db6c1d9c57c3dc115dc22413442cf1aa5e69df
Author: Mohammed Abdul Azeem 
Date:   Wed Jul 27 22:28:39 2016 +0530

GSOC - Avoid tokenizing strings for Unknown elements:

Added a special case when token handler is not set, which
avoids tokenizing strings.

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

diff --git a/sax/source/fastparser/fastparser.cxx 
b/sax/source/fastparser/fastparser.cxx
index 49038b8..ab324a1 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -738,9 +738,6 @@ void FastSaxParserImpl::parseStream(const InputSource& 
maStructSource)
 Entity entity( maData );
 entity.maStructSource = maStructSource;
 
-if( !entity.mxTokenHandler.is() )
-throw SAXException("No token handler, use setTokenHandler()", 
Reference< XInterface >(), Any() );
-
 if( !entity.maStructSource.aInputStream.is() )
 throw SAXException("No input source", Reference< XInterface >(), Any() 
);
 
@@ -1072,60 +1069,88 @@ void FastSaxParserImpl::callbackStartElement(const 
xmlChar *localName , const xm
 
 try
 {
-/*  #158414# Each element may define new namespaces, also for 
attribues.
-First, process all namespaces, second, process the attributes 
after namespaces
-have been initialized. */
-
-// #158414# first: get namespaces
-for (int i = 0; i < numNamespaces * 2; i += 2)
+if ( rEntity.mxTokenHandler.is() )
 {
-// namespaces[] is (prefix/URI)
-if( namespaces[ i ] != nullptr )
+/*  #158414# Each element may define new namespaces, also for 
attribues.
+First, process all namespaces, second, process the attributes 
after namespaces
+have been initialized. */
+
+// #158414# first: get namespaces
+for (int i = 0; i < numNamespaces * 2; i += 2)
 {
-DefineNamespace( OString( XML_CAST( namespaces[ i ] )),
-OUString( XML_CAST( namespaces[ i + 1 ] ), strlen( 
XML_CAST( namespaces[ i + 1 ] )), RTL_TEXTENCODING_UTF8 ));
-if( rEntity.mxNamespaceHandler.is() )
-rEvent.mxDeclAttributes->addUnknown( OString( 
XML_CAST( namespaces[ i ] ) ), OString( XML_CAST( namespaces[ i + 1 ] ) ) );
+// namespaces[] is (prefix/URI)
+if( namespaces[ i ] != nullptr )
+{
+DefineNamespace( OString( XML_CAST( namespaces[ i ] )),
+OUString( XML_CAST( namespaces[ i + 1 ] ), strlen( 
XML_CAST( namespaces[ i + 1 ] )), RTL_TEXTENCODING_UTF8 ));
+}
+else
+{
+// default namespace
+sNamespace = OUString( XML_CAST( namespaces[ i + 1 ] ), 
strlen( XML_CAST( namespaces[ i + 1 ] )), RTL_TEXTENCODING_UTF8 );
+nNamespaceToken = GetNamespaceToken( sNamespace );
+}
 }
+
+// #158414# second: fill attribute list with other attributes
+for (int i = 0; i < numAttributes * 5; i += 5)
+{
+// attributes[] is ( localname / prefix / nsURI / valueBegin / 
valueEnd )
+if( attributes[ i + 1 ] != nullptr )
+{
+sal_Int32 nAttributeToken = GetTokenWithPrefix( 
attributes[ i + 1 ], strlen( XML_CAST( attributes[ i + 1 ] )), attributes[ i ], 
strlen( XML_CAST( attributes[ i ] )));
+if( nAttributeToken != FastToken::DONTKNOW )
+rEvent.mxAttributes->add( nAttributeToken, XML_CAST( 
attributes[ i + 3 ] ), attributes[ i + 4 ] - attributes[ i + 3 ] );
+else
+rEvent.mxAttributes->addUnknown( OUString( XML_CAST( 
attributes[ i + 1 ] ), strlen( XML_CAST( attributes[ i + 1 ] )), 
RTL_TEXTENCODING_UTF8 ),
+OString( XML_CAST( attributes[ i ] )), 
OString( XML_CAST( attributes[ i + 3 ] ), attributes[ i + 4 ] - attributes[ i + 
3 ] ));
+}
+else
+{
+sal_Int32 nAttributeToken = GetToken( attributes[ i ], 
strlen( XML_CAST( attributes[ i ] )));
+if( nAttributeToken != FastToken::DONTKNOW )
+rEvent.mxAttributes->add( nAttributeToken, XML_CAST( 
attributes[ i + 3 ] ), attributes[ i + 4 ] - attributes[ i + 3 ] );
+else
+

Re: XLegacyFastParser - Errors

2016-07-20 Thread Mohammed Abdul Azeem
Hi,

On Tue, Jul 19, 2016 at 5:42 PM, Stephan Bergmann 
wrote:

> On 07/11/2016 12:33 PM, Stephan Bergmann wrote:
>
>> By the way, when you add things to .idl files in unoidl, please add
>> "@since LibreOffice 5.3" tags to the comments.  (Seen you added an
>> interface XFastNamespaceHandler, and a method setNamespaceHandler to
>> unpublished interface XFasterParser.)
>>
>
> Added them now with <
> https://cgit.freedesktop.org/libreoffice/core/commit/?id=31623bb04a86cc848beec359bd7567833aad5fd3>
> "Missing @since tags".  Please remember to also add some documentation.  :)
>

Thanks Stephan, I had forgotten about it. Sure, I will add the
documentation for that. :)

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[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/manifest

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

2016-07-16 Thread Mohammed Abdul Azeem
 sax/qa/cppunit/xmlimport.cxx |6 --
 sax/qa/data/testthreading.xml|5 +
 sax/source/fastparser/fastparser.cxx |   25 ++---
 3 files changed, 31 insertions(+), 5 deletions(-)

New commits:
commit 38b596d11f913477836cd29489017cf4a5e1debd
Author: Mohammed Abdul Azeem 
Date:   Thu Jul 14 20:22:07 2016 +0530

GSoC - Sync namespace handler calls with elements:

This syncs the namespace declaration calls with element's events. A
test case is also added which enables threads of fastparser.

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

diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx
index 747a3d5..7694223 100644
--- a/sax/qa/cppunit/xmlimport.cxx
+++ b/sax/qa/cppunit/xmlimport.cxx
@@ -82,7 +82,7 @@ private:
 
 public:
 TestDocumentHandler() {}
-const OUString& getString() { return m_aStr; }
+const OUString getString() { return m_aStr; }
 
 // XDocumentHandler
 virtual void SAL_CALL startDocument() throw (SAXException, 
RuntimeException, exception) override;
@@ -140,7 +140,9 @@ void SAL_CALL TestDocumentHandler::startDocument()
 throw(SAXException, RuntimeException, exception)
 {
 m_aStr.clear();
+m_aNamespaceStack.clear();
 m_aNamespaceStack.emplace_back( make_pair( OUString( "default" ), 
OUString() ) );
+m_aCountStack = stack();
 m_aCountStack.emplace(0);
 }
 
@@ -306,7 +308,7 @@ void XMLImportTest::parse()
 {
 OUString fileNames[] = {"simple.xml", "defaultns.xml", "inlinens.xml",
 "multiplens.xml", "multiplepfx.xml",
-"nstoattributes.xml", "nestedns.xml"};
+"nstoattributes.xml", "nestedns.xml", 
"testthreading.xml"};
 
 for (sal_uInt16 i = 0; i < sizeof( fileNames ) / sizeof( OUString ); i++)
 {
diff --git a/sax/qa/data/testthreading.xml b/sax/qa/data/testthreading.xml
new file mode 100644
index 000..0d05fd9
--- /dev/null
+++ b/sax/qa/data/testthreading.xml
@@ -0,0 +1,5 @@
+http://www.w3.org/2000/09/xmldsig#"; 
Id="idPackageSignature">http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>http://www.w3.org/2000/09/xmldsig#Object"; 
URI="#idPackageObject">http://www.w3.org/2001/04/xmlenc#sha256"/>NOjlH6v6g2ojDvQoi4M5B8Bght0y3ES4fjxlRk2xtVE=http://www.w3.org/2000/09/xmldsig#Object"; 
URI="#idOfficeObject">http://www.w3.org/2001/04/xmlenc#sha256"/>mq1H1GLrTZSuUUTqX5HpjytFwl8nJFggNsXJUgQZT0U=http://uri.etsi.org/01903#SignedProperties"; 
URI="#idSignedProperties">http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>http://www.w3.org/2001/04/xml
 
enc#sha256"/>6jeT5n6jeqOspz6K6BIgitwfLZf4s1/uS9dPdOQRF8s=UZwOWZbOm9ysRa+eYwoksUW8d+jBFPOkqOtfTvT8waHWDe3siDc4N79W6jPCYMIHMtPQjCb4qMDe
+dhCYvg6TTWFWCvU/br+A1Qo0xovWHD3DwB29qk7NDBfbnEIPxbOe2D70cZa86Zl2MgW5YqQlgRFH
+g6+XxwBUp+ZYx4knFWEg8zgbe3JnV7zeI/RG/1iq9TYH1GUBloF10df4qaulrp2AUkdSvnnUcxRP
+ZfbS+14YxUHkW0UTyV+6ZeXqtTnXS0F/LG5JH2/xkN+mgwLB6TPfxtQD6vcj+Tdnf0hHlnuOmvBS
+L7Pn+zwS0ueMOTxIozcaYPsmJc9fVpEU2I59PA==MIIE7jCCAtagAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwVzELMAkGA1UEBhMCVUsxEDAOBgNVBAgMB0VuZ2xhbmQxEjAQBgNVBAoMCVRTQ1AgVGVzdDEiMCAGA1UEAwwZVFNDUCBJbnRlcm1lZGlhdGUgUm9vdCBDQTAeFw0xNTEyMTgwNzU4MTlaFw0xNjEyMjcwNzU4MTlaMFUxCzAJBgNVBAYTAlVLMRAwDgYDVQQIDAdFbmdsYW5kMRIwEAYDVQQKDAlUU0NQIFRlc3QxIDAeBgNVBAMMF1RTQ1AgVGVzdCBleGFtcGxlIEFsaWNlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3m2YNdX+nc1LkhlrNrcIPI3yCWnv0/0k9zDKpKiwjMH4vjWM46M6ptAiupxVpAMW5ojnhEyxaNHvZNsCwddYE6778hut2SJvz0szSBuHUuedcALI2EhVwdM0yLqfGo6WGeOIBDId49TemdNCMhk2zOpb1BqYhKls0LfdbxT/an3JaDmmLhPjvgYMJNYVX86L199OQFLJ1zLqQ0YirkKqXL9cSPmyYBKjgnqQ4Z5YfPL63EP0TsEfa5oQmy/0gS5FB2Wz9CqIptB130v0GR4XObTpOkhPFfC5RDBFTMZoi4NCK10wn2NCbr7qZ3aMrOlfeKbsNIifwu0KYFHXyxL5AwIDAQABo4HFMIHCMAkGA1UdEwQCMAAwEQYJYIZIAYb4QgEBBAQDAgWgMDMGCWCGSAGG+EIBDQQmFiRPcGVuU1NMIEdlbmVyYXRlZCBDbGllbnQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCL6DzsuAbni8475Z+HkX5tv8iiWMB8GA1UdIwQYMBaAFMuejS1rWjUf3x1+
 
2QbPSVpuXFl+MA4GA1UdDwEB/wQEAwIF4DAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwQwDQYJKoZIhvcNAQELBQADggIBAFs0DeCDjttHQ0UHsYcnhfBCWRdOFdIr3F/IEbN2BL/grScGXoXRaYMIQJv/s5dKgZIuH7xMCVKazoftPVqU4bOEduAv0IJ6hQF/wEMBueA0UjvQQVYZgsOALi7TD3gYpFqYcH2Wfx5/5Ln6dllL8UsHoP+6gSLaYwjJd7FQ+IlNTzR65dRMLoJhoKqqyuM6cf/PM8sbK2NH2r8toypjfPixvD/w3wP7xn4oo/IGXcRK4DTHBF/rSMqeR6ePwXm5tVHrQBfnxN3dsGsXkQgqzBvvbPY0raraO4CPR7mZp4GVFHOsUNh5TI1SlfxWZ49HU3F5jWeiI9jPuw1RmuAyZdFEt403Wi67v6revXe1By6UqIZjq3b2pJGBKZH+60P1cJScawzrN8pi1qQFV8JiiJM6/MSciqplTT5F7SG0XZx1CjnBz5rMdYNhI9NNtF3oy9Xy9RvgYehFaC43ZlBBUMDmZFj5a78hOOkkq1UnrHUdeXyWhiEFzv5d8My2i0kWGq8r0H

Re: GSoC Progress

2016-07-13 Thread Mohammed Abdul Azeem
Hi,

Sorry, I completely forgot to write my progress last week.

*Progress for week6 and 7:*
We wrote a test case to check mishandling of namespaces (
https://gerrit.libreoffice.org/#/c/26661/ ).
Since our LegacyFastParser emitted elements with namespace URL rather than
namespace prefix like xparser, we made some changes to XFastParser and
added a namespace handler that passes namespace declaration information.
Using that we modified LegacyFastParser to emit elements just like XParser
( https://gerrit.libreoffice.org/#/c/26982/ ).

We are trying to see if we can adopt LegacyFastParser in all places where
XParser is used. It failed at some places. One of the places was
svgio::XSvgParser::getDecomposition, which was fixed by adding a dummy
initialize method to LegacyFastParser. Currently it is still failing at
couple of other places, the causes to those are identified and we are
figuring out the solution.
Hopefully we can sort these out and profile it by the end of this week.

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: XLegacyFastParser - Errors

2016-07-12 Thread Mohammed Abdul Azeem
On Mon, Jul 11, 2016 at 1:48 PM, Michael Meeks 
wrote:
>
> On Mon, 2016-07-11 at 10:22 +0530, Mohammed Abdul Azeem wrote:
>
> > 2. SwUiWriterTest::testAutoCorr
> > It fails with an uncaught exception of type
> > com.sun.star.container.NoSuchElementException.
> > It fails at sw/qa/extras/uiwriter/uiwriter.cxx:1034, so I assume these
> > statements
> > pWrtShell->Insert("Bolt");
> > pWrtShell->AutoCorrect(corr, cIns);
> > at line 1032 and 1033 is failing for some reason.
> > During the execution of those statements, LegacyParser is called with
> > these two filters as document handlers.
> > com.sun.star.comp.Writer.XMLStylesImporter
> > com.sun.star.comp.Writer.XMLContentImporter
>
> A quick git grep:
>
> xmloff/source/transform/OOo2Oasis.cxx-OOO_IMPORTER(
> XMLWriterContentImportOOO,
> xmloff/source/transform/OOo2Oasis.cxx:
> "com.sun.star.comp.Writer.XMLContentImporter",
> xmloff/source/transform/OOo2Oasis.cxx-
> "com.sun.star.comp.Writer.XMLOasisContentImporter" )
>
> Suggests that there is some sort of wrapper / renaming (?)
>
> sw/source/filter/xml/xmlimp.cxx-extern "C" SAL_DLLPUBLIC_EXPORT
> css::uno::XInterface* SAL_CALL
> sw/source/filter/xml/xmlimp.cxx:com_sun_star_comp_Writer_XMLOasisContentImporter_get_implementation(css::uno::XComponentContext*
> context,
> sw/source/filter/xml/xmlimp.cxx-css::uno::Sequence
> const &)
>
> Might be a good place to look,
>
> At some point of time ManifestReader::readManifestSequence is called,
which calls the parser. But our new parser is not emitting any events for
this source, while XParser parses the manifest file and emits some events.
I am not sure why this is happening. I have attached the diff -u of outputs
of events emitted by both the parsers during SwUiWriterTest::testAutoCorr
test.

Any help is appreciated.

Thanks,
Azeem
--- xparser.txt 2016-07-13 00:22:37.251741561 +0530
+++ legacyfastparser.txt2016-07-13 00:22:38.419716423 +0530
@@ -699,160 +699,10 @@
 Attribs: script:name = Module1
 Attribs: script:language = StarBasic
 characters: REM  *  BASIC  *
-characters: 
 
-characters: 
-
-characters: Sub Main
-characters: 
-
-characters: 
-
-characters: End Sub
-startElement: manifest:manifest
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = /
-Attribs: manifest:media-type = 
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = 4xx/styles.xml
-Attribs: manifest:media-type = text/xml
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = 4xx/manifest.rdf
-Attribs: manifest:media-type = application/rdf+xml
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = 4xx/content.xml
-Attribs: manifest:media-type = text/xml
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = 4xx/
-Attribs: manifest:media-type = application/vnd.oasis.opendocument.text
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = Bolt/content.xml
-Attribs: manifest:media-type = text/xml
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = Bolt/manifest.rdf
-Attribs: manifest:media-type = application/rdf+xml
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = Bolt/styles.xml
-Attribs: manifest:media-type = text/xml
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = Bolt/
-Attribs: manifest:media-type = application/vnd.oasis.opendocument.text
-characters: 
-
-startElement: manifest:manifest
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = /
-Attribs: manifest:media-type = 
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = 4xx/styles.xml
-Attribs: manifest:media-type = text/xml
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = 4xx/manifest.rdf
-Attribs: manifest:media-type = application/rdf+xml
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = 4xx/content.xml
-Attribs: manifest:media-type = text/xml
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = 4xx/
-Attribs: manifest:media-type = application/vnd.oasis.opendocument.text
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = Bolt/content.xml
-Attribs: manifest:media-type = text/xml
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = Bolt/manifest.rdf
-Attribs: manifest:media-type = application/rdf+xml
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = Bolt/styles.xml
-Attribs: manifest:media-type = text/xml
-characters: 
-
-startElement: manifest:file-entry
-Attribs: manifest:full-path = Bolt/
-At

XLegacyFastParser - Errors

2016-07-10 Thread Mohammed Abdul Azeem
Hi,

Our new parser is failing at couple of other places. After much debugging,
I've identified the causes for these failures.

1. SigningTest::testOOXMLPartial
The xml file parsed by ImplXMLSignatureListener filter is big and it
activates threading. When threading is enabled our namespace handler fails,
since namespace declarations passed are not in sync with the elements and
there is no way to identify which elements these declarations belong to.
I think the solution would be to somehow include these declarations in the
event and then pass these declarations before calling startUnknownElement.
I copied the signature xml file and added it to our test case and it fails.

2. SwUiWriterTest::testAutoCorr
It fails with an uncaught exception of type
com.sun.star.container.NoSuchElementException.
It fails at sw/qa/extras/uiwriter/uiwriter.cxx:1034, so I assume these
statements
pWrtShell->Insert("Bolt");
pWrtShell->AutoCorrect(corr, cIns);
at line 1032 and 1033 is failing for some reason.
During the execution of those statements, LegacyParser is called with these
two filters as document handlers.
com.sun.star.comp.Writer.XMLStylesImporter
com.sun.star.comp.Writer.XMLContentImporter

I couldn't find the implementation of these filters, so any help is
appreciated.

Thanks,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: GSoC Progress

2016-06-29 Thread Mohammed Abdul Azeem
Hi,

*Progress for week5:*
When trying to adopt LegacyFastParser in place of old parser, we hit quite
a few problems. Some of the XDocumentHandlers were using
namespacePrefix:foo kind of comparision directly on element name and some
expect namespace declarations explicitly and tries to resolve the already
resolved name in case of LegacyFastParser.

I thought of pushing xmlns: declaration through unknown attributes (
https://gerrit.libreoffice.org/#/c/26661/ ), but as Michael said, it would
affect the performance where XFastParser is already being used. So I've
reconsidered and thinking of implementing some kind of namespace handler
and keep the bit away from usual cases of XFastParser. I'm currently
looking into all places where XParser is used and where Document
Handler misuses
defined namespaces without resolving them. I'm hoping to write a
comprehensive test to cover all these cases within this week.

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: GSoC Progress

2016-06-22 Thread Mohammed Abdul Azeem
Hi,

*Progress for week4:*
We wrote mapping between legacy parser and XFastParser and parsed our test
files using it ( https://gerrit.libreoffice.org/#/c/26229/ ).

We are trying to shift to our new LegacyFastParser in all places where we
used XParser before. I had some problems with calling factory method to get
LegacyFastParser, which Micheal helped me with later. We have included an
environmental variable which is when set/unset will give
XParser/LegacyFastParser implementation.

When we adopt LegacyFastParser, in quite some places code seams to be
broken as they explicitly try to qualify an element (convert form
namespaceName:elementName to namespaceURL:elementName). I'm looking into
it, I will try to identify all places which are causing problems and then
we will see what can be done about those.

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2016-06-17 Thread Mohammed Abdul Azeem
 sax/Library_expwrap.mk |1 
 sax/qa/cppunit/xmlimport.cxx   |   53 -
 sax/source/expatwrap/expwrap.component |4 
 sax/source/fastparser/legacyfastparser.cxx |  275 +
 4 files changed, 325 insertions(+), 8 deletions(-)

New commits:
commit 551a5066fcc8000850d34408d8c1bcdd5b599db3
Author: Mohammed Abdul Azeem 
Date:   Mon Jun 13 23:30:09 2016 +0530

GSoC: Mapping legacy sax parser and XFastParser

This implements legacy parser interface using XFastParser, and
unit test is also added.

Change-Id: Ia2eb7d517d80a3f7ec0cf26ffa2e5747ad22b186
Reviewed-on: https://gerrit.libreoffice.org/26229
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/sax/Library_expwrap.mk b/sax/Library_expwrap.mk
index e8e049a..6b38278 100644
--- a/sax/Library_expwrap.mk
+++ b/sax/Library_expwrap.mk
@@ -44,6 +44,7 @@ $(eval $(call gb_Library_add_exception_objects,expwrap,\
sax/source/expatwrap/saxwriter \
sax/source/expatwrap/xml2utf \
sax/source/fastparser/fastparser \
+   sax/source/fastparser/legacyfastparser \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx
index c8bd217..fe4af60 100644
--- a/sax/qa/cppunit/xmlimport.cxx
+++ b/sax/qa/cppunit/xmlimport.cxx
@@ -83,6 +83,7 @@ private:
 public:
 TestDocumentHandler() {}
 const OUString& getString() { return m_aStr; }
+void setString( const OUString aStr ) { m_aStr = aStr; }
 
 // XDocumentHandler
 virtual void SAL_CALL startDocument() throw (SAXException, 
RuntimeException, exception) override;
@@ -319,15 +320,43 @@ public:
 }
 };
 
+class TestLegacyDocumentHandler : public TestDocumentHandler
+{
+public:
+virtual void SAL_CALL startElement( const OUString& aName, const 
Reference< XAttributeList >& xAttribs ) throw (SAXException, RuntimeException, 
exception) override;
+virtual void SAL_CALL endElement( const OUString& aName ) throw 
(SAXException, RuntimeException, exception) override;
+};
+
+void SAL_CALL TestLegacyDocumentHandler::startElement( const OUString& aName, 
const Reference< XAttributeList >& xAttribs )
+throw( SAXException, RuntimeException, exception )
+{
+setString( getString() + aName );
+sal_uInt16 len = xAttribs->getLength();
+for (sal_uInt16 i = 0; i < len; i++)
+{
+OUString sAttrName = xAttribs->getNameByIndex(i);
+OUString sAttrValue = xAttribs->getValueByIndex(i);
+setString( getString() + sAttrName + sAttrValue );
+}
+}
+
+
+void SAL_CALL TestLegacyDocumentHandler::endElement( const OUString& aName )
+throw( SAXException, RuntimeException, exception )
+{
+setString( getString() + aName );
+}
 
 class XMLImportTest : public test::BootstrapFixture
 {
 private:
 OUString m_sDirPath;
-rtl::Reference< TestDocumentHandler > m_xDocumentHandler;
-rtl::Reference< TestFastDocumentHandler > m_xFastDocumentHandler;
+Reference< TestDocumentHandler > m_xDocumentHandler;
+Reference< TestFastDocumentHandler > m_xFastDocumentHandler;
 Reference< XParser > m_xParser;
 Reference< XFastParser > m_xFastParser;
+Reference< XParser > m_xLegacyFastParser;
+Reference< TestLegacyDocumentHandler > m_xLegacyDocumentHandler;
 Reference< XFastTokenHandler > m_xFastTokenHandler;
 
 public:
@@ -345,16 +374,19 @@ public:
 void XMLImportTest::setUp()
 {
 test::BootstrapFixture::setUp();
+Reference< XComponentContext > xContext = 
comphelper::getProcessComponentContext();
 m_xDocumentHandler.set( new TestDocumentHandler() );
 m_xFastDocumentHandler.set( new TestFastDocumentHandler() );
+m_xLegacyDocumentHandler.set( new TestLegacyDocumentHandler() );
 m_xFastTokenHandler.set( new TestTokenHandler() );
-m_xParser = Parser::create(
-::comphelper::getProcessComponentContext() );
-m_xFastParser = FastParser::create(
-::comphelper::getProcessComponentContext() );
-m_xParser->setDocumentHandler( m_xDocumentHandler.get() );
-m_xFastParser->setFastDocumentHandler( m_xFastDocumentHandler.get() );
+m_xParser = Parser::create( xContext );
+m_xFastParser = FastParser::create( xContext );
+m_xParser->setDocumentHandler( m_xDocumentHandler );
+m_xFastParser->setFastDocumentHandler( m_xFastDocumentHandler );
 m_xFastParser->setTokenHandler( m_xFastTokenHandler );
+m_xLegacyFastParser.set( 
xContext->getServiceManager()->createInstanceWithContext
+( "com.sun.star.xml.sax.LegacyFastParser", xContext ), 
UNO_QUERY );
+m_xLegacyFastParser->setDocumentHandler( m_xLegacyDocumentHandler );
 m_sDirPath = m_directories.getPathFromSrc( "/sax/qa/data/" );
 }
 
@@ -382,7 +414,12 @@ void XMLImportTest::parse(

Re: GSoC Progress

2016-06-15 Thread Mohammed Abdul Azeem
Hi,

*Progress for week3:*
We parsed the test files using XFastParser, built string out of it and
compared them with strings built from XParser (
https://gerrit.libreoffice.org/#/c/25935/ ).
We have implemented a mapping between legacy parser and XFastParser, and
again parsed all the test files using this implementation. It is just the
basic implementation which uses only unknown (unregistered) elements.

This week will try to complete this mapping, some tests for it and then we
will start profiling it.

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2016-06-15 Thread Mohammed Abdul Azeem
 sax/CppunitTest_sax_xmlimport.mk |   11 +
 sax/qa/cppunit/xmlimport.cxx |  218 ---
 sax/qa/data/nestedns.xml |2 
 3 files changed, 190 insertions(+), 41 deletions(-)

New commits:
commit 8f75eeebbf354ef58d3d0ced6ea1c2d8df89e64f
Author: Mohammed Abdul Azeem 
Date:   Mon Jun 6 03:07:35 2016 +0530

GSoC: sax2/ unit tests:

Parsed the same test files using XFastParser and built string, we
asssert that both the strings built from XParser and XFastParser
are identical.

Change-Id: Ie1e0dc6b676ca32dd10d75c3cb272b5c8b795ab7

diff --git a/sax/CppunitTest_sax_xmlimport.mk b/sax/CppunitTest_sax_xmlimport.mk
index 71e2792..14b6488 100644
--- a/sax/CppunitTest_sax_xmlimport.mk
+++ b/sax/CppunitTest_sax_xmlimport.mk
@@ -22,6 +22,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sax_xmlimport, \
 sax \
 unotest \
 utl \
+salhelper \
 $(gb_UWINAPI) \
 ))
 
@@ -30,11 +31,18 @@ $(eval $(call gb_CppunitTest_use_api,sax_xmlimport,\
 udkapi \
 ))
 
-$(eval $(call gb_CppunitTest_use_external,sax_xmlimport,boost_headers))
+$(eval $(call gb_CppunitTest_use_externals,sax_xmlimport, \
+   boost_headers \
+))
 
 $(eval $(call gb_CppunitTest_use_ure,sax_xmlimport))
 $(eval $(call gb_CppunitTest_use_vcl,sax_xmlimport))
 
+$(eval $(call gb_CppunitTest_set_include,sax_xmlimport,\
+-I$(SRCDIR)/sax/inc \
+$$(INCLUDE) \
+))
+
 $(eval $(call gb_CppunitTest_use_components,sax_xmlimport,\
 configmgr/source/configmgr \
 sax/source/expatwrap/expwrap \
@@ -42,7 +50,6 @@ $(eval $(call gb_CppunitTest_use_components,sax_xmlimport,\
 ucb/source/ucp/file/ucpfile1 \
 ))
 
-
 $(eval $(call gb_CppunitTest_use_configuration,sax_xmlimport))
 
 # vim: set noet sw=4 ts=4:
diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx
index 28c2764..394a285 100644
--- a/sax/qa/cppunit/xmlimport.cxx
+++ b/sax/qa/cppunit/xmlimport.cxx
@@ -25,39 +25,52 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
+
 
 namespace {
 
 using namespace css;
-using namespace css::uno;
-using namespace css::io;
+using namespace uno;
+using namespace io;
+using namespace xml::sax;
 using namespace std;
+using namespace ::osl;
+using namespace sax_fastparser;
 
 Reference< XInputStream > createStreamFromFile (
 const OUString & filePath)
 {
 Reference<  XInputStream >  xInputStream;
 OUString aInStr;
-osl::FileBase::getFileURLFromSystemPath(filePath, aInStr);
+FileBase::getFileURLFromSystemPath(filePath, aInStr);
 SvStream* pStream = utl::UcbStreamHelper::CreateStream(aInStr, 
StreamMode::READ);
 if(pStream == nullptr)
 CPPUNIT_ASSERT(false);
-uno::Reference xStream(new utl::OStreamWrapper(*pStream));
-xInputStream.set(xStream, uno::UNO_QUERY);
+Reference< XStream > xStream(new utl::OStreamWrapper(*pStream));
+xInputStream.set(xStream, UNO_QUERY);
 return xInputStream;
 }
 
-class TestDocumentHandler : public cppu::WeakImplHelper< 
xml::sax::XDocumentHandler >
+class TestDocumentHandler : public cppu::WeakImplHelper< XDocumentHandler >
 {
 private:
 OUString m_aStr;
@@ -69,16 +82,17 @@ private:
 
 public:
 TestDocumentHandler() {}
+const OUString& getString() { return m_aStr; }
 
 // XDocumentHandler
-virtual void SAL_CALL startDocument() throw (xml::sax::SAXException, 
RuntimeException, std::exception) override;
-virtual void SAL_CALL endDocument() throw (xml::sax::SAXException, 
RuntimeException, std::exception) override;
-virtual void SAL_CALL startElement( const OUString& aName, const 
Reference< xml::sax::XAttributeList >& xAttribs ) throw 
(xml::sax::SAXException, RuntimeException, std::exception) override;
-virtual void SAL_CALL endElement( const OUString& aName ) throw 
(xml::sax::SAXException, RuntimeException, std::exception) override;
-virtual void SAL_CALL characters( const OUString& aChars ) throw 
(xml::sax::SAXException, RuntimeException, std::exception) override;
-virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) 
throw (xml::sax::SAXException, RuntimeException, std::exception) override;
-virtual void SAL_CALL processingInstruction( const OUString& aTarget, 
const OUString& aData ) throw (xml::sax::SAXException, RuntimeException, 
std::exception) override;
-virtual void SAL_CALL setDocumentLocator( const Reference< 
xml::sax::XLocator >& xLocator ) throw (xml::sax::SAXException, 
RuntimeException, std::exception) override;
+virtual void SAL_CALL startDocument() throw (SAXException, 
RuntimeException, exception) override;
+virtual void SAL_CALL endDocument() throw (SAXException, RuntimeException, 
exception) override

Re: GSoC Progress

2016-06-08 Thread Mohammed Abdul Azeem
Hi,

*Progess for week2:*
We parsed the same test files using XFastParser and produced a string,
which we test against the string we built earlier from XParser. The changes
I've pushed to gerrit, it is still to be reviewed. It took a little more
time than expected, as I was trying to understand the underlying parser
(libxml2) and also got stuck once with some linking error.

This week, I will be working on the mapping between legacy SAX interface
and XFastParser interface.

Should we use different thread every week? I think its convenient and easy
to manage if everything's under a single thread. In case you want me to use
a different thread, please let me know. :)

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


GSoC Progress

2016-05-31 Thread Mohammed Abdul Azeem
Hi,

I'm working on Implementation of Legacy SAX parser with XFastParser project
(Mentors: Meeks and Noel).

As a first phase, we are writing comprehensive tests for our old parser and
XFastParser interface.
So far, We have created some test xml files in sax/qa/data and parsed them
with old parser to create a string (
https://gerrit.libreoffice.org/#/c/24883/ ). We then handled namespaces to
generate a cononicalized string ( https://gerrit.libreoffice.org/#/c/25468/
).

I'm working on implementing XFastParser and related APIs for testing,
hopefully I can finish that and start with the implementation of mapping
legacy parser with XFastParser by the end of this week.

Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2016-05-28 Thread Mohammed Abdul Azeem
 sax/qa/cppunit/xmlimport.cxx   |  114 +
 sax/qa/data/defaultns.xml  |   11 +++
 sax/qa/data/inlinens.xml   |   12 
 sax/qa/data/multiplens.xml |   13 
 sax/qa/data/multiplepfx.xml|9 +++
 sax/qa/data/namespace.xml  |6 --
 sax/qa/data/nestedns.xml   |   30 ++
 sax/qa/data/note.xml   |7 --
 sax/qa/data/nstoattributes.xml |   17 ++
 sax/qa/data/simple.xml |   11 +++
 10 files changed, 197 insertions(+), 33 deletions(-)

New commits:
commit 8128d597224b55965c4f1bba3d824f193a55041b
Author: Mohammed Abdul Azeem 
Date:   Thu May 26 02:05:13 2016 +0530

sax2/ unit tests.

Test xml files are added, string is built for each file
and namespaces are handled.

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

diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx
index 204c45d..0ba32c1 100644
--- a/sax/qa/cppunit/xmlimport.cxx
+++ b/sax/qa/cppunit/xmlimport.cxx
@@ -32,12 +32,16 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 namespace {
 
 using namespace css;
 using namespace css::uno;
 using namespace css::io;
+using namespace std;
 
 Reference< XInputStream > createStreamFromFile (
 const OUString filePath)
@@ -56,11 +60,17 @@ Reference< XInputStream > createStreamFromFile (
 class TestDocumentHandler : public cppu::WeakImplHelper< 
xml::sax::XDocumentHandler >
 {
 private:
-// OUString m_aStr;
+OUString m_aStr;
+deque< pair > m_aNamespaceStack;
+stack m_aCountStack;
+
+OUString canonicalform(const OUString &sName, const OUString &sValue, bool 
isElement);
+OUString getNamespace(const OUString &sName);
 
 public:
 TestDocumentHandler() {}
-//const OUString& getString() { return m_aStr; }
+OUString getString() { return m_aStr; }
+
 // XDocumentHandler
 virtual void SAL_CALL startDocument() throw (xml::sax::SAXException, 
RuntimeException, std::exception) override;
 virtual void SAL_CALL endDocument() throw (xml::sax::SAXException, 
RuntimeException, std::exception) override;
@@ -72,10 +82,53 @@ public:
 virtual void SAL_CALL setDocumentLocator( const Reference< 
xml::sax::XLocator >& xLocator ) throw (xml::sax::SAXException, 
RuntimeException, std::exception) override;
 };
 
+OUString TestDocumentHandler::canonicalform(const OUString &sName, const 
OUString &sValue, bool isElement)
+{
+sal_Int16 nIndex = sName.indexOf(":");
+if ( !isElement && sName.match( "xmlns" ) )
+{
+m_aCountStack.top() += 1;
+if ( nIndex < 0 )
+m_aNamespaceStack.push_back( make_pair( OUString( "default" ), 
sValue ) );
+else
+m_aNamespaceStack.push_back( make_pair( sName.copy( nIndex + 1 ), 
sValue ) );
+}
+else
+{
+if ( nIndex >= 0 )
+{
+OUString sNamespace = getNamespace( sName.copy( 0, nIndex ) );
+return sNamespace + sName.copy(nIndex);
+}
+else
+{
+OUString sDefaultns = getNamespace( "default" );
+if ( !isElement || sDefaultns.isEmpty() )
+return sName;
+else
+return sDefaultns + ":" + sName;
+}
+}
+return OUString("");
+}
+
+OUString TestDocumentHandler::getNamespace(const OUString &sName)
+{
+for (sal_Int16 i = m_aNamespaceStack.size() - 1; i>=0; i--)
+{
+pair aPair = m_aNamespaceStack.at(i);
+if (aPair.first == sName)
+return aPair.second;
+}
+return OUString("");
+}
+
 void SAL_CALL TestDocumentHandler::startDocument()
 throw(xml::sax::SAXException, RuntimeException, std::exception)
 {
-// m_aStr.clear();
+m_aStr.clear();
+m_aNamespaceStack.emplace_back( make_pair( OUString( "default" ), 
OUString() ) );
+m_aCountStack.emplace(0);
 }
 
 
@@ -84,30 +137,45 @@ void SAL_CALL TestDocumentHandler::endDocument()
 {
 }
 
-void SAL_CALL TestDocumentHandler::startElement( const OUString& /*aName*/, 
const Reference< xml::sax::XAttributeList >& /*xAttribs*/ )
+void SAL_CALL TestDocumentHandler::startElement( const OUString& aName, const 
Reference< xml::sax::XAttributeList >& xAttribs )
 throw( xml::sax::SAXException, RuntimeException, std::exception )
 {
-// m_aStr = m_aStr + "<" + aName + "> ";
+OUString sAttributes;
+m_aCountStack.push(0);
+sal_uInt16 len = xAttribs->getLength();
+for (sal_uInt16 i=0; igetValueByIndex(i);
+OUString sAttrName = canonicalform(xAttribs->getNameByIndex(i), 
sAttrValue, false);
+if (!sAttrName.isEmpty())
+sAttributes 

[Libreoffice-commits] core.git: sax/CppunitTest_sax_xmlimport.mk sax/Module_sax.mk sax/qa

2016-05-19 Thread Mohammed Abdul Azeem
 sax/CppunitTest_sax_xmlimport.mk |   48 ++
 sax/Module_sax.mk|1 
 sax/qa/cppunit/xmlimport.cxx |  181 +++
 sax/qa/data/namespace.xml|6 +
 sax/qa/data/note.xml |7 +
 5 files changed, 243 insertions(+)

New commits:
commit e94deb06391f516ee9c1fa019b3521e222a5615b
Author: Mohammed Abdul Azeem 
Date:   Wed May 11 16:57:44 2016 +0530

First cut at adding sax2/ unit tests.

This is a first-step towards implementing the legacy parser using
the XFastParser.

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

diff --git a/sax/CppunitTest_sax_xmlimport.mk b/sax/CppunitTest_sax_xmlimport.mk
new file mode 100644
index 000..71e2792
--- /dev/null
+++ b/sax/CppunitTest_sax_xmlimport.mk
@@ -0,0 +1,48 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,sax_xmlimport))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sax_xmlimport, \
+sax/qa/cppunit/xmlimport \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sax_xmlimport, \
+test \
+cppu \
+comphelper \
+sal \
+cppuhelper \
+sax \
+unotest \
+utl \
+$(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sax_xmlimport,\
+offapi \
+udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_external,sax_xmlimport,boost_headers))
+
+$(eval $(call gb_CppunitTest_use_ure,sax_xmlimport))
+$(eval $(call gb_CppunitTest_use_vcl,sax_xmlimport))
+
+$(eval $(call gb_CppunitTest_use_components,sax_xmlimport,\
+configmgr/source/configmgr \
+sax/source/expatwrap/expwrap \
+ucb/source/core/ucb1 \
+ucb/source/ucp/file/ucpfile1 \
+))
+
+
+$(eval $(call gb_CppunitTest_use_configuration,sax_xmlimport))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sax/Module_sax.mk b/sax/Module_sax.mk
index ae8ab9c6..4fca4ef 100644
--- a/sax/Module_sax.mk
+++ b/sax/Module_sax.mk
@@ -18,6 +18,7 @@ $(eval $(call gb_Module_add_check_targets,sax,\
CppunitTest_sax \
CppunitTest_sax_attributes \
CppunitTest_sax_parser \
+   CppunitTest_sax_xmlimport \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx
new file mode 100644
index 000..881b0cc
--- /dev/null
+++ b/sax/qa/cppunit/xmlimport.cxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace {
+
+using namespace css;
+using namespace css::uno;
+using namespace css::io;
+
+Reference< XInputStream > createStreamFromFile (
+const OUString filePath)
+{
+Reference<  XInputStream >  xInputStream;
+OUString aInStr;
+osl::FileBase::getFileURLFromSystemPath(filePath, aInStr);
+SvStream* pStream = utl::UcbStreamHelper::CreateStream(aInStr, 
StreamMode::READ);
+if(pStream == NULL)
+CPPUNIT_ASSERT(false);
+uno::Reference xStream(new utl::OStreamWrapper(*pStream));
+xInputStream.set(xStream, uno::UNO_QUERY);
+return xInputStream;
+}
+
+class TestDocumentHandler : public cppu::WeakImplHelper< 
xml::sax::XDocumentHandler >
+{
+private:
+OUString m_aStr;
+
+public:
+TestDocumentHandler() {}
+OUString getString() { return m_aStr; }
+// XDocumentHandler
+virtual void SAL_CALL startDocument() throw (xml::sax::SAXException, 
RuntimeException, std::exception) override;
+virtual void SAL_CALL endDocument() throw (xml::sax::SAXException, 
RuntimeException, std::exception) override;
+virtual void SAL_CALL startElement( const OUString& aName, const 
Ref

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

2016-03-23 Thread Mohammed Abdul Azeem
 include/svx/numfmtsh.hxx |1 
 include/svx/tbcontrl.hxx |2 
 svx/source/items/numfmtsh.cxx|   79 
 svx/source/tbxctrls/tbcontrl.cxx |  147 +++
 4 files changed, 109 insertions(+), 120 deletions(-)

New commits:
commit f9cf53a082f1d99b313ebd09c8791541859eac40
Author: Mohammed Abdul Azeem 
Date:   Wed Mar 23 03:18:14 2016 +0530

tdf#82641 Changes to currency drop-down list

Common codes have been shared in a static function. Now the list
shows complete set of currency options.

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

diff --git a/include/svx/numfmtsh.hxx b/include/svx/numfmtsh.hxx
index 504b087..179b597 100644
--- a/include/svx/numfmtsh.hxx
+++ b/include/svx/numfmtsh.hxx
@@ -170,7 +170,6 @@ public:
 short   GetListPos4Entry( const OUString& rFmtString );
 
 voidGetCurrencySymbols(std::vector& rList, 
sal_uInt16* pPos );
-voidGetCurrencySymbols(std::vector& rList, bool 
bFlag );
 
 sal_uInt16  FindCurrencyTableEntry( const OUString& rFmtString, 
bool &bTestBanking );
 boolIsInTable(sal_uInt16 nPos, bool bTmpBanking,
diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 928f75f..0aaa94f 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -297,6 +297,8 @@ private:
 LanguageType m_eLanguage;
 sal_uInt32   m_nFormatKey;
 public:
+static void GetCurrencySymbols( std::vector& rList, bool bFlag,
+std::vector& rCurrencyList );
 SFX_DECL_TOOLBOX_CONTROL();
 SvxCurrencyToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& 
rBox );
 virtual ~SvxCurrencyToolBoxControl();
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index 12dc409..7d78eca 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -26,12 +26,8 @@
 #include 
 #include 
 
-#include 
-#include 
-#include 
-#include 
-
 #include 
+#include 
 
 #include 
 
@@ -1369,7 +1365,7 @@ void 
SvxNumberFormatShell::GetCurrencySymbols(std::vector& rList, sal_
 
 bool bFlag=(pTmpCurrencyEntry==nullptr);
 
-GetCurrencySymbols(rList, bFlag);
+SvxCurrencyToolBoxControl::GetCurrencySymbols( rList, bFlag, 
aCurCurrencyList );
 
 if(pPos!=nullptr)
 {
@@ -1402,77 +1398,6 @@ void 
SvxNumberFormatShell::GetCurrencySymbols(std::vector& rList, sal_
 
 }
 
-void SvxNumberFormatShell::GetCurrencySymbols(std::vector& rList, 
bool bFlag)
-{
-aCurCurrencyList.clear();
-
-const NfCurrencyTable& 
rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
-sal_uInt16 nCount=rCurrencyTable.size();
-
-sal_uInt16 nStart=1;
-
-OUString aString( ApplyLreOrRleEmbedding( rCurrencyTable[0].GetSymbol()));
-aString += " ";
-aString += ApplyLreOrRleEmbedding( SvtLanguageTable::GetLanguageString( 
rCurrencyTable[0].GetLanguage()));
-
-rList.push_back(aString);
-sal_uInt16 nAuto=(sal_uInt16)-1;
-aCurCurrencyList.push_back(nAuto);
-
-if(bFlag)
-{
-rList.push_back(aString);
-aCurCurrencyList.push_back(0);
-++nStart;
-}
-
-CollatorWrapper aCollator( ::comphelper::getProcessComponentContext());
-aCollator.loadDefaultCollator( 
Application::GetSettings().GetLanguageTag().getLocale(), 0);
-
-const OUString aTwoSpace("  ");
-
-for(sal_uInt16 i = 1; i < nCount; ++i)
-{
-OUString aStr( ApplyLreOrRleEmbedding( 
rCurrencyTable[i].GetBankSymbol()));
-aStr += aTwoSpace;
-aStr += ApplyLreOrRleEmbedding( rCurrencyTable[i].GetSymbol());
-aStr += aTwoSpace;
-aStr += ApplyLreOrRleEmbedding( SvtLanguageTable::GetLanguageString( 
rCurrencyTable[i].GetLanguage()));
-
-sal_uInt16 j = nStart;
-for(; j < rList.size(); ++j)
-if (aCollator.compareString(aStr, rList[j]) < 0)
-break;  // insert before first greater than
-
-rList.insert(rList.begin() + j, aStr);
-aCurCurrencyList.insert(aCurCurrencyList.begin() + j, i);
-}
-
-// Append ISO codes to symbol list.
-// XXX If this is to be changed, various other places would had to be
-// adapted that assume this order!
-sal_uInt16 nCont = rList.size();
-
-for(sal_uInt16 i = 1; i < nCount; ++i)
-{
-bool bInsert = true;
-OUString 
aStr(ApplyLreOrRleEmbedding(rCurrencyTable[i].GetBankSymbol()));
-
-sal_uInt16 j = nCont;
-for(; j < rList.size() && bInsert; ++j)
-{
-if(rList[j] == aStr)
-bInsert = false;
-else if (aCollator.compareString(aStr, rList[j]) < 0)
-break;  // insert before first great

Re: Interested in working on GSoC projects

2016-03-20 Thread Mohammed Abdul Azeem
Thanks Jan I. :)

The Document Liberation Foundation projects have impressed me recently. So,
I'd rather like to work on the project 'Implement legacy StarOffice binary
formats import filter'. I have written a mail to the mentioned mentors
indicating my interest. :)
Apologies for the change of plans and it was unintentional.

Regards,
Azeem


Regards,
Azeem

On Thu, Mar 10, 2016 at 5:19 PM, jan iversen 
wrote:

> Welcome
>
> As you surely have seen we require you have solved a difficult easyHacks
> in order to be aproved, you can find our step by step guide here:
> https://wiki.documentfoundation.org/Development/GetInvolved
>
> rgds
> jan i.
>
>
> > On 10 Mar 2016, at 12:38, Mohammed Abdul Azeem 
> wrote:
> >
> > Hi, I'm Mohammed Abdul Azeem, studying pre-final year B.Tech
> (Information Technology) at NITK, India.
> >
> > I would love to work on one of the following projects:
> > 1. Chart Sheets in Calc
> > 2. Improve VML import (Writer)
> >
> > Thank you. :)
> >
> >
> > Regards,
> > Azeem
> > ___
> > LibreOffice mailing list
> > LibreOffice@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/libreoffice
>
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2016-03-19 Thread Mohammed Abdul Azeem
 include/svx/tbcontrl.hxx |   18 +++
 sc/sdi/scalc.sdi |3 
 sc/source/ui/app/scdll.cxx   |3 
 sc/source/ui/view/formatsh.cxx   |   67 ++---
 svx/source/tbxctrls/tbcontrl.cxx |  198 +++
 5 files changed, 274 insertions(+), 15 deletions(-)

New commits:
commit bf17a8dfbb9f966c90b5d6eb0a7b8e7838392d27
Author: Mohammed Abdul Azeem 
Date:   Mon Mar 7 01:35:57 2016 +0530

tdf#82641 Currency drop-down list

Currency drop-down list has been added. It retains
the position of selected entry. Clicking on button
toggles between the previously selected currency
and number formats.

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

diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 179e8e7..928f75f 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -290,6 +290,24 @@ public:
   const SfxPoolItem* pState) override;
 };
 
+class SVX_DLLPUBLIC SvxCurrencyToolBoxControl : public SfxToolBoxControl
+{
+private:
+OUString m_aFormatString;
+LanguageType m_eLanguage;
+sal_uInt32   m_nFormatKey;
+public:
+SFX_DECL_TOOLBOX_CONTROL();
+SvxCurrencyToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& 
rBox );
+virtual ~SvxCurrencyToolBoxControl();
+virtual void Select( sal_uInt16 nSelectModifier ) override;
+virtual VclPtr CreatePopupWindow() override;
+virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
+  const SfxPoolItem* pState) override;
+};
+
+
+
 #endif // INCLUDED_SVX_TBCONTRL_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 99a5313..14169f0 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -3735,7 +3735,7 @@ SfxStringItem NumberFormat SID_NUMBER_FORMAT
 
 
 SfxVoidItem NumberFormatCurrency SID_NUMBER_CURRENCY
-()
+(SfxUInt32Item NumberFormatCurrency SID_NUMBER_CURRENCY)
 [
 AutoUpdate = FALSE,
 FastCall = FALSE,
@@ -3744,6 +3744,7 @@ SfxVoidItem NumberFormatCurrency SID_NUMBER_CURRENCY
 Container = FALSE,
 RecordAbsolute = FALSE,
 RecordPerSet;
+SlotType = SfxUInt32Item
 
 AccelConfig = TRUE,
 MenuConfig = TRUE,
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index e83cc18..d35328a9 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -146,7 +146,8 @@ void ScDLL::Init()
 ScPageBreakShell::RegisterInterface(pMod);
 
 // Own Controller
-ScZoomSliderControl ::RegisterControl(SID_PREVIEW_SCALINGFACTOR, pMod);
+ScZoomSliderControl 
::RegisterControl(SID_PREVIEW_SCALINGFACTOR, pMod);
+SvxCurrencyToolBoxControl   ::RegisterControl(SID_NUMBER_CURRENCY, 
pMod);
 
 // SvxToolboxController
 SvxTbxCtlDraw   ::RegisterControl(SID_INSERT_DRAW, 
 pMod);
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 240cc74..0850aad 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -988,11 +988,11 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
 
 void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
 {
-ScModule*   pScMod  = SC_MOD();
-ScTabViewShell* pTabViewShell   = GetViewData()->GetViewShell();
-const SfxItemSet*   pReqArgs= rReq.GetArgs();
-sal_uInt16  nSlot   = rReq.GetSlot();
-SfxBindings& rBindings  = 
pTabViewShell->GetViewFrame()->GetBindings();
+ScModule*   pScMod  = SC_MOD();
+ScTabViewShell* pTabViewShell   = GetViewData()->GetViewShell();
+const SfxItemSet*   pReqArgs= rReq.GetArgs();
+sal_uInt16  nSlot   = rReq.GetSlot();
+SfxBindings&rBindings   = 
pTabViewShell->GetViewFrame()->GetBindings();
 
 pTabViewShell->HideListBox();   // 
Autofilter-DropDown-Listbox
 
@@ -1062,11 +1062,43 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
 rReq.Done();
 break;
 case SID_NUMBER_CURRENCY:
-if ((nType & css::util::NumberFormat::CURRENCY))
-pTabViewShell->SetNumberFormat( 
css::util::NumberFormat::NUMBER );
+if(pReqArgs)
+{
+const SfxPoolItem* pItem;
+if ( pReqArgs->HasItem( SID_NUMBER_CURRENCY, &pItem ) )
+{
+sal_uInt32 nNewFormat = static_cast(pItem)->GetValue();
+ScDocument* pDoc = pViewData->GetDocument();
+SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+const SfxItemSet& rOldSet = 
pTabViewShell-&

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

2016-03-10 Thread Mohammed Abdul Azeem
 sc/source/core/data/table6.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 69ac605191860aceee09f1147a5234222d1b3300
Author: Mohammed Abdul Azeem 
Date:   Mon Feb 29 16:48:03 2016 +0530

tdf#57523 - Regex search "^$" finds all empty cells in given range.

Just added a condition to trigger ScTable::SearchAndReplaceEmptyCells
which already finds and replaces all empty cells.

Corrected range detection to find empty cells in data area only.
Odd behavior when selection was left or above actual data area
has been fixed.

Change-Id: I4b0cedd9d28ebdcaf580ca1bc8da780cf6342c54
Reviewed-on: https://gerrit.libreoffice.org/22766
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index d094a7e..1cef849 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -728,7 +728,7 @@ bool ScTable::SearchAndReplace(
 css::util::SearchOptions2 aSearchOptions = 
rSearchItem.GetSearchOptions();
 aSearchOptions.Locale = *ScGlobal::GetLocale();
 
-if (aSearchOptions.searchString.isEmpty())
+if (aSearchOptions.searchString.isEmpty() || ( 
rSearchItem.GetRegExp() && aSearchOptions.searchString.equals("^$") ) )
 {
 // Search for empty cells.
 return SearchAndReplaceEmptyCells(rSearchItem, rCol, rRow, 
rMark, rMatchedRanges, rUndoStr, pUndoDoc);
@@ -784,15 +784,15 @@ bool ScTable::SearchAndReplaceEmptyCells(
 for ( size_t i = 0, n = aMarkedRanges.size(); i < n; ++i )
 {
 ScRange* p = aMarkedRanges[ i ];
-if (p->aStart.Col() > nColEnd || p->aStart.Row() > nRowEnd)
+if (p->aStart.Col() > nColEnd || p->aStart.Row() > nRowEnd || 
p->aEnd.Col() < nColStart || p->aEnd.Row() < nRowStart)
 // This range is outside the data area.  Skip it.
 continue;
 
 // Shrink the range into data area only.
 if (p->aStart.Col() < nColStart)
-p->aStart.SetCol(rCol);
+p->aStart.SetCol(nColStart);
 if (p->aStart.Row() < nRowStart)
-p->aStart.SetRow(rRow);
+p->aStart.SetRow(nRowStart);
 
 if (p->aEnd.Col() > nColEnd)
 p->aEnd.SetCol(nColEnd);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Interested in working on GSoC projects

2016-03-10 Thread Mohammed Abdul Azeem
Hi, I'm Mohammed Abdul Azeem, studying pre-final year B.Tech (Information
Technology) at NITK, India.

I would love to work on one of the following projects:
1. Chart Sheets in Calc
2. Improve VML import (Writer)

Thank you. :)


Regards,
Azeem
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2016-02-26 Thread Mohammed Abdul Azeem
 sc/source/filter/inc/addressconverter.hxx |   18 +++
 sc/source/filter/inc/defnamesbuffer.hxx   |1 
 sc/source/filter/inc/externallinkfragment.hxx |2 
 sc/source/filter/inc/formulabuffer.hxx|   18 ---
 sc/source/filter/inc/scenariobuffer.hxx   |2 
 sc/source/filter/inc/sheetdatabuffer.hxx  |   10 ++--
 sc/source/filter/inc/viewsettings.hxx |6 +-
 sc/source/filter/inc/worksheethelper.hxx  |2 
 sc/source/filter/oox/addressconverter.cxx |   42 
 sc/source/filter/oox/defnamesbuffer.cxx   |   65 --
 sc/source/filter/oox/drawingbase.cxx  |   10 ++--
 sc/source/filter/oox/externallinkbuffer.cxx   |4 -
 sc/source/filter/oox/externallinkfragment.cxx |   14 ++---
 sc/source/filter/oox/formulabase.cxx  |9 +--
 sc/source/filter/oox/formulabuffer.cxx|   41 
 sc/source/filter/oox/formulaparser.cxx|   24 -
 sc/source/filter/oox/pivotcachebuffer.cxx |6 +-
 sc/source/filter/oox/scenariobuffer.cxx   |4 -
 sc/source/filter/oox/sheetdatabuffer.cxx  |   46 ++
 sc/source/filter/oox/sheetdatacontext.cxx |   19 +++
 sc/source/filter/oox/viewsettings.cxx |   28 +--
 sc/source/filter/oox/worksheethelper.cxx  |   36 +++---
 22 files changed, 258 insertions(+), 149 deletions(-)

New commits:
commit 4b63e7ee7e286b116d60dda676349024808182ed
Author: Mohammed Abdul Azeem 
Date:   Sun Feb 21 04:37:20 2016 +0530

tdf#97654 - replaced CellAddress types with ScAddress.

Differences in default constructors is compensated and other changes have
been made as suggested.

Change-Id: I15bdf5043816502ace797c352242a4a59f1cd64e
Reviewed-on: https://gerrit.libreoffice.org/22579
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/filter/inc/addressconverter.hxx 
b/sc/source/filter/inc/addressconverter.hxx
index a85ee97..662d044 100644
--- a/sc/source/filter/inc/addressconverter.hxx
+++ b/sc/source/filter/inc/addressconverter.hxx
@@ -237,17 +237,17 @@ public:
 sal_Int32 nLength = SAL_MAX_INT32 );
 
 /** Returns the biggest valid cell address in the own Calc document. */
-inline const css::table::CellAddress&
+inline const ScAddress&
 getMaxApiAddress() const { return maMaxApiPos; }
 
 /** Returns the biggest valid cell address in the imported/exported
 Excel document. */
-inline const css::table::CellAddress&
+inline const ScAddress&
 getMaxXlsAddress() const { return maMaxXlsPos; }
 
 /** Returns the biggest valid cell address in both Calc and the
 imported/exported Excel document. */
-inline const css::table::CellAddress&
+inline const ScAddress&
 getMaxAddress() const { return maMaxPos; }
 
 /** Checks if the passed column index is valid.
@@ -376,8 +376,7 @@ public:
 @param bTrackOverflow  true = Update the internal overflow flags, if
 the address is outside of the supported sheet limits.
 @return  A valid API cell address struct. */
-css::table::CellAddress
-createValidCellAddress(
+ScAddress   createValidCellAddress(
 const OUString& rString,
 sal_Int16 nSheet,
 bool bTrackOverflow );
@@ -443,8 +442,7 @@ public:
 @param bTrackOverflow  true = Update the internal overflow flags, if
 the address is outside of the supported sheet limits.
 @return  A valid API cell address struct. */
-css::table::CellAddress
-createValidCellAddress(
+ScAddress   createValidCellAddress(
 const BinAddress& rBinAddress,
 sal_Int16 nSheet,
 bool bTrackOverflow );
@@ -653,9 +651,9 @@ private:
 sal_Unicode cSameSheet );
 };
 
-css::table::CellAddress maMaxApiPos; /// Maximum valid cell address in 
Calc.
-css::table::CellAddress maMaxXlsPos; /// Maximum valid cell address in 
Excel.
-css::table::CellAddress maMaxPos;/// Maximum valid cell address in 
Calc/Excel.
+ScAddress maMaxApiPos; /// Maximum valid cell address in Calc.
+ScAddress maMaxXlsPos; /// Maximum valid cell address in Excel.
+ScAddress maMaxPos;/// Maximum valid cell address in Calc/Excel.
 ControlCharacters   maLinkChars; /// Control characters for 
external link import (BIFF).
 ControlCharacters   maDConChars; /// Control characters for DCON* 
record import (BIFF).
 boolmbColOverflow;   /// Flag for "columns overflow".
diff --git a/sc/source/filter/inc/defnamesbuffer.hxx 
b/sc/

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

2016-02-17 Thread Mohammed Abdul Azeem
 sc/source/filter/inc/addressconverter.hxx|   77 ++-
 sc/source/filter/inc/formulabase.hxx |4 +
 sc/source/filter/inc/formulabuffer.hxx   |   15 +
 sc/source/filter/inc/formulaparser.hxx   |9 +++
 sc/source/filter/inc/sheetdatabuffer.hxx |   14 
 sc/source/filter/inc/worksheethelper.hxx |   22 +++
 sc/source/filter/oox/addressconverter.cxx|   74 -
 sc/source/filter/oox/condformatbuffer.cxx|   10 +--
 sc/source/filter/oox/excelchartconverter.cxx |2 
 sc/source/filter/oox/formulabase.cxx |5 +
 sc/source/filter/oox/formulabuffer.cxx   |   45 +++
 sc/source/filter/oox/formulaparser.cxx   |   54 ++
 sc/source/filter/oox/pivotcachebuffer.cxx|4 -
 sc/source/filter/oox/sheetdatabuffer.cxx |   61 +++--
 sc/source/filter/oox/sheetdatacontext.cxx|   19 +++---
 sc/source/filter/oox/worksheetfragment.cxx   |2 
 sc/source/filter/oox/worksheethelper.cxx |   70 
 17 files changed, 455 insertions(+), 32 deletions(-)

New commits:
commit 2c02986b76f26d6f09d5b1f9d209879bfa427ea1
Author: Mohammed Abdul Azeem 
Date:   Tue Feb 9 03:54:15 2016 +0530

tdf#97654 - replaced UNO cell types in xlsx import with calc internal ones

All reference to CellAddress in ApiCellRangeList::getBaseAddress() is 
changed to ScAddress and its chain of changes has been made.

Change-Id: I43d9eb8dc02c74640d9fac11a44429850f31ade1
Reviewed-on: https://gerrit.libreoffice.org/2
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/filter/inc/addressconverter.hxx 
b/sc/source/filter/inc/addressconverter.hxx
index b84f153..a85ee97 100644
--- a/sc/source/filter/inc/addressconverter.hxx
+++ b/sc/source/filter/inc/addressconverter.hxx
@@ -72,8 +72,7 @@ public:
 { mvAddresses.push_back( rAddress ); }
 
 /** Returns the base address of this range list (top-left cell of first 
range). */
-css::table::CellAddress
-getBaseAddress() const;
+ScAddress getBaseAddress() const;
 
 /** Converts to a sequence. */
 css::uno::Sequence< css::table::CellRangeAddress >
@@ -92,6 +91,7 @@ struct BinAddress
 inline explicit BinAddress() : mnCol( 0 ), mnRow( 0 ) {}
 inline explicit BinAddress( sal_Int32 nCol, sal_Int32 nRow ) : mnCol( 
nCol ), mnRow( nRow ) {}
 inline explicit BinAddress( const css::table::CellAddress& rAddr ) : 
mnCol( rAddr.Column ), mnRow( rAddr.Row ) {}
+inline explicit BinAddress( const ScAddress& rAddr ) : mnCol( 
rAddr.Col() ), mnRow( rAddr.Row() ) {}
 
 voidread( SequenceInputStream& rStrm );
 voidread( BiffInputStream& rStrm, bool bCol16Bit = true, 
bool bRow32Bit = false );
@@ -288,6 +288,17 @@ public:
 const css::table::CellAddress& rAddress,
 bool bTrackOverflow );
 
+/** Checks the passed cell address if it fits into the spreadsheet limits.
+
+@param rAddress  The cell address to be checked.
+@param bTrackOverflow  true = Update the internal overflow flags, if
+the address is outside of the supported sheet limits.
+@return  true = Passed address is valid (no index overflow).
+ */
+boolcheckCellAddress(
+const ScAddress& rAddress,
+bool bTrackOverflow );
+
 /** Converts the passed string to a single cell address, without checking
 any sheet limits.
 
@@ -301,9 +312,25 @@ public:
 const OUString& rString,
 sal_Int16 nSheet );
 
+/** Converts the passed string to a single cell address, without checking
+any sheet limits.
+
+@param orAddress  (out-parameter) Returns the converted cell address.
+@param rString  Cell address string in A1 notation.
+@param nSheet  Sheet index to be inserted into orAddress.
+@return  true = Cell address could be parsed from the passed string.
+ */
+static boolconvertToCellAddressUnchecked(
+ScAddress& orAddress,
+const OUString& rString,
+sal_Int16 nSheet );
+
 static bool convertToCellAddressUnchecked(
 css::table::CellAddress& orAddress, const char* pStr, sal_Int16 nSheet 
);
 
+static bool convertToCellAddressUnchecked(
+ScAddress& orAddress, const char* pStr, sal_Int16 nSheet );
+
 /** Tries to convert the passed string to a single cell address.
 
 @param orAddress  (out-parameter) Returns the converted cell address.
@@ -319,10 +346,29 @@ public:
 sal_Int16 nSheet,
 bool bTrackOverflow );
 
+/** Tries to