diff options
author | Tomaž Vajngerl <quikee@gmail.com> | 2013-05-20 00:13:10 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2013-05-20 00:20:27 +0200 |
commit | 2d3baccf0249f8c68dcf8f9b0000453d0bc82d8f (patch) | |
tree | e40b44c418a9dde000e6e461d719b98227538539 /starmath | |
parent | Resolves: #i121128# added missing original data export for SVG... (diff) | |
download | core-2d3baccf0249f8c68dcf8f9b0000453d0bc82d8f.tar.gz core-2d3baccf0249f8c68dcf8f9b0000453d0bc82d8f.zip |
Math: new rendered Elements docking window added
Added a docking window with elements that are rendered using the
math renderer insted of static pictures. Currently this is an
alternative to the existing elements floating window which will
be removed when the new one is ready. This is an initial but
fully functional version.
Change-Id: I7678d09d643c532c672447026b0f12b7b70fc91d
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/Library_sm.mk | 1 | ||||
-rw-r--r-- | starmath/inc/ElementsDockingWindow.hxx | 142 | ||||
-rw-r--r-- | starmath/inc/starmath.hrc | 48 | ||||
-rw-r--r-- | starmath/sdi/smath.sdi | 52 | ||||
-rw-r--r-- | starmath/sdi/smslots.sdi | 11 | ||||
-rw-r--r-- | starmath/source/ElementsDockingWindow.cxx | 530 | ||||
-rw-r--r-- | starmath/source/commands.src | 42 | ||||
-rw-r--r-- | starmath/source/document.cxx | 4 | ||||
-rw-r--r-- | starmath/source/smdll.cxx | 3 | ||||
-rw-r--r-- | starmath/source/smres.src | 57 | ||||
-rw-r--r-- | starmath/source/view.cxx | 78 | ||||
-rw-r--r-- | starmath/uiconfig/smath/menubar/menubar.xml | 1 |
12 files changed, 930 insertions, 39 deletions
diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk index 342190b70ffb..a56e4391b3e6 100644 --- a/starmath/Library_sm.mk +++ b/starmath/Library_sm.mk @@ -53,6 +53,7 @@ $(eval $(call gb_Library_use_libraries,sm,\ )) $(eval $(call gb_Library_add_exception_objects,sm,\ + starmath/source/ElementsDockingWindow \ starmath/source/accessibility \ starmath/source/action \ starmath/source/caret \ diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx new file mode 100644 index 000000000000..48fc51bf8052 --- /dev/null +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -0,0 +1,142 @@ +/* -*- 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 _ELEMENTSDOCKINGWINDOW_HXX_ +#define _ELEMENTSDOCKINGWINDOW_HXX_ + +#include <sfx2/ctrlitem.hxx> +#include <sfx2/dockwin.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/fixed.hxx> +#include <vcl/group.hxx> +#include <vcl/graph.hxx> + +#include <svx/dlgctrl.hxx> +#include <document.hxx> + +class SmElement +{ + SmNode* mpNode; + OUString maText; +public: + SmElement(SmNode* pNode, OUString aText); + virtual ~SmElement(); + SmNode* getNode(); + + OUString getText() { return maText; } + + virtual bool isSeparator() + { + return false; + } + + Point mBoxLocation; + Size mBoxSize; +}; + +class SmElementSeparator : public SmElement +{ +public: + SmElementSeparator(); + + virtual bool isSeparator() + { + return true; + } +}; + +class SmElementsControl : public Control +{ + + static const sal_uInt16 aUnaryBinaryOperatorsList[]; + static const sal_uInt16 aRelationsList[]; + static const sal_uInt16 aSetOperations[]; + static const sal_uInt16 aFunctions[]; + static const sal_uInt16 aOperators[]; + static const sal_uInt16 aAttributes[]; + static const sal_uInt16 aBrackets[]; + static const sal_uInt16 aFormats[]; + static const sal_uInt16 aOthers[]; + + Link aSelectHdlLink; + + virtual void Paint(const Rectangle&); + virtual void MouseButtonDown(const MouseEvent& rMEvt); + virtual void MouseMove( const MouseEvent& rMEvt ); + + SmDocShell* mpDocShell; + SmFormat maFormat; + sal_uInt16 maCurrentSetId; + SmElement* mpCurrentElement; + + std::vector<SmElement*> maElementList; + Size maMaxElementDimensions; + + void addElement(OUString aElementVisual, OUString aElementSource); + + void addElements(const sal_uInt16 aElementsArray[], sal_uInt16 size); + + void addSeparator(); + + void build(); + +public: + SmElementsControl(Window *pParent, const ResId& rResId); + + void setElementSetId(sal_uInt16 aSetId); + + void SetSelectHdl(const Link& rLink) { aSelectHdlLink = rLink; } +}; + +class SmElementsDockingWindow : public SfxDockingWindow +{ + static const sal_uInt16 aCategories[]; + + SmElementsControl maElementsControl; + ListBox maElementListBox; + + virtual void Resize(); + SmViewShell* GetView(); + + DECL_LINK(SelectClickHdl, SmElement*); + DECL_LINK(ElementSelectedHandle, ListBox*); + +public: + + SmElementsDockingWindow( SfxBindings* pBindings, + SfxChildWindow* pChildWindow, + Window* pParent ); + ~SmElementsDockingWindow(); +}; + +class SmElementsDockingWindowWrapper : public SfxChildWindow +{ + SFX_DECL_CHILDWINDOW_WITHID(SmElementsDockingWindowWrapper); + +protected: + SmElementsDockingWindowWrapper( Window* pParentWindow, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo ); + virtual ~SmElementsDockingWindowWrapper(); +}; + + +#endif // _SYMBOLDOCKINGWINDOW_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index ed1eb26ce920..a9bfbfa83119 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -56,6 +56,7 @@ #define SID_INSERTSYMBOL (SID_SMA_START + 104) /** Command for inserting a math construction specified in commands.src */ #define SID_INSERTCOMMAND (SID_SMA_START + 105) +#define SID_INSERTCOMMANDTEXT (SID_SMA_START + 106) #define SID_LOADSYMBOLS (SID_SMA_START + 107) #define SID_SAVESYMBOLS (SID_SMA_START + 108) @@ -77,6 +78,7 @@ #define SID_TOOLBOXWINDOW (SID_SMA_START + 123) #define SID_NO_RIGHT_SPACES (SID_SMA_START + 124) #define SID_SAVE_ONLY_USED_SYMBOLS (SID_SMA_START + 125) +#define SID_ELEMENTSDOCKINGWINDOW (SID_SMA_START + 126) #define RID_FONTDIALOG (RID_APP_START + 2) @@ -110,6 +112,7 @@ #define RID_SYMBOLFILESSTR (RID_APP_START + 809) #define RID_ALLFILESSTR (RID_APP_START + 810) #define RID_STATUSBAR (RID_APP_START + 816) +#define RID_ELEMENTSDOCKINGWINDOW (RID_APP_START + 817) #define STR_MATH_DOCUMENT_FULLTYPE_CURRENT (RID_APP_START + 821) #define STR_STATSTR_READING (RID_APP_START + 823) @@ -281,6 +284,39 @@ #define RID_LIMINFX (RID_APP_START + 1616) #define RID_LIMSUPX (RID_APP_START + 1617) +#define RID_LIM_FROMX (RID_APP_START + 1621) +#define RID_SUM_FROMX (RID_APP_START + 1622) +#define RID_PROD_FROMX (RID_APP_START + 1623) +#define RID_COPROD_FROMX (RID_APP_START + 1624) +#define RID_INT_FROMX (RID_APP_START + 1625) +#define RID_IINT_FROMX (RID_APP_START + 1626) +#define RID_IIINT_FROMX (RID_APP_START + 1627) +#define RID_LINT_FROMX (RID_APP_START + 1629) +#define RID_LLINT_FROMX (RID_APP_START + 1630) +#define RID_LLLINT_FROMX (RID_APP_START + 1631) + +#define RID_LIM_TOX (RID_APP_START + 1641) +#define RID_SUM_TOX (RID_APP_START + 1642) +#define RID_PROD_TOX (RID_APP_START + 1643) +#define RID_COPROD_TOX (RID_APP_START + 1644) +#define RID_INT_TOX (RID_APP_START + 1645) +#define RID_IINT_TOX (RID_APP_START + 1646) +#define RID_IIINT_TOX (RID_APP_START + 1647) +#define RID_LINT_TOX (RID_APP_START + 1649) +#define RID_LLINT_TOX (RID_APP_START + 1650) +#define RID_LLLINT_TOX (RID_APP_START + 1651) + +#define RID_LIM_FROMTOX (RID_APP_START + 1661) +#define RID_SUM_FROMTOX (RID_APP_START + 1662) +#define RID_PROD_FROMTOX (RID_APP_START + 1663) +#define RID_COPROD_FROMTOX (RID_APP_START + 1664) +#define RID_INT_FROMTOX (RID_APP_START + 1665) +#define RID_IINT_FROMTOX (RID_APP_START + 1666) +#define RID_IIINT_FROMTOX (RID_APP_START + 1667) +#define RID_LINT_FROMTOX (RID_APP_START + 1669) +#define RID_LLINT_FROMTOX (RID_APP_START + 1670) +#define RID_LLLINT_FROMTOX (RID_APP_START + 1671) + #define RID_ACUTEX (RID_APP_START + 1701) #define RID_GRAVEX (RID_APP_START + 1702) #define RID_CHECKX (RID_APP_START + 1703) @@ -396,6 +432,16 @@ #define RID_SPANISH_50_NAMES (RID_APP_START + 3113) #define RID_SPANISH_60_NAMES (RID_APP_START + 3114) +#define RID_CATERGORY_UNARY_BINARY_OPERATORS (RID_APP_START + 4001) +#define RID_CATERGORY_RELATIONS (RID_APP_START + 4002) +#define RID_CATERGORY_SET_OPERATIONS (RID_APP_START + 4003) +#define RID_CATERGORY_FUNCTIONS (RID_APP_START + 4004) +#define RID_CATERGORY_OPERATORS (RID_APP_START + 4005) +#define RID_CATERGORY_ATTRIBUTES (RID_APP_START + 4006) +#define RID_CATERGORY_BRACKETS (RID_APP_START + 4007) +#define RID_CATERGORY_FORMATS (RID_APP_START + 4008) +#define RID_CATERGORY_OTHERS (RID_APP_START + 4009) +#define RID_CATERGORY_EXAMPLES (RID_APP_START + 4010) #define BMP_ARROW_RIGHT 1 @@ -406,6 +452,8 @@ #define MN_SUB_SPELLING 34 #define MN_SUB_TEMPLATES 35 +#define FT_1 1 + // 342 == SCH_IF_SMAVIEWSHELL, because SFX_INTERFACE_LIB is no // Define but latterly an Enum #define HID_SMA_VIEWSHELL_DOCUMENT (342) diff --git a/starmath/sdi/smath.sdi b/starmath/sdi/smath.sdi index 95366b08f2d0..6df2a617d227 100644 --- a/starmath/sdi/smath.sdi +++ b/starmath/sdi/smath.sdi @@ -165,6 +165,31 @@ SfxVoidItem CommandWindow SID_CMDBOXWINDOW ] //-------------------------------------------------------------------------- +SfxVoidItem ElementsDockingWindow SID_ELEMENTSDOCKINGWINDOW +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_VIEW; +] + +//-------------------------------------------------------------------------- SfxVoidItem Preferences SID_PREFERENCES () [ @@ -368,6 +393,30 @@ SfxVoidItem InsertCommand SID_INSERTCOMMAND GroupId = GID_INSERT; ] +SfxVoidItem InsertCommandText SID_INSERTCOMMANDTEXT +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_INSERT; +] + //-------------------------------------------------------------------------- SfxVoidItem InsertConfigName SID_INSERTSYMBOL () @@ -777,7 +826,7 @@ SfxStringItem TextStatus SID_TEXTSTATUS ] //-------------------------------------------------------------------------- -SfxVoidItem ToolBowWindow SID_TOOLBOXWINDOW +SfxVoidItem ToolBoxWindow SID_TOOLBOXWINDOW () [ /* flags: */ @@ -952,4 +1001,3 @@ SfxVoidItem ZoomOut SID_ZOOMOUT ToolBoxConfig = TRUE, GroupId = GID_VIEW; ] - diff --git a/starmath/sdi/smslots.sdi b/starmath/sdi/smslots.sdi index 5291ca1c40e0..710442350f41 100644 --- a/starmath/sdi/smslots.sdi +++ b/starmath/sdi/smslots.sdi @@ -260,6 +260,11 @@ interface FormulaView ExecMethod = Execute ; StateMethod = GetState ; ] + SID_INSERTCOMMANDTEXT + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] //idlpp kein Menueeintrag , also keine Texte SID_INSERTSYMBOL //idlpp ole : no , status : no [ @@ -296,6 +301,11 @@ interface FormulaView ExecMethod = NoExec ; StateMethod = NoState ; ] + SID_ELEMENTSDOCKINGWINDOW + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] //idlpp kein Menueeintrag , also keine Texte SID_TOOLBOXWINDOW //idlpp ole : no , status : no [ @@ -320,4 +330,3 @@ shell SmViewShell } } - diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx new file mode 100644 index 000000000000..81a6467afe6e --- /dev/null +++ b/starmath/source/ElementsDockingWindow.cxx @@ -0,0 +1,530 @@ +/* -*- 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 . + */ + +#include <ElementsDockingWindow.hxx> +#include <starmath.hrc> +#include <smmod.hxx> +#include <config.hxx> + +#include <node.hxx> +#include <view.hxx> +#include <visitors.hxx> + +#include <svl/stritem.hxx> +#include <sfx2/dispatch.hxx> + +SV_DECL_REF(SmDocShell) +SV_IMPL_REF(SmDocShell) + +SmElement::SmElement(SmNode* pNode, OUString aText) : + mpNode(pNode), + maText(aText) +{} + +SmElement::~SmElement() +{} + +SmElementSeparator::SmElementSeparator() : + SmElement(NULL, OUString()) +{} + +SmNode* SmElement::getNode() +{ + return mpNode; +} + +////////////////////////////////// + +const sal_uInt16 SmElementsControl::aUnaryBinaryOperatorsList[] = +{ + RID_PLUSX, RID_MINUSX, RID_PLUSMINUSX, RID_MINUSPLUSX, + 0xFFFF, + RID_XPLUSY, RID_XMINUSY, RID_XCDOTY, RID_XTIMESY, + RID_XSYMTIMESY, RID_XOVERY, RID_XDIVY, RID_XSYMDIVIDEY, + RID_XCIRCY, RID_XWIDESLASHY, RID_XWIDEBSLASHY, + 0xFFFF, + RID_NEGX, RID_XANDY, RID_XORY, +}; + +const sal_uInt16 SmElementsControl::aRelationsList[] = +{ + RID_XEQY, RID_XNEQY, RID_XLTY, RID_XLEY, + RID_XLESLANTY, RID_XGTY, RID_XGEY, RID_XGESLANTY, + 0xFFFF, + RID_XAPPROXY, RID_XSIMY, RID_XSIMEQY, RID_XEQUIVY, + RID_XPROPY, RID_XPARALLELY, RID_XORTHOY, RID_XDIVIDESY, + RID_XNDIVIDESY, RID_XTOWARDY, + 0xFFFF, + RID_DLARROW, RID_DLRARROW, RID_DRARROW, + 0xFFFF, + RID_XPRECEDESY, RID_XSUCCEEDSY, RID_XPRECEDESEQUALY, RID_XSUCCEEDSEQUALY, + RID_XPRECEDESEQUIVY, RID_XSUCCEEDSEQUIVY, RID_XNOTPRECEDESY, RID_XNOTSUCCEEDSY +}; + +const sal_uInt16 SmElementsControl::aSetOperations[] = +{ + RID_XINY, RID_XNOTINY, RID_XOWNSY, + 0xFFFF, + RID_XINTERSECTIONY, RID_XUNIONY, RID_XSETMINUSY, RID_XSLASHY, + RID_XSUBSETY, RID_XSUBSETEQY, RID_XSUPSETEQY, RID_XNSUBSETY, + RID_XNSUBSETEQY, RID_XNSUPSETY, RID_XNSUPSETEQY, + 0xFFFF, + RID_EMPTYSET, RID_ALEPH, RID_SETN, RID_SETZ, + RID_SETQ, RID_SETR, RID_SETC +}; + +const sal_uInt16 SmElementsControl::aFunctions[] = +{ + RID_ABSX, RID_FACTX, RID_SQRTX, RID_NROOTXY, + RID_RSUPX, RID_EX, RID_LNX, RID_EXPX, + RID_LOGX, + 0xFFFF, + RID_SINX, RID_COSX, RID_TANX, RID_COTX, + RID_SINHX, RID_COSHX, RID_TANHX, RID_COTHX, + 0xFFFF, + RID_ARCSINX, RID_ARCCOSX, RID_ARCTANX, RID_ARCCOTX, + RID_ARSINHX, RID_ARCOSHX, RID_ARTANHX, RID_ARCOTHX +}; + +const sal_uInt16 SmElementsControl::aOperators[] = +{ + RID_LIMX, RID_SUMX, RID_PRODX, RID_COPRODX, + RID_INTX, RID_IINTX, RID_IIINTX, RID_LINTX, + RID_LLINTX, RID_LLLINTX, + 0xFFFF, + RID_LIM_FROMX, RID_SUM_FROMX, RID_PROD_FROMX, RID_COPROD_FROMX, + RID_INT_FROMX, RID_IINT_FROMX, RID_IIINT_FROMX, RID_LINT_FROMX, + RID_LLINT_FROMX, RID_LLLINT_FROMX, + 0xFFFF, + RID_LIM_TOX, RID_SUM_TOX, RID_PROD_TOX, RID_COPROD_TOX, + RID_INT_TOX, RID_IINT_TOX, RID_IIINT_TOX, RID_LINT_TOX, + RID_LLINT_TOX, RID_LLLINT_TOX, + 0xFFFF, + RID_LIM_FROMTOX, RID_SUM_FROMTOX, RID_PROD_FROMTOX, RID_COPROD_FROMTOX, + RID_INT_FROMTOX, RID_IINT_FROMTOX, RID_IIINT_FROMTOX, RID_LINT_FROMTOX, + RID_LLINT_FROMTOX, RID_LLLINT_FROMTOX, + +}; + +const sal_uInt16 SmElementsControl::aAttributes[] = +{ + RID_ACUTEX, RID_GRAVEX, RID_BREVEX, RID_CIRCLEX, + RID_DOTX, RID_DDOTX, RID_DDDOTX, RID_BARX, + RID_VECX, RID_TILDEX, RID_HATX, + 0xFFFF, + RID_WIDEVECX, RID_WIDETILDEX, RID_WIDEHATX, RID_OVERLINEX, + RID_UNDERLINEX, RID_OVERSTRIKEX, + 0xFFFF, + RID_PHANTOMX, RID_BOLDX, RID_ITALX, RID_SIZEXY, RID_FONTXY +}; + +const sal_uInt16 SmElementsControl::aBrackets[] = +{ + RID_LRGROUPX, + 0xFFFF, + RID_LRPARENTX, RID_LRBRACKETX, RID_LRDBRACKETX, RID_LRBRACEX, + RID_LRANGLEX, RID_LMRANGLEXY, RID_LRCEILX, RID_LRFLOORX, + RID_LRLINEX, RID_LRDLINEX, + 0xFFFF, + RID_SLRPARENTX, RID_SLRBRACKETX, RID_SLRDBRACKETX, RID_SLRANGLEX, + RID_SLMRANGLEXY, RID_SLRCEILX, RID_SLRFLOORX, RID_SLRLINEX, + RID_SLRDLINEX, + 0XFFFF, + RID_XOVERBRACEY, RID_XUNDERBRACEY +}; + +const sal_uInt16 SmElementsControl::aFormats[] = +{ + RID_RSUPX, RID_RSUBX, RID_LSUPX, RID_LSUBX, + RID_CSUPX, RID_CSUBX, + 0xFFFF, + RID_NEWLINE, RID_SBLANK, RID_BLANK, RID_NOSPACE, + RID_BINOMXY, RID_STACK, RID_MATRIX, +}; + +const sal_uInt16 SmElementsControl::aOthers[] = +{ + RID_INFINITY, RID_PARTIAL, RID_NABLA, RID_EXISTS, + RID_NOTEXISTS, RID_FORALL, RID_HBAR, RID_LAMBDABAR, + RID_RE, RID_IM, RID_WP, + 0xFFFF, + RID_LEFTARROW, RID_RIGHTARROW, RID_UPARROW, RID_DOWNARROW, + 0xFFFF, + RID_DOTSLOW, RID_DOTSAXIS, RID_DOTSVERT, RID_DOTSUP, + RID_DOTSDOWN +}; + +SmElementsControl::SmElementsControl(Window *pParent, const ResId& rResId) : + Control(pParent, rResId), + mpDocShell(new SmDocShell(SFXOBJECTSHELL_STD_NORMAL)), + mpCurrentElement(NULL) +{ + maFormat.SetBaseSize(PixelToLogic(Size(0, 24))); +} + +void SmElementsControl::Paint(const Rectangle&) +{ + Push(); + + SetMapMode( MapMode(MAP_100TH_MM) ); + SetDrawMode( DRAWMODE_DEFAULT ); + SetLayoutMode( TEXT_LAYOUT_BIDI_LTR ); + SetDigitLanguage( LANGUAGE_ENGLISH ); + + sal_uInt32 boxX = maMaxElementDimensions.Width() + 10; + sal_uInt32 boxY = maMaxElementDimensions.Height() + 10; + + sal_uInt32 x = 0; + sal_uInt32 y = 0; + + sal_uInt32 perLine = GetOutputSizePixel().Width() / boxX; + + if(perLine <= 0) { + perLine = 1; + } + + boxX = GetOutputSizePixel().Width() / perLine; + + for (sal_uInt16 i = 0; i < maElementList.size() ; i++) + { + SmElement* element = maElementList[i]; + if (element->isSeparator()) + { + x = 0; + y += boxY; + Rectangle aSelectionRectangle( + x+5, y+5-1, + GetOutputSizePixel().Width() - 5, y+5+1); + + DrawRect(PixelToLogic(aSelectionRectangle)); + y += 10; + } + else + { + Size aSizePixel = LogicToPixel(Size(element->getNode()->GetWidth(), element->getNode()->GetHeight())); + if ( x + boxX > GetOutputSizePixel().Width()) + { + x = 0; + y += boxY; + } + + if (mpCurrentElement == element) + { + Push(); + SetFillColor( Color(230,230,230) ); + SetLineColor( Color(230,230,230) ); + + DrawRect(PixelToLogic(Rectangle(x+2, y+2, x+boxX-2, y+boxY-2))); + Pop(); + } + + Point location(x + ((boxX-aSizePixel.Width())/2), y + ((boxY-aSizePixel.Height())/2)); + SmDrawingVisitor(*this, PixelToLogic(location), element->getNode()); + + element->mBoxLocation = Point(x,y); + element->mBoxSize = Size(boxX, boxY); + + x += boxX; + } + + } + Pop(); +} + +void SmElementsControl::MouseMove( const MouseEvent& rMouseEvent ) +{ + mpCurrentElement = NULL; + if (Rectangle(Point(0, 0), GetOutputSizePixel()).IsInside(rMouseEvent.GetPosPixel())) + { + for (sal_uInt16 i = 0; i < maElementList.size() ; i++) + { + SmElement* element = maElementList[i]; + Rectangle rect(element->mBoxLocation, element->mBoxSize); + if (rect.IsInside(rMouseEvent.GetPosPixel())) + { + if (mpCurrentElement != element) + { + mpCurrentElement = element; + Invalidate(); + } + } + } + } + else + { + Control::MouseMove (rMouseEvent); + } +} + +void SmElementsControl::MouseButtonDown(const MouseEvent& rMouseEvent) +{ + GrabFocus(); + + if (rMouseEvent.IsLeft() && Rectangle(Point(0, 0), GetOutputSizePixel()).IsInside(rMouseEvent.GetPosPixel())) + { + for (sal_uInt16 i = 0; i < maElementList.size() ; i++) + { + SmElement* element = maElementList[i]; + Rectangle rect(element->mBoxLocation, element->mBoxSize); + if (rect.IsInside(rMouseEvent.GetPosPixel())) + { + aSelectHdlLink.Call(element); + return; + } + } + } + else + { + Control::MouseButtonDown (rMouseEvent); + } +} + +void SmElementsControl::addSeparator() +{ + SmElement* pElement = new SmElementSeparator(); + maElementList.push_back(pElement); +} + +void SmElementsControl::addElement(OUString aElementVisual, OUString aElementSource) +{ + SmNode* pNode = SmParser().ParseExpression(aElementVisual); + pNode->Prepare(maFormat, *mpDocShell); + pNode->SetSize(Fraction(10,8)); + pNode->Arrange(*this, maFormat); + + Size aSizePixel = LogicToPixel(Size(pNode->GetWidth(), pNode->GetHeight()), MAP_100TH_MM); + if (aSizePixel.Width() > maMaxElementDimensions.Width()) { + maMaxElementDimensions.Width() = aSizePixel.Width(); + } + + if (aSizePixel.Height() > maMaxElementDimensions.Height()) { + maMaxElementDimensions.Height() = aSizePixel.Height(); + } + + SmElement* pElement = new SmElement(pNode, aElementSource); + maElementList.push_back(pElement); +} + +void SmElementsControl::setElementSetId(sal_uInt16 aSetId) +{ + maCurrentSetId = aSetId; + maMaxElementDimensions = Size(); + build(); +} + +void SmElementsControl::addElements(const sal_uInt16 aElementsArray[], sal_uInt16 size) +{ + for (sal_uInt16 i = 0; i < size ; i++) + { + sal_uInt16 aElementId = aElementsArray[i]; + if (aElementId == 0xFFFF) { + addSeparator(); + } else { + if (aElementId == RID_NEWLINE) + addElement(OStringToOUString( "\xe2\x86\xb5", RTL_TEXTENCODING_UTF8 ), SmResId(aElementId)); + else if (aElementId == RID_SBLANK) + addElement(OUString("\"`\""), SmResId(aElementId)); + else if (aElementId == RID_BLANK) + addElement(OUString("\"~\""), SmResId(aElementId)); + else if (aElementId == RID_PHANTOMX) + addElement(OUString("\"hide\""), SmResId(aElementId)); + else if (aElementId == RID_BOLDX) + addElement(OUString("bold B"), SmResId(aElementId)); + else if (aElementId == RID_ITALX) + addElement(OUString("ital I"), SmResId(aElementId)); + else if (aElementId == RID_SIZEXY) + addElement(OUString("\"size\""), SmResId(aElementId)); + else if (aElementId == RID_FONTXY) + addElement(OUString("\"font\""), SmResId(aElementId)); + else + addElement(SmResId(aElementId), SmResId(aElementId)); + } + } +} + +void SmElementsControl::build() +{ + maElementList.clear(); + + switch(maCurrentSetId) + { + case RID_CATERGORY_UNARY_BINARY_OPERATORS: + addElements(aUnaryBinaryOperatorsList, sizeof(aUnaryBinaryOperatorsList) / sizeof(sal_uInt16)); + break; + case RID_CATERGORY_RELATIONS: + addElements(aRelationsList, sizeof(aRelationsList) / sizeof(sal_uInt16)); + break; + case RID_CATERGORY_SET_OPERATIONS: + addElements(aSetOperations, sizeof(aSetOperations) / sizeof(sal_uInt16)); + break; + case RID_CATERGORY_FUNCTIONS: + addElements(aFunctions, sizeof(aFunctions) / sizeof(sal_uInt16)); + break; + case RID_CATERGORY_OPERATORS: + addElements(aOperators, sizeof(aOperators) / sizeof(sal_uInt16)); + break; + case RID_CATERGORY_ATTRIBUTES: + addElements(aAttributes, sizeof(aAttributes) / sizeof(sal_uInt16)); + break; + case RID_CATERGORY_BRACKETS: + addElements(aBrackets, sizeof(aBrackets) / sizeof(sal_uInt16)); + break; + case RID_CATERGORY_FORMATS: + addElements(aFormats, sizeof(aFormats) / sizeof(sal_uInt16)); + break; + case RID_CATERGORY_OTHERS: + addElements(aOthers, sizeof(aOthers) / sizeof(sal_uInt16)); + break; + case RID_CATERGORY_EXAMPLES: + { + OUString aFunctionList[] = { + "C=%pi cdot d = 2 cdot %pi cdot r", + "E=mc^2", + "a^2 + b^2 = c^2", + "f ( x ) = sum from { { i = 0 } } to { infinity } { {f^{(i)}(0)} over {i!} x^i}", + "f ( x ) = {1} over {%sigma sqrt{2%pi} }e^-{{(x-%mu)^2} over {2%sigma^2}}" + }; + for (sal_uInt16 i = 0; i < 5 ; i++) + { + addElement(aFunctionList[i], aFunctionList[i]); + } + } + break; + } + Invalidate(); +} + +//******************* + +const sal_uInt16 SmElementsDockingWindow::aCategories[] = { + RID_CATERGORY_UNARY_BINARY_OPERATORS, + RID_CATERGORY_RELATIONS, + RID_CATERGORY_SET_OPERATIONS, + RID_CATERGORY_FUNCTIONS, + RID_CATERGORY_OPERATORS, + RID_CATERGORY_ATTRIBUTES, + RID_CATERGORY_BRACKETS, + RID_CATERGORY_FORMATS, + RID_CATERGORY_OTHERS, + RID_CATERGORY_EXAMPLES +}; + +SmElementsDockingWindow::SmElementsDockingWindow(SfxBindings* pInputBindings, SfxChildWindow* pChildWindow, Window* pParent) : + SfxDockingWindow(pInputBindings, pChildWindow, pParent, SmResId(RID_ELEMENTSDOCKINGWINDOW)), + maElementsControl (this, SmResId(1)), + maElementListBox (this, SmResId(1)) +{ + maElementsControl.SetBorderStyle( WINDOW_BORDER_MONO ); + + maElementListBox.SetDropDownLineCount( 10 ); + + for (sal_uInt16 i = 0; i < sizeof(aCategories) / sizeof(sal_uInt16) ; i++) + { + maElementListBox.InsertEntry(OUString(SmResId(aCategories[i]))); + } + + maElementListBox.SetSelectHdl(LINK(this, SmElementsDockingWindow, ElementSelectedHandle)); + + Wallpaper aWallpaper( Color( COL_WHITE ) ); + + maElementsControl.SetBackground( aWallpaper ); + maElementsControl.SetTextColor( Color( COL_BLACK ) ); + maElementsControl.SetSelectHdl(LINK(this, SmElementsDockingWindow, SelectClickHdl)); + + maElementListBox.SelectEntry(OUString(SmResId(RID_CATERGORY_UNARY_BINARY_OPERATORS))); + maElementsControl.setElementSetId(RID_CATERGORY_UNARY_BINARY_OPERATORS); +} + +SmElementsDockingWindow::~SmElementsDockingWindow () +{ +} + +IMPL_LINK( SmElementsDockingWindow, SelectClickHdl, SmElement*, pElement) +{ + SmViewShell* pViewSh = GetView(); + + if (pViewSh) + { + pViewSh->GetViewFrame()->GetDispatcher()->Execute( + SID_INSERTCOMMANDTEXT, SFX_CALLMODE_STANDARD, + new SfxStringItem(SID_INSERTCOMMANDTEXT, pElement->getText()), 0L); + } + return 0; +} + +IMPL_LINK( SmElementsDockingWindow, ElementSelectedHandle, ListBox*, pList) +{ + for (sal_uInt16 i = 0; i < sizeof(aCategories) / sizeof(sal_uInt16) ; i++) + { + sal_uInt16 aCurrentCategory = aCategories[i]; + OUString aCurrentCategoryString = OUString(SmResId(aCurrentCategory)); + if (aCurrentCategoryString == pList->GetSelectEntry()) + { + maElementsControl.setElementSetId(aCurrentCategory); + return 0; + } + } + return 0; +} + +SmViewShell* SmElementsDockingWindow::GetView() +{ + SfxViewShell *pView = GetBindings().GetDispatcher()->GetFrame()->GetViewShell(); + return PTR_CAST(SmViewShell, pView); +} + +void SmElementsDockingWindow::Resize() +{ + sal_uInt32 aWidth = GetOutputSizePixel().Width(); + sal_uInt32 aHeight = GetOutputSizePixel().Height(); + + sal_uInt32 aElementsSetsHeight = 23; + sal_uInt32 aPadding = 5; + + Rectangle aRect1 = Rectangle(aPadding, aPadding, aWidth - aPadding, aElementsSetsHeight + aPadding); + + maElementListBox.SetPosSizePixel(aRect1.TopLeft(), aRect1.GetSize()); + + Rectangle aRect = Rectangle(aPadding, aElementsSetsHeight + aPadding + aPadding, aWidth - aPadding, aHeight - aPadding); + + maElementsControl.SetPosSizePixel(aRect.TopLeft(), aRect.GetSize()); + + SfxDockingWindow::Resize(); + Invalidate(); +} + +SFX_IMPL_DOCKINGWINDOW_WITHID(SmElementsDockingWindowWrapper, SID_ELEMENTSDOCKINGWINDOW); + +SmElementsDockingWindowWrapper::SmElementsDockingWindowWrapper( + Window *pParentWindow, sal_uInt16 nId, + SfxBindings *pBindings, SfxChildWinInfo *pInfo) : + SfxChildWindow(pParentWindow, nId) +{ + pWindow = new SmElementsDockingWindow(pBindings, this, pParentWindow); + SmElementsDockingWindow* pDialog = (SmElementsDockingWindow*) pWindow; + eChildAlignment = SFX_ALIGN_NOALIGNMENT; + pDialog->Initialize( pInfo ); +} + +SmElementsDockingWindowWrapper::~SmElementsDockingWindowWrapper() +{ +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/source/commands.src b/starmath/source/commands.src index 92413c770f0a..e6a002ff7d1f 100644 --- a/starmath/source/commands.src +++ b/starmath/source/commands.src @@ -105,20 +105,50 @@ String RID_ARCOSHX { Text = "arcosh(<?>) " ; }; String RID_ARTANHX { Text = "artanh(<?>) " ; }; String RID_ARCOTHX { Text = "arcoth(<?>) " ; }; String RID_SUMX { Text = "sum <?> " ; }; +String RID_SUM_FROMX { Text = "sum from{<?>} <?> " ; }; +String RID_SUM_TOX { Text = "sum to{<?>} <?> " ; }; +String RID_SUM_FROMTOX { Text = "sum from{<?>} to{<?>} <?> " ; }; String RID_PRODX { Text = "prod <?> " ; }; +String RID_PROD_FROMX { Text = "prod from{<?>} <?> " ; }; +String RID_PROD_TOX { Text = "prod to{<?>} <?> " ; }; +String RID_PROD_FROMTOX { Text = "prod from{<?>} to{<?>} <?> " ; }; String RID_COPRODX { Text = "coprod <?> " ; }; +String RID_COPROD_FROMX { Text = "coprod from{<?>} <?> " ; }; +String RID_COPROD_TOX { Text = "coprod to{<?>} <?> " ; }; +String RID_COPROD_FROMTOX { Text = "coprod from{<?>} to{<?>} <?> " ; }; String RID_LIMX { Text = "lim <?> " ; }; +String RID_LIM_FROMX { Text = "lim from{<?>} <?> " ; }; +String RID_LIM_TOX { Text = "lim to{<?>} <?> " ; }; +String RID_LIM_FROMTOX { Text = "lim from{<?>} to{<?>} <?> " ; }; String RID_LIMINFX { Text = "liminf <?> " ; }; String RID_LIMSUPX { Text = "limsup <?> " ; }; String RID_EXISTS { Text = "exists " ; }; String RID_NOTEXISTS { Text = "notexists " ; }; String RID_FORALL { Text = "forall " ; }; String RID_INTX { Text = "int <?> " ; }; +String RID_INT_FROMX { Text = "int from{<?>} <?> " ; }; +String RID_INT_TOX { Text = "int to{<?>} <?> " ; }; +String RID_INT_FROMTOX { Text = "int from{<?>} to{<?>} <?> " ; }; String RID_IINTX { Text = "iint <?> " ; }; +String RID_IINT_FROMX { Text = "iint from{<?>} <?> " ; }; +String RID_IINT_TOX { Text = "iint to{<?>} <?> " ; }; +String RID_IINT_FROMTOX { Text = "iint from{<?>} to{<?>} <?> " ; }; String RID_IIINTX { Text = "iiint <?> " ; }; +String RID_IIINT_FROMX { Text = "iiint from{<?>} <?> " ; }; +String RID_IIINT_TOX { Text = "iiint to{<?>} <?> " ; }; +String RID_IIINT_FROMTOX { Text = "iiint from{<?>} to{<?>} <?> " ; }; String RID_LINTX { Text = "lint <?> " ; }; +String RID_LINT_FROMX { Text = "lint from{<?>} <?> " ; }; +String RID_LINT_TOX { Text = "lint to{<?>} <?> " ; }; +String RID_LINT_FROMTOX { Text = "lint from{<?>} to{<?>} <?> " ; }; String RID_LLINTX { Text = "llint <?> " ; }; +String RID_LLINT_FROMX { Text = "llint from{<?>} <?> " ; }; +String RID_LLINT_TOX { Text = "llint to{<?>} <?> " ; }; +String RID_LLINT_FROMTOX { Text = "llint from{<?>} to{<?>} <?> " ; }; String RID_LLLINTX { Text = "lllint <?> " ; }; +String RID_LLLINT_FROMX { Text = "lllint from{<?>} <?> " ; }; +String RID_LLLINT_TOX { Text = "lllint to{<?>} <?> " ; }; +String RID_LLLINT_FROMTOX { Text = "lllint from{<?>} to{<?>} <?> " ; }; String RID_FROMX { Text = "from{<?>} <?> " ; }; String RID_TOX { Text = "to{<?>} <?> " ; }; String RID_FROMXTOY { Text = "from{<?>} to{<?>} <?> " ; }; @@ -226,6 +256,18 @@ String RID_XSUCCEEDSEQUALY { Text = "<?> succcurlyeq <?> " ; }; String RID_XSUCCEEDSEQUIVY { Text = "<?> succsim <?> " ; }; String RID_XNOTPRECEDESY { Text = "<?> nprec <?> " ; }; String RID_XNOTSUCCEEDSY { Text = "<?> nsucc <?> " ; }; + +String RID_CATERGORY_UNARY_BINARY_OPERATORS { Text = "Unary/Binary Operators" ; }; +String RID_CATERGORY_RELATIONS { Text = "Relations" ; }; +String RID_CATERGORY_SET_OPERATIONS { Text = "Set Operations" ; }; +String RID_CATERGORY_FUNCTIONS { Text = "Functions" ; }; +String RID_CATERGORY_OPERATORS { Text = "Operators" ; }; +String RID_CATERGORY_ATTRIBUTES { Text = "Attributes" ; }; +String RID_CATERGORY_BRACKETS { Text = "Brackets" ; }; +String RID_CATERGORY_FORMATS { Text = "Formats" ; }; +String RID_CATERGORY_OTHERS { Text = "Others" ; }; +String RID_CATERGORY_EXAMPLES { Text = "Examples" ; }; + ////////////////////////////////////////// diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index ff6b0c748b20..91d4088e8f57 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -481,8 +481,6 @@ void SmDocShell::DrawFormula(OutputDevice &rDev, Point &rPosition, bool bDrawSel rDev.SetDrawMode( nOldDrawMode ); } - - Size SmDocShell::GetSize() { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::GetSize" ); @@ -645,7 +643,7 @@ void SmDocShell::SetPrinter( SfxPrinter *pNew ) RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::SetPrinter" ); delete pPrinter; - pPrinter = pNew; //Eigentumsuebergang! + pPrinter = pNew; //Transfer ownership pPrinter->SetMapMode( MapMode(MAP_100TH_MM) ); SetFormulaArranged(false); Repaint(); diff --git a/starmath/source/smdll.cxx b/starmath/source/smdll.cxx index 8395c09d63e9..e25dca417e30 100644 --- a/starmath/source/smdll.cxx +++ b/starmath/source/smdll.cxx @@ -33,6 +33,8 @@ #include <toolbox.hxx> #include <view.hxx> +#include <ElementsDockingWindow.hxx> + #include <starmath.hrc> #include <svx/xmlsecctrl.hxx> @@ -72,6 +74,7 @@ namespace SmToolBoxWrapper::RegisterChildWindow(true); SmCmdBoxWrapper::RegisterChildWindow(true); + SmElementsDockingWindowWrapper::RegisterChildWindow(true); ::sfx2::TaskPaneWrapper::RegisterChildWindow(false, pModule); } diff --git a/starmath/source/smres.src b/starmath/source/smres.src index 0e5ebf5f076a..dc4ee7b624f8 100644 --- a/starmath/source/smres.src +++ b/starmath/source/smres.src @@ -77,8 +77,8 @@ ModalDialog RID_FONTDIALOG Pos = MAP_APPFONT ( 126 , 42 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; - HelpID = "starmath:HelpButton:RID_FONTDIALOG:1"; - Text [ en-US ] = "~Help" ; + HelpID = "starmath:HelpButton:RID_FONTDIALOG:1"; + Text [ en-US ] = "~Help" ; }; OKButton 1 { @@ -271,8 +271,8 @@ ModalDialog RID_FONTSIZEDIALOG Pos = MAP_APPFONT ( 114 , 46 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; - HelpID = "starmath:PushButton:RID_FONTSIZEDIALOG:1"; - Text [ en-US ] = "~Help" ; + HelpID = "starmath:PushButton:RID_FONTSIZEDIALOG:1"; + Text [ en-US ] = "~Help" ; }; PushButton 1 { @@ -443,8 +443,8 @@ ModalDialog RID_FONTTYPEDIALOG Pos = MAP_APPFONT ( 225 , 66 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; - HelpID = "starmath:HelpButton:RID_FONTYPEDIALOG:1"; - Text [ en-US ] = "~Help" ; + HelpID = "starmath:HelpButton:RID_FONTYPEDIALOG:1"; + Text [ en-US ] = "~Help" ; }; PushButton 2 { @@ -572,8 +572,8 @@ ModalDialog RID_DISTANCEDIALOG Pos = MAP_APPFONT ( 184 , 87 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; - HelpID = "starmath:HelpButton:RID_DISTANCEDIALOG:1"; - Text [ en-US ] = "~Help" ; + HelpID = "starmath:HelpButton:RID_DISTANCEDIALOG:1"; + Text [ en-US ] = "~Help" ; }; PushButton 1 { @@ -925,8 +925,8 @@ ModalDialog RID_ALIGNDIALOG Pos = MAP_APPFONT ( 83 , 46 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; - HelpID = "starmath:HelpButton:RID_ALIGNDIALOG:1"; - Text [ en-US ] = "~Help" ; + HelpID = "starmath:HelpButton:RID_ALIGNDIALOG:1"; + Text [ en-US ] = "~Help" ; }; PushButton 1 { @@ -1121,8 +1121,8 @@ ModalDialog RID_SYMBOLDIALOG Pos = MAP_APPFONT ( 177 , 60 ) ; Size = MAP_APPFONT ( 56 , 14 ) ; TabStop = TRUE ; - HelpID = "starmath:HelpButton:RID_SYMBOLDIALOG:1"; - Text [ en-US ] = "~Help" ; + HelpID = "starmath:HelpButton:RID_SYMBOLDIALOG:1"; + Text [ en-US ] = "~Help" ; }; }; @@ -1339,8 +1339,8 @@ ModalDialog RID_SYMDEFINEDIALOG Pos = MAP_APPFONT ( 310 , 42 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; - HelpID = "starmath:HelpButton:RID_SYMDEFINEDIALOG:1"; - Text [ en-US ] = "~Help" ; + HelpID = "starmath:HelpButton:RID_SYMDEFINEDIALOG:1"; + Text [ en-US ] = "~Help" ; }; OKButton 1 { @@ -1569,6 +1569,35 @@ DockingWindow RID_CMDBOXWINDOW\ CMDBOXWINDOW_TEXT }; +DockingWindow RID_ELEMENTSDOCKINGWINDOW +{ + OutputSize = TRUE ; + Hide = FALSE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 300 , 300 ) ; + Sizeable = TRUE ; + Moveable = TRUE ; + Closeable = TRUE ; + Zoomable = TRUE ; + Dockable = TRUE ; + + Control 1 + { + Border = FALSE ; + }; + + ListBox 1 + { + Border = TRUE ; + TabStop = TRUE ; + Sort = FALSE ; + DropDown = TRUE ; + VScroll = TRUE ; + }; + + Text [ en-US ] = "Symbols" ; +}; + String STR_CMDBOXWINDOW { diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 4c755734bb80..d144dde573e9 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -70,12 +70,13 @@ #include "mathmlimport.hxx" #include "cursor.hxx" #include "accessibility.hxx" +#include "ElementsDockingWindow.hxx" #define MINZOOM 25 #define MAXZOOM 800 // space around the edit window, in pixels -#define CMD_BOX_PADDING 4 +#define CMD_BOX_PADDING 10 #define SmViewShell #include "smslots.hxx" @@ -382,27 +383,30 @@ void SmGraphicWindow::Paint(const Rectangle&) rDoc.DrawFormula(*this, aPoint, true); //! modifies aPoint to be the topleft //! corner of the formula SetFormulaDrawPos(aPoint); - if(IsInlineEditEnabled()) { + if(IsInlineEditEnabled()) + { //Draw cursor if any... if(pViewShell->GetDoc()->HasCursor() && IsLineVisible()) pViewShell->GetDoc()->GetCursor().Draw(*this, aPoint, IsCursorVisible()); - } else { - SetIsCursorVisible(false); // (old) cursor must be drawn again - - const SmEditWindow *pEdit = pViewShell->GetEditWindow(); - if (pEdit) - { // get new position for formula-cursor (for possible altered formula) - sal_Int32 nRow; - sal_uInt16 nCol; - SmGetLeftSelectionPart(pEdit->GetSelection(), nRow, nCol); - nRow++; - nCol++; - const SmNode *pFound = SetCursorPos(static_cast<sal_uInt16>(nRow), nCol); - - SmModule *pp = SM_MOD(); - if (pFound && pp->GetConfig()->IsShowFormulaCursor()) - ShowCursor(true); } + else + { + SetIsCursorVisible(false); // (old) cursor must be drawn again + + const SmEditWindow *pEdit = pViewShell->GetEditWindow(); + if (pEdit) + { // get new position for formula-cursor (for possible altered formula) + sal_Int32 nRow; + sal_uInt16 nCol; + SmGetLeftSelectionPart(pEdit->GetSelection(), nRow, nCol); + nRow++; + nCol++; + const SmNode *pFound = SetCursorPos(static_cast<sal_uInt16>(nRow), nCol); + + SmModule *pp = SM_MOD(); + if (pFound && pp->GetConfig()->IsShowFormulaCursor()) + ShowCursor(true); + } } } @@ -927,6 +931,7 @@ SFX_IMPL_INTERFACE(SmViewShell, SfxViewShell, SmResId(0)) SFX_CHILDWINDOW_REGISTRATION(SID_TASKPANE); SFX_CHILDWINDOW_REGISTRATION(SmToolBoxWrapper::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(SmCmdBoxWrapper::GetChildWindowId()); + SFX_CHILDWINDOW_REGISTRATION(SmElementsDockingWindowWrapper::GetChildWindowId()); } @@ -1705,6 +1710,23 @@ void SmViewShell::Execute(SfxRequest& rReq) break; } + case SID_INSERTCOMMANDTEXT: + { + const SfxStringItem& rItem = (const SfxStringItem&)rReq.GetArgs()->Get(SID_INSERTCOMMANDTEXT); + + if (pWin && (bInsertIntoEditWindow || !IsInlineEditEnabled())) + { + pWin->InsertText(rItem.GetValue()); + } + if (IsInlineEditEnabled() && (GetDoc() && !bInsertIntoEditWindow)) + { + GetDoc()->GetCursor().InsertCommandText(rItem.GetValue()); + GetGraphicWindow().GrabFocus(); + } + break; + + } + case SID_INSERTSYMBOL: { const SfxStringItem& rItem = @@ -1837,6 +1859,15 @@ void SmViewShell::Execute(SfxRequest& rReq) } break; + case SID_ELEMENTSDOCKINGWINDOW: + { + GetViewFrame()->ToggleChildWindow( SmElementsDockingWindowWrapper::GetChildWindowId() ); + GetViewFrame()->GetBindings().Invalidate( SID_ELEMENTSDOCKINGWINDOW ); + + rReq.Ignore (); + } + break; + case SID_SYMBOLS_CATALOGUE: { @@ -1927,7 +1958,16 @@ void SmViewShell::GetState(SfxItemSet &rSet) rSet.Put(SfxBoolItem(nWh, pp->GetConfig()->IsShowFormulaCursor())); } break; - + case SID_ELEMENTSDOCKINGWINDOW: + { + bool bState = false; + SfxChildWindow *pChildWnd = GetViewFrame()-> + GetChildWindow( SmElementsDockingWindowWrapper::GetChildWindowId() ); + if (pChildWnd && pChildWnd->GetWindow()->IsVisible()) + bState = true; + rSet.Put(SfxBoolItem(SID_ELEMENTSDOCKINGWINDOW, bState)); + } + break; case SID_TOOLBOX: { bool bState = false; diff --git a/starmath/uiconfig/smath/menubar/menubar.xml b/starmath/uiconfig/smath/menubar/menubar.xml index 8a4d7c989737..9fb97394164b 100644 --- a/starmath/uiconfig/smath/menubar/menubar.xml +++ b/starmath/uiconfig/smath/menubar/menubar.xml @@ -81,6 +81,7 @@ <menu:menuitem menu:id=".uno:StatusBarVisible"/> <menu:menuitem menu:id=".uno:ShowImeStatusWindow"/> <menu:menuitem menu:id=".uno:ToolBox"/> + <menu:menuitem menu:id=".uno:ElementsDockingWindow"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:TaskPane"/> <menu:menuseparator/> |