summaryrefslogtreecommitdiff
path: root/starmath/source
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-05-20 00:13:10 +0200
committerTomaž Vajngerl <quikee@gmail.com>2013-05-20 00:20:27 +0200
commit2d3baccf0249f8c68dcf8f9b0000453d0bc82d8f (patch)
treee40b44c418a9dde000e6e461d719b98227538539 /starmath/source
parentc0b8dd85d4b49e8800e69e614c567ce272ac9780 (diff)
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/source')
-rw-r--r--starmath/source/ElementsDockingWindow.cxx530
-rw-r--r--starmath/source/commands.src42
-rw-r--r--starmath/source/document.cxx4
-rw-r--r--starmath/source/smdll.cxx3
-rw-r--r--starmath/source/smres.src57
-rw-r--r--starmath/source/view.cxx78
6 files changed, 678 insertions, 36 deletions
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;