Branch data Line data Source code
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 : : #ifndef DBAUI_QUERYDESIGNFIELDUNDOACT_HXX
20 : : #define DBAUI_QUERYDESIGNFIELDUNDOACT_HXX
21 : :
22 : : #include "GeneralUndo.hxx"
23 : : #include "dbu_qry.hrc"
24 : : #include "SelectionBrowseBox.hxx"
25 : :
26 : :
27 : : namespace dbaui
28 : : {
29 : : // ================================================================================================
30 : : // OQueryDesignFieldUndoAct - Basisklasse fuer Undos in der Feldauflistung im Abfrageentwurf
31 : :
32 : :
33 : : class OQueryDesignFieldUndoAct : public OCommentUndoAction
34 : : {
35 : : protected:
36 : : OSelectionBrowseBox* pOwner;
37 : : sal_uInt16 m_nColumnPostion;
38 : :
39 : : virtual void Undo() = 0;
40 : : virtual void Redo() = 0;
41 : :
42 : : public:
43 : : OQueryDesignFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, sal_uInt16 nCommentID);
44 : : virtual ~OQueryDesignFieldUndoAct();
45 : :
46 : 0 : inline void SetColumnPosition(sal_uInt16 _nColumnPostion)
47 : : {
48 : 0 : m_nColumnPostion = _nColumnPostion;
49 : : OSL_ENSURE(m_nColumnPostion != BROWSER_INVALIDID,"Column position was not set add the undo action!");
50 : : OSL_ENSURE(m_nColumnPostion < pOwner->GetColumnCount(),"Position outside the column count!");
51 : 0 : }
52 : : };
53 : :
54 : : // ================================================================================================
55 : : // OTabFieldCellModifiedUndoAct - Undo-Klasse fuer Aendern einer Zelle einer Spaltenbeschreibung
56 : :
57 [ # # ][ # # ]: 0 : class OTabFieldCellModifiedUndoAct : public OQueryDesignFieldUndoAct
58 : : {
59 : : protected:
60 : : String m_strNextCellContents;
61 : : sal_Int32 m_nCellIndex;
62 : :
63 : : public:
64 : 0 : OTabFieldCellModifiedUndoAct(OSelectionBrowseBox* pSelBrwBox)
65 : : : OQueryDesignFieldUndoAct(pSelBrwBox, STR_QUERY_UNDO_MODIFY_CELL)
66 [ # # ]: 0 : ,m_nCellIndex(BROWSER_INVALIDID){ }
67 : :
68 : 0 : inline void SetCellContents(const String& str) { m_strNextCellContents = str; }
69 : 0 : inline void SetCellIndex(sal_Int32 nIndex) { m_nCellIndex = nIndex; }
70 : :
71 : : virtual void Undo();
72 : 0 : virtual void Redo() { Undo(); }
73 : : };
74 : :
75 : : // ================================================================================================
76 : : // OTabFieldSizedUndoAct - Undo-Klasse fuer Aendern einer Spaltenbreite
77 : :
78 [ # # ]: 0 : class OTabFieldSizedUndoAct : public OQueryDesignFieldUndoAct
79 : : {
80 : : protected:
81 : : long m_nNextWidth;
82 : :
83 : : public:
84 : 0 : OTabFieldSizedUndoAct(OSelectionBrowseBox* pSelBrwBox) : OQueryDesignFieldUndoAct(pSelBrwBox, STR_QUERY_UNDO_SIZE_COLUMN), m_nNextWidth(0) { }
85 : :
86 : 0 : inline void SetOriginalWidth(long nWidth) { m_nNextWidth = nWidth; }
87 : :
88 : : virtual void Undo();
89 : 0 : virtual void Redo() { Undo(); }
90 : : };
91 : :
92 : : // ================================================================================================
93 : : // OTabFieldUndoAct - Basisklasse fuer Undos in der Feldauflistung im Abfrageentwurf, die mit Veraendern einer kompletten Feldbeschreibung zu tun haben
94 : :
95 [ # # ][ # # ]: 0 : class OTabFieldUndoAct : public OQueryDesignFieldUndoAct
96 : : {
97 : : protected:
98 : : OTableFieldDescRef pDescr; // geloeschte Spaltenbeschreibung
99 : :
100 : : public:
101 : 0 : OTabFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, sal_uInt16 nCommentID) : OQueryDesignFieldUndoAct(pSelBrwBox, nCommentID) { }
102 : :
103 : 0 : void SetTabFieldDescr(OTableFieldDescRef pDescription) { pDescr = pDescription; }
104 : : };
105 : :
106 : : // ================================================================================================
107 : : // OTabFieldDelUndoAct - Undo-Klasse fuer Loeschen eines Feldes
108 : :
109 [ # # ]: 0 : class OTabFieldDelUndoAct : public OTabFieldUndoAct
110 : : {
111 : : protected:
112 [ # # ]: 0 : virtual void Undo() { pOwner->EnterUndoMode();pOwner->InsertColumn(pDescr, m_nColumnPostion);pOwner->LeaveUndoMode(); }
113 : 0 : virtual void Redo() { pOwner->EnterUndoMode();pOwner->RemoveColumn(pDescr->GetColumnId());pOwner->LeaveUndoMode(); }
114 : :
115 : : public:
116 : 0 : OTabFieldDelUndoAct(OSelectionBrowseBox* pSelBrwBox) : OTabFieldUndoAct(pSelBrwBox, STR_QUERY_UNDO_TABFIELDDELETE) { }
117 : : };
118 : :
119 : : // ================================================================================================
120 : : // OTabFieldDelUndoAct - Undo-Klasse fuer Anlegen eines Feldes
121 : :
122 [ # # ]: 0 : class OTabFieldCreateUndoAct : public OTabFieldUndoAct
123 : : {
124 : : protected:
125 : 0 : virtual void Undo() { pOwner->EnterUndoMode();pOwner->RemoveColumn(pDescr->GetColumnId());pOwner->LeaveUndoMode();}
126 [ # # ]: 0 : virtual void Redo() { pOwner->EnterUndoMode();pOwner->InsertColumn(pDescr, m_nColumnPostion);pOwner->LeaveUndoMode();}
127 : :
128 : : public:
129 : 0 : OTabFieldCreateUndoAct(OSelectionBrowseBox* pSelBrwBox) : OTabFieldUndoAct(pSelBrwBox, STR_QUERY_UNDO_TABFIELDCREATE) { }
130 : : };
131 : :
132 : : // ================================================================================================
133 : : // OTabFieldMovedUndoAct - Undo-class when a field was moved inside the selection
134 : :
135 [ # # ]: 0 : class OTabFieldMovedUndoAct : public OTabFieldUndoAct
136 : : {
137 : : protected:
138 : : virtual void Undo();
139 : 0 : virtual void Redo()
140 : : {
141 : 0 : Undo();
142 : 0 : }
143 : :
144 : : public:
145 : 0 : OTabFieldMovedUndoAct(OSelectionBrowseBox* pSelBrwBox) : OTabFieldUndoAct(pSelBrwBox, STR_QUERY_UNDO_TABFIELDMOVED) { }
146 : : };
147 : : }
148 : : #endif // DBAUI_QUERYDESIGNFIELDUNDOACT_HXX
149 : :
150 : :
151 : :
152 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|