summaryrefslogtreecommitdiff
path: root/dbaccess/source
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-02-15 14:34:48 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-02-15 14:34:48 +0100
commit009ab0e80350627a53b6f69a8d4f85ab26af8de4 (patch)
tree71142ea9f532457b6d156257d51ae28d67e3ea6f /dbaccess/source
parentf4ba6a75910f44a8b98de1243fbd5a9dfef5aa49 (diff)
autorecovery: when saving recovery information for a DB doc, export query designers, too
Diffstat (limited to 'dbaccess/source')
-rw-r--r--dbaccess/source/core/recovery/dbdocrecovery.cxx244
-rw-r--r--dbaccess/source/core/recovery/makefile.mk5
-rw-r--r--dbaccess/source/core/recovery/storagestream.cxx93
-rw-r--r--dbaccess/source/core/recovery/storagestream.hxx79
-rw-r--r--dbaccess/source/core/recovery/storagetextstream.cxx130
-rw-r--r--dbaccess/source/core/recovery/storagetextstream.hxx66
-rw-r--r--dbaccess/source/core/recovery/storagexmlstream.cxx155
-rw-r--r--dbaccess/source/core/recovery/storagexmlstream.hxx85
-rw-r--r--dbaccess/source/inc/stringconstants.hrc1
-rw-r--r--dbaccess/source/ui/inc/JoinController.hxx7
-rw-r--r--dbaccess/source/ui/inc/TableFieldDescription.hxx7
-rw-r--r--dbaccess/source/ui/inc/querycontroller.hxx23
-rw-r--r--dbaccess/source/ui/querydesign/JoinController.cxx61
-rw-r--r--dbaccess/source/ui/querydesign/TableFieldDescription.cxx47
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx131
-rw-r--r--dbaccess/source/ui/relationdesign/RelationController.cxx9
16 files changed, 987 insertions, 156 deletions
diff --git a/dbaccess/source/core/recovery/dbdocrecovery.cxx b/dbaccess/source/core/recovery/dbdocrecovery.cxx
index 7e102dd84eb4..296f3ba901d5 100644
--- a/dbaccess/source/core/recovery/dbdocrecovery.cxx
+++ b/dbaccess/source/core/recovery/dbdocrecovery.cxx
@@ -27,6 +27,8 @@
#include "recovery/dbdocrecovery.hxx"
#include "sdbcoretools.hxx"
+#include "storagexmlstream.hxx"
+#include "storagetextstream.hxx"
#include "subcomponentloader.hxx"
#include "dbastrings.hrc"
@@ -45,6 +47,7 @@
#include <com/sun/star/sdb/XReportDocumentsSupplier.hpp>
#include <com/sun/star/ucb/XCommandProcessor.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
/** === end UNO includes === **/
#include <comphelper/componentcontext.hxx>
@@ -52,6 +55,8 @@
#include <connectivity/dbtools.hxx>
#include <rtl/strbuf.hxx>
#include <tools/diagnose_ex.h>
+#include <xmloff/XMLSettingsExportContext.hxx>
+#include <xmloff/SettingsExportHelper.hxx>
#include <hash_map>
#include <algorithm>
@@ -82,7 +87,6 @@ namespace dbaccess
using ::com::sun::star::beans::PropertyValue;
using ::com::sun::star::beans::Pair;
using ::com::sun::star::io::XStream;
- using ::com::sun::star::io::XOutputStream;
using ::com::sun::star::io::XTextOutputStream;
using ::com::sun::star::io::XActiveDataSource;
using ::com::sun::star::io::XTextInputStream;
@@ -93,6 +97,8 @@ namespace dbaccess
using ::com::sun::star::sdb::XReportDocumentsSupplier;
using ::com::sun::star::ucb::XCommandProcessor;
using ::com::sun::star::container::XHierarchicalNameAccess;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::lang::XMultiServiceFactory;
/** === end UNO using === **/
namespace ElementModes = ::com::sun::star::embed::ElementModes;
@@ -191,6 +197,32 @@ namespace dbaccess
static const ::rtl::OUString s_sRecDataStorName( RTL_CONSTASCII_USTRINGPARAM( "recovery" ) );
return s_sRecDataStorName;
}
+ // .........................................................................
+ static const ::rtl::OUString& lcl_getComponentStorageBaseName( const SubComponentType i_eType )
+ {
+ static const ::rtl::OUString s_sFormBaseName( RTL_CONSTASCII_USTRINGPARAM( "form" ) );
+ static const ::rtl::OUString s_sReportBaseName( RTL_CONSTASCII_USTRINGPARAM( "report" ) );
+ static const ::rtl::OUString s_sTableBaseName( RTL_CONSTASCII_USTRINGPARAM( "table" ) );
+ static const ::rtl::OUString s_sQueryBaseName( RTL_CONSTASCII_USTRINGPARAM( "query" ) );
+
+ switch ( i_eType )
+ {
+ case FORM:
+ return s_sFormBaseName;
+ case REPORT:
+ return s_sReportBaseName;
+ case TABLE:
+ return s_sTableBaseName;
+ case QUERY:
+ return s_sQueryBaseName;
+ default:
+ break;
+ }
+
+ OSL_ENSURE( false, "lcl_getComponentStorageBaseName: unimplemented case!" );
+ static const ::rtl::OUString s_sFallback;
+ return s_sFallback;
+ }
// .........................................................................
static const ::rtl::OUString& lcl_getComponentsStorageName( const SubComponentType i_eType )
@@ -230,6 +262,27 @@ namespace dbaccess
}
// .........................................................................
+ static const ::rtl::OUString& lcl_getStatementStreamName()
+ {
+ static const ::rtl::OUString s_sStatementStreamName( RTL_CONSTASCII_USTRINGPARAM( "statement.txt" ) );
+ return s_sStatementStreamName;
+ }
+
+ // .........................................................................
+ static const ::rtl::OUString& lcl_getSettingsStreamName()
+ {
+ static const ::rtl::OUString s_sStatementStreamName( RTL_CONSTASCII_USTRINGPARAM( "settings.xml" ) );
+ return s_sStatementStreamName;
+ }
+
+ // .........................................................................
+ static const ::rtl::OUString& lcl_getCurrentQueryDesignName()
+ {
+ static const ::rtl::OUString s_sQuerySettingsName( RTL_CONSTASCII_USTRINGPARAM( "ooo:current-query-design" ) );
+ return s_sQuerySettingsName;
+ }
+
+ // .........................................................................
static const ::rtl::OUString& lcl_getMapStreamEncodingName()
{
static const ::rtl::OUString s_sMapStreamEncodingName( RTL_CONSTASCII_USTRINGPARAM( "UTF-8" ) );
@@ -244,19 +297,9 @@ namespace dbaccess
// nothing to do
return;
- ENSURE_OR_THROW( i_rStorage.is(), "invalid storage" );
- Reference< XStream > xIniStream( i_rStorage->openStreamElement(
- lcl_getObjectMapStreamName(), ElementModes::WRITE | ElementModes::TRUNCATE ), UNO_SET_THROW );
+ StorageTextOutputStream aTextOutput( i_rContext, i_rStorage, lcl_getObjectMapStreamName() );
- Reference< XTextOutputStream > xTextOutput( i_rContext.createComponent( "com.sun.star.io.TextOutputStream" ), UNO_QUERY_THROW );
- xTextOutput->setEncoding( lcl_getMapStreamEncodingName() );
-
- Reference< XActiveDataSource > xDataSource( xTextOutput, UNO_QUERY_THROW );
- xDataSource->setOutputStream( xIniStream->getOutputStream() );
-
- const ::rtl::OUString sLineFeed( sal_Unicode( '\n' ) );
- xTextOutput->writeString( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[storages]" ) ) );
- xTextOutput->writeString( sLineFeed );
+ aTextOutput.writeLine( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[storages]" ) ) );
for ( MapStringToCompDesc::const_iterator stor = i_mapStorageToCompDesc.begin();
stor != i_mapStorageToCompDesc.end();
@@ -265,12 +308,11 @@ namespace dbaccess
{
::rtl::OUStringBuffer aLine;
lcl_getPersistentRepresentation( *stor, aLine );
- aLine.append( sLineFeed );
- xTextOutput->writeString( aLine.makeStringAndClear() );
+ aTextOutput.writeLine( aLine.makeStringAndClear() );
}
- xTextOutput->writeString( sLineFeed );
+ aTextOutput.writeLine();
}
// .........................................................................
@@ -411,7 +453,7 @@ namespace dbaccess
//====================================================================
//= DatabaseDocumentRecovery_Data
//====================================================================
- struct DatabaseDocumentRecovery_Data
+ struct DBACCESS_DLLPRIVATE DatabaseDocumentRecovery_Data
{
const ::comphelper::ComponentContext aContext;
@@ -422,9 +464,88 @@ namespace dbaccess
};
//====================================================================
+ //= SettingsExportContext
+ //====================================================================
+ class DBACCESS_DLLPRIVATE SettingsExportContext : public ::xmloff::XMLSettingsExportContext
+ {
+ public:
+ SettingsExportContext( const ::comphelper::ComponentContext& i_rContext, const StorageXMLOutputStream& i_rDelegator )
+ :m_rContext( i_rContext )
+ ,m_rDelegator( i_rDelegator )
+ ,m_aNamespace( ::xmloff::token::GetXMLToken( ::xmloff::token::XML_NP_CONFIG ) )
+ {
+ }
+
+ public:
+ virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, const ::rtl::OUString& i_rValue );
+ virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, enum ::xmloff::token::XMLTokenEnum i_eValue );
+ virtual void StartElement( enum ::xmloff::token::XMLTokenEnum i_eName, const sal_Bool i_bIgnoreWhitespace );
+ virtual void EndElement ( const sal_Bool i_bIgnoreWhitespace );
+ virtual void Characters( const ::rtl::OUString& i_rCharacters );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ GetServiceFactory() const;
+
+ private:
+ ::rtl::OUString impl_prefix( const ::xmloff::token::XMLTokenEnum i_eToken )
+ {
+ ::rtl::OUStringBuffer aQualifiedName( m_aNamespace );
+ aQualifiedName.append( sal_Unicode( ':' ) );
+ aQualifiedName.append( ::xmloff::token::GetXMLToken( i_eToken ) );
+ return aQualifiedName.makeStringAndClear();
+ }
+
+ private:
+ const ::comphelper::ComponentContext& m_rContext;
+ const StorageXMLOutputStream& m_rDelegator;
+ const ::rtl::OUStringBuffer m_aNamespace;
+ };
+
+ //--------------------------------------------------------------------
+ void SettingsExportContext::AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, const ::rtl::OUString& i_rValue )
+ {
+ m_rDelegator.addAttribute( impl_prefix( i_eName ), i_rValue );
+ }
+
+ //--------------------------------------------------------------------
+ void SettingsExportContext::AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, enum ::xmloff::token::XMLTokenEnum i_eValue )
+ {
+ m_rDelegator.addAttribute( impl_prefix( i_eName ), ::xmloff::token::GetXMLToken( i_eValue ) );
+ }
+
+ //--------------------------------------------------------------------
+ void SettingsExportContext::StartElement( enum ::xmloff::token::XMLTokenEnum i_eName, const sal_Bool i_bIgnoreWhitespace )
+ {
+ if ( i_bIgnoreWhitespace )
+ m_rDelegator.ignorableWhitespace( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) ) );
+
+ m_rDelegator.startElement( impl_prefix( i_eName ) );
+ }
+
+ //--------------------------------------------------------------------
+ void SettingsExportContext::EndElement( const sal_Bool i_bIgnoreWhitespace )
+ {
+ if ( i_bIgnoreWhitespace )
+ m_rDelegator.ignorableWhitespace( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) ) );
+ m_rDelegator.endElement();
+ }
+
+ //--------------------------------------------------------------------
+ void SettingsExportContext::Characters( const ::rtl::OUString& i_rCharacters )
+ {
+ m_rDelegator.characters( i_rCharacters );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XMultiServiceFactory > SettingsExportContext::GetServiceFactory() const
+ {
+ return m_rContext.getLegacyServiceFactory();
+ }
+
+ //====================================================================
//= SubComponentRecovery
//====================================================================
- class SubComponentRecovery
+ class DBACCESS_DLLPRIVATE SubComponentRecovery
{
public:
SubComponentRecovery( const ::comphelper::ComponentContext& i_rContext, const Reference< XDatabaseDocumentUI >& i_rController,
@@ -441,8 +562,11 @@ namespace dbaccess
private:
void impl_saveSubDocument_throw(
- const Reference< XStorage >& i_rRecoveryStorage,
- MapStringToCompDesc& io_mapStorageToCompDesc
+ const Reference< XStorage >& i_rObjectStorage
+ );
+
+ void impl_saveQueryDesign_throw(
+ const Reference< XStorage >& i_rObjectStorage
);
void impl_identifyComponent_throw(
@@ -465,11 +589,26 @@ namespace dbaccess
// quite fatal, but has already been reported (as assertion) before
return;
+ // open the sub storage for the given kind of components
+ const ::rtl::OUString& rStorageName( lcl_getComponentsStorageName( m_eType ) );
+ const Reference< XStorage > xComponentsStorage( i_rRecoveryStorage->openStorageElement(
+ rStorageName, ElementModes::READWRITE ), UNO_QUERY_THROW );
+
+ // find a free sub storage name, and create Yet Another Sub Storage
+ const ::rtl::OUString& rBaseName( lcl_getComponentStorageBaseName( m_eType ) );
+ const ::rtl::OUString sStorName = ::dbtools::createUniqueName( xComponentsStorage.get(), rBaseName, true );
+ const Reference< XStorage > xObjectStor( xComponentsStorage->openStorageElement(
+ sStorName, ElementModes::READWRITE ), UNO_QUERY_THROW );
+
switch ( m_eType )
{
case FORM:
case REPORT:
- impl_saveSubDocument_throw( i_rRecoveryStorage, io_mapCompDescs[ m_eType ] );
+ impl_saveSubDocument_throw( xObjectStor );
+ break;
+
+ case QUERY:
+ impl_saveQueryDesign_throw( xObjectStor );
break;
default:
@@ -477,6 +616,16 @@ namespace dbaccess
OSL_ENSURE( false, "SubComponentRecoverys::saveToRecoveryStorage: unimplemented case!" );
break;
}
+
+ // commit the storage(s)
+ tools::stor::commitStorageIfWriteable( xObjectStor );
+ tools::stor::commitStorageIfWriteable( xComponentsStorage );
+
+ // remember the relationship from the component name to the storage name
+ MapStringToCompDesc& rMapCompDescs = io_mapCompDescs[ m_eType ];
+ OSL_ENSURE( rMapCompDescs.find( sStorName ) == rMapCompDescs.end(),
+ "SubComponentRecoverys::saveToRecoveryStorage: object name already used!" );
+ rMapCompDescs[ sStorName ] = m_aCompDesc;
}
//--------------------------------------------------------------------
@@ -534,34 +683,43 @@ namespace dbaccess
}
//--------------------------------------------------------------------
- void SubComponentRecovery::impl_saveSubDocument_throw( const Reference< XStorage >& i_rRecoveryStorage,
- MapStringToCompDesc& io_mapStorageToCompDesc )
+ void SubComponentRecovery::impl_saveQueryDesign_throw( const Reference< XStorage >& i_rObjectStorage )
{
- ENSURE_OR_THROW( ( m_eType == FORM ) || ( m_eType == REPORT ), "illegal sub component type" );
- ENSURE_OR_THROW( i_rRecoveryStorage.is(), "illegal storage" );
+ ENSURE_OR_THROW( m_eType == QUERY, "illegal sub component type" );
+ ENSURE_OR_THROW( i_rObjectStorage.is(), "illegal storage" );
- // open the sub storage for the given kind of documents
- const ::rtl::OUString& rStorageName( lcl_getComponentsStorageName( m_eType ) );
- const Reference< XStorage > xDocsStor( i_rRecoveryStorage->openStorageElement(
- rStorageName, ElementModes::READWRITE ), UNO_QUERY_THROW );
+ // retrieve the current query design (which might differ from what we can retrieve as ActiveCommand property, since
+ // the latter is updated only upon successful save of the design)
+ Reference< XPropertySet > xDesignerProps( m_xComponent, UNO_QUERY_THROW );
+ Sequence< PropertyValue > aCurrentQueryDesign;
+ OSL_VERIFY( xDesignerProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CurrentQueryDesign" ) ) ) >>= aCurrentQueryDesign );
- // find a free sub storage name, and create Yet Another Sub Storage
- const ::rtl::OUString sBaseName( ::rtl::OUString::createFromAscii( m_eType == FORM ? "form" : "report" ) );
- const ::rtl::OUString sCompStorName = ::dbtools::createUniqueName( xDocsStor.get(), sBaseName, true );
- const Reference< XStorage > xCompStor( xDocsStor->openStorageElement(
- sCompStorName, ElementModes::READWRITE ), UNO_QUERY_THROW );
+ // write the query design
+ StorageXMLOutputStream aDesignOutput( m_rContext, i_rObjectStorage, lcl_getSettingsStreamName() );
+ SettingsExportContext aSettingsExportContext( m_rContext, aDesignOutput );
- // store the document into the storage
- Reference< XStorageBasedDocument > xStorageDocument( m_xComponent, UNO_QUERY_THROW );
- xStorageDocument->storeToStorage( xCompStor, Sequence< PropertyValue >() );
+ const ::rtl::OUString sWhitespace( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) ) );
+
+ aDesignOutput.startElement( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "office:settings" ) ) );
+ aDesignOutput.ignorableWhitespace( sWhitespace );
+
+ XMLSettingsExportHelper aSettingsExporter( aSettingsExportContext );
+ aSettingsExporter.exportAllSettings( aCurrentQueryDesign, lcl_getCurrentQueryDesignName() );
+
+ aDesignOutput.ignorableWhitespace( sWhitespace );
+ aDesignOutput.endElement();
+ aDesignOutput.close();
+ }
- // remember the relationship between the component name to the storage name
- OSL_ENSURE( io_mapStorageToCompDesc.find( sCompStorName ) == io_mapStorageToCompDesc.end(),
- "SubComponentRecoverys::impl_saveSubDocument_throw: object name already used!" );
- io_mapStorageToCompDesc[ sCompStorName ] = m_aCompDesc;
+ //--------------------------------------------------------------------
+ void SubComponentRecovery::impl_saveSubDocument_throw( const Reference< XStorage >& i_rObjectStorage )
+ {
+ ENSURE_OR_THROW( ( m_eType == FORM ) || ( m_eType == REPORT ), "illegal sub component type" );
+ ENSURE_OR_THROW( i_rObjectStorage.is(), "illegal storage" );
- // commit the storage for the documents collection
- tools::stor::commitStorageIfWriteable( xDocsStor );
+ // store the document into the storage
+ Reference< XStorageBasedDocument > xStorageDocument( m_xComponent, UNO_QUERY_THROW );
+ xStorageDocument->storeToStorage( i_rObjectStorage, Sequence< PropertyValue >() );
}
//====================================================================
diff --git a/dbaccess/source/core/recovery/makefile.mk b/dbaccess/source/core/recovery/makefile.mk
index 2a69495c4044..04f6e44e8e34 100644
--- a/dbaccess/source/core/recovery/makefile.mk
+++ b/dbaccess/source/core/recovery/makefile.mk
@@ -45,7 +45,10 @@ ENABLE_EXCEPTIONS=TRUE
SLOFILES= \
$(SLO)$/dbdocrecovery.obj \
- $(SLO)$/subcomponentloader.obj
+ $(SLO)$/subcomponentloader.obj \
+ $(SLO)$/storagestream.obj \
+ $(SLO)$/storagexmlstream.obj \
+ $(SLO)$/storagetextstream.obj
# --- Targets ----------------------------------
diff --git a/dbaccess/source/core/recovery/storagestream.cxx b/dbaccess/source/core/recovery/storagestream.cxx
new file mode 100644
index 000000000000..e8fb99600854
--- /dev/null
+++ b/dbaccess/source/core/recovery/storagestream.cxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#include "precompiled_dbaccess.hxx"
+
+#include "storagestream.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/embed/ElementModes.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+
+//........................................................................
+namespace dbaccess
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::embed::XStorage;
+ using ::com::sun::star::io::XStream;
+ /** === end UNO using === **/
+ namespace ElementModes = ::com::sun::star::embed::ElementModes;
+
+ //====================================================================
+ //= StorageOutputStream
+ //====================================================================
+ //--------------------------------------------------------------------
+ StorageOutputStream::StorageOutputStream( const ::comphelper::ComponentContext& i_rContext,
+ const Reference< XStorage >& i_rParentStorage,
+ const ::rtl::OUString& i_rStreamName
+ )
+ :m_rContext( i_rContext )
+ {
+ ENSURE_OR_THROW( i_rParentStorage.is(), "illegal stream" );
+
+ const Reference< XStream > xStream(
+ i_rParentStorage->openStreamElement( i_rStreamName, ElementModes::READWRITE ), UNO_QUERY_THROW );
+ m_xOutputStream.set( xStream->getOutputStream(), UNO_SET_THROW );
+ }
+
+ //--------------------------------------------------------------------
+ StorageOutputStream::~StorageOutputStream()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void StorageOutputStream::close()
+ {
+ ENSURE_OR_RETURN_VOID( m_xOutputStream.is(), "already closed" );
+ m_xOutputStream->closeOutput();
+ m_xOutputStream.clear();
+
+ // if you add additional functionality here, be aware that there are derived classes which
+ // (legitimately) do not call this method here.
+ }
+
+//........................................................................
+} // namespace dbaccess
+//........................................................................
diff --git a/dbaccess/source/core/recovery/storagestream.hxx b/dbaccess/source/core/recovery/storagestream.hxx
new file mode 100644
index 000000000000..a214d3d84d7d
--- /dev/null
+++ b/dbaccess/source/core/recovery/storagestream.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef STORAGESTREAM_HXX
+#define STORAGESTREAM_HXX
+
+#include "dbaccessdllapi.h"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/embed/XStorage.hpp>
+/** === end UNO includes === **/
+
+namespace comphelper
+{
+ class ComponentContext;
+}
+
+//........................................................................
+namespace dbaccess
+{
+//........................................................................
+
+ //====================================================================
+ //= StorageOutputStream
+ //====================================================================
+ /** convenience wrapper around a stream living in a storage
+ */
+ class DBACCESS_DLLPRIVATE StorageOutputStream
+ {
+ public:
+ StorageOutputStream(
+ const ::comphelper::ComponentContext& i_rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rParentStorage,
+ const ::rtl::OUString& i_rStreamName
+ );
+ virtual ~StorageOutputStream();
+
+ /** simply calls closeOutput on our output stream, override to extend/modify this behavior
+ */
+ virtual void close();
+
+ protected:
+ const ::comphelper::ComponentContext& getContext() const { return m_rContext; }
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >&
+ getOutputStream() const { return m_xOutputStream; }
+
+ private:
+ const ::comphelper::ComponentContext& m_rContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ m_xOutputStream;
+ };
+
+//........................................................................
+} // namespace dbaccess
+//........................................................................
+
+#endif // STORAGESTREAM_HXX
diff --git a/dbaccess/source/core/recovery/storagetextstream.cxx b/dbaccess/source/core/recovery/storagetextstream.cxx
new file mode 100644
index 000000000000..af1b832b67b3
--- /dev/null
+++ b/dbaccess/source/core/recovery/storagetextstream.cxx
@@ -0,0 +1,130 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#include "precompiled_dbaccess.hxx"
+
+#include "storagetextstream.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/io/XTextOutputStream.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <tools/diagnose_ex.h>
+
+//......................................................................................................................
+namespace dbaccess
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::embed::XStorage;
+ using ::com::sun::star::io::XTextOutputStream;
+ using ::com::sun::star::io::XActiveDataSource;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= StorageTextOutputStream_Data
+ //==================================================================================================================
+ struct StorageTextOutputStream_Data
+ {
+ Reference< XTextOutputStream > xTextOutput;
+ };
+
+ //==================================================================================================================
+ //= helper
+ //==================================================================================================================
+ namespace
+ {
+ //--------------------------------------------------------------------------------------------------------------
+ static const ::rtl::OUString& lcl_getTextStreamEncodingName()
+ {
+ static const ::rtl::OUString s_sMapStreamEncodingName( RTL_CONSTASCII_USTRINGPARAM( "UTF-8" ) );
+ return s_sMapStreamEncodingName;
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ static const ::rtl::OUString& lcl_getLineFeed()
+ {
+ static const ::rtl::OUString s_sLineFeed( sal_Unicode( '\n' ) );
+ return s_sLineFeed;
+ }
+ }
+
+ //==================================================================================================================
+ //= StorageTextOutputStream
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ StorageTextOutputStream::StorageTextOutputStream( const ::comphelper::ComponentContext& i_rContext,
+ const Reference< XStorage >& i_rParentStorage,
+ const ::rtl::OUString& i_rStreamName
+ )
+ :StorageOutputStream( i_rContext, i_rParentStorage, i_rStreamName )
+ ,m_pData( new StorageTextOutputStream_Data )
+ {
+ m_pData->xTextOutput.set( i_rContext.createComponent( "com.sun.star.io.TextOutputStream" ), UNO_QUERY_THROW );
+ m_pData->xTextOutput->setEncoding( lcl_getTextStreamEncodingName() );
+
+ Reference< XActiveDataSource > xDataSource( m_pData->xTextOutput, UNO_QUERY_THROW );
+ xDataSource->setOutputStream( getOutputStream() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ StorageTextOutputStream::~StorageTextOutputStream()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void StorageTextOutputStream::writeLine( const ::rtl::OUString& i_rLine )
+ {
+ ENSURE_OR_RETURN_VOID( m_pData->xTextOutput.is(), "no text output" );
+
+ m_pData->xTextOutput->writeString( i_rLine );
+ m_pData->xTextOutput->writeString( lcl_getLineFeed() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void StorageTextOutputStream::writeLine()
+ {
+ ENSURE_OR_RETURN_VOID( m_pData->xTextOutput.is(), "no text output" );
+
+ m_pData->xTextOutput->writeString( lcl_getLineFeed() );
+ }
+
+//......................................................................................................................
+} // namespace dbaccess
+//......................................................................................................................
diff --git a/dbaccess/source/core/recovery/storagetextstream.hxx b/dbaccess/source/core/recovery/storagetextstream.hxx
new file mode 100644
index 000000000000..08d02008f1a4
--- /dev/null
+++ b/dbaccess/source/core/recovery/storagetextstream.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef STORAGETEXTSTREAM_HXX
+#define STORAGETEXTSTREAM_HXX
+
+#include "storagestream.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <memory>
+
+//......................................................................................................................
+namespace dbaccess
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= StorageTextStream
+ //==================================================================================================================
+ struct StorageTextOutputStream_Data;
+ class DBACCESS_DLLPRIVATE StorageTextOutputStream : public StorageOutputStream
+ {
+ public:
+ StorageTextOutputStream(
+ const ::comphelper::ComponentContext& i_rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rParentStorage,
+ const ::rtl::OUString& i_rStreamName
+ );
+ ~StorageTextOutputStream();
+
+ void writeLine( const ::rtl::OUString& i_rLine );
+ void writeLine();
+
+ private:
+ ::std::auto_ptr< StorageTextOutputStream_Data > m_pData;
+ };
+
+//......................................................................................................................
+} // namespace dbaccess
+//......................................................................................................................
+
+#endif // STORAGETEXTSTREAM_HXX
diff --git a/dbaccess/source/core/recovery/storagexmlstream.cxx b/dbaccess/source/core/recovery/storagexmlstream.cxx
new file mode 100644
index 000000000000..10c64cc4141c
--- /dev/null
+++ b/dbaccess/source/core/recovery/storagexmlstream.cxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#include "precompiled_dbaccess.hxx"
+
+#include "storagexmlstream.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <rtl/ref.hxx>
+#include <tools/diagnose_ex.h>
+#include <xmloff/attrlist.hxx>
+
+#include <stack>
+
+//......................................................................................................................
+namespace dbaccess
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::embed::XStorage;
+ using ::com::sun::star::xml::sax::XDocumentHandler;
+ using ::com::sun::star::xml::sax::XAttributeList;
+ using ::com::sun::star::io::XStream;
+ using ::com::sun::star::io::XOutputStream;
+ using ::com::sun::star::io::XActiveDataSource;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= StorageXMLOutputStream_Data
+ //==================================================================================================================
+ struct StorageXMLOutputStream_Data
+ {
+ Reference< XDocumentHandler > xHandler;
+ ::std::stack< ::rtl::OUString > aElements;
+ ::rtl::Reference< SvXMLAttributeList > xAttributes;
+ };
+
+ //==================================================================================================================
+ //= StorageXMLOutputStream
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ StorageXMLOutputStream::StorageXMLOutputStream( const ::comphelper::ComponentContext& i_rContext,
+ const Reference< XStorage >& i_rParentStorage,
+ const ::rtl::OUString& i_rStreamName )
+ :StorageOutputStream( i_rContext, i_rParentStorage, i_rStreamName )
+ ,m_pData( new StorageXMLOutputStream_Data )
+ {
+ const Reference< XActiveDataSource > xSaxWriter( i_rContext.createComponent( "com.sun.star.xml.sax.Writer" ), UNO_QUERY_THROW );
+ xSaxWriter->setOutputStream( getOutputStream() );
+
+ m_pData->xHandler.set( xSaxWriter, UNO_QUERY_THROW );
+ m_pData->xHandler->startDocument();
+
+ m_pData->xAttributes = new SvXMLAttributeList;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ StorageXMLOutputStream::~StorageXMLOutputStream()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void StorageXMLOutputStream::close()
+ {
+ ENSURE_OR_RETURN_VOID( m_pData->xHandler.is(), "illegal document handler" );
+ m_pData->xHandler->endDocument();
+ // do not call the base class, it would call closeOutput on the output stream, which is already done by
+ // endDocument
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void StorageXMLOutputStream::addAttribute( const ::rtl::OUString& i_rName, const ::rtl::OUString& i_rValue ) const
+ {
+ m_pData->xAttributes->AddAttribute( i_rName, i_rValue );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void StorageXMLOutputStream::startElement( const ::rtl::OUString& i_rElementName ) const
+ {
+ ENSURE_OR_RETURN_VOID( m_pData->xHandler.is(), "no document handler" );
+
+ m_pData->xHandler->startElement( i_rElementName, m_pData->xAttributes.get() );
+ m_pData->xAttributes = new SvXMLAttributeList;
+ m_pData->aElements.push( i_rElementName );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void StorageXMLOutputStream::endElement() const
+ {
+ ENSURE_OR_RETURN_VOID( m_pData->xHandler.is(), "no document handler" );
+ ENSURE_OR_RETURN_VOID( !m_pData->aElements.empty(), "no element on the stack" );
+
+ const ::rtl::OUString sElementName( m_pData->aElements.top() );
+ m_pData->xHandler->endElement( sElementName );
+ m_pData->aElements.pop();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void StorageXMLOutputStream::ignorableWhitespace( const ::rtl::OUString& i_rWhitespace ) const
+ {
+ ENSURE_OR_RETURN_VOID( m_pData->xHandler.is(), "no document handler" );
+
+ m_pData->xHandler->ignorableWhitespace( i_rWhitespace );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void StorageXMLOutputStream::characters( const ::rtl::OUString& i_rCharacters ) const
+ {
+ ENSURE_OR_RETURN_VOID( m_pData->xHandler.is(), "no document handler" );
+
+ m_pData->xHandler->characters( i_rCharacters );
+ }
+
+//......................................................................................................................
+} // namespace dbaccess
+//......................................................................................................................
diff --git a/dbaccess/source/core/recovery/storagexmlstream.hxx b/dbaccess/source/core/recovery/storagexmlstream.hxx
new file mode 100644
index 000000000000..504e6b7ccd25
--- /dev/null
+++ b/dbaccess/source/core/recovery/storagexmlstream.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef STORAGEXMLSTREAM_HXX
+#define STORAGEXMLSTREAM_HXX
+
+#include "storagestream.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/embed/XStorage.hpp>
+/** === end UNO includes === **/
+
+#include <memory>
+
+namespace comphelper
+{
+ class ComponentContext;
+}
+
+//........................................................................
+namespace dbaccess
+{
+//........................................................................
+
+ //====================================================================
+ //= StorageXMLOutputStream
+ //====================================================================
+ struct StorageXMLOutputStream_Data;
+ class DBACCESS_DLLPRIVATE StorageXMLOutputStream : public StorageOutputStream
+ {
+ public:
+ StorageXMLOutputStream(
+ const ::comphelper::ComponentContext& i_rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rParentStorage,
+ const ::rtl::OUString& i_rStreamName
+ );
+ ~StorageXMLOutputStream();
+
+ // StorageOutputStream overridables
+ virtual void close();
+
+ void addAttribute( const ::rtl::OUString& i_rName, const ::rtl::OUString& i_rValue ) const;
+
+ void startElement( const ::rtl::OUString& i_rElementName ) const;
+ void endElement() const;
+
+ void ignorableWhitespace( const ::rtl::OUString& i_rWhitespace ) const;
+ void characters( const ::rtl::OUString& i_rCharacters ) const;
+
+ private:
+ StorageXMLOutputStream(); // never implemented
+ StorageXMLOutputStream( const StorageXMLOutputStream& ); // never implemented
+ StorageXMLOutputStream& operator=( const StorageXMLOutputStream& ); // never implemented
+
+ private:
+ ::std::auto_ptr< StorageXMLOutputStream_Data > m_pData;
+ };
+
+//........................................................................
+} // namespace dbaccess
+//........................................................................
+
+#endif // STORAGEXMLSTREAM_HXX
diff --git a/dbaccess/source/inc/stringconstants.hrc b/dbaccess/source/inc/stringconstants.hrc
index 384d669226dc..57c4227154cf 100644
--- a/dbaccess/source/inc/stringconstants.hrc
+++ b/dbaccess/source/inc/stringconstants.hrc
@@ -184,6 +184,7 @@
#define PROPERTY_ID_ENCODING 141
#define PROPERTY_ID_HELP_URL 142
#define PROPERTY_ID_PERSISTENT_PATH 143
+#define PROPERTY_ID_CURRENT_QUERY_DESIGN 144
//============================================================
//= property names
diff --git a/dbaccess/source/ui/inc/JoinController.hxx b/dbaccess/source/ui/inc/JoinController.hxx
index 88fc32ee8c07..72e61c4bab3d 100644
--- a/dbaccess/source/ui/inc/JoinController.hxx
+++ b/dbaccess/source/ui/inc/JoinController.hxx
@@ -52,6 +52,11 @@
#endif
#include <boost/shared_ptr.hpp>
+namespace comphelper
+{
+ class NamedValueCollection;
+}
+
class VCLXWindow;
namespace dbaui
{
@@ -97,7 +102,7 @@ namespace dbaui
@param _rViewProps
Contains the new sequence.
*/
- void saveTableWindows(::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _rViewProps);
+ void saveTableWindows( ::comphelper::NamedValueCollection& o_rViewSettings ) const;
virtual ~OJoinController();
public:
diff --git a/dbaccess/source/ui/inc/TableFieldDescription.hxx b/dbaccess/source/ui/inc/TableFieldDescription.hxx
index 9230bef621c3..dd4489821331 100644
--- a/dbaccess/source/ui/inc/TableFieldDescription.hxx
+++ b/dbaccess/source/ui/inc/TableFieldDescription.hxx
@@ -47,6 +47,11 @@
#include <vos/ref.hxx>
#endif
+namespace comphelper
+{
+ class NamedValueCollection;
+}
+
class Window;
namespace dbaui
{
@@ -142,7 +147,7 @@ namespace dbaui
const ::std::vector< ::rtl::OUString>& GetCriteria() const { return m_vecCriteria;}
void Load(const ::com::sun::star::beans::PropertyValue& _rProperty);
- void Save(::com::sun::star::beans::PropertyValue& _rProperty);
+ void Save( ::comphelper::NamedValueCollection& o_rSettings );
};
//------------------------------------------------------------------
diff --git a/dbaccess/source/ui/inc/querycontroller.hxx b/dbaccess/source/ui/inc/querycontroller.hxx
index 5a1d2b24b82b..eeabaa13192b 100644
--- a/dbaccess/source/ui/inc/querycontroller.hxx
+++ b/dbaccess/source/ui/inc/querycontroller.hxx
@@ -56,6 +56,11 @@
#include <connectivity/sqlparse.hxx>
#include <svl/undo.hxx>
+namespace comphelper
+{
+ class NamedValueCollection;
+}
+
class VCLXWindow;
namespace dbaui
{
@@ -125,7 +130,7 @@ namespace dbaui
void executeQuery();
bool doSaveAsDoc(sal_Bool _bSaveAs);
- void saveViewSettings( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& o_rViewData );
+ void saveViewSettings( ::comphelper::NamedValueCollection& o_rViewSettings, const bool i_includngCriteria ) const;
void loadViewSettings( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rViewData );
::rtl::OUString translateStatement( bool _bFireStatementChange = true );
@@ -204,6 +209,22 @@ namespace dbaui
// OPropertyArrayUsageHelper
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+ // OPropertySetHelper
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(
+ ::com::sun::star::uno::Any& rConvertedValue,
+ ::com::sun::star::uno::Any& rOldValue,
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue
+ ) throw (::com::sun::star::lang::IllegalArgumentException);
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue
+ ) throw (::com::sun::star::uno::Exception );
+ virtual void SAL_CALL getFastPropertyValue(
+ ::com::sun::star::uno::Any& rValue,
+ sal_Int32 nHandle
+ ) const;
+
virtual OJoinDesignView* getJoinView();
// ask the user if the design should be saved when it is modified
virtual short saveModified();
diff --git a/dbaccess/source/ui/querydesign/JoinController.cxx b/dbaccess/source/ui/querydesign/JoinController.cxx
index 0c5367165530..7191bf6252b6 100644
--- a/dbaccess/source/ui/querydesign/JoinController.cxx
+++ b/dbaccess/source/ui/querydesign/JoinController.cxx
@@ -536,56 +536,31 @@ void OJoinController::loadTableWindow(const Sequence<PropertyValue>& _rTable)
}
}
// -----------------------------------------------------------------------------
-void OJoinController::saveTableWindows(Sequence<PropertyValue>& _rViewProps)
+void OJoinController::saveTableWindows( ::comphelper::NamedValueCollection& o_rViewSettings ) const
{
if ( !m_vTableData.empty() )
{
- PropertyValue *pViewIter = _rViewProps.getArray();
- PropertyValue *pEnd = pViewIter + _rViewProps.getLength();
- const static ::rtl::OUString s_sTables(RTL_CONSTASCII_USTRINGPARAM("Tables"));
- for (; pViewIter != pEnd && pViewIter->Name != s_sTables; ++pViewIter)
- ;
+ ::comphelper::NamedValueCollection aAllTablesData;
- if ( pViewIter == pEnd )
+ TTableWindowData::const_iterator aIter = m_vTableData.begin();
+ TTableWindowData::const_iterator aEnd = m_vTableData.end();
+ for ( sal_Int32 i = 1; aIter != aEnd; ++aIter, ++i )
{
- sal_Int32 nLen = _rViewProps.getLength();
- _rViewProps.realloc( nLen + 1 );
- pViewIter = _rViewProps.getArray() + nLen;
- pViewIter->Name = s_sTables;
+ ::comphelper::NamedValueCollection aWindowData;
+ aWindowData.put( "ComposedName", (*aIter)->GetComposedName() );
+ aWindowData.put( "TableName", (*aIter)->GetTableName() );
+ aWindowData.put( "WindowName", (*aIter)->GetWinName() );
+ aWindowData.put( "WindowTop", (*aIter)->GetPosition().Y() );
+ aWindowData.put( "WindowLeft", (*aIter)->GetPosition().X() );
+ aWindowData.put( "WindowWidth", (*aIter)->GetSize().Width() );
+ aWindowData.put( "WindowHeight", (*aIter)->GetSize().Height() );
+ aWindowData.put( "ShowAll", (*aIter)->IsShowAll() );
+
+ const ::rtl::OUString sTableName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Table" ) ) + ::rtl::OUString::valueOf( i ) );
+ aAllTablesData.put( sTableName, aWindowData.getPropertyValues() );
}
- Sequence<PropertyValue> aTables(m_vTableData.size());
- PropertyValue *pIter = aTables.getArray();
-
- Sequence<PropertyValue> aWindow(8);
-
- TTableWindowData::iterator aIter = m_vTableData.begin();
- TTableWindowData::iterator aEnd = m_vTableData.end();
- for(sal_Int32 i = 1;aIter != aEnd;++aIter,++pIter,++i)
- {
- pIter->Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Table")) + ::rtl::OUString::valueOf(i);
-
- sal_Int32 nPos = 0;
- aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ComposedName"));
- aWindow[nPos++].Value <<= (*aIter)->GetComposedName();
- aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TableName"));
- aWindow[nPos++].Value <<= (*aIter)->GetTableName();
- aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WindowName"));
- aWindow[nPos++].Value <<= (*aIter)->GetWinName();
- aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WindowTop"));
- aWindow[nPos++].Value <<= (*aIter)->GetPosition().Y();
- aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WindowLeft"));
- aWindow[nPos++].Value <<= (*aIter)->GetPosition().X();
- aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WindowWidth"));
- aWindow[nPos++].Value <<= (*aIter)->GetSize().Width();
- aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WindowHeight"));
- aWindow[nPos++].Value <<= (*aIter)->GetSize().Height();
- aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowAll"));
- aWindow[nPos++].Value <<= (*aIter)->IsShowAll();
-
- pIter->Value <<= aWindow;
- }
- pViewIter->Value <<= aTables;
+ o_rViewSettings.put( "Tables", aAllTablesData.getPropertyValues() );
}
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
index a00bc3dbd54c..4b053661df1b 100644
--- a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
+++ b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
@@ -40,9 +40,7 @@
#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
#include <com/sun/star/sdbc/DataType.hpp>
#endif
-#ifndef _COMPHELPER_STREAMSECTION_HXX_
-#include <comphelper/streamsection.hxx>
-#endif
+#include <comphelper/namedvaluecollection.hxx>
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::uno;
@@ -207,39 +205,22 @@ void OTableFieldDesc::Load(const ::com::sun::star::beans::PropertyValue& _rPrope
}
}
//------------------------------------------------------------------------------
-void OTableFieldDesc::Save(::com::sun::star::beans::PropertyValue& _rProperty)
+void OTableFieldDesc::Save( ::comphelper::NamedValueCollection& o_rSettings )
{
DBG_CHKTHIS(OTableFieldDesc,NULL);
-
- Sequence<PropertyValue> aFieldDesc(13);
- sal_Int32 nPos = 0;
- aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AliasName"));
- aFieldDesc[nPos++].Value <<= m_aAliasName;
- aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TableName"));
- aFieldDesc[nPos++].Value <<= m_aTableName;
- aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldName"));
- aFieldDesc[nPos++].Value <<= m_aFieldName;
- aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldAlias"));
- aFieldDesc[nPos++].Value <<= m_aFieldAlias;
- aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FunctionName"));
- aFieldDesc[nPos++].Value <<= m_aFunctionName;
- aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataType"));
- aFieldDesc[nPos++].Value <<= m_eDataType;
- aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FunctionType"));
- aFieldDesc[nPos++].Value <<= (sal_Int32)m_eFunctionType;
- aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldType"));
- aFieldDesc[nPos++].Value <<= (sal_Int32)m_eFieldType;
- aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OrderDir"));
- aFieldDesc[nPos++].Value <<= (sal_Int32)m_eOrderDir;
- aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ColWidth"));
- aFieldDesc[nPos++].Value <<= m_nColWidth;
- aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GroupBy"));
- aFieldDesc[nPos++].Value <<= m_bGroupBy;
- aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Visible"));
- aFieldDesc[nPos++].Value <<= m_bVisible;
-
- _rProperty.Value <<= aFieldDesc;
+ o_rSettings.put( "AliasName", m_aAliasName );
+ o_rSettings.put( "TableName", m_aTableName );
+ o_rSettings.put( "FieldName", m_aFieldName );
+ o_rSettings.put( "FieldAlias", m_aFieldAlias );
+ o_rSettings.put( "FunctionName", m_aFunctionName );
+ o_rSettings.put( "DataType", m_eDataType );
+ o_rSettings.put( "FunctionType", (sal_Int32)m_eFunctionType );
+ o_rSettings.put( "FieldType", (sal_Int32)m_eFieldType );
+ o_rSettings.put( "OrderDir", (sal_Int32)m_eOrderDir );
+ o_rSettings.put( "ColWidth", m_nColWidth );
+ o_rSettings.put( "GroupBy", m_bGroupBy );
+ o_rSettings.put( "Visible", m_bVisible );
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index e907a9edff2a..aab0703b364c 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -81,6 +81,7 @@
#include <comphelper/basicio.hxx>
#include <comphelper/extract.hxx>
+#include <comphelper/property.hxx>
#include <comphelper/seqstream.hxx>
#include <comphelper/streamsection.hxx>
#include <comphelper/types.hxx>
@@ -374,6 +375,49 @@ Reference< XPropertySetInfo > SAL_CALL OQueryController::getPropertySetInfo() th
}
//-------------------------------------------------------------------------
+sal_Bool SAL_CALL OQueryController::convertFastPropertyValue( Any& o_rConvertedValue, Any& o_rOldValue, sal_Int32 i_nHandle, const Any& i_rValue ) throw (IllegalArgumentException)
+{
+ return OPropertyContainer::convertFastPropertyValue( o_rConvertedValue, o_rOldValue, i_nHandle, i_rValue );
+}
+
+//-------------------------------------------------------------------------
+void SAL_CALL OQueryController::setFastPropertyValue_NoBroadcast( sal_Int32 i_nHandle, const Any& i_rValue ) throw ( Exception )
+{
+ OPropertyContainer::setFastPropertyValue_NoBroadcast( i_nHandle, i_rValue );
+}
+
+//-------------------------------------------------------------------------
+void SAL_CALL OQueryController::getFastPropertyValue( Any& o_rValue, sal_Int32 i_nHandle ) const
+{
+ switch ( i_nHandle )
+ {
+ case PROPERTY_ID_CURRENT_QUERY_DESIGN:
+ {
+ ::comphelper::NamedValueCollection aCurrentDesign;
+ aCurrentDesign.put( "GraphicalDesign", isGraphicalDesign() );
+ aCurrentDesign.put( (::rtl::OUString)PROPERTY_ESCAPE_PROCESSING, m_bEscapeProcessing );
+
+ if ( isGraphicalDesign() )
+ {
+ getContainer()->SaveUIConfig();
+ saveViewSettings( aCurrentDesign, true );
+ }
+ else
+ {
+ aCurrentDesign.put( "Statement", getContainer()->getStatement() );
+ }
+
+ o_rValue <<= aCurrentDesign.getPropertyValues();
+ }
+ break;
+
+ default:
+ OPropertyContainer::getFastPropertyValue( o_rValue, i_nHandle );
+ break;
+ }
+}
+
+//-------------------------------------------------------------------------
::cppu::IPropertyArrayHelper& OQueryController::getInfoHelper()
{
return *const_cast< OQueryController* >( this )->getArrayHelper();
@@ -383,7 +427,24 @@ Reference< XPropertySetInfo > SAL_CALL OQueryController::getPropertySetInfo() th
::cppu::IPropertyArrayHelper* OQueryController::createArrayHelper( ) const
{
Sequence< Property > aProps;
- describeProperties(aProps);
+ describeProperties( aProps );
+
+ // one additional property:
+ const sal_Int32 nLength = aProps.getLength();
+ aProps.realloc( nLength + 1 );
+ aProps[ nLength ] = Property(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CurrentQueryDesign" ) ),
+ PROPERTY_ID_CURRENT_QUERY_DESIGN,
+ ::cppu::UnoType< Sequence< PropertyValue > >::get(),
+ PropertyAttribute::READONLY
+ );
+
+ ::std::sort(
+ aProps.getArray(),
+ aProps.getArray() + aProps.getLength(),
+ ::comphelper::PropertyCompareByName()
+ );
+
return new ::cppu::OPropertyArrayHelper(aProps);
}
@@ -1096,42 +1157,53 @@ void OQueryController::reconnect(sal_Bool _bUI)
InvalidateAll();
}
}
+
// -----------------------------------------------------------------------------
-void OQueryController::saveViewSettings( Sequence< PropertyValue >& o_rViewData )
+void OQueryController::saveViewSettings( ::comphelper::NamedValueCollection& o_rViewSettings, const bool i_includngCriteria ) const
{
- saveTableWindows( o_rViewData );
+ saveTableWindows( o_rViewSettings );
- OTableFields::const_iterator aFieldIter = m_vTableFieldDesc.begin();
- OTableFields::const_iterator aFieldEnd = m_vTableFieldDesc.end();
- sal_Int32 nCount = 0;
- for(;aFieldIter != aFieldEnd;++aFieldIter)
- {
- if(!(*aFieldIter)->IsEmpty())
- ++nCount;
- }
+ OTableFields::const_iterator field = m_vTableFieldDesc.begin();
+ OTableFields::const_iterator fieldEnd = m_vTableFieldDesc.end();
- ::comphelper::NamedValueCollection aViewData( o_rViewData );
- if ( nCount != 0 )
+ ::comphelper::NamedValueCollection aAllFieldsData;
+ ::comphelper::NamedValueCollection aFieldData;
+ for ( sal_Int32 i = 1; field != fieldEnd; ++field, ++i )
{
- Sequence<PropertyValue> aFields(nCount);
- PropertyValue *pFieldsIter = aFields.getArray();
- // the fielddata
- aFieldIter = m_vTableFieldDesc.begin();
- for(sal_Int32 i = 1;aFieldIter !=aFieldEnd;++aFieldIter,++i)
+ if ( !(*field)->IsEmpty() )
{
- if ( !(*aFieldIter)->IsEmpty() )
+ const ::rtl::OUString sFieldSettingName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Field" ) ) + ::rtl::OUString::valueOf( i );
+
+ aFieldData.clear();
+ (*field)->Save( aFieldData );
+
+ if ( i_includngCriteria )
{
- pFieldsIter->Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Field")) + ::rtl::OUString::valueOf(i);
- (*aFieldIter)->Save(*pFieldsIter++);
+ const ::std::vector< ::rtl::OUString >& rCriteria( (*field)->GetCriteria() );
+ if ( !rCriteria.empty() )
+ {
+ sal_Int32 c = 0;
+ ::comphelper::NamedValueCollection aCriteria;
+ for ( ::std::vector< ::rtl::OUString >::const_iterator crit = rCriteria.begin();
+ crit != rCriteria.end();
+ ++crit, ++c
+ )
+ {
+ const ::rtl::OUString sCritName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Criterion_" ) ) + ::rtl::OUString::valueOf( c );
+ aCriteria.put( sCritName, *crit );
+ }
+
+ aFieldData.put( "Criteria", aCriteria.getPropertyValues() );
+ }
}
- }
- aViewData.put( "Fields", aFields );
+ aAllFieldsData.put( sFieldSettingName, aFieldData.getPropertyValues() );
+ }
}
- aViewData.put( "SplitterPosition", m_nSplitPos );
- aViewData.put( "VisibleRows", m_nVisibleRows );
- o_rViewData = aViewData.getPropertyValues();
+ o_rViewSettings.put( "Fields", aAllFieldsData.getPropertyValues() );
+ o_rViewSettings.put( "SplitterPosition", m_nSplitPos );
+ o_rViewSettings.put( "VisibleRows", m_nVisibleRows );
}
// -----------------------------------------------------------------------------
void OQueryController::loadViewSettings( const Sequence< PropertyValue >& i_rViewData )
@@ -1758,9 +1830,10 @@ Any SAL_CALL OQueryController::getViewData() throw( RuntimeException )
getContainer()->SaveUIConfig();
- Sequence< PropertyValue > aLayout;
- saveViewSettings( aLayout );
- return makeAny( aLayout );
+ ::comphelper::NamedValueCollection aViewSettings;
+ saveViewSettings( aViewSettings, false );
+
+ return makeAny( aViewSettings.getPropertyValues() );
}
// -----------------------------------------------------------------------------
void SAL_CALL OQueryController::restoreViewData(const Any& /*Data*/) throw( RuntimeException )
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx
index 3f259d867844..d59ef63642e0 100644
--- a/dbaccess/source/ui/relationdesign/RelationController.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -189,14 +189,15 @@ void ORelationController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue
{
if ( haveDataSource() && getDataSource()->getPropertySetInfo()->hasPropertyByName(PROPERTY_LAYOUTINFORMATION) )
{
- Sequence<PropertyValue> aWindows;
- saveTableWindows(aWindows);
- getDataSource()->setPropertyValue(PROPERTY_LAYOUTINFORMATION,makeAny(aWindows));
+ ::comphelper::NamedValueCollection aWindowsData;
+ saveTableWindows( aWindowsData );
+ getDataSource()->setPropertyValue( PROPERTY_LAYOUTINFORMATION, makeAny( aWindowsData.getPropertyValues() ) );
setModified(sal_False);
}
}
- catch(Exception&)
+ catch ( const Exception& )
{
+ DBG_UNHANDLED_EXCEPTION();
}
}
}