1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "QueryTextView.hxx"
21 #include "querycontainerwindow.hxx"
22 #include "QueryViewSwitch.hxx"
23 #include "sqledit.hxx"
24 #include "undosqledit.hxx"
25 #include "browserids.hxx"
26 #include "querycontroller.hxx"
27 #include "dbu_qry.hrc"
28 #include "dbustrings.hrc"
29 #include <toolkit/helper/vclunohelper.hxx>
30 #include <vcl/split.hxx>
31 #include <vcl/svapp.hxx>
32 #include <comphelper/types.hxx>
33 #include "QueryDesignView.hxx"
34 #include <boost/scoped_ptr.hpp>
36 using namespace dbaui
;
37 using namespace ::com::sun::star::uno
;
38 using namespace ::com::sun::star::lang
;
39 using namespace ::com::sun::star::frame
;
41 // end of temp classes
42 OQueryTextView::OQueryTextView(OQueryContainerWindow
* _pParent
)
45 m_pEdit
= VclPtr
<OSqlEdit
>::Create(this);
46 m_pEdit
->SetRightToLeft(false);
47 m_pEdit
->ClearModifyFlag();
49 m_pEdit
->SetPosPixel( Point( 0, 0 ) );
53 OQueryTextView::~OQueryTextView()
58 void OQueryTextView::dispose()
60 m_pEdit
.disposeAndClear();
61 vcl::Window::dispose();
64 void OQueryTextView::GetFocus()
70 void OQueryTextView::Resize()
73 m_pEdit
->SetSizePixel( GetOutputSizePixel() );
76 OUString
OQueryTextView::getStatement()
78 return m_pEdit
->GetText();
81 void OQueryTextView::clear()
83 OSqlEditUndoAct
* pUndoAct
= new OSqlEditUndoAct( m_pEdit
);
85 pUndoAct
->SetOriginalText( m_pEdit
->GetText() );
86 getContainerWindow()->getDesignView()->getController().addUndoActionAndInvalidate( pUndoAct
);
88 m_pEdit
->SetText(OUString());
91 void OQueryTextView::setStatement(const OUString
& _rsStatement
)
93 m_pEdit
->SetText(_rsStatement
);
96 void OQueryTextView::copy()
98 if(!m_pEdit
->IsInAccelAct() )
102 bool OQueryTextView::isCutAllowed()
104 return !m_pEdit
->GetSelected().isEmpty();
107 void OQueryTextView::cut()
109 if(!m_pEdit
->IsInAccelAct() )
111 getContainerWindow()->getDesignView()->getController().setModified(sal_True
);
114 void OQueryTextView::paste()
116 if(!m_pEdit
->IsInAccelAct() )
118 getContainerWindow()->getDesignView()->getController().setModified(sal_True
);
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */