tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / dbaccess / source / ui / inc / TableConnectionData.hxx
blob096a6de70ad3e21446bda92aae42e22b603de22f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #pragma once
21 #include "ConnectionLineData.hxx"
22 #include "TableWindowData.hxx"
23 #include <vector>
24 #include <memory>
26 namespace dbaui
28 //===========================================//
29 // ConnData ---------->* ConnLineData //
30 // ^1 ^1 //
31 // | | //
32 // Conn ---------->* ConnLine //
33 //===========================================//
35 /** Contains all connection data which exists between two windows */
36 class OTableConnectionData
38 protected:
39 TTableWindowData::value_type m_pReferencingTable;
40 TTableWindowData::value_type m_pReferencedTable;
41 OUString m_aConnName;
43 OConnectionLineDataVec m_vConnLineData;
45 void Init();
47 OTableConnectionData& operator=( const OTableConnectionData& rConnData );
48 public:
49 OTableConnectionData();
50 OTableConnectionData( TTableWindowData::value_type _aReferencingTable,
51 TTableWindowData::value_type _aReferencedTable );
52 OTableConnectionData( const OTableConnectionData& rConnData );
53 virtual ~OTableConnectionData();
55 /// initialise from a source (more comfortable than a virtual assignment operator)
56 virtual void CopyFrom(const OTableConnectionData& rSource);
58 /** deliver a new instance of my own type
60 derived classes have to deliver an instance of their own type
62 @note does NOT have to be initialised
64 virtual std::shared_ptr<OTableConnectionData> NewInstance() const;
66 void SetConnLine( sal_uInt16 nIndex, const OUString& rSourceFieldName, const OUString& rDestFieldName );
67 bool AppendConnLine( const OUString& rSourceFieldName, const OUString& rDestFieldName );
68 /** Deletes list of ConnLines
70 void ResetConnLines();
72 /** moves the empty lines to the back
73 removes duplicated empty lines
75 caller is responsible for repainting them
77 @return index of first changed line, or one-past-the-end if no change
79 OConnectionLineDataVec::size_type normalizeLines();
81 const OConnectionLineDataVec& GetConnLineDataList() const { return m_vConnLineData; }
82 OConnectionLineDataVec& GetConnLineDataList() { return m_vConnLineData; }
84 const TTableWindowData::value_type& getReferencingTable() const { return m_pReferencingTable; }
85 const TTableWindowData::value_type& getReferencedTable() const { return m_pReferencedTable; }
87 void setReferencingTable(const TTableWindowData::value_type& _pTable) { m_pReferencingTable = _pTable; }
88 void setReferencedTable(const TTableWindowData::value_type& _pTable) { m_pReferencedTable = _pTable; }
90 /** Update create a new connection
92 @return true if successful
94 virtual bool Update(){ return true; }
97 typedef std::vector< std::shared_ptr<OTableConnectionData> > TTableConnectionData;
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */