24#include <com/sun/star/beans/XMultiPropertySet.hpp>
25#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
26#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
27#include <officecfg/Office/Common.hxx>
47 public cppu::WeakImplHelper< css::beans::XPropertiesChangeListener >
55 virtual void SAL_CALL
disposing(css::lang::EventObject
const &)
override
62 css::uno::Sequence< css::beans::PropertyChangeEvent >
const &)
override
71SQLEditView::SQLEditView(std::unique_ptr<weld::ScrolledWindow> xScrolledWindow)
72 : m_xScrolledWindow(
std::move(xScrolledWindow))
73 , m_aUpdateDataTimer(
"dbaccess SQLEditView m_aUpdateDataTimer")
76 , m_bDisableInternalUndo(false)
89 OUString sFontName(officecfg::Office::Common::Font::SourceViewFont::FontName::get().value_or(OUString()));
90 if (sFontName.isEmpty())
96 Size aFontSize(0, officecfg::Office::Common::Font::SourceViewFont::FontHeight::get());
144 css::uno::Reference< css::beans::XMultiPropertySet >
n(
145 officecfg::Office::Common::Font::SourceViewFont::get(),
146 css::uno::UNO_QUERY_THROW);
151 css::uno::Sequence< OUString > s {
"FontHeight",
"FontName" };
158 css::uno::Reference< css::beans::XMultiPropertySet >
n;
179 m_aUpdateDataTimer.Start();
204 OUString aLine( rEditEngine.
GetText( nLine ) );
212 std::vector<HighlightPortion> aPortions;
214 for (
auto const& portion : aPortions)
237 sal_Int32 nStartPos = aCurrentPos.
nStartPos;
238 const sal_uInt32 nStartPara = aCurrentPos.
nStartPara;
273 sal_uInt32 nPara = nStartPara;
276 if (nPara == nStartPara && nStartPos == 0)
284 for (sal_Int32
i = (nPara==nStartPara) ? nStartPos-1 : aLine.getLength()-1;
i>0; --
i)
286 if (aLine[
i] == nChar)
303 if (aLine[
i] == nKey)
316 case HighlighterLanguage::SQL:
327 default: aColor =
Color(0,0,0);
331 case HighlighterLanguage::Basic:
335 case TokenType::Identifier: aColor =
Color(255,0,0);
break;
336 case TokenType::Comment: aColor =
Color(0,0,45);
break;
337 case TokenType::Number: aColor =
Color(204,102,204);
break;
338 case TokenType::String: aColor =
Color(0,255,45);
break;
339 case TokenType::Operator: aColor =
Color(0,0,100);
break;
340 case TokenType::Keywords: aColor =
Color(0,0,255);
break;
341 case TokenType::Error : aColor =
Color(0,255,255);
break;
342 default: aColor =
Color(0,0,0);
346 default: aColor =
Color(0,0,0);
359 if (eFunc == KeyFuncType::UNDO || eFunc == KeyFuncType::REDO)
368 if (rCEvt.
GetCommand() == CommandEventId::ContextMenu)
373 std::unique_ptr<weld::Menu> xContextMenu(xBuilder->weld_menu(
"menu"));
375 bool bEnableCut =
true;
376 bool bEnableCopy =
true;
377 bool bEnableDelete =
true;
378 bool bEnablePaste =
true;
379 bool bEnableSpecialChar =
true;
387 bEnableDelete =
false;
393 bEnablePaste =
false;
394 bEnableDelete =
false;
395 bEnableSpecialChar =
false;
398 xContextMenu->set_sensitive(
"cut", bEnableCut);
399 xContextMenu->set_sensitive(
"copy", bEnableCopy);
400 xContextMenu->set_sensitive(
"delete", bEnableDelete);
401 xContextMenu->set_sensitive(
"paste", bEnablePaste);
402 xContextMenu->set_sensitive(
"specialchar", bEnableSpecialChar);
403 xContextMenu->set_visible(
"undo",
false);
406 OUString sCommand = xContextMenu->popup_at_rect(pPopupParent, aRect);
408 if (sCommand ==
"cut")
410 else if (sCommand ==
"copy")
412 else if (sCommand ==
"paste")
414 else if (sCommand ==
"delete")
416 else if (sCommand ==
"selectall")
425 else if (sCommand ==
"specialchar")
428 if (!aChars.isEmpty())
459 int nVStepIncrement = aOut.
Height() * 2 / 10;
460 int nVPageIncrement = aOut.
Height() * 8 / 10;
461 int nVPageSize = aOut.
Height();
471 nVPageSize = std::min(nVPageSize, nVUpper);
474 nVStepIncrement, nVPageIncrement, nVPageSize);
491 auto currentDocPos =
m_xEditView->GetVisArea().Top();
510 OUString aTxt(rEditEngine.
GetText());
static const AllSettings & GetSettings()
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
CommandEventId GetCommand() const
const Point & GetMousePosPixel() const
OUString GetText(LineEnd eEnd=LINEEND_LF) const
sal_Int32 GetParagraphCount() const
void EnableUndo(bool bEnable)
void RemoveAttribs(const ESelection &rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich)
sal_uInt32 GetTextHeight() const
bool IsUndoEnabled() const
void SetDefaultHorizontalTextDirection(EEHorizontalTextDirection eHTextDir)
static rtl::Reference< SfxItemPool > CreatePool()
const SfxItemSet & GetEmptyItemSet() const
void SetStatusEventHdl(const Link< EditStatus &, void > &rLink)
void QuickSetAttribs(const SfxItemSet &rSet, const ESelection &rSel)
void SetModifyHdl(const Link< LinkParamNone *, void > &rLink)
tools::Rectangle GetVisArea() const
bool HasSelection() const
void SetSelection(const ESelection &rNewSel)
void InsertText(const OUString &rNew, bool bSelect=false, bool bLOKShowSelect=true)
const tools::Rectangle & GetOutputArea() const
sal_Unicode GetCharCode() const
const vcl::KeyCode & GetKeyCode() const
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
virtual void SAL_CALL propertiesChange(css::uno::Sequence< css::beans::PropertyChangeEvent > const &) override
virtual void SAL_CALL disposing(css::lang::EventObject const &) override
virtual ~ChangesListener() override
ChangesListener(SQLEditView &editor)
void SetPoolDefaultItem(const SfxPoolItem &)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
constexpr tools::Long Height() const
void getHighlightPortions(std::u16string_view rLine, std::vector< HighlightPortion > &pPortions) const
HighlighterLanguage GetLanguage() const
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
std::unique_ptr< EditEngine > m_xEditEngine
std::unique_ptr< EditView > m_xEditView
virtual bool Command(const CommandEvent &rCEvt) override
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
virtual EditView * GetEditView() const
void SetText(const OUString &rStr)
virtual EditEngine * GetEditEngine() const
virtual bool KeyInput(const KeyEvent &rKEvt) override
const svtools::ColorConfig m_aColorConfig
virtual void ConfigurationChanged(utl::ConfigurationBroadcaster *, ConfigurationHints) override
rtl::Reference< ChangesListener > m_listener
void DoBracketHilight(sal_uInt16 nKey)
void DisableInternalUndo()
bool m_bDisableInternalUndo
virtual ~SQLEditView() override
static void SetItemPoolFont(SfxItemPool *pItemPool)
virtual void EditViewScrollStateChange() override
virtual bool KeyInput(const KeyEvent &rKEvt) override
static Color GetSyntaxHighlightColor(const svtools::ColorConfig &rColorConfig, HighlighterLanguage eLanguage, TokenType aToken)
Link< LinkParamNone *, void > m_aModifyLink
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
std::unique_ptr< weld::ScrolledWindow > m_xScrolledWindow
virtual bool Command(const CommandEvent &rCEvt) override
svtools::ColorConfig m_ColorConfig
const SyntaxHighlighter m_aHighlighter
void SetTextAndUpdate(const OUString &rNewText)
rtl::Reference< SfxItemPool > m_pItemPool
friend class ChangesListener
css::uno::Reference< css::beans::XMultiPropertySet > m_notifier
virtual void makeEditEngine() override
Color GetColorValue(TokenType aToken)
tools::Long GetFontHeight() const
FontFamily GetFamilyType()
const OUString & GetFamilyName() const
KeyFuncType GetFunction() const
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CTL(EE_CHAR_START+22)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CJK(EE_CHAR_START+21)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
#define LINK(Instance, Class, Member)
IMPL_LINK_NOARG(OApplicationController, OnClipboardChanged, TransferableDataHelper *, void)
FncGetSpecialChars GetGetSpecialCharsFunction()