/* -*- 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 . */ #pragma once #include #include #include #include "symbol.hxx" class SubsetMap; class SmFormat; class FontList; class SvxShowCharSet; #define CATEGORY_NONE 0xFFFF /**************************************************************************/ void SetFontStyle(std::u16string_view rStyleName, vcl::Font &rFont); /**************************************************************************/ class SmPrintOptionsTabPage final : public SfxTabPage { std::unique_ptr m_xTitle; std::unique_ptr m_xTitleImg; std::unique_ptr m_xText; std::unique_ptr m_xTextImg; std::unique_ptr m_xFrame; std::unique_ptr m_xFrameImg; std::unique_ptr m_xSizeNormal; std::unique_ptr m_xSizeScaled; std::unique_ptr m_xSizeZoomed; std::unique_ptr m_xLockPrintImg; std::unique_ptr m_xZoom; std::unique_ptr m_xEnableInlineEdit; std::unique_ptr m_xEnableInlineEditImg; std::unique_ptr m_xNoRightSpaces; std::unique_ptr m_xNoRightSpacesImg; std::unique_ptr m_xSaveOnlyUsedSymbols; std::unique_ptr m_xSaveOnlyUsedSymbolsImg; std::unique_ptr m_xAutoCloseBrackets; std::unique_ptr m_xAutoCloseBracketsImg; std::unique_ptr m_xSmZoom; std::unique_ptr m_xSmZoomImg; DECL_LINK(SizeButtonClickHdl, weld::Toggleable&, void); virtual bool FillItemSet(SfxItemSet* rSet) override; virtual void Reset(const SfxItemSet* rSet) override; public: static std::unique_ptr Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet); SmPrintOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rOptions); virtual ~SmPrintOptionsTabPage() override; virtual OUString GetAllStrings() override; }; /**************************************************************************/ class SmShowFont final : public weld::CustomWidgetController { virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; vcl::Font maFont; public: SmShowFont() { } virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; void SetFont(const vcl::Font& rFont); }; class SmFontDialog : public weld::GenericDialogController { vcl::Font maFont; SmShowFont m_aShowFont; std::unique_ptr m_xFontBox; std::unique_ptr m_xAttrFrame; std::unique_ptr m_xBoldCheckBox; std::unique_ptr m_xItalicCheckBox; std::unique_ptr m_xShowFont; DECL_LINK(FontSelectHdl, weld::ComboBox&, void); DECL_LINK(AttrChangeHdl, weld::Toggleable&, void); public: SmFontDialog(weld::Window* pParent, OutputDevice *pFntListDevice, bool bHideCheckboxes); virtual ~SmFontDialog() override; const vcl::Font& GetFont() const { return maFont; } void SetFont(const vcl::Font &rFont); }; /**************************************************************************/ class SmFontSizeDialog final : 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 final : public weld::GenericDialogController { VclPtr pFontListDev; std::unique_ptr m_xMathFont; 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 OUString&, 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 final : 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; std::unique_ptr m_xCategories[NOCATEGORIES]; sal_uInt16 nActiveCategory; bool bScaleAllBrackets; DECL_LINK(GetFocusHdl, weld::Widget&, void); DECL_LINK(MenuSelectHdl, const OUString&, void); DECL_LINK(DefaultButtonClickHdl, weld::Button&, void); DECL_LINK(CheckBoxClickHdl, weld::Toggleable&, 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 final : 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 SmShowSymbolSet final : public weld::CustomWidgetController { SmViewShell &m_rViewShell; Size m_aOldSize; SymbolPtrVec_t aSymbolSet; Link aSelectHdlLink; Link aDblClickHdlLink; tools::Long nLen; sal_Int32 nRows, nColumns; tools::Long nXOffset, nYOffset; sal_uInt16 nSelectSymbol; std::unique_ptr m_xScrolledWindow; void SetScrollBarRange(); Point OffsetPoint(const Point &rPoint) const; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; virtual bool KeyInput(const KeyEvent& rKEvt) override; virtual void Resize() override; DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void); public: SmShowSymbolSet(std::unique_ptr pScrolledWindow, SmViewShell &rViewShell); virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override { CustomWidgetController::SetDrawingArea(pDrawingArea); m_aOldSize = Size(pDrawingArea->get_approximate_digit_width() * 27, pDrawingArea->get_text_height() * 9); pDrawingArea->set_size_request(m_aOldSize.Width(), m_aOldSize.Height()); SetOutputSizePixel(m_aOldSize); calccols(pDrawingArea->get_ref_device()); } void calccols(const vcl::RenderContext& rRenderContext); 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 SmShowSymbol final : public weld::CustomWidgetController { private: SmViewShell &m_rViewShell; vcl::Font m_aFont; OUString m_aText; Link aDblClickHdlLink; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; void setFontSize(vcl::Font &rFont) const; public: SmShowSymbol(SmViewShell &rViewShell); virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override { CustomWidgetController::SetDrawingArea(pDrawingArea); pDrawingArea->set_size_request(pDrawingArea->get_approximate_digit_width() * 27, pDrawingArea->get_text_height() * 9); } 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 SetSymbol(const SmSym *pSymbol); void SetDblClickHdl(const Link &rLink) { aDblClickHdlLink = rLink; } }; class SmSymbolDialog final : public weld::GenericDialogController { SmViewShell &m_rViewSh; SmSymbolManager &m_rSymbolMgr; OUString m_aSymbolSetName; SymbolPtrVec_t m_aSymbolSet; VclPtr m_pFontListDev; SmShowSymbol m_aSymbolDisplay; std::unique_ptr m_xSymbolSets; std::unique_ptr m_xSymbolSetDisplay; std::unique_ptr m_xSymbolSetDisplayArea; std::unique_ptr m_xSymbolName; std::unique_ptr m_xSymbolDisplay; std::unique_ptr m_xGetBtn; std::unique_ptr m_xEditBtn; DECL_LINK(SymbolSetChangeHdl, weld::ComboBox&, void); DECL_LINK(SymbolChangeHdl, SmShowSymbolSet&, void); DECL_LINK(SymbolDblClickHdl, SmShowSymbol&, void); DECL_LINK(SymbolDblClickHdl2, SmShowSymbolSet&, void); DECL_LINK(EditClickHdl, weld::Button&, void); DECL_LINK(GetClickHdl, weld::Button&, void); void SymbolDblClickHdl(); void FillSymbolSets(); const SmSym *GetSymbol() const; public: SmSymbolDialog(weld::Window* pParent, OutputDevice *pFntListDevice, SmSymbolManager &rSymbolMgr, SmViewShell &rViewShell); virtual ~SmSymbolDialog() override; bool SelectSymbolSet(const OUString &rSymbolSetName); void SelectSymbol(sal_uInt16 nSymbolPos); }; class SmShowChar final : public weld::CustomWidgetController { private: OUString m_aText; vcl::Font m_aFont; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; virtual void Resize() override; public: SmShowChar() { } virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override { CustomWidgetController::SetDrawingArea(pDrawingArea); pDrawingArea->set_size_request(pDrawingArea->get_approximate_digit_width() * 7, pDrawingArea->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; } }; class SmSymDefineDialog final : public weld::GenericDialogController { VclPtr m_xVirDev; SmSymbolManager m_aSymbolMgrCopy; SmSymbolManager& m_rSymbolMgr; SmShowChar m_aOldSymbolDisplay; SmShowChar m_aSymbolDisplay; 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; std::unique_ptr m_xCharsetDisplayArea; DECL_LINK(OldSymbolChangeHdl, weld::ComboBox&, void); DECL_LINK(OldSymbolSetChangeHdl, weld::ComboBox&, void); DECL_LINK(ModifyHdl, weld::ComboBox&, void); DECL_LINK(FontChangeHdl, weld::ComboBox&, void); DECL_LINK(SubsetChangeHdl, weld::ComboBox&, void); DECL_LINK(StyleChangeHdl, weld::ComboBox&, 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::ComboBox& rComboBox, bool bDeleteText = true); void FillSymbolSets(weld::ComboBox& rComboBox, bool bDeleteText = true); void FillFonts(); void FillStyles(); void SetSymbolSetManager(const SmSymbolManager &rMgr); void SetFont(const OUString &rFontName, std::u16string_view rStyleName); void SetOrigSymbol(const SmSym *pSymbol, const OUString &rSymbolSetName); void UpdateButtons(); bool SelectSymbolSet(weld::ComboBox &rComboBox, std::u16string_view rSymbolSetName, bool bDeleteText); bool SelectSymbol(weld::ComboBox& rComboBox, const OUString &rSymbolName, bool bDeleteText); bool SelectFont(const OUString &rFontName, bool bApplyFont); bool SelectStyle(const OUString &rStyleName, bool bApplyFont); SmSym* GetSymbol(const weld::ComboBox& rComboBox); const SmSym* GetSymbol(const weld::ComboBox& rComboBox) const { return const_cast(this)->GetSymbol(rComboBox); } public: SmSymDefineDialog(weld::Window *pParent, OutputDevice *pFntListDevice, SmSymbolManager &rMgr); virtual ~SmSymDefineDialog() override; virtual short run() override; void SelectOldSymbolSet(std::u16string_view rSymbolSetName) { SelectSymbolSet(*m_xOldSymbolSets, rSymbolSetName, false); } void SelectOldSymbol(const OUString &rSymbolName) { SelectSymbol(*m_xOldSymbols, rSymbolName, false); } bool SelectSymbolSet(std::u16string_view 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); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */