Kaydet (Commit) 7bd6f298 authored tarafından Miklos Vajna's avatar Miklos Vajna

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
üst 27d94c48
...@@ -28,14 +28,16 @@ struct SwDBData ...@@ -28,14 +28,16 @@ struct SwDBData
OUString sDataSource; OUString sDataSource;
OUString sCommand; //table, query or statement OUString sCommand; //table, query or statement
sal_Int32 nCommandType; //com::sun::star::sdb::CommandType sal_Int32 nCommandType; //com::sun::star::sdb::CommandType
/// Name of the embedded database that's included in the current document.
OUString sEmbeddedName;
SwDBData() : SwDBData() :
nCommandType(0){} nCommandType(0){}
void dumpAsXml(struct _xmlTextWriter* pWriter) const; void dumpAsXml(struct _xmlTextWriter* pWriter) const;
bool operator !=(const SwDBData& rCmp) 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 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 #endif
......
...@@ -1957,6 +1957,7 @@ void SwDBData::dumpAsXml(xmlTextWriterPtr pWriter) const ...@@ -1957,6 +1957,7 @@ void SwDBData::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sDataSource"), BAD_CAST(sDataSource.toUtf8().getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sDataSource"), BAD_CAST(sDataSource.toUtf8().getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sCommand"), BAD_CAST(sCommand.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("nCommandType"), BAD_CAST(OString::number(nCommandType).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sEmbeddedName"), BAD_CAST(sEmbeddedName.toUtf8().getStr()));
xmlTextWriterEndElement(pWriter); xmlTextWriterEndElement(pWriter);
} }
......
...@@ -1159,6 +1159,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC ...@@ -1159,6 +1159,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
const PropertyValue* currentDatabaseDataSource = NULL; const PropertyValue* currentDatabaseDataSource = NULL;
const PropertyValue* currentDatabaseCommand = NULL; const PropertyValue* currentDatabaseCommand = NULL;
const PropertyValue* currentDatabaseCommandType = NULL; const PropertyValue* currentDatabaseCommandType = NULL;
const PropertyValue* embeddedDatabaseName = 0;
while( nCount-- ) while( nCount-- )
{ {
...@@ -1189,6 +1190,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC ...@@ -1189,6 +1190,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
currentDatabaseCommand = pValues; currentDatabaseCommand = pValues;
else if( pValues->Name == "CurrentDatabaseCommandType" ) else if( pValues->Name == "CurrentDatabaseCommandType" )
currentDatabaseCommandType = pValues; currentDatabaseCommandType = pValues;
else if (pValues->Name == "EmbeddedDatabaseName")
embeddedDatabaseName = pValues;
else else
xProps->setPropertyValue( pValues->Name, xProps->setPropertyValue( pValues->Name,
pValues->Value ); pValues->Value );
...@@ -1263,6 +1266,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC ...@@ -1263,6 +1266,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
xProps->setPropertyValue( currentDatabaseCommand->Name, currentDatabaseCommand->Value ); xProps->setPropertyValue( currentDatabaseCommand->Name, currentDatabaseCommand->Value );
if( currentDatabaseCommandType != NULL ) if( currentDatabaseCommandType != NULL )
xProps->setPropertyValue( currentDatabaseCommandType->Name, currentDatabaseCommandType->Value ); xProps->setPropertyValue( currentDatabaseCommandType->Name, currentDatabaseCommandType->Value );
if (embeddedDatabaseName)
xProps->setPropertyValue(embeddedDatabaseName->Name, embeddedDatabaseName->Value);
} catch( Exception& ) } catch( Exception& )
{ {
OSL_FAIL( "SwXMLImport::SetConfigurationSettings: Exception!" ); OSL_FAIL( "SwXMLImport::SetConfigurationSettings: Exception!" );
......
...@@ -72,6 +72,7 @@ enum SwDocumentSettingsPropertyHandles ...@@ -72,6 +72,7 @@ enum SwDocumentSettingsPropertyHandles
HANDLE_CURRENT_DATABASE_DATA_SOURCE, HANDLE_CURRENT_DATABASE_DATA_SOURCE,
HANDLE_CURRENT_DATABASE_COMMAND, HANDLE_CURRENT_DATABASE_COMMAND,
HANDLE_CURRENT_DATABASE_COMMAND_TYPE, HANDLE_CURRENT_DATABASE_COMMAND_TYPE,
HANDLE_EMBEDDED_DATABASE_NAME,
HANDLE_SAVE_VERSION_ON_CLOSE, HANDLE_SAVE_VERSION_ON_CLOSE,
HANDLE_IS_GRID_VISIBLE, HANDLE_IS_GRID_VISIBLE,
HANDLE_IS_SNAP_TO_GRID, HANDLE_IS_SNAP_TO_GRID,
...@@ -151,6 +152,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo() ...@@ -151,6 +152,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
{ OUString("CurrentDatabaseDataSource"), HANDLE_CURRENT_DATABASE_DATA_SOURCE, cppu::UnoType<OUString>::get(), 0, 0}, { 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("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("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("SaveVersionOnClose"), HANDLE_SAVE_VERSION_ON_CLOSE, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("UpdateFromTemplate"), HANDLE_UPDATE_FROM_TEMPLATE, 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 ...@@ -504,6 +506,13 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
"\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseCommand\"" ); "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseCommand\"" );
} }
break; break;
case HANDLE_EMBEDDED_DATABASE_NAME:
{
SwDBData aData = mpDoc->GetDBData();
if (rValue >>= aData.sEmbeddedName)
mpDoc->ChgDBData(aData);
}
break;
case HANDLE_SAVE_VERSION_ON_CLOSE: case HANDLE_SAVE_VERSION_ON_CLOSE:
{ {
mpDocSh->SetSaveVersionOnClose( *static_cast<sal_Bool const *>(rValue.getValue()) ); mpDocSh->SetSaveVersionOnClose( *static_cast<sal_Bool const *>(rValue.getValue()) );
...@@ -977,6 +986,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf ...@@ -977,6 +986,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
rValue <<= rData.nCommandType; rValue <<= rData.nCommandType;
} }
break; break;
case HANDLE_EMBEDDED_DATABASE_NAME:
{
const SwDBData& rData = mpDoc->GetDBDesc();
rValue <<= rData.sEmbeddedName;
}
break;
case HANDLE_SAVE_VERSION_ON_CLOSE: case HANDLE_SAVE_VERSION_ON_CLOSE:
{ {
rValue <<= mpDocSh->IsSaveVersionOnClose(); rValue <<= mpDocSh->IsSaveVersionOnClose();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment