sw/inc/swdbdata.hxx | 6 ++++-- sw/source/core/doc/docfmt.cxx | 1 + sw/source/filter/xml/xmlimp.cxx | 5 +++++ sw/source/uibase/uno/SwXDocumentSettings.cxx | 15 +++++++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-)
New commits: commit 7bd6f298b43732fd5d4a270f2493ae11eb20ad22 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed May 6 10:33:46 2015 +0200 sw: add SwDBData::sEmbeddedName It is supposed to contain the name of a stream in the document storage (like "Object 1") that has an embedded database for mail merge data source definition purposes. It's just loaded / saved from ODF at the moment, it's not yet used for anything. Change-Id: Ida366478fd83aa51e66e958ac09d852332c227c9 diff --git a/sw/inc/swdbdata.hxx b/sw/inc/swdbdata.hxx index 6d91e2b..02ccf68 100644 --- a/sw/inc/swdbdata.hxx +++ b/sw/inc/swdbdata.hxx @@ -28,14 +28,16 @@ struct SwDBData OUString sDataSource; OUString sCommand; //table, query or statement sal_Int32 nCommandType; //com::sun::star::sdb::CommandType + /// Name of the embedded database that's included in the current document. + OUString sEmbeddedName; SwDBData() : nCommandType(0){} void dumpAsXml(struct _xmlTextWriter* pWriter) const; bool operator !=(const SwDBData& rCmp) const - {return rCmp.sDataSource != sDataSource || rCmp.sCommand != sCommand || rCmp.nCommandType != nCommandType;} + {return rCmp.sDataSource != sDataSource || rCmp.sCommand != sCommand || rCmp.nCommandType != nCommandType || rCmp.sEmbeddedName != sEmbeddedName;} bool operator ==(const SwDBData& rCmp) const - {return rCmp.sDataSource == sDataSource && rCmp.sCommand == sCommand && rCmp.nCommandType == nCommandType;} + {return rCmp.sDataSource == sDataSource && rCmp.sCommand == sCommand && rCmp.nCommandType == nCommandType && rCmp.sEmbeddedName == sEmbeddedName;} }; #endif diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index c900a08..5e41a85 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1957,6 +1957,7 @@ void SwDBData::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sDataSource"), BAD_CAST(sDataSource.toUtf8().getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sCommand"), BAD_CAST(sCommand.toUtf8().getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nCommandType"), BAD_CAST(OString::number(nCommandType).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sEmbeddedName"), BAD_CAST(sEmbeddedName.toUtf8().getStr())); xmlTextWriterEndElement(pWriter); } diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index eb806ed..08ab57c 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1159,6 +1159,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC const PropertyValue* currentDatabaseDataSource = NULL; const PropertyValue* currentDatabaseCommand = NULL; const PropertyValue* currentDatabaseCommandType = NULL; + const PropertyValue* embeddedDatabaseName = 0; while( nCount-- ) { @@ -1189,6 +1190,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC currentDatabaseCommand = pValues; else if( pValues->Name == "CurrentDatabaseCommandType" ) currentDatabaseCommandType = pValues; + else if (pValues->Name == "EmbeddedDatabaseName") + embeddedDatabaseName = pValues; else xProps->setPropertyValue( pValues->Name, pValues->Value ); @@ -1263,6 +1266,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC xProps->setPropertyValue( currentDatabaseCommand->Name, currentDatabaseCommand->Value ); if( currentDatabaseCommandType != NULL ) xProps->setPropertyValue( currentDatabaseCommandType->Name, currentDatabaseCommandType->Value ); + if (embeddedDatabaseName) + xProps->setPropertyValue(embeddedDatabaseName->Name, embeddedDatabaseName->Value); } catch( Exception& ) { OSL_FAIL( "SwXMLImport::SetConfigurationSettings: Exception!" ); diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index 7d222ae..f57cf50 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -72,6 +72,7 @@ enum SwDocumentSettingsPropertyHandles HANDLE_CURRENT_DATABASE_DATA_SOURCE, HANDLE_CURRENT_DATABASE_COMMAND, HANDLE_CURRENT_DATABASE_COMMAND_TYPE, + HANDLE_EMBEDDED_DATABASE_NAME, HANDLE_SAVE_VERSION_ON_CLOSE, HANDLE_IS_GRID_VISIBLE, HANDLE_IS_SNAP_TO_GRID, @@ -151,6 +152,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo() { OUString("CurrentDatabaseDataSource"), HANDLE_CURRENT_DATABASE_DATA_SOURCE, cppu::UnoType<OUString>::get(), 0, 0}, { OUString("CurrentDatabaseCommand"), HANDLE_CURRENT_DATABASE_COMMAND, cppu::UnoType<OUString>::get(), 0, 0}, { OUString("CurrentDatabaseCommandType"), HANDLE_CURRENT_DATABASE_COMMAND_TYPE, cppu::UnoType<sal_Int32>::get(), 0, 0}, + { OUString("EmbeddedDatabaseName"), HANDLE_EMBEDDED_DATABASE_NAME, cppu::UnoType<OUString>::get(), 0, 0}, { OUString("SaveVersionOnClose"), HANDLE_SAVE_VERSION_ON_CLOSE, cppu::UnoType<bool>::get(), 0, 0}, { OUString("UpdateFromTemplate"), HANDLE_UPDATE_FROM_TEMPLATE, cppu::UnoType<bool>::get(), 0, 0}, @@ -504,6 +506,13 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseCommand\"" ); } break; + case HANDLE_EMBEDDED_DATABASE_NAME: + { + SwDBData aData = mpDoc->GetDBData(); + if (rValue >>= aData.sEmbeddedName) + mpDoc->ChgDBData(aData); + } + break; case HANDLE_SAVE_VERSION_ON_CLOSE: { mpDocSh->SetSaveVersionOnClose( *static_cast<sal_Bool const *>(rValue.getValue()) ); @@ -977,6 +986,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf rValue <<= rData.nCommandType; } break; + case HANDLE_EMBEDDED_DATABASE_NAME: + { + const SwDBData& rData = mpDoc->GetDBDesc(); + rValue <<= rData.sEmbeddedName; + } + break; case HANDLE_SAVE_VERSION_ON_CLOSE: { rValue <<= mpDocSh->IsSaveVersionOnClose(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits