[Libreoffice-commits] core.git: 2 commits - sw/Library_sw.mk sw/source

Michael Stahl mstahl at redhat.com
Thu Nov 6 07:31:14 PST 2014


 sw/Library_sw.mk                             |    1 
 sw/source/core/inc/SwXMLBlockListContext.hxx |  129 -----------
 sw/source/core/swg/SwXMLBlockImport.cxx      |  314 ++++++++++++++++++++++++++-
 sw/source/core/swg/SwXMLBlockListContext.cxx |  240 --------------------
 4 files changed, 312 insertions(+), 372 deletions(-)

New commits:
commit 3c8330ce1485659299d851adc3cb0e00841c3bb1
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Nov 6 13:04:18 2014 +0100

    sw: clean up namespace prefixes in SwXMLBlockImport.cxx
    
    Change-Id: I64716c9d087d1e9d3e76d14d555768af486e8982

diff --git a/sw/source/core/swg/SwXMLBlockImport.cxx b/sw/source/core/swg/SwXMLBlockImport.cxx
index dbd7b69..5d5355b 100644
--- a/sw/source/core/swg/SwXMLBlockImport.cxx
+++ b/sw/source/core/swg/SwXMLBlockImport.cxx
@@ -25,7 +25,6 @@
 #include <unotools/charclass.hxx>
 #include <swtypes.hxx>
 
-using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star;
 using namespace ::xmloff::token;
 
@@ -42,13 +41,11 @@ public:
     SwXMLBlockListContext( SwXMLBlockListImport& rImport,
                            sal_uInt16 nPrefix,
                            const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+                           const uno::Reference<xml::sax::XAttributeList> & xAttrList);
     virtual ~SwXMLBlockListContext ( void );
     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
                            const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
+                           const uno::Reference<xml::sax::XAttributeList> & xAttrList) SAL_OVERRIDE;
 
 };
 
@@ -58,8 +55,7 @@ public:
     SwXMLBlockContext(     SwXMLBlockListImport& rImport,
                            sal_uInt16 nPrefix,
                            const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+                           const uno::Reference<xml::sax::XAttributeList> & xAttrList);
     virtual ~SwXMLBlockContext ( void );
 };
 
@@ -72,12 +68,10 @@ public:
     SwXMLTextBlockDocumentContext(     SwXMLTextBlockImport& rImport,
                            sal_uInt16 nPrefix,
                            const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+                           const uno::Reference<xml::sax::XAttributeList> & xAttrList);
     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
                            const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
+                           const uno::Reference<xml::sax::XAttributeList> & xAttrList) SAL_OVERRIDE;
     virtual ~SwXMLTextBlockDocumentContext ( void );
 };
 
@@ -90,12 +84,10 @@ public:
     SwXMLTextBlockBodyContext(     SwXMLTextBlockImport& rImport,
                            sal_uInt16 nPrefix,
                            const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+                           const uno::Reference<xml::sax::XAttributeList > & xAttrList);
     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
                            const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
+                           const uno::Reference<xml::sax::XAttributeList> & xAttrList) SAL_OVERRIDE;
     virtual ~SwXMLTextBlockBodyContext ( void );
 };
 
@@ -108,12 +100,12 @@ public:
     SwXMLTextBlockTextContext(     SwXMLTextBlockImport& rImport,
                            sal_uInt16 nPrefix,
                            const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+                           const uno::Reference<
+                           xml::sax::XAttributeList > & xAttrList );
     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
                            const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
+                           const uno::Reference<
+                           xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
     virtual ~SwXMLTextBlockTextContext ( void );
 };
 
@@ -126,8 +118,8 @@ public:
     SwXMLTextBlockParContext(     SwXMLTextBlockImport& rImport,
                            sal_uInt16 nPrefix,
                            const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+                           const uno::Reference<
+                           xml::sax::XAttributeList > & xAttrList );
     virtual void Characters( const OUString& rChars ) SAL_OVERRIDE;
     virtual ~SwXMLTextBlockParContext ( void );
 };
commit c4df4d7cf0bf464194ce60da440f3d800ea51b33
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Nov 6 12:58:52 2014 +0100

    sw: merge SwXMLBlockListContext.cxx into SwXMLBlockImport.cxx
    
    ... so all the import is in one source file not 3 tiny ones.
    
    Change-Id: I239316ec54cab28a7af643372af33782f70e7040

diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 4bdae0b..09d9b0c 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -350,7 +350,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
     sw/source/core/sw3io/swacorr \
     sw/source/core/swg/SwXMLBlockExport \
     sw/source/core/swg/SwXMLBlockImport \
-    sw/source/core/swg/SwXMLBlockListContext \
     sw/source/core/swg/SwXMLSectionList \
     sw/source/core/swg/SwXMLTextBlocks \
     sw/source/core/swg/SwXMLTextBlocks1 \
diff --git a/sw/source/core/inc/SwXMLBlockListContext.hxx b/sw/source/core/inc/SwXMLBlockListContext.hxx
deleted file mode 100644
index b10b40c..0000000
--- a/sw/source/core/inc/SwXMLBlockListContext.hxx
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- 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 .
- */
-
-#ifndef INCLUDED_SW_SOURCE_CORE_INC_SWXMLBLOCKLISTCONTEXT_HXX
-#define INCLUDED_SW_SOURCE_CORE_INC_SWXMLBLOCKLISTCONTEXT_HXX
-
-#include <xmloff/xmlictxt.hxx>
-
-class SwXMLBlockListImport;
-class SwXMLTextBlockImport;
-
-class SwXMLBlockListContext : public SvXMLImportContext
-{
-private:
-    SwXMLBlockListImport & rLocalRef;
-
-public:
-    SwXMLBlockListContext( SwXMLBlockListImport& rImport,
-                           sal_uInt16 nPrefix,
-                           const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
-    virtual ~SwXMLBlockListContext ( void );
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                           const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
-
-};
-
-class SwXMLBlockContext : public SvXMLImportContext
-{
-public:
-    SwXMLBlockContext(     SwXMLBlockListImport& rImport,
-                           sal_uInt16 nPrefix,
-                           const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
-    virtual ~SwXMLBlockContext ( void );
-};
-
-class SwXMLTextBlockDocumentContext : public SvXMLImportContext
-{
-private:
-    SwXMLTextBlockImport & rLocalRef;
-
-public:
-    SwXMLTextBlockDocumentContext(     SwXMLTextBlockImport& rImport,
-                           sal_uInt16 nPrefix,
-                           const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                           const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
-    virtual ~SwXMLTextBlockDocumentContext ( void );
-};
-
-class SwXMLTextBlockBodyContext : public SvXMLImportContext
-{
-private:
-    SwXMLTextBlockImport & rLocalRef;
-
-public:
-    SwXMLTextBlockBodyContext(     SwXMLTextBlockImport& rImport,
-                           sal_uInt16 nPrefix,
-                           const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                           const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
-    virtual ~SwXMLTextBlockBodyContext ( void );
-};
-
-class SwXMLTextBlockTextContext : public SvXMLImportContext
-{
-private:
-    SwXMLTextBlockImport & rLocalRef;
-
-public:
-    SwXMLTextBlockTextContext(     SwXMLTextBlockImport& rImport,
-                           sal_uInt16 nPrefix,
-                           const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                           const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
-    virtual ~SwXMLTextBlockTextContext ( void );
-};
-
-class SwXMLTextBlockParContext : public SvXMLImportContext
-{
-private:
-    SwXMLTextBlockImport & rLocalRef;
-
-public:
-    SwXMLTextBlockParContext(     SwXMLTextBlockImport& rImport,
-                           sal_uInt16 nPrefix,
-                           const OUString& rLocalName,
-                           const ::com::sun::star::uno::Reference<
-                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
-    virtual void Characters( const OUString& rChars ) SAL_OVERRIDE;
-    virtual ~SwXMLTextBlockParContext ( void );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/swg/SwXMLBlockImport.cxx b/sw/source/core/swg/SwXMLBlockImport.cxx
index b3b2f6e..dbd7b69 100644
--- a/sw/source/core/swg/SwXMLBlockImport.cxx
+++ b/sw/source/core/swg/SwXMLBlockImport.cxx
@@ -20,12 +20,330 @@
 #include <SwXMLBlockImport.hxx>
 #include <xmloff/nmspmap.hxx>
 #include <xmloff/xmlnmspe.hxx>
-#include <SwXMLBlockListContext.hxx>
 #include <SwXMLTextBlocks.hxx>
+#include <xmloff/xmlictxt.hxx>
+#include <unotools/charclass.hxx>
+#include <swtypes.hxx>
+
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star;
 using namespace ::xmloff::token;
 
+
+class SwXMLBlockListImport;
+class SwXMLTextBlockImport;
+
+class SwXMLBlockListContext : public SvXMLImportContext
+{
+private:
+    SwXMLBlockListImport & rLocalRef;
+
+public:
+    SwXMLBlockListContext( SwXMLBlockListImport& rImport,
+                           sal_uInt16 nPrefix,
+                           const OUString& rLocalName,
+                           const ::com::sun::star::uno::Reference<
+                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+    virtual ~SwXMLBlockListContext ( void );
+    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+                           const OUString& rLocalName,
+                           const ::com::sun::star::uno::Reference<
+                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
+
+};
+
+class SwXMLBlockContext : public SvXMLImportContext
+{
+public:
+    SwXMLBlockContext(     SwXMLBlockListImport& rImport,
+                           sal_uInt16 nPrefix,
+                           const OUString& rLocalName,
+                           const ::com::sun::star::uno::Reference<
+                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+    virtual ~SwXMLBlockContext ( void );
+};
+
+class SwXMLTextBlockDocumentContext : public SvXMLImportContext
+{
+private:
+    SwXMLTextBlockImport & rLocalRef;
+
+public:
+    SwXMLTextBlockDocumentContext(     SwXMLTextBlockImport& rImport,
+                           sal_uInt16 nPrefix,
+                           const OUString& rLocalName,
+                           const ::com::sun::star::uno::Reference<
+                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+                           const OUString& rLocalName,
+                           const ::com::sun::star::uno::Reference<
+                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
+    virtual ~SwXMLTextBlockDocumentContext ( void );
+};
+
+class SwXMLTextBlockBodyContext : public SvXMLImportContext
+{
+private:
+    SwXMLTextBlockImport & rLocalRef;
+
+public:
+    SwXMLTextBlockBodyContext(     SwXMLTextBlockImport& rImport,
+                           sal_uInt16 nPrefix,
+                           const OUString& rLocalName,
+                           const ::com::sun::star::uno::Reference<
+                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+                           const OUString& rLocalName,
+                           const ::com::sun::star::uno::Reference<
+                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
+    virtual ~SwXMLTextBlockBodyContext ( void );
+};
+
+class SwXMLTextBlockTextContext : public SvXMLImportContext
+{
+private:
+    SwXMLTextBlockImport & rLocalRef;
+
+public:
+    SwXMLTextBlockTextContext(     SwXMLTextBlockImport& rImport,
+                           sal_uInt16 nPrefix,
+                           const OUString& rLocalName,
+                           const ::com::sun::star::uno::Reference<
+                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+                           const OUString& rLocalName,
+                           const ::com::sun::star::uno::Reference<
+                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
+    virtual ~SwXMLTextBlockTextContext ( void );
+};
+
+class SwXMLTextBlockParContext : public SvXMLImportContext
+{
+private:
+    SwXMLTextBlockImport & rLocalRef;
+
+public:
+    SwXMLTextBlockParContext(     SwXMLTextBlockImport& rImport,
+                           sal_uInt16 nPrefix,
+                           const OUString& rLocalName,
+                           const ::com::sun::star::uno::Reference<
+                           ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+    virtual void Characters( const OUString& rChars ) SAL_OVERRIDE;
+    virtual ~SwXMLTextBlockParContext ( void );
+};
+
+
+SwXMLBlockListContext::SwXMLBlockListContext(
+   SwXMLBlockListImport& rImport,
+   sal_uInt16 nPrefix,
+   const OUString& rLocalName,
+   const uno::Reference<
+   xml::sax::XAttributeList > & xAttrList ) :
+    SvXMLImportContext ( rImport, nPrefix, rLocalName ),
+    rLocalRef (rImport)
+{
+    sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+    for (sal_Int16 i=0; i < nAttrCount; i++)
+    {
+        const OUString& rAttrName = xAttrList->getNameByIndex( i );
+        OUString aLocalName;
+        sal_uInt16 nPrefx = rImport.GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName);
+        const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+        if ( XML_NAMESPACE_BLOCKLIST == nPrefx )
+        {
+            if ( IsXMLToken ( aLocalName, XML_LIST_NAME ) )
+            {
+                rImport.getBlockList().SetName(rAttrValue);
+                break;
+            }
+        }
+    }
+}
+
+SwXMLBlockListContext::~SwXMLBlockListContext ( void )
+{
+}
+
+SvXMLImportContext *SwXMLBlockListContext::CreateChildContext(
+    sal_uInt16 nPrefix,
+    const OUString& rLocalName,
+    const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+    SvXMLImportContext *pContext = 0;
+    if (nPrefix == XML_NAMESPACE_BLOCKLIST &&
+        IsXMLToken ( rLocalName, XML_BLOCK ) )
+        pContext = new SwXMLBlockContext (rLocalRef, nPrefix, rLocalName, xAttrList);
+    else
+        pContext = new SvXMLImportContext( rLocalRef, nPrefix, rLocalName);
+    return pContext;
+}
+
+SwXMLBlockContext::SwXMLBlockContext(
+   SwXMLBlockListImport& rImport,
+   sal_uInt16 nPrefix,
+   const OUString& rLocalName,
+   const uno::Reference<
+   xml::sax::XAttributeList > & xAttrList ) :
+    SvXMLImportContext ( rImport, nPrefix, rLocalName )
+{
+    static const CharClass & rCC = GetAppCharClass();
+    OUString aShort;
+    OUString aLong;
+    OUString aPackageName;
+    bool bTextOnly = false;
+
+    sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+    for (sal_Int16 i=0; i < nAttrCount; i++)
+    {
+        const OUString& rAttrName = xAttrList->getNameByIndex( i );
+        OUString aLocalName;
+        sal_uInt16 nPrefx = rImport.GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName);
+        const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+        if (XML_NAMESPACE_BLOCKLIST == nPrefx)
+        {
+            if ( IsXMLToken ( aLocalName, XML_ABBREVIATED_NAME ) )
+            {
+                aShort = rCC.uppercase(rAttrValue);
+            }
+            else if ( IsXMLToken ( aLocalName, XML_NAME ) )
+            {
+                aLong = rAttrValue;
+            }
+            else if ( IsXMLToken ( aLocalName, XML_PACKAGE_NAME ) )
+            {
+                aPackageName = rAttrValue;
+            }
+            else if ( IsXMLToken ( aLocalName, XML_UNFORMATTED_TEXT ) )
+            {
+                if ( IsXMLToken ( rAttrValue, XML_TRUE ) )
+                    bTextOnly = true;
+            }
+        }
+    }
+    if (aShort.isEmpty() || aLong.isEmpty() || aPackageName.isEmpty())
+        return;
+    rImport.getBlockList().AddName( aShort, aLong, aPackageName, bTextOnly);
+}
+
+SwXMLBlockContext::~SwXMLBlockContext ( void )
+{
+}
+
+SwXMLTextBlockDocumentContext::SwXMLTextBlockDocumentContext(
+   SwXMLTextBlockImport& rImport,
+   sal_uInt16 nPrefix,
+   const OUString& rLocalName,
+   const uno::Reference<
+   xml::sax::XAttributeList > & ) :
+    SvXMLImportContext ( rImport, nPrefix, rLocalName ),
+    rLocalRef(rImport)
+{
+}
+
+SvXMLImportContext *SwXMLTextBlockDocumentContext::CreateChildContext(
+    sal_uInt16 nPrefix,
+    const OUString& rLocalName,
+    const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+    SvXMLImportContext *pContext = 0;
+    if (nPrefix == XML_NAMESPACE_OFFICE &&
+        IsXMLToken ( rLocalName, XML_BODY ) )
+        pContext = new SwXMLTextBlockBodyContext (rLocalRef, nPrefix, rLocalName, xAttrList);
+    else
+        pContext = new SvXMLImportContext( rLocalRef, nPrefix, rLocalName);
+    return pContext;
+}
+SwXMLTextBlockDocumentContext::~SwXMLTextBlockDocumentContext ( void )
+{
+}
+
+SwXMLTextBlockTextContext::SwXMLTextBlockTextContext(
+   SwXMLTextBlockImport& rImport,
+   sal_uInt16 nPrefix,
+   const OUString& rLocalName,
+   const uno::Reference<
+   xml::sax::XAttributeList > & ) :
+    SvXMLImportContext ( rImport, nPrefix, rLocalName ),
+    rLocalRef(rImport)
+{
+}
+
+SvXMLImportContext *SwXMLTextBlockTextContext::CreateChildContext(
+    sal_uInt16 nPrefix,
+    const OUString& rLocalName,
+    const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+    SvXMLImportContext *pContext = 0;
+    if (nPrefix == XML_NAMESPACE_TEXT &&
+        IsXMLToken ( rLocalName, XML_P ) )
+        pContext = new SwXMLTextBlockParContext (rLocalRef, nPrefix, rLocalName, xAttrList);
+    else
+        pContext = new SvXMLImportContext( rLocalRef, nPrefix, rLocalName);
+    return pContext;
+}
+
+SwXMLTextBlockTextContext::~SwXMLTextBlockTextContext ( void )
+{
+}
+
+SwXMLTextBlockBodyContext::SwXMLTextBlockBodyContext(
+   SwXMLTextBlockImport& rImport,
+   sal_uInt16 nPrefix,
+   const OUString& rLocalName,
+   const uno::Reference<
+   xml::sax::XAttributeList > & ) :
+    SvXMLImportContext ( rImport, nPrefix, rLocalName ),
+    rLocalRef(rImport)
+{
+}
+
+SvXMLImportContext *SwXMLTextBlockBodyContext::CreateChildContext(
+    sal_uInt16 nPrefix,
+    const OUString& rLocalName,
+    const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+    SvXMLImportContext *pContext = 0;
+    if (nPrefix == XML_NAMESPACE_OFFICE &&
+        IsXMLToken ( rLocalName, XML_TEXT ) )
+        pContext = new SwXMLTextBlockTextContext (rLocalRef, nPrefix, rLocalName, xAttrList);
+    else if (nPrefix == XML_NAMESPACE_TEXT &&
+        IsXMLToken ( rLocalName, XML_P ) )
+        pContext = new SwXMLTextBlockParContext (rLocalRef, nPrefix, rLocalName, xAttrList);
+    else
+        pContext = new SvXMLImportContext( rLocalRef, nPrefix, rLocalName);
+    return pContext;
+}
+SwXMLTextBlockBodyContext::~SwXMLTextBlockBodyContext ( void )
+{
+}
+SwXMLTextBlockParContext::SwXMLTextBlockParContext(
+   SwXMLTextBlockImport& rImport,
+   sal_uInt16 nPrefix,
+   const OUString& rLocalName,
+   const uno::Reference<
+   xml::sax::XAttributeList > & ) :
+    SvXMLImportContext ( rImport, nPrefix, rLocalName ),
+    rLocalRef(rImport)
+{
+}
+
+void SwXMLTextBlockParContext::Characters( const OUString& rChars )
+{
+    rLocalRef.m_rText += rChars;
+}
+SwXMLTextBlockParContext::~SwXMLTextBlockParContext ( void )
+{
+    if (rLocalRef.bTextOnly)
+        rLocalRef.m_rText += "\015";
+    else
+    {
+        if (!rLocalRef.m_rText.endsWith( " " ))
+            rLocalRef.m_rText += " ";
+    }
+}
+
+// SwXMLBlockListImport //////////////////////////////
+
 sal_Char const sXML_np__block_list[] = "_block-list";
 sal_Char const sXML_np__office[] = "_ooffice";
 sal_Char const sXML_np__text[] = "_otext";
diff --git a/sw/source/core/swg/SwXMLBlockListContext.cxx b/sw/source/core/swg/SwXMLBlockListContext.cxx
deleted file mode 100644
index b2f273b..0000000
--- a/sw/source/core/swg/SwXMLBlockListContext.cxx
+++ /dev/null
@@ -1,240 +0,0 @@
-/* -*- 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 <SwXMLBlockListContext.hxx>
-#include <SwXMLBlockImport.hxx>
-#include <SwXMLTextBlocks.hxx>
-#include <xmloff/nmspmap.hxx>
-#include <xmloff/xmlnmspe.hxx>
-#include <unotools/charclass.hxx>
-#include <swtypes.hxx>
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star;
-using namespace ::xmloff::token;
-
-SwXMLBlockListContext::SwXMLBlockListContext(
-   SwXMLBlockListImport& rImport,
-   sal_uInt16 nPrefix,
-   const OUString& rLocalName,
-   const uno::Reference<
-   xml::sax::XAttributeList > & xAttrList ) :
-    SvXMLImportContext ( rImport, nPrefix, rLocalName ),
-    rLocalRef (rImport)
-{
-    sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-    for (sal_Int16 i=0; i < nAttrCount; i++)
-    {
-        const OUString& rAttrName = xAttrList->getNameByIndex( i );
-        OUString aLocalName;
-        sal_uInt16 nPrefx = rImport.GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName);
-        const OUString& rAttrValue = xAttrList->getValueByIndex( i );
-        if ( XML_NAMESPACE_BLOCKLIST == nPrefx )
-        {
-            if ( IsXMLToken ( aLocalName, XML_LIST_NAME ) )
-            {
-                rImport.getBlockList().SetName(rAttrValue);
-                break;
-            }
-        }
-    }
-}
-
-SwXMLBlockListContext::~SwXMLBlockListContext ( void )
-{
-}
-
-SvXMLImportContext *SwXMLBlockListContext::CreateChildContext(
-    sal_uInt16 nPrefix,
-    const OUString& rLocalName,
-    const uno::Reference< xml::sax::XAttributeList > & xAttrList )
-{
-    SvXMLImportContext *pContext = 0;
-    if (nPrefix == XML_NAMESPACE_BLOCKLIST &&
-        IsXMLToken ( rLocalName, XML_BLOCK ) )
-        pContext = new SwXMLBlockContext (rLocalRef, nPrefix, rLocalName, xAttrList);
-    else
-        pContext = new SvXMLImportContext( rLocalRef, nPrefix, rLocalName);
-    return pContext;
-}
-
-SwXMLBlockContext::SwXMLBlockContext(
-   SwXMLBlockListImport& rImport,
-   sal_uInt16 nPrefix,
-   const OUString& rLocalName,
-   const uno::Reference<
-   xml::sax::XAttributeList > & xAttrList ) :
-    SvXMLImportContext ( rImport, nPrefix, rLocalName )
-{
-    static const CharClass & rCC = GetAppCharClass();
-    OUString aShort;
-    OUString aLong;
-    OUString aPackageName;
-    bool bTextOnly = false;
-
-    sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-    for (sal_Int16 i=0; i < nAttrCount; i++)
-    {
-        const OUString& rAttrName = xAttrList->getNameByIndex( i );
-        OUString aLocalName;
-        sal_uInt16 nPrefx = rImport.GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName);
-        const OUString& rAttrValue = xAttrList->getValueByIndex( i );
-        if (XML_NAMESPACE_BLOCKLIST == nPrefx)
-        {
-            if ( IsXMLToken ( aLocalName, XML_ABBREVIATED_NAME ) )
-            {
-                aShort = rCC.uppercase(rAttrValue);
-            }
-            else if ( IsXMLToken ( aLocalName, XML_NAME ) )
-            {
-                aLong = rAttrValue;
-            }
-            else if ( IsXMLToken ( aLocalName, XML_PACKAGE_NAME ) )
-            {
-                aPackageName = rAttrValue;
-            }
-            else if ( IsXMLToken ( aLocalName, XML_UNFORMATTED_TEXT ) )
-            {
-                if ( IsXMLToken ( rAttrValue, XML_TRUE ) )
-                    bTextOnly = true;
-            }
-        }
-    }
-    if (aShort.isEmpty() || aLong.isEmpty() || aPackageName.isEmpty())
-        return;
-    rImport.getBlockList().AddName( aShort, aLong, aPackageName, bTextOnly);
-}
-
-SwXMLBlockContext::~SwXMLBlockContext ( void )
-{
-}
-
-SwXMLTextBlockDocumentContext::SwXMLTextBlockDocumentContext(
-   SwXMLTextBlockImport& rImport,
-   sal_uInt16 nPrefix,
-   const OUString& rLocalName,
-   const uno::Reference<
-   xml::sax::XAttributeList > & ) :
-    SvXMLImportContext ( rImport, nPrefix, rLocalName ),
-    rLocalRef(rImport)
-{
-}
-
-SvXMLImportContext *SwXMLTextBlockDocumentContext::CreateChildContext(
-    sal_uInt16 nPrefix,
-    const OUString& rLocalName,
-    const uno::Reference< xml::sax::XAttributeList > & xAttrList )
-{
-    SvXMLImportContext *pContext = 0;
-    if (nPrefix == XML_NAMESPACE_OFFICE &&
-        IsXMLToken ( rLocalName, XML_BODY ) )
-        pContext = new SwXMLTextBlockBodyContext (rLocalRef, nPrefix, rLocalName, xAttrList);
-    else
-        pContext = new SvXMLImportContext( rLocalRef, nPrefix, rLocalName);
-    return pContext;
-}
-SwXMLTextBlockDocumentContext::~SwXMLTextBlockDocumentContext ( void )
-{
-}
-
-SwXMLTextBlockTextContext::SwXMLTextBlockTextContext(
-   SwXMLTextBlockImport& rImport,
-   sal_uInt16 nPrefix,
-   const OUString& rLocalName,
-   const uno::Reference<
-   xml::sax::XAttributeList > & ) :
-    SvXMLImportContext ( rImport, nPrefix, rLocalName ),
-    rLocalRef(rImport)
-{
-}
-
-SvXMLImportContext *SwXMLTextBlockTextContext::CreateChildContext(
-    sal_uInt16 nPrefix,
-    const OUString& rLocalName,
-    const uno::Reference< xml::sax::XAttributeList > & xAttrList )
-{
-    SvXMLImportContext *pContext = 0;
-    if (nPrefix == XML_NAMESPACE_TEXT &&
-        IsXMLToken ( rLocalName, XML_P ) )
-        pContext = new SwXMLTextBlockParContext (rLocalRef, nPrefix, rLocalName, xAttrList);
-    else
-        pContext = new SvXMLImportContext( rLocalRef, nPrefix, rLocalName);
-    return pContext;
-}
-SwXMLTextBlockTextContext::~SwXMLTextBlockTextContext ( void )
-{
-}
-
-SwXMLTextBlockBodyContext::SwXMLTextBlockBodyContext(
-   SwXMLTextBlockImport& rImport,
-   sal_uInt16 nPrefix,
-   const OUString& rLocalName,
-   const uno::Reference<
-   xml::sax::XAttributeList > & ) :
-    SvXMLImportContext ( rImport, nPrefix, rLocalName ),
-    rLocalRef(rImport)
-{
-}
-
-SvXMLImportContext *SwXMLTextBlockBodyContext::CreateChildContext(
-    sal_uInt16 nPrefix,
-    const OUString& rLocalName,
-    const uno::Reference< xml::sax::XAttributeList > & xAttrList )
-{
-    SvXMLImportContext *pContext = 0;
-    if (nPrefix == XML_NAMESPACE_OFFICE &&
-        IsXMLToken ( rLocalName, XML_TEXT ) )
-        pContext = new SwXMLTextBlockTextContext (rLocalRef, nPrefix, rLocalName, xAttrList);
-    else if (nPrefix == XML_NAMESPACE_TEXT &&
-        IsXMLToken ( rLocalName, XML_P ) )
-        pContext = new SwXMLTextBlockParContext (rLocalRef, nPrefix, rLocalName, xAttrList);
-    else
-        pContext = new SvXMLImportContext( rLocalRef, nPrefix, rLocalName);
-    return pContext;
-}
-SwXMLTextBlockBodyContext::~SwXMLTextBlockBodyContext ( void )
-{
-}
-SwXMLTextBlockParContext::SwXMLTextBlockParContext(
-   SwXMLTextBlockImport& rImport,
-   sal_uInt16 nPrefix,
-   const OUString& rLocalName,
-   const uno::Reference<
-   xml::sax::XAttributeList > & ) :
-    SvXMLImportContext ( rImport, nPrefix, rLocalName ),
-    rLocalRef(rImport)
-{
-}
-
-void SwXMLTextBlockParContext::Characters( const OUString& rChars )
-{
-    rLocalRef.m_rText += rChars;
-}
-SwXMLTextBlockParContext::~SwXMLTextBlockParContext ( void )
-{
-    if (rLocalRef.bTextOnly)
-        rLocalRef.m_rText += "\015";
-    else
-    {
-        if (!rLocalRef.m_rText.endsWith( " " ))
-            rLocalRef.m_rText += " ";
-    }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list