/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #ifndef INCLUDED_STARMATH_INC_DIALOG_HXX #define INCLUDED_STARMATH_INC_DIALOG_HXX #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "utility.hxx" #include "format.hxx" #include "symbol.hxx" #include class SubsetMap; #define CATEGORY_NONE 0xFFFF /**************************************************************************/ void SetFontStyle(const OUString &rStyleName, vcl::Font &rFont); /**************************************************************************/ class SmPrintOptionsTabPage : public SfxTabPage { std::unique_ptr m_xTitle; std::unique_ptr m_xText; std::unique_ptr m_xFrame; std::unique_ptr m_xSizeNormal; std::unique_ptr m_xSizeScaled; std::unique_ptr m_xSizeZoomed; std::unique_ptr m_xZoom; std::unique_ptr m_xNoRightSpaces; std::unique_ptr m_xSaveOnlyUsedSymbols; std::unique_ptr m_xAutoCloseBrackets; DECL_LINK(SizeButtonClickHdl, weld::ToggleButton&, void); virtual bool FillItemSet(SfxItemSet* rSet) override; virtual void Reset(const SfxItemSet* rSet) override; public: static VclPtr Create(TabPageParent pWindow, const SfxItemSet &rSet); SmPrintOptionsTabPage(TabPageParent pPage, const SfxItemSet &rOptions); virtual ~SmPrintOptionsTabPage() override; }; /**************************************************************************/ class SmShowFont : public vcl::Window { virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; vcl::Font maFont; public: SmShowFont(vcl::Window *pParent, WinBits nStyle) : Window(pParent, nStyle) { } virtual Size GetOptimalSize() const override; void SetFont(const vcl::Font& rFont); }; class SmFontDialog : public ModalDialog { VclPtr m_pFontBox; VclPtr m_pAttrFrame; VclPtr m_pBoldCheckBox; VclPtr m_pItalicCheckBox; VclPtr m_pShowFont; vcl::Font maFont; DECL_LINK(FontSelectHdl, ComboBox&, void); DECL_LINK(FontModifyHdl, Edit&, void); DECL_LINK(AttrChangeHdl, Button *, void); virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; public: SmFontDialog(vcl::Window * pParent, OutputDevice *pFntListDevice, bool bHideCheckboxes); virtual ~SmFontDialog() override; virtual void dispose() override; const vcl::Font& GetFont() const { return maFont; } void SetFont(const vcl::Font &rFont); }; /**************************************************************************/ class SmFontSizeDialog : public weld::GenericDialogController { std::unique_ptr m_xBaseSize; std::unique_ptr m_xTextSize; std::unique_ptr m_xIndexSize; std::unique_ptr m_xFunctionSize; std::unique_ptr m_xOperatorSize; std::unique_ptr m_xBorderSize; std::unique_ptr m_xDefaultButton; DECL_LINK(DefaultButtonClickHdl, weld::Button&, void); public: SmFontSizeDialog(weld::Window *pParent); virtual ~SmFontSizeDialog() override; void ReadFrom(const SmFormat &rFormat); void WriteTo (SmFormat &rFormat) const; }; /**************************************************************************/ class SmFontTypeDialog : public weld::GenericDialogController { VclPtr pFontListDev; std::unique_ptr m_xVariableFont; std::unique_ptr m_xFunctionFont; std::unique_ptr m_xNumberFont; std::unique_ptr m_xTextFont; std::unique_ptr m_xSerifFont; std::unique_ptr m_xSansFont; std::unique_ptr m_xFixedFont; std::unique_ptr m_xMenuButton; std::unique_ptr m_xDefaultButton; DECL_LINK(MenuSelectHdl, const OString&, void); DECL_LINK(DefaultButtonClickHdl, weld::Button&, void); public: SmFontTypeDialog(weld::Window* pParent, OutputDevice *pFntListDevice); virtual ~SmFontTypeDialog() override; void ReadFrom(const SmFormat &rFormat); void WriteTo (SmFormat &rFormat) const; }; /**************************************************************************/ #define NOCATEGORIES 10 class SmCategoryDesc { OUString Name; OUString Strings[4]; std::unique_ptr Graphics[4]; /* regular bitmaps */ sal_uInt16 Minimum[4]; sal_uInt16 Maximum[4]; sal_uInt16 Value[4]; public: SmCategoryDesc(weld::Builder& rBuilder, sal_uInt16 nCategoryIdx); ~SmCategoryDesc(); const OUString& GetName() const { return Name; } const OUString& GetString(sal_uInt16 Index) const { return Strings[Index]; } sal_uInt16 GetMinimum(sal_uInt16 Index) { return Minimum[Index]; } sal_uInt16 GetMaximum(sal_uInt16 Index) { return Maximum[Index]; } sal_uInt16 GetValue(sal_uInt16 Index) const { return Value[Index]; } void SetValue(sal_uInt16 Index, sal_uInt16 nVal) { Value[Index] = nVal;} weld::Widget* GetGraphic(sal_uInt16 Index) const { return Graphics[Index].get(); } }; class SmDistanceDialog : public weld::GenericDialogController { std::unique_ptr m_xFrame; std::unique_ptr m_xFixedText1; std::unique_ptr m_xMetricField1; std::unique_ptr m_xFixedText2; std::unique_ptr m_xMetricField2; std::unique_ptr m_xFixedText3; std::unique_ptr m_xMetricField3; std::unique_ptr m_xCheckBox1; std::unique_ptr m_xFixedText4; std::unique_ptr m_xMetricField4; std::unique_ptr m_xMenuButton; std::unique_ptr m_xDefaultButton; std::unique_ptr m_xBitmap; weld::Widget* m_pCurrentImage; SmCategoryDesc *Categories[NOCATEGORIES]; sal_uInt16 nActiveCategory; bool bScaleAllBrackets; DECL_LINK(GetFocusHdl, weld::Widget&, void); DECL_LINK(MenuSelectHdl, const OString&, void); DECL_LINK(DefaultButtonClickHdl, weld::Button&, void); DECL_LINK(CheckBoxClickHdl, weld::ToggleButton&, void); void SetCategory(sal_uInt16 Category); public: SmDistanceDialog(weld::Window *pParent); virtual ~SmDistanceDialog() override; void ReadFrom(const SmFormat &rFormat); void WriteTo (SmFormat &rFormat); }; /**************************************************************************/ class SmAlignDialog : public weld::GenericDialogController { std::unique_ptr m_xLeft; std::unique_ptr m_xCenter; std::unique_ptr m_xRight; std::unique_ptr m_xDefaultButton; DECL_LINK(DefaultButtonClickHdl, weld::Button&, void); public: SmAlignDialog(weld::Window *pParent); virtual ~SmAlignDialog() override; void ReadFrom(const SmFormat &rFormat); void WriteTo (SmFormat &rFormat) const; }; /**************************************************************************/ class SmShowSymbolSetWindow : public Control { VclPtr m_pVScrollBar; SymbolPtrVec_t aSymbolSet; Link aSelectHdlLink; Link aDblClickHdlLink; long nLen; long nRows, nColumns; long nXOffset, nYOffset; sal_uInt16 nSelectSymbol; void SetScrollBarRange(); Point OffsetPoint(const Point &rPoint) const; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; virtual void MouseButtonDown(const MouseEvent& rMEvt) override; virtual void KeyInput(const KeyEvent& rKEvt) override; virtual void Resize() override; virtual Size GetOptimalSize() const override; DECL_LINK( ScrollHdl, ScrollBar*, void ); public: SmShowSymbolSetWindow(vcl::Window *pParent, WinBits nStyle); virtual ~SmShowSymbolSetWindow() override; virtual void dispose() override; void setScrollbar(ScrollBar *pVScrollBar); void calccols(); void SelectSymbol(sal_uInt16 nSymbol); sal_uInt16 GetSelectSymbol() const { return nSelectSymbol; } void SetSymbolSet(const SymbolPtrVec_t& rSymbolSet); void SetSelectHdl(const Link& rLink) { aSelectHdlLink = rLink; } void SetDblClickHdl(const Link& rLink) { aDblClickHdlLink = rLink; } }; class SmShowSymbolSet : public VclHBox { VclPtr aSymbolWindow; VclPtr aVScrollBar; public: SmShowSymbolSet(vcl::Window *pParent); virtual ~SmShowSymbolSet() override; virtual void dispose() override; void SetSymbolSet(const SymbolPtrVec_t& rSymbolSet) { aSymbolWindow->SetSymbolSet(rSymbolSet); } void SelectSymbol(sal_uInt16 nSymbol) { aSymbolWindow->SelectSymbol(nSymbol); } sal_uInt16 GetSelectSymbol() const { return aSymbolWindow->GetSelectSymbol(); } void SetSelectHdl(const Link& rLink) { aSymbolWindow->SetSelectHdl(rLink); } void SetDblClickHdl(const Link& rLink) { aSymbolWindow->SetDblClickHdl(rLink); } }; class SmShowSymbol : public Control { Link aDblClickHdlLink; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; virtual void MouseButtonDown(const MouseEvent& rMEvt) override; virtual void Resize() override; void setFontSize(vcl::Font &rFont) const; public: SmShowSymbol(vcl::Window *pParent, WinBits nStyle) : Control(pParent, nStyle) { } void SetSymbol(const SmSym *pSymbol); void SetDblClickHdl(const Link &rLink) { aDblClickHdlLink = rLink; } }; class SmSymbolDialog : public ModalDialog { VclPtr m_pSymbolSets; VclPtr m_pSymbolSetDisplay; VclPtr m_pSymbolName; VclPtr m_pSymbolDisplay; VclPtr m_pGetBtn; VclPtr m_pEditBtn; SmViewShell &rViewSh; SmSymbolManager &rSymbolMgr; OUString aSymbolSetName; SymbolPtrVec_t aSymbolSet; VclPtr pFontListDev; DECL_LINK(SymbolSetChangeHdl, ListBox&, void); DECL_LINK(SymbolChangeHdl, SmShowSymbolSetWindow&, void); DECL_LINK(SymbolDblClickHdl, SmShowSymbol&, void); DECL_LINK(SymbolDblClickHdl2, SmShowSymbolSetWindow&, void); DECL_LINK(EditClickHdl, Button*, void); DECL_LINK(GetClickHdl, Button*, void); void SymbolDblClickHdl(); void FillSymbolSets(); const SmSym *GetSymbol() const; virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; public: SmSymbolDialog(vcl::Window * pParent, OutputDevice *pFntListDevice, SmSymbolManager &rSymbolMgr, SmViewShell &rViewShell); virtual ~SmSymbolDialog() override; virtual void dispose() override; bool SelectSymbolSet(const OUString &rSymbolSetName); void SelectSymbol(sal_uInt16 nSymbolPos); }; class SmShowChar { private: std::unique_ptr m_xDrawingArea; OUString m_aText; vcl::Font m_aFont; Size m_aSize; DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void); DECL_LINK(DoResize, const Size& rSize, void); public: SmShowChar(weld::DrawingArea* pDrawingArea) : m_xDrawingArea(pDrawingArea) { m_xDrawingArea->connect_size_allocate(LINK(this, SmShowChar, DoResize)); m_xDrawingArea->connect_draw(LINK(this, SmShowChar, DoPaint)); m_xDrawingArea->set_size_request(m_xDrawingArea->get_approximate_digit_width() * 7, m_xDrawingArea->get_text_height() * 3); } void SetSymbol(const SmSym *pSym); void SetSymbol(sal_UCS4 cChar, const vcl::Font &rFont); void SetText(const OUString& rText) { m_aText = rText; } const OUString& GetText() const { return m_aText; } void SetFont(const vcl::Font& rFont) { m_aFont = rFont; } const vcl::Font& GetFont() const { return m_aFont; } void queue_draw() { m_xDrawingArea->queue_draw(); } }; class SmSymDefineDialog : public weld::GenericDialogController { VclPtr m_xVirDev; SmSymbolManager m_aSymbolMgrCopy; SmSymbolManager& m_rSymbolMgr; std::unique_ptr m_xOrigSymbol; std::unique_ptr m_xSubsetMap; std::unique_ptr m_xFontList; std::unique_ptr m_xOldSymbols; std::unique_ptr m_xOldSymbolSets; std::unique_ptr m_xSymbols; std::unique_ptr m_xSymbolSets; std::unique_ptr m_xFonts; std::unique_ptr m_xFontsSubsetLB; std::unique_ptr m_xStyles; std::unique_ptr m_xOldSymbolName; std::unique_ptr m_xOldSymbolSetName; std::unique_ptr m_xSymbolName; std::unique_ptr m_xSymbolSetName; std::unique_ptr m_xAddBtn; std::unique_ptr m_xChangeBtn; std::unique_ptr m_xDeleteBtn; std::unique_ptr m_xOldSymbolDisplay; std::unique_ptr m_xSymbolDisplay; std::unique_ptr m_xCharsetDisplay; DECL_LINK(OldSymbolChangeHdl, weld::ComboBoxText&, void); DECL_LINK(OldSymbolSetChangeHdl, weld::ComboBoxText&, void); DECL_LINK(ModifyHdl, weld::ComboBoxText&, void); DECL_LINK(FontChangeHdl, weld::ComboBoxText&, void); DECL_LINK(SubsetChangeHdl, weld::ComboBoxText&, void); DECL_LINK(StyleChangeHdl, weld::ComboBoxText&, void); DECL_LINK(CharHighlightHdl, SvxShowCharSet*, void); DECL_LINK(AddClickHdl, weld::Button&, void); DECL_LINK(ChangeClickHdl, weld::Button&, void); DECL_LINK(DeleteClickHdl, weld::Button&, void); void FillSymbols(weld::ComboBoxText& rComboBox, bool bDeleteText = true); void FillSymbolSets(weld::ComboBoxText& rComboBox, bool bDeleteText = true); void FillFonts(); void FillStyles(); void SetSymbolSetManager(const SmSymbolManager &rMgr); void SetFont(const OUString &rFontName, const OUString &rStyleName); void SetOrigSymbol(const SmSym *pSymbol, const OUString &rSymbolSetName); void UpdateButtons(); bool SelectSymbolSet(weld::ComboBoxText &rComboBox, const OUString &rSymbolSetName, bool bDeleteText); bool SelectSymbol(weld::ComboBoxText& rComboBox, const OUString &rSymbolName, bool bDeleteText); bool SelectFont(const OUString &rFontName, bool bApplyFont); bool SelectStyle(const OUString &rStyleName, bool bApplyFont); SmSym* GetSymbol(const weld::ComboBoxText& rComboBox); const SmSym* GetSymbol(const weld::ComboBoxText& rComboBox) const { return const_cast(this)->GetSymbol(rComboBox); } public: SmSymDefineDialog(weld::Window *pParent, OutputDevice *pFntListDevice, SmSymbolManager &rMgr); virtual ~SmSymDefineDialog() override; short execute(); void SelectOldSymbolSet(const OUString &rSymbolSetName) { SelectSymbolSet(*m_xOldSymbolSets, rSymbolSetName, false); } void SelectOldSymbol(const OUString &rSymbolName) { SelectSymbol(*m_xOldSymbols, rSymbolName, false); } bool SelectSymbolSet(const OUString &rSymbolSetName) { return SelectSymbolSet(*m_xSymbolSets, rSymbolSetName, false); } bool SelectSymbol(const OUString &rSymbolName) { return SelectSymbol(*m_xSymbols, rSymbolName, false); } bool SelectFont(const OUString &rFontName) { return SelectFont(rFontName, true); } bool SelectStyle(const OUString &rStyleName) { return SelectStyle(rStyleName, true); }; void SelectChar(sal_Unicode cChar); }; #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */