LibreOffice Module dbaccess (master) 1
WTypeSelect.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#pragma once
20
21#include "FieldDescControl.hxx"
22#include "TypeInfo.hxx"
23#include "WTabPage.hxx"
24
25class SvStream;
26
27namespace dbaui
28{
29 class OWizTypeSelect;
30 class OTableDesignHelpBar;
31 // OWizTypeSelectControl
33 {
35 virtual void ActivateAggregate( EControlType eType ) override;
36 virtual void DeactivateAggregate( EControlType eType ) override;
37
38 virtual void CellModified(sal_Int32 nRow, sal_uInt16 nColId ) override;
39
40 virtual css::lang::Locale GetLocale() const override;
41 virtual css::uno::Reference< css::util::XNumberFormatter > GetFormatter() const override;
42 virtual TOTypeInfoSP getTypeInfo(sal_Int32 _nPos) override;
43 virtual const OTypeInfoMap* getTypeInfo() const override;
44 virtual bool isAutoIncrementValueEnabled() const override;
45 virtual OUString getAutoIncrementValue() const override;
46
47 public:
49 virtual ~OWizTypeSelectControl() override;
50
51 virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() override;
52 virtual css::uno::Reference< css::sdbc::XConnection> getConnection() override;
53 };
54
55 // Wizard Page: OWizTypeSelectList
56 // just defines the css::ucb::Command for the Contextmenu
58 {
59 std::unique_ptr<weld::TreeView> m_xControl;
60 bool m_bPKey;
61 bool IsPrimaryKeyAllowed() const;
62 void setPrimaryKey( OFieldDescription* _pFieldDescr,
63 sal_uInt16 _nPos,
64 bool _bSet = false);
65
66 DECL_LINK(CommandHdl, const CommandEvent&, bool);
67
69
70 public:
71 OWizTypeSelectList(std::unique_ptr<weld::TreeView> xControl);
72 void SetPKey(bool bPKey) { m_bPKey = bPKey; }
73 weld::TreeView* GetWidget() { return m_xControl.get(); }
74 OUString get_selected_id() const { return m_xControl->get_selected_id(); }
75 void clear() { m_xControl->clear(); }
76 void append(const OUString& rId, const OUString& rStr)
77 {
78 m_xControl->append(rId, rStr);
79 }
80 void set_image(int nRow, const OUString& rImage)
81 {
82 m_xControl->set_image(nRow, rImage);
83 }
84 void set_selection_mode(SelectionMode eMode) { m_xControl->set_selection_mode(eMode); }
85 int count_selected_rows() const { return m_xControl->count_selected_rows(); }
86 void select(int pos) { m_xControl->select(pos); }
88 {
89 m_aChangeHdl = rLink;
90 m_xControl->connect_changed(rLink);
91 }
92 };
93
94 // Wizard Page: OWizTypeSelect
95 // Serves as base class for different copy properties.
96 // Calls FillColumnList, when button AUTO is triggered
98 {
100 friend class OWizTypeSelectList;
101
102 DECL_LINK( ColumnSelectHdl, weld::TreeView&, void );
103 DECL_LINK( ButtonClickHdl, weld::Button&, void );
104 protected:
105 std::unique_ptr<OWizTypeSelectList> m_xColumnNames;
106 std::unique_ptr<weld::Container> m_xControlContainer;
107 std::unique_ptr<OWizTypeSelectControl> m_xTypeControl;
108 std::unique_ptr<weld::Label> m_xAutoType;
109 std::unique_ptr<weld::Label> m_xAutoFt;
110 std::unique_ptr<weld::SpinButton> m_xAutoEt;
111 std::unique_ptr<weld::Button> m_xAutoPb;
112
113 SvStream* m_pParserStream; // stream to read the tokens from or NULL
115 sal_Int32 m_nDisplayRow;
118
119 virtual void createReaderAndCallParser(sal_Int32 _nRows) = 0;
120
121 void EnableAuto(bool bEnable);
122 public:
123 virtual void Reset ( ) override;
124 virtual void Activate( ) override;
125 virtual bool LeavePage() override;
126 virtual OUString GetTitle() const override;
127
128 OWizTypeSelect(weld::Container* pParent, OCopyTableWizard* pWizard, SvStream* pStream = nullptr);
129 virtual ~OWizTypeSelect() override;
130
131 void setDisplayRow(sal_Int32 _nRow) { m_nDisplayRow = _nRow - 1; }
132 void setDuplicateName(bool _bDuplicateName) { m_bDuplicateName = _bDuplicateName; }
133 };
134
135 typedef std::unique_ptr<OWizTypeSelect> (*TypeSelectionPageFactory)(weld::Container*, OCopyTableWizard*, SvStream&);
136}
137
138/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::lang::Locale GetLocale() const override
virtual bool isAutoIncrementValueEnabled() const override
OWizTypeSelectControl(weld::Container *pPage, OWizTypeSelect *pParentTabPage)
Definition: WTypeSelect.cxx:42
virtual TOTypeInfoSP getTypeInfo(sal_Int32 _nPos) override
OWizTypeSelect * m_pParentTabPage
Definition: WTypeSelect.hxx:34
virtual ~OWizTypeSelectControl() override
Definition: WTypeSelect.cxx:48
virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > getMetaData() override
virtual void DeactivateAggregate(EControlType eType) override
Definition: WTypeSelect.cxx:66
virtual css::uno::Reference< css::util::XNumberFormatter > GetFormatter() const override
virtual OUString getAutoIncrementValue() const override
virtual void ActivateAggregate(EControlType eType) override
Definition: WTypeSelect.cxx:52
virtual void CellModified(sal_Int32 nRow, sal_uInt16 nColId) override
Definition: WTypeSelect.cxx:80
virtual const OTypeInfoMap * getTypeInfo() const override
virtual css::uno::Reference< css::sdbc::XConnection > getConnection() override
Link< weld::TreeView &, void > m_aChangeHdl
Definition: WTypeSelect.hxx:68
int count_selected_rows() const
Definition: WTypeSelect.hxx:85
void connect_changed(const Link< weld::TreeView &, void > &rLink)
Definition: WTypeSelect.hxx:87
void append(const OUString &rId, const OUString &rStr)
Definition: WTypeSelect.hxx:76
OWizTypeSelectList(std::unique_ptr< weld::TreeView > xControl)
OUString get_selected_id() const
Definition: WTypeSelect.hxx:74
void set_image(int nRow, const OUString &rImage)
Definition: WTypeSelect.hxx:80
DECL_LINK(CommandHdl, const CommandEvent &, bool)
void setPrimaryKey(OFieldDescription *_pFieldDescr, sal_uInt16 _nPos, bool _bSet=false)
void set_selection_mode(SelectionMode eMode)
Definition: WTypeSelect.hxx:84
std::unique_ptr< weld::TreeView > m_xControl
Definition: WTypeSelect.hxx:59
weld::TreeView * GetWidget()
Definition: WTypeSelect.hxx:73
void SetPKey(bool bPKey)
Definition: WTypeSelect.hxx:72
bool IsPrimaryKeyAllowed() const
std::unique_ptr< weld::Label > m_xAutoType
std::unique_ptr< OWizTypeSelectControl > m_xTypeControl
void setDuplicateName(bool _bDuplicateName)
virtual void Reset() override
std::unique_ptr< weld::Label > m_xAutoFt
std::unique_ptr< weld::SpinButton > m_xAutoEt
SvStream * m_pParserStream
std::unique_ptr< weld::Container > m_xControlContainer
DECL_LINK(ButtonClickHdl, weld::Button &, void)
void setDisplayRow(sal_Int32 _nRow)
OWizTypeSelect(weld::Container *pParent, OCopyTableWizard *pWizard, SvStream *pStream=nullptr)
DECL_LINK(ColumnSelectHdl, weld::TreeView &, void)
void EnableAuto(bool bEnable)
OUString m_sAutoIncrementValue
virtual ~OWizTypeSelect() override
std::unique_ptr< weld::Button > m_xAutoPb
virtual void createReaderAndCallParser(sal_Int32 _nRows)=0
std::unique_ptr< OWizTypeSelectList > m_xColumnNames
virtual void Activate() override
virtual OUString GetTitle() const override
virtual bool LeavePage() override
OUString eType
Definition: generalpage.cxx:78
Mode eMode
std::unique_ptr< OWizTypeSelect >(* TypeSelectionPageFactory)(weld::Container *, OCopyTableWizard *, SvStream &)
std::multimap< sal_Int32, TOTypeInfoSP > OTypeInfoMap
Definition: TypeInfo.hxx:100
std::shared_ptr< OTypeInfo > TOTypeInfoSP
Definition: TypeInfo.hxx:99
EControlType
Definition: QEnumTypes.hxx:63
SelectionMode
size_t pos