/* -*- 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 { VclPtr m_pTitle; VclPtr m_pText; VclPtr m_pFrame; VclPtr m_pSizeNormal; VclPtr m_pSizeScaled; VclPtr m_pSizeZoomed; VclPtr m_pZoom; VclPtr m_pNoRightSpaces; VclPtr m_pSaveOnlyUsedSymbols; DECL_LINK(SizeButtonClickHdl, Button *); virtual bool FillItemSet(SfxItemSet* rSet) SAL_OVERRIDE; virtual void Reset(const SfxItemSet* rSet) SAL_OVERRIDE; public: static VclPtr Create(vcl::Window *pWindow, const SfxItemSet &rSet); SmPrintOptionsTabPage(vcl::Window *pParent, const SfxItemSet &rOptions); virtual ~SmPrintOptionsTabPage(); virtual void dispose() SAL_OVERRIDE; }; /**************************************************************************/ class SmShowFont : public vcl::Window { virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle&) SAL_OVERRIDE; vcl::Font maFont; public: SmShowFont(vcl::Window *pParent, WinBits nStyle) : Window(pParent, nStyle) { } virtual Size GetOptimalSize() const SAL_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 *); DECL_LINK(FontModifyHdl, ComboBox *); DECL_LINK(AttrChangeHdl, CheckBox *); virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; public: SmFontDialog(vcl::Window * pParent, OutputDevice *pFntListDevice, bool bHideCheckboxes); virtual ~SmFontDialog(); virtual void dispose() SAL_OVERRIDE; const vcl::Font& GetFont() const { return maFont; } void SetFont(const vcl::Font &rFont); }; /**************************************************************************/ class SmFontSizeDialog : public ModalDialog { VclPtr m_pBaseSize; VclPtr m_pTextSize; VclPtr m_pIndexSize; VclPtr m_pFunctionSize; VclPtr m_pOperatorSize; VclPtr m_pBorderSize; VclPtr m_pDefaultButton; DECL_LINK(DefaultButtonClickHdl, Button *); public: SmFontSizeDialog(vcl::Window *pParent); virtual ~SmFontSizeDialog(); virtual void dispose() SAL_OVERRIDE; void ReadFrom(const SmFormat &rFormat); void WriteTo (SmFormat &rFormat) const; }; /**************************************************************************/ class SmFontTypeDialog : public ModalDialog { VclPtr m_pVariableFont; VclPtr m_pFunctionFont; VclPtr m_pNumberFont; VclPtr m_pTextFont; VclPtr m_pSerifFont; VclPtr m_pSansFont; VclPtr m_pFixedFont; VclPtr m_pMenuButton; VclPtr m_pDefaultButton; VclPtr pFontListDev; DECL_LINK(MenuSelectHdl, Menu *); DECL_LINK(DefaultButtonClickHdl, Button *); DECL_LINK(HelpButtonClickHdl, Button *); public: SmFontTypeDialog(vcl::Window *pParent, OutputDevice *pFntListDevice); virtual ~SmFontTypeDialog(); virtual void dispose() SAL_OVERRIDE; void ReadFrom(const SmFormat &rFormat); void WriteTo (SmFormat &rFormat) const; }; /**************************************************************************/ #define NOCATEGORIES 10 class SmCategoryDesc { OUString Name; OUString *Strings[4]; Image *Graphics[4]; /* regular bitmaps */ sal_uInt16 Minimum[4]; sal_uInt16 Maximum[4]; sal_uInt16 Value[4]; public: SmCategoryDesc(VclBuilderContainer& 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;} const Image * GetGraphic(sal_uInt16 Index) const { return Graphics[Index]; } }; class SmDistanceDialog : public ModalDialog { VclPtr m_pFrame; VclPtr m_pFixedText1; VclPtr m_pMetricField1; VclPtr m_pFixedText2; VclPtr m_pMetricField2; VclPtr m_pFixedText3; VclPtr m_pMetricField3; VclPtr m_pCheckBox1; VclPtr m_pFixedText4; VclPtr m_pMetricField4; VclPtr m_pMenuButton; VclPtr m_pDefaultButton; VclPtr m_pBitmap; SmCategoryDesc *Categories[NOCATEGORIES]; sal_uInt16 nActiveCategory; bool bScaleAllBrackets; DECL_LINK(GetFocusHdl, Control *); DECL_LINK(MenuSelectHdl, Menu *); DECL_LINK(DefaultButtonClickHdl, Button *); DECL_LINK(CheckBoxClickHdl, CheckBox *); using Window::SetHelpId; static void SetHelpId(MetricField &rField, const OString& sHelpId); void SetCategory(sal_uInt16 Category); public: SmDistanceDialog(vcl::Window *pParent); virtual ~SmDistanceDialog(); virtual void dispose() SAL_OVERRIDE; void ReadFrom(const SmFormat &rFormat); void WriteTo (SmFormat &rFormat) /*const*/; // Window virtual void DataChanged( const DataChangedEvent &rEvt ) SAL_OVERRIDE; }; /**************************************************************************/ class SmAlignDialog : public ModalDialog { VclPtr m_pLeft; VclPtr m_pCenter; VclPtr m_pRight; VclPtr m_pDefaultButton; DECL_LINK(DefaultButtonClickHdl, Button *); public: SmAlignDialog(vcl::Window *pParent); virtual ~SmAlignDialog(); virtual void dispose() SAL_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 Rectangle&) SAL_OVERRIDE; virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE; virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; virtual Size GetOptimalSize() const SAL_OVERRIDE; DECL_LINK( ScrollHdl, ScrollBar* ); public: SmShowSymbolSetWindow(vcl::Window *pParent, WinBits nStyle); virtual ~SmShowSymbolSetWindow(); virtual void dispose() SAL_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(); virtual void dispose() SAL_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 Rectangle&) SAL_OVERRIDE; virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE; virtual void Resize() SAL_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 SmSymDefineDialog; 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, void*); DECL_LINK(SymbolChangeHdl, void*); DECL_LINK(SymbolDblClickHdl, void*); DECL_LINK(EditClickHdl, void*); DECL_LINK(GetClickHdl, void*); void FillSymbolSets(bool bDeleteText = true); void SetSymbolSetManager(SmSymbolManager &rMgr); const SmSym *GetSymbol() const; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; public: SmSymbolDialog(vcl::Window * pParent, OutputDevice *pFntListDevice, SmSymbolManager &rSymbolMgr, SmViewShell &rViewShell); virtual ~SmSymbolDialog(); virtual void dispose() SAL_OVERRIDE; bool SelectSymbolSet(const OUString &rSymbolSetName); void SelectSymbol(sal_uInt16 nSymbolPos); sal_uInt16 GetSelectedSymbol() const { return m_pSymbolSetDisplay->GetSelectSymbol(); } }; class SmShowChar : public Control { virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle&) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; public: SmShowChar(vcl::Window *pParent, WinBits nStyle) : Control(pParent, nStyle) { } void SetSymbol( const SmSym *pSym ); void SetSymbol( sal_UCS4 cChar, const vcl::Font &rFont ); }; class SmSymDefineDialog : public ModalDialog { VclPtr pOldSymbols; VclPtr pOldSymbolSets; VclPtr pCharsetDisplay; VclPtr pSymbols; VclPtr pSymbolSets; VclPtr pFonts; VclPtr pFontsSubsetLB; VclPtr pStyles; VclPtr pOldSymbolName; VclPtr pOldSymbolDisplay; VclPtr pOldSymbolSetName; VclPtr pSymbolName; VclPtr pSymbolDisplay; VclPtr pSymbolSetName; VclPtr pAddBtn; VclPtr pChangeBtn; VclPtr pDeleteBtn; SmSymbolManager aSymbolMgrCopy, &rSymbolMgr; std::unique_ptr pOrigSymbol; std::unique_ptr pSubsetMap; FontList *pFontList; DECL_LINK(OldSymbolChangeHdl, ComboBox *); DECL_LINK(OldSymbolSetChangeHdl, ComboBox *); DECL_LINK(ModifyHdl, ComboBox *); DECL_LINK(FontChangeHdl, ListBox *); DECL_LINK(SubsetChangeHdl, ListBox*); DECL_LINK(StyleChangeHdl, ComboBox *); DECL_LINK(CharHighlightHdl, void *); DECL_LINK(AddClickHdl, Button *); DECL_LINK(ChangeClickHdl, Button *); DECL_LINK(DeleteClickHdl, Button *); void FillSymbols(ComboBox &rComboBox, bool bDeleteText = true); void FillSymbolSets(ComboBox &rComboBox, bool bDeleteText = true); void FillFonts(bool bDeleteText = true); void FillStyles(bool bDeleteText = true); 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(ComboBox &rComboBox, const OUString &rSymbolSetName, bool bDeleteText); bool SelectSymbol(ComboBox &rComboBox, const OUString &rSymbolName, bool bDeleteText); bool SelectFont(const OUString &rFontName, bool bApplyFont); bool SelectStyle(const OUString &rStyleName, bool bApplyFont); SmSym * GetSymbol(const ComboBox &rComboBox); const SmSym * GetSymbol(const ComboBox &rComboBox) const { return const_cast(this)->GetSymbol(rComboBox); } virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; public: SmSymDefineDialog(vcl::Window *pParent, OutputDevice *pFntListDevice, SmSymbolManager &rMgr); virtual ~SmSymDefineDialog(); virtual void dispose() SAL_OVERRIDE; using OutputDevice::SetFont; // Dialog virtual short Execute() SAL_OVERRIDE; bool SelectOldSymbolSet(const OUString &rSymbolSetName) { return SelectSymbolSet(*pOldSymbolSets, rSymbolSetName, false); } bool SelectOldSymbol(const OUString &rSymbolName) { return SelectSymbol(*pOldSymbols, rSymbolName, false); } bool SelectSymbolSet(const OUString &rSymbolSetName) { return SelectSymbolSet(*pSymbolSets, rSymbolSetName, false); } bool SelectSymbol(const OUString &rSymbolName) { return SelectSymbol(*pSymbols, 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: */