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
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
......
......@@ -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);
}
......
......@@ -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!" );
......
......@@ -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();
......
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