1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: QueryDesignFieldUndoAct.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef DBAUI_QUERYDESIGNFIELDUNDOACT_HXX
31 #define DBAUI_QUERYDESIGNFIELDUNDOACT_HXX
33 #ifndef DBAUI_GENERALUNDO_HXX
34 #include "GeneralUndo.hxx"
37 #include "dbu_qry.hrc"
39 #ifndef DBAUI_QUERYDESIGN_OSELECTIONBROWSEBOX_HXX
40 #include "SelectionBrowseBox.hxx"
46 // ================================================================================================
47 // OQueryDesignFieldUndoAct - Basisklasse fuer Undos in der Feldauflistung im Abfrageentwurf
50 class OQueryDesignFieldUndoAct
: public OCommentUndoAction
53 OSelectionBrowseBox
* pOwner
;
54 USHORT m_nColumnPostion
;
56 virtual void Undo() = 0;
57 virtual void Redo() = 0;
60 OQueryDesignFieldUndoAct(OSelectionBrowseBox
* pSelBrwBox
, USHORT nCommentID
);
61 virtual ~OQueryDesignFieldUndoAct();
63 inline void SetColumnPosition(USHORT _nColumnPostion
)
65 m_nColumnPostion
= _nColumnPostion
;
66 OSL_ENSURE(m_nColumnPostion
!= BROWSER_INVALIDID
,"Column position was not set add the undo action!");
67 OSL_ENSURE(m_nColumnPostion
< pOwner
->GetColumnCount(),"Position outside the column count!");
71 // ================================================================================================
72 // OTabFieldCellModifiedUndoAct - Undo-Klasse fuer Aendern einer Zelle einer Spaltenbeschreibung
74 class OTabFieldCellModifiedUndoAct
: public OQueryDesignFieldUndoAct
77 String m_strNextCellContents
;
78 sal_Int32 m_nCellIndex
;
81 OTabFieldCellModifiedUndoAct(OSelectionBrowseBox
* pSelBrwBox
)
82 : OQueryDesignFieldUndoAct(pSelBrwBox
, STR_QUERY_UNDO_MODIFY_CELL
)
83 ,m_nCellIndex(BROWSER_INVALIDID
){ }
85 inline void SetCellContents(const String
& str
) { m_strNextCellContents
= str
; }
86 inline void SetCellIndex(sal_Int32 nIndex
) { m_nCellIndex
= nIndex
; }
89 virtual void Redo() { Undo(); }
92 // ================================================================================================
93 // OTabFieldSizedUndoAct - Undo-Klasse fuer Aendern einer Spaltenbreite
95 class OTabFieldSizedUndoAct
: public OQueryDesignFieldUndoAct
101 OTabFieldSizedUndoAct(OSelectionBrowseBox
* pSelBrwBox
) : OQueryDesignFieldUndoAct(pSelBrwBox
, STR_QUERY_UNDO_SIZE_COLUMN
), m_nNextWidth(0) { }
103 inline void SetOriginalWidth(long nWidth
) { m_nNextWidth
= nWidth
; }
106 virtual void Redo() { Undo(); }
109 // ================================================================================================
110 // OTabFieldUndoAct - Basisklasse fuer Undos in der Feldauflistung im Abfrageentwurf, die mit Veraendern einer kompletten Feldbeschreibung zu tun haben
112 class OTabFieldUndoAct
: public OQueryDesignFieldUndoAct
115 OTableFieldDescRef pDescr
; // geloeschte Spaltenbeschreibung
118 OTabFieldUndoAct(OSelectionBrowseBox
* pSelBrwBox
, USHORT nCommentID
) : OQueryDesignFieldUndoAct(pSelBrwBox
, nCommentID
) { }
120 void SetTabFieldDescr(OTableFieldDescRef pDescription
) { pDescr
= pDescription
; }
123 // ================================================================================================
124 // OTabFieldDelUndoAct - Undo-Klasse fuer Loeschen eines Feldes
126 class OTabFieldDelUndoAct
: public OTabFieldUndoAct
129 virtual void Undo() { pOwner
->EnterUndoMode();pOwner
->InsertColumn(pDescr
, m_nColumnPostion
);pOwner
->LeaveUndoMode(); }
130 virtual void Redo() { pOwner
->EnterUndoMode();pOwner
->RemoveColumn(pDescr
->GetColumnId());pOwner
->LeaveUndoMode(); }
133 OTabFieldDelUndoAct(OSelectionBrowseBox
* pSelBrwBox
) : OTabFieldUndoAct(pSelBrwBox
, STR_QUERY_UNDO_TABFIELDDELETE
) { }
136 // ================================================================================================
137 // OTabFieldDelUndoAct - Undo-Klasse fuer Anlegen eines Feldes
139 class OTabFieldCreateUndoAct
: public OTabFieldUndoAct
142 virtual void Undo() { pOwner
->EnterUndoMode();pOwner
->RemoveColumn(pDescr
->GetColumnId());pOwner
->LeaveUndoMode();}
143 virtual void Redo() { pOwner
->EnterUndoMode();pOwner
->InsertColumn(pDescr
, m_nColumnPostion
);pOwner
->LeaveUndoMode();}
146 OTabFieldCreateUndoAct(OSelectionBrowseBox
* pSelBrwBox
) : OTabFieldUndoAct(pSelBrwBox
, STR_QUERY_UNDO_TABFIELDCREATE
) { }
149 // ================================================================================================
150 // OTabFieldMovedUndoAct - Undo-class when a field was moved inside the selection
152 class OTabFieldMovedUndoAct
: public OTabFieldUndoAct
162 OTabFieldMovedUndoAct(OSelectionBrowseBox
* pSelBrwBox
) : OTabFieldUndoAct(pSelBrwBox
, STR_QUERY_UNDO_TABFIELDMOVED
) { }
165 #endif // DBAUI_QUERYDESIGNFIELDUNDOACT_HXX