[Libreoffice-commits] core.git: 2 commits - connectivity/source dbaccess/source sw/qa

YogeshBharate yogesh.bharate at synerzip.com
Wed Nov 13 07:02:06 PST 2013


 connectivity/source/drivers/firebird/Connection.cxx                  |   54 ++--------
 connectivity/source/drivers/firebird/Connection.hxx                  |   18 ++-
 dbaccess/source/core/dataaccess/datasource.cxx                       |    7 +
 sw/qa/extras/ooxmlexport/data/multi-column-line-separator-SAVED.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                             |    7 +
 5 files changed, 38 insertions(+), 48 deletions(-)

New commits:
commit 0fe680b266f272fb82edc357fd036be85d4124cd
Author: YogeshBharate <yogesh.bharate at synerzip.com>
Date:   Fri Oct 18 17:45:36 2013 +0530

    Added unit test for multicolumn section separator line
    
    Unit test case to verify the multicolumn separator value.
    
    Conflicts:
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    
    Change-Id: Ifd5b060a4981dda20df2f2ee5cbb2879f9ba0cdb
    Reviewed-on: https://gerrit.libreoffice.org/6318
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/extras/ooxmlexport/data/multi-column-line-separator-SAVED.docx b/sw/qa/extras/ooxmlexport/data/multi-column-line-separator-SAVED.docx
new file mode 100644
index 0000000..9645883
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/multi-column-line-separator-SAVED.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 5c44dc8..69c3b58 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1532,6 +1532,13 @@ DECLARE_OOXML_TEST(testCharHighlight, "char_highlight.docx")
     }
 }
 
+DECLARE_OOXML_TEST(testMultiColumnLineSeparator, "multi-column-line-separator-SAVED.docx")
+{
+    // Check for the Column Separator value.It should be FALSE as the document doesnt contains separator line.
+    xmlDocPtr pXmlDoc = parseExport();
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:pPr/w:sectPr/w:cols","sep","false");
+}
+
 DECLARE_OOXML_TEST(testCustomXmlGrabBag, "customxml.docx")
 {
    // The problem was that item[n].xml and itemProps[n].xml and .rels files for item[n].xml
commit a3eece5a885395888e3b8e779e1fa46f9538d7af
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Sun Nov 10 08:34:27 2013 +0000

    Pass Document directly to Driver for embedded databases.
    
    Change-Id: I346a8ef07c5d695b3aa879f5c25cc4af97e25b99
    Reviewed-on: https://gerrit.libreoffice.org/6627
    Reviewed-by: Lionel Elie Mamane <lionel at mamane.lu>
    Tested-by: Lionel Elie Mamane <lionel at mamane.lu>

diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index 728e54f..d00478a 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -124,6 +124,7 @@ void Connection::construct(const ::rtl::OUString& url, const Sequence< PropertyV
     if (url.equals("sdbc:embedded:firebird"))
     {
         m_bIsEmbedded = true;
+
         const PropertyValue* pIter = info.getConstArray();
         const PropertyValue* pEnd = pIter + info.getLength();
 
@@ -137,6 +138,10 @@ void Connection::construct(const ::rtl::OUString& url, const Sequence< PropertyV
             {
                 pIter->Value >>= aStorageURL;
             }
+            else if ( pIter->Name == "Document" )
+            {
+                pIter->Value >>= m_xParentDocument;
+            }
         }
 
         if ( !m_xEmbeddedStorage.is() )
@@ -284,52 +289,19 @@ void Connection::construct(const ::rtl::OUString& url, const Sequence< PropertyV
         // it in the .odb.
         rebuildIndexes();
 
-        attachAsDocumentListener(aStorageURL);
+        // We need to attach as a document listener in order to be able to store
+        // the temporary db back into the .odb when saving
+        uno::Reference<XDocumentEventBroadcaster> xBroadcaster(m_xParentDocument, UNO_QUERY);
+
+        if (xBroadcaster.is())
+            xBroadcaster->addDocumentEventListener(this);
+        else
+            assert(false);
     }
 
     osl_atomic_decrement( &m_refCount );
 }
 
-void Connection::attachAsDocumentListener(const OUString& rStorageURL)
-{
-    // We can't directly access the Document that is using this connection
-    // (since a Connection can in fact be used independently of a DB document)
-    // hence we need to iterate through all Frames to find our Document.
-    uno::Reference< frame::XDesktop2 > xFramesSupplier =
-        frame::Desktop::create(::comphelper::getProcessComponentContext());
-    uno::Reference< frame::XFrames > xFrames(xFramesSupplier->getFrames(),
-                                             uno::UNO_QUERY);
-    if (!xFrames.is())
-        return;
-
-    uno::Sequence< uno::Reference<frame::XFrame> > xFrameList =
-        xFrames->queryFrames( frame::FrameSearchFlag::ALL );
-
-    for (sal_Int32 i = 0; i < xFrameList.getLength(); i++)
-    {
-        uno::Reference< frame::XFrame > xf = xFrameList[i];
-        uno::Reference< XController > xc;
-        if (xf.is())
-            xc = xf->getController();
-
-        uno::Reference< XModel > xm;
-        if (xc.is())
-            xm = xc->getModel();
-
-        if (xm.is() && xm->getURL() == rStorageURL)
-        {
-            uno::Reference<XDocumentEventBroadcaster> xBroadcaster( xm, UNO_QUERY);
-            if (xBroadcaster.is())
-            {
-                xBroadcaster->addDocumentEventListener(this);
-                return;
-            }
-            //TODO: remove in the disposing?
-        }
-    }
-    assert(false); // If we have an embedded DB we must have a document
-}
-
 //----- XServiceInfo ---------------------------------------------------------
 IMPLEMENT_SERVICE_INFO(Connection, "com.sun.star.sdbc.drivers.firebird.Connection",
                                                     "com.sun.star.sdbc.Connection")
diff --git a/connectivity/source/drivers/firebird/Connection.hxx b/connectivity/source/drivers/firebird/Connection.hxx
index 6c8dba4..40ebee7 100644
--- a/connectivity/source/drivers/firebird/Connection.hxx
+++ b/connectivity/source/drivers/firebird/Connection.hxx
@@ -45,6 +45,7 @@
 #include <com/sun/star/sdbc/XConnection.hpp>
 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
 
 namespace connectivity
 {
@@ -96,6 +97,17 @@ namespace connectivity
             /* EMBEDDED MODE DATA */
             /** Denotes that we have a .fdb stored within a .odb file. */
             sal_Bool            m_bIsEmbedded;
+
+            /**
+             * Handle for the parent DatabaseDocument. We need to notify this
+             * whenever any data is written to our temporary database so that
+             * the user is able to save this back to the .odb file.
+             *
+             * Note that this is ONLY set in embedded mode.
+             */
+            ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable >
+                m_xParentDocument;
+
             /**
              * Handle for the folder within the .odb where we store our .fdb
              * (Only used if m_bIsEmbedded is true).
@@ -131,12 +143,6 @@ namespace connectivity
             OWeakRefArray       m_aStatements;
 
             /**
-             * If we are embedded in a .odb we need to listen to Document events
-             * in order to save the .fdb back into the .odb.
-             */
-            void attachAsDocumentListener(const ::rtl::OUString& rStorageURL);
-
-            /**
              * Firebird stores binary collations for indexes on Character based
              * columns, these can be binary-incompatible between different icu
              * version, hence we need to rebuild the indexes when switching icu
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 94cd6da..83bb45e 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -703,12 +703,17 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
             if ( m_pImpl->isEmbeddedDatabase() )
             {
                 sal_Int32 nCount = aDriverInfo.getLength();
-                aDriverInfo.realloc(nCount + 2 );
+                aDriverInfo.realloc(nCount + 3 );
+
                 aDriverInfo[nCount].Name = "URL";
                 aDriverInfo[nCount++].Value <<= m_pImpl->getURL();
+
                 aDriverInfo[nCount].Name = "Storage";
                 Reference< css::document::XDocumentSubStorageSupplier> xDocSup( m_pImpl->getDocumentSubStorageSupplier() );
                 aDriverInfo[nCount++].Value <<= xDocSup->getDocumentSubStorage("database",ElementModes::READWRITE);
+
+                aDriverInfo[nCount].Name = "Document";
+                aDriverInfo[nCount++].Value <<= getDatabaseDocument();
             }
             if (nAdditionalArgs)
                 xReturn = xManager->getConnectionWithInfo(m_pImpl->m_sConnectURL, ::comphelper::concatSequences(aUserPwd,aDriverInfo));


More information about the Libreoffice-commits mailing list