23#include <com/sun/star/uno/Sequence.hxx>
24#include <com/sun/star/beans/PropertyValue.hpp>
25#include <com/sun/star/sdb/DatabaseContext.hpp>
41 static Sequence<OUString> aNames =
43 "CurrentDataSource/DataSourceName",
44 "CurrentDataSource/Command",
45 "CurrentDataSource/CommandType",
50 "ShowColumnAssignmentWarning"
60 , bShowColumnAssignmentWarning(false)
102 for(
int nProp = 0; nProp < aPropertyNames.getLength(); nProp++)
123 for(OUString
const & nodeName : aNodeNames)
125 Sequence<OUString> aHistoryNames(3);
126 OUString* pHistoryNames = aHistoryNames.getArray();
129 pHistoryNames[0] =
sPrefix +
"DataSourceName";
130 pHistoryNames[1] =
sPrefix +
"Command";
131 pHistoryNames[2] =
sPrefix +
"CommandType";
133 Sequence<Any> aHistoryValues =
GetProperties( aHistoryNames );
134 const Any* pHistoryValues = aHistoryValues.getConstArray();
136 if(aHistoryValues.getLength() == aHistoryNames.getLength())
139 pHistoryValues[0] >>=
pMapping->sURL;
140 pHistoryValues[1] >>=
pMapping->sTableName;
141 pHistoryValues[2] >>=
pMapping->nCommandType;
145 Sequence<OUString> aAssignmentPropertyNames(aAssignmentNodeNames.getLength() * 2);
146 OUString* pAssignmentPropertyNames = aAssignmentPropertyNames.getArray();
147 sal_Int16 nFieldIdx = 0;
148 for(OUString
const & assignName : aAssignmentNodeNames)
150 OUString sSubPrefix =
sPrefix +
"/" + assignName;
151 pAssignmentPropertyNames[nFieldIdx] = sSubPrefix;
152 pAssignmentPropertyNames[nFieldIdx++] +=
"/ProgrammaticFieldName";
153 pAssignmentPropertyNames[nFieldIdx] = sSubPrefix;
154 pAssignmentPropertyNames[nFieldIdx++] +=
"/AssignedFieldName";
156 Sequence<Any> aAssignmentValues =
GetProperties(aAssignmentPropertyNames);
157 const Any* pAssignmentValues = aAssignmentValues.getConstArray();
158 OUString sTempLogical;
160 sal_Int16 nSetMapping = 0;
162 for(sal_Int32 nFieldVal = 0; nFieldVal < aAssignmentValues.getLength() / 2; nFieldVal++)
164 pAssignmentValues[nFieldIdx++] >>= sTempLogical;
165 pAssignmentValues[nFieldIdx++] >>= sTempReal;
166 if(!(sTempLogical.isEmpty() || sTempReal.isEmpty()))
168 pMapping->aColumnPairs[nSetMapping].sLogicalColumnName = sTempLogical;
169 pMapping->aColumnPairs[nSetMapping++].sRealColumnName = sTempReal;
213 Sequence< PropertyValue > aNodeValues(
mvMappings.size() * 3);
214 PropertyValue* pNodeValues = aNodeValues.getArray();
217 for(sal_Int32
i = 0; i < static_cast<sal_Int32>(
mvMappings.size());
i++)
230 sal_Int32 nFieldAssignment = 0;
231 OUString sFieldName =
"/ProgrammaticFieldName";
232 OUString sDatabaseFieldName =
"/AssignedFieldName";
236 !
pMapping->aColumnPairs[nFieldAssignment].sLogicalColumnName.isEmpty())
238 OUString sSubPrefix =
sPrefix +
"/_" + OUString::number(nFieldAssignment);
239 Sequence< PropertyValue > aAssignmentValues
252 for(std::unique_ptr<Mapping>
const &
i :
mvMappings)
274 mvMappings.push_back(std::make_unique<Mapping>(*pSetMapping));
290 Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
291 Reference<XDatabaseContext> xDBContext = DatabaseContext::create(xContext);
const PropertyValue * pValues
PropertyValueVector_t aPropertyValues
constexpr OUStringLiteral cDataSourceHistory
const Mapping * GetMapping(const BibDBDescriptor &rDesc) const
OUString aColumnDefaults[COLUMN_COUNT]
static css::uno::Sequence< OUString > const & GetPropertyNames()
void SetMapping(const BibDBDescriptor &rDesc, const Mapping *pMapping)
virtual ~BibConfig() override
virtual void ImplCommit() override
void SetBibliographyURL(const BibDBDescriptor &rDesc)
bool bShowColumnAssignmentWarning
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
BibDBDescriptor GetBibliographyURL()
const css::uno::Sequence< OUString > & GetDataSourceNames()
css::uno::Sequence< OUString > aSourceNames
DBChangeDialogConfig_Impl()
~DBChangeDialogConfig_Impl()
static bool PutProperties(css::uno::Reference< css::container::XHierarchicalNameAccess > const &xHierarchyAccess, const css::uno::Sequence< OUString > &rNames, const css::uno::Sequence< css::uno::Any > &rValues, bool bAllLocales)
static bool SetSetProperties(css::uno::Reference< css::container::XHierarchicalNameAccess > const &xHierarchyAccess, const OUString &rNode, const css::uno::Sequence< css::beans::PropertyValue > &rValues)
static bool ClearNodeSet(css::uno::Reference< css::container::XHierarchicalNameAccess > const &xHierarchyAccess, const OUString &rNode)
static css::uno::Sequence< css::uno::Any > GetProperties(css::uno::Reference< css::container::XHierarchicalNameAccess > const &xHierarchyAccess, const css::uno::Sequence< OUString > &rNames, bool bAllLocales)
static css::uno::Sequence< OUString > GetNodeNames(css::uno::Reference< css::container::XHierarchicalNameAccess > const &xHierarchyAccess, const OUString &rNode, ConfigNameFormat eFormat)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)