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"
35 using namespace dbaui
;
36 using namespace ::com::sun::star::uno
;
37 using namespace ::com::sun::star::lang
;
38 using namespace ::com::sun::star::frame
;
40 // end of temp classes
41 OQueryTextView::OQueryTextView(OQueryContainerWindow
* _pParent
)
44 m_pEdit
= VclPtr
<OSqlEdit
>::Create(this);
45 m_pEdit
->SetRightToLeft(false);
46 m_pEdit
->ClearModifyFlag();
48 m_pEdit
->SetPosPixel( Point( 0, 0 ) );
52 OQueryTextView::~OQueryTextView()
57 void OQueryTextView::dispose()
59 m_pEdit
.disposeAndClear();
60 vcl::Window::dispose();
63 void OQueryTextView::GetFocus()
69 void OQueryTextView::Resize()
72 m_pEdit
->SetSizePixel( GetOutputSizePixel() );
75 OUString
OQueryTextView::getStatement()
77 return m_pEdit
->GetText();
80 void OQueryTextView::clear()
82 OSqlEditUndoAct
* pUndoAct
= new OSqlEditUndoAct( m_pEdit
);
84 pUndoAct
->SetOriginalText( m_pEdit
->GetText() );
85 getContainerWindow()->getDesignView()->getController().addUndoActionAndInvalidate( pUndoAct
);
87 m_pEdit
->SetText(OUString());
90 void OQueryTextView::setStatement(const OUString
& _rsStatement
)
92 m_pEdit
->SetText(_rsStatement
);
95 void OQueryTextView::copy()
97 if(!m_pEdit
->IsInAccelAct() )
101 bool OQueryTextView::isCutAllowed()
103 return !m_pEdit
->GetSelected().isEmpty();
106 void OQueryTextView::cut()
108 if(!m_pEdit
->IsInAccelAct() )
110 getContainerWindow()->getDesignView()->getController().setModified(true);
113 void OQueryTextView::paste()
115 if(!m_pEdit
->IsInAccelAct() )
117 getContainerWindow()->getDesignView()->getController().setModified(true);
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */