25 #include <com/sun/star/sdb/CommandType.hpp>
26 #include <com/sun/star/sdbc/XDataSource.hpp>
27 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
44 using namespace ::
svx;
67 OUString sSourceArg, sCommandArg;
68 sal_Int32 nCommandTypeArg = 0;
80 Sequence<Any> aSelection;
101 if ( pConnectionItem )
104 if ( !xConnection.is() )
110 if(!xConnection.is())
114 Reference<XResultSet> xCursor;
123 if(pSourceItem && pCommandItem && pCommandTypeItem)
144 bool bDisposeResultSet =
false;
149 bDisposeResultSet = xCursor.is();
152 ODataAccessDescriptor aDescriptor;
153 aDescriptor.setDataSource(sSourceArg);
154 aDescriptor[DataAccessDescriptorProperty::Command] <<= sCommandArg;
155 aDescriptor[DataAccessDescriptorProperty::Cursor] <<= xCursor;
156 aDescriptor[DataAccessDescriptorProperty::Selection] <<= aSelection;
157 aDescriptor[DataAccessDescriptorProperty::CommandType] <<= nCommandTypeArg;
160 pDBManager->
Merge(aMergeDesc);
162 if ( bDisposeResultSet )
163 ::comphelper::disposeComponent(xCursor);
175 OUString sColumnName;
178 OUString sDBName = sSourceArg + OUStringChar(
DB_DELIM)
179 + sCommandArg + OUStringChar(
DB_DELIM)
180 + OUString::number(nCommandTypeArg)
181 + OUStringChar(
DB_DELIM) + sColumnName;
191 uno::Reference< XDispatchRecorder > xRecorder =
193 if ( xRecorder.is() )
207 OSL_ENSURE(
false,
"wrong dispatcher");
217 bool bDispose =
false;
218 Reference< sdbc::XConnection> xConnection = pDBStruct->
xConnection;
221 if(xConnection.is() && !xSource.is())
224 if ( !xConnection.is() )
226 SwView &rSwView = GetView();
231 Reference< XColumnsSupplier> xColSupp;
246 if(
RET_OK == pDlg->Execute() )
248 Reference <XResultSet> xResSet = pDBStruct->
xCursor;
249 pDlg->DataToDoc( pDBStruct->
aSelection, xSource, xConnection, xResSet);
253 ::comphelper::disposeComponent(xConnection);
SfxViewFrame * GetViewFrame() const
#define LINK(Instance, Class, Member)
#define FN_DB_CONNECTION_ANY
#define FN_DB_DATA_SOURCE_ANY
css::uno::Any m_aDBColumn
void ExecDB(SfxRequest const &)
static css::uno::Reference< css::sdbcx::XColumnsSupplier > GetColumnSupplier(css::uno::Reference< css::sdbc::XConnection > const &xConnection, const OUString &rTableOrQuery, SwDBSelect eTableOrQuery=SwDBSelect::UNKNOWN)
SwWrtShell * GetShellPtr()
Sequence< Any > aSelection
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
#define FN_DB_DATA_COMMAND_ANY
void Done(bool bRemove=false)
const SfxItemSet * GetArgs() const
bool InsertField(const SwInsertField_Data &rData)
#define FN_QRY_MERGE_FIELD
Reference< XConnection > xConnection
css::uno::Any m_aDBConnection
static css::uno::Reference< css::sdbc::XResultSet > createCursor(const OUString &_sDataSourceName, const OUString &_sCommand, sal_Int32 _nCommandType, const css::uno::Reference< css::sdbc::XConnection > &_xConnection, const SwView *pView)
creates a RowSet, which must be disposed after use.
static css::uno::Reference< css::sdbc::XDataSource > getDataSourceAsParent(const css::uno::Reference< css::sdbc::XConnection > &_xConnection, const OUString &_sDataSourceName)
try to get the data source from the given connection through the XChild interface.
constexpr OUStringLiteral aData
bool Merge(const SwMergeDescriptor &rMergeDesc)
Merging of data records into fields.
SwDBManager * GetDBManager() const
For evaluation of DB fields (new DB-manager).
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SfxBindings & GetBindings()
static css::uno::Reference< css::sdbc::XConnection > GetConnection(const OUString &rDataSource, css::uno::Reference< css::sdbc::XDataSource > &rxSource, const SwView *pView)
static SwAbstractDialogFactory * Create()
#define FN_DB_DATA_CURSOR_ANY
#define FN_INSERT_DBFIELD
#define FN_QRY_INSERT_FIELD
#define FN_DB_DATA_COLUMN_NAME_ANY
#define FN_DB_DATA_SELECTION_ANY
sal_uInt16 GetSlot() const
const css::uno::Reference< css::frame::XDispatchRecorder > & GetRecorder() const
#define FN_DB_DATA_COMMAND_TYPE_ANY
IMPL_LINK(SwBaseShell, InsertDBTextHdl, void *, p, void)
#define FN_PARAM_FIELD_TYPE
virtual VclPtr< AbstractSwInsertDBColAutoPilot > CreateSwInsertDBColAutoPilot(SwView &rView, css::uno::Reference< css::sdbc::XDataSource > rxSource, css::uno::Reference< css::sdbcx::XColumnsSupplier > xColSupp, const SwDBData &rData)=0
void AppendItem(const SfxPoolItem &)
Reference< XResultSet > xCursor