fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dbaccess / source / ui / querydesign / QueryTabWinUndoAct.cxx
blobd898780b9d48910dda9ff44b810c1735199f2224
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 .
20 #include "QueryTabWinUndoAct.hxx"
21 #include <osl/diagnose.h>
22 #include "QTableWindow.hxx"
23 #include "QTableWindowData.hxx"
24 #include "TableConnection.hxx"
25 #include "TableConnectionData.hxx"
26 #include "QueryDesignFieldUndoAct.hxx"
27 #include "QueryTableView.hxx"
29 using namespace dbaui;
30 OQueryDesignFieldUndoAct::OQueryDesignFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, sal_uInt16 nCommentID)
31 : OCommentUndoAction(nCommentID)
32 , pOwner(pSelBrwBox)
33 , m_nColumnPostion(BROWSER_INVALIDID)
37 OQueryDesignFieldUndoAct::~OQueryDesignFieldUndoAct()
39 pOwner = NULL;
42 OQueryTabWinUndoAct::OQueryTabWinUndoAct(OQueryTableView* pOwner, sal_uInt16 nCommentID)
43 : OQueryDesignUndoAction(pOwner, nCommentID)
44 , m_pTabWin(NULL)
45 , m_bOwnerOfObjects(false)
49 OQueryTabWinUndoAct::~OQueryTabWinUndoAct()
51 if (m_bOwnerOfObjects)
53 // I should take care to delete the window if I am the only owner
54 OSL_ENSURE(m_pTabWin != nullptr, "OQueryTabWinUndoAct::~OQueryTabWinUndoAct() : m_pTabWin sollte nicht NULL sein");
55 OSL_ENSURE(!m_pTabWin->IsVisible(), "OQueryTabWinUndoAct::~OQueryTabWinUndoAct() : *m_pTabWin sollte nicht sichtbar sein");
57 if ( m_pTabWin )
58 m_pTabWin->clearListBox();
59 m_pTabWin.disposeAndClear();
61 // and of course the corresponding connections
62 auto aIter = m_vTableConnection.begin();
63 auto aEnd = m_vTableConnection.end();
64 for(;aIter != aEnd;++aIter)
66 m_pOwner->DeselectConn(*aIter);
67 aIter->disposeAndClear();
69 m_vTableConnection.clear();
73 void OTabFieldCellModifiedUndoAct::Undo()
75 pOwner->EnterUndoMode();
76 OSL_ENSURE(m_nColumnPostion != BROWSER_INVALIDID,"Column position was not set add the undo action!");
77 OSL_ENSURE(m_nColumnPostion < pOwner->GetColumnCount(),"Position outside the column count!");
78 if ( m_nColumnPostion != BROWSER_INVALIDID )
80 sal_uInt16 nColumnId = pOwner->GetColumnId(m_nColumnPostion);
81 OUString strNext = pOwner->GetCellContents(m_nCellIndex, nColumnId);
82 pOwner->SetCellContents(m_nCellIndex, nColumnId, m_strNextCellContents);
83 m_strNextCellContents = strNext;
85 pOwner->LeaveUndoMode();
88 void OTabFieldSizedUndoAct::Undo()
90 pOwner->EnterUndoMode();
91 OSL_ENSURE(m_nColumnPostion != BROWSER_INVALIDID,"Column position was not set add the undo action!");
92 if ( m_nColumnPostion != BROWSER_INVALIDID )
94 sal_uInt16 nColumnId = pOwner->GetColumnId(m_nColumnPostion);
95 long nNextWidth = pOwner->GetColumnWidth(nColumnId);
96 pOwner->SetColWidth(nColumnId, m_nNextWidth);
97 m_nNextWidth = nNextWidth;
99 pOwner->LeaveUndoMode();
102 void OTabFieldMovedUndoAct::Undo()
104 pOwner->EnterUndoMode();
105 OSL_ENSURE(m_nColumnPostion != BROWSER_INVALIDID,"Column position was not set add the undo action!");
106 if ( m_nColumnPostion != BROWSER_INVALIDID )
108 sal_uInt16 nId = pDescr->GetColumnId();
109 sal_uInt16 nOldPos = pOwner->GetColumnPos(nId);
110 pOwner->SetColumnPos(nId,m_nColumnPostion);
111 pOwner->ColumnMoved(nId,false);
112 m_nColumnPostion = nOldPos;
114 pOwner->LeaveUndoMode();
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */