summaryrefslogtreecommitdiff
path: root/starmath/inc
diff options
context:
space:
mode:
Diffstat (limited to 'starmath/inc')
-rw-r--r--starmath/inc/action.hxx9
-rw-r--r--starmath/inc/caret.hxx72
-rw-r--r--starmath/inc/cursor.hxx80
-rw-r--r--starmath/inc/edit.hxx28
-rw-r--r--starmath/inc/error.hxx5
-rw-r--r--starmath/inc/smdll.hxx2
-rw-r--r--starmath/inc/types.hxx13
7 files changed, 111 insertions, 98 deletions
diff --git a/starmath/inc/action.hxx b/starmath/inc/action.hxx
index cb4a4eddf740..8f98d12cf2a4 100644
--- a/starmath/inc/action.hxx
+++ b/starmath/inc/action.hxx
@@ -24,15 +24,14 @@
class SmDocShell;
-
class SmFormatAction final : public SfxUndoAction
{
- SmDocShell *pDoc;
- SmFormat aOldFormat;
- SmFormat aNewFormat;
+ SmDocShell* pDoc;
+ SmFormat aOldFormat;
+ SmFormat aNewFormat;
public:
- SmFormatAction(SmDocShell *pDocSh, const SmFormat& rOldFormat, const SmFormat& rNewFormat);
+ SmFormatAction(SmDocShell* pDocSh, const SmFormat& rOldFormat, const SmFormat& rNewFormat);
virtual void Undo() override;
virtual void Redo() override;
diff --git a/starmath/inc/caret.hxx b/starmath/inc/caret.hxx
index bc69139994ee..6cc663206da4 100644
--- a/starmath/inc/caret.hxx
+++ b/starmath/inc/caret.hxx
@@ -18,7 +18,8 @@
#include <vector>
/** Representation of caret position with an equation */
-struct SmCaretPos{
+struct SmCaretPos
+{
SmCaretPos(SmNode* selectedNode = nullptr, int iIndex = 0)
: pSelectedNode(selectedNode)
, nIndex(iIndex)
@@ -43,7 +44,8 @@ struct SmCaretPos{
/** True, if this is a valid caret position */
bool IsValid() const { return pSelectedNode != nullptr; }
- bool operator==(const SmCaretPos &pos) const {
+ bool operator==(const SmCaretPos& pos) const
+ {
return pos.pSelectedNode == pSelectedNode && nIndex == pos.nIndex;
}
/** Get the caret position after pNode, regardless of pNode
@@ -51,48 +53,56 @@ struct SmCaretPos{
* Gets the caret position following pNode, this is SmCaretPos(pNode, 1).
* Unless pNode is an instance of SmTextNode, then the index is the text length.
*/
- static SmCaretPos GetPosAfter(SmNode* pNode) {
- if(pNode && pNode->GetType() == SmNodeType::Text)
+ static SmCaretPos GetPosAfter(SmNode* pNode)
+ {
+ if (pNode && pNode->GetType() == SmNodeType::Text)
return SmCaretPos(pNode, static_cast<SmTextNode*>(pNode)->GetText().getLength());
return SmCaretPos(pNode, 1);
}
};
/** A line that represents a caret */
-class SmCaretLine{
+class SmCaretLine
+{
public:
- SmCaretLine(tools::Long left = 0, tools::Long top = 0, tools::Long height = 0) {
+ SmCaretLine(tools::Long left = 0, tools::Long top = 0, tools::Long height = 0)
+ {
_top = top;
_left = left;
_height = height;
}
- tools::Long GetTop() const {return _top;}
- tools::Long GetLeft() const {return _left;}
- tools::Long GetHeight() const {return _height;}
- tools::Long SquaredDistanceX(const SmCaretLine& line) const{
+ tools::Long GetTop() const { return _top; }
+ tools::Long GetLeft() const { return _left; }
+ tools::Long GetHeight() const { return _height; }
+ tools::Long SquaredDistanceX(const SmCaretLine& line) const
+ {
return (GetLeft() - line.GetLeft()) * (GetLeft() - line.GetLeft());
}
- tools::Long SquaredDistanceX(const Point &pos) const{
+ tools::Long SquaredDistanceX(const Point& pos) const
+ {
return (GetLeft() - pos.X()) * (GetLeft() - pos.X());
}
- tools::Long SquaredDistanceY(const SmCaretLine& line) const{
+ tools::Long SquaredDistanceY(const SmCaretLine& line) const
+ {
tools::Long d = GetTop() - line.GetTop();
- if(d < 0)
+ if (d < 0)
d = (d * -1) - GetHeight();
else
d = d - line.GetHeight();
- if(d < 0)
+ if (d < 0)
return 0;
return d * d;
}
- tools::Long SquaredDistanceY(const Point &pos) const{
+ tools::Long SquaredDistanceY(const Point& pos) const
+ {
tools::Long d = GetTop() - pos.Y();
- if(d < 0)
+ if (d < 0)
d = (d * -1) - GetHeight();
- if(d < 0)
+ if (d < 0)
return 0;
return d * d;
}
+
private:
tools::Long _top;
tools::Long _left;
@@ -102,11 +112,12 @@ private:
// SmCaretPosGraph
/** An entry in SmCaretPosGraph */
-struct SmCaretPosGraphEntry{
+struct SmCaretPosGraphEntry
+{
SmCaretPosGraphEntry(SmCaretPos pos, SmCaretPosGraphEntry* left, SmCaretPosGraphEntry* right)
- : CaretPos{pos}
- , Left{left}
- , Right{right}
+ : CaretPos{ pos }
+ , Left{ left }
+ , Right{ right }
{
}
/** Caret position */
@@ -115,18 +126,15 @@ struct SmCaretPosGraphEntry{
SmCaretPosGraphEntry* Left;
/** Entry to the right visually */
SmCaretPosGraphEntry* Right;
- void SetRight(SmCaretPosGraphEntry* right){
- Right = right;
- }
- void SetLeft(SmCaretPosGraphEntry* left){
- Left = left;
- }
+ void SetRight(SmCaretPosGraphEntry* right) { Right = right; }
+ void SetLeft(SmCaretPosGraphEntry* left) { Left = left; }
};
/** A graph over all caret positions
* @remarks Graphs can only grow, entries cannot be removed!
*/
-class SmCaretPosGraph{
+class SmCaretPosGraph
+{
public:
SmCaretPosGraph();
@@ -135,18 +143,14 @@ public:
/** Add a caret position
* @remarks If left is NULL, they will point back to the entry.
*/
- SmCaretPosGraphEntry* Add(SmCaretPos pos,
- SmCaretPosGraphEntry* left = nullptr);
+ SmCaretPosGraphEntry* Add(SmCaretPos pos, SmCaretPosGraphEntry* left = nullptr);
std::vector<std::unique_ptr<SmCaretPosGraphEntry>>::iterator begin()
{
return mvEntries.begin();
}
- std::vector<std::unique_ptr<SmCaretPosGraphEntry>>::iterator end()
- {
- return mvEntries.end();
- }
+ std::vector<std::unique_ptr<SmCaretPosGraphEntry>>::iterator end() { return mvEntries.end(); }
private:
std::vector<std::unique_ptr<SmCaretPosGraphEntry>> mvEntries;
diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx
index 47218e490865..a30beda63368 100644
--- a/starmath/inc/cursor.hxx
+++ b/starmath/inc/cursor.hxx
@@ -19,10 +19,11 @@
/** Factor to multiple the squared horizontal distance with
* Used for Up and Down movement.
*/
-#define HORIZONTICAL_DISTANCE_FACTOR 10
+#define HORIZONTICAL_DISTANCE_FACTOR 10
/** Enum of direction for movement */
-enum SmMovementDirection{
+enum SmMovementDirection
+{
MoveUp,
MoveDown,
MoveLeft,
@@ -30,7 +31,8 @@ enum SmMovementDirection{
};
/** Enum of elements that can inserted into a formula */
-enum SmFormulaElement{
+enum SmFormulaElement
+{
BlankElement,
FactorialElement,
PlusElement,
@@ -43,7 +45,8 @@ enum SmFormulaElement{
};
/** Bracket types that can be inserted */
-enum class SmBracketType {
+enum class SmBracketType
+{
/** Round brackets, left command "(" */
Round,
/**Square brackets, left command "[" */
@@ -65,7 +68,8 @@ class SmDocShell;
* a formula programmatically.
* @remarks This class is a very intimate friend of SmDocShell.
*/
-class SmCursor{
+class SmCursor
+{
public:
SmCursor(SmNode* tree, SmDocShell* pShell)
: mpAnchor(nullptr)
@@ -159,7 +163,8 @@ public:
/** Copy the current selection */
void Copy();
/** Cut the current selection */
- void Cut(){
+ void Cut()
+ {
Copy();
Delete();
}
@@ -189,8 +194,7 @@ public:
private:
friend class SmDocShell;
- SmCaretPosGraphEntry *mpAnchor,
- *mpPosition;
+ SmCaretPosGraphEntry *mpAnchor, *mpPosition;
/** Formula tree */
SmNode* mpTree;
/** Owner of the formula tree */
@@ -207,7 +211,7 @@ private:
*
* These are SmExpression, SmBinHorNode, SmUnHorNode etc.
*/
- static bool IsLineCompositionNode(SmNode const * pNode);
+ static bool IsLineCompositionNode(SmNode const* pNode);
/** Count number of selected nodes, excluding line composition nodes
*
@@ -231,21 +235,24 @@ private:
* This method sets pNode = NULL and remove it from its parent.
* (Assuming it has a parent, and is a child of it).
*/
- static void NodeToList(SmNode*& rpNode, SmNodeList& rList){
+ static void NodeToList(SmNode*& rpNode, SmNodeList& rList)
+ {
//Remove from parent and NULL rpNode
SmNode* pNode = rpNode;
- if(rpNode && rpNode->GetParent()){ //Don't remove this, correctness relies on it
+ if (rpNode && rpNode->GetParent())
+ { //Don't remove this, correctness relies on it
int index = rpNode->GetParent()->IndexOfSubNode(rpNode);
assert(index >= 0);
rpNode->GetParent()->SetSubNode(index, nullptr);
}
rpNode = nullptr;
//Create line from node
- if(pNode && IsLineCompositionNode(pNode)){
+ if (pNode && IsLineCompositionNode(pNode))
+ {
LineToList(static_cast<SmStructureNode*>(pNode), rList);
return;
}
- if(pNode)
+ if (pNode)
rList.push_front(pNode);
}
@@ -272,7 +279,7 @@ private:
void AnnotateSelection();
/** Clone list of nodes in a clipboard (creates a deep clone) */
- static std::unique_ptr<SmNodeList> CloneList(SmClipboard &rClipboard);
+ static std::unique_ptr<SmNodeList> CloneList(SmClipboard& rClipboard);
/** Find an iterator pointing to the node in pLineList following rCaretPos
*
@@ -299,7 +306,7 @@ private:
* @returns A caret position equivalent to one selecting the node before aIter, the method returns
* an invalid SmCaretPos to indicate placement in front of the line.
*/
- static SmCaretPos PatchLineList(SmNodeList* pLineList, SmNodeList::iterator aIter);
+ static SmCaretPos PatchLineList(SmNodeList* pLineList, SmNodeList::iterator aIter);
/** Take selected nodes from a list
*
@@ -311,11 +318,11 @@ private:
*
* @returns An iterator pointing to the element following the selection taken.
*/
- static SmNodeList::iterator TakeSelectedNodesFromList(SmNodeList *pLineList,
- SmNodeList *pSelectedNodes = nullptr);
+ static SmNodeList::iterator TakeSelectedNodesFromList(SmNodeList* pLineList,
+ SmNodeList* pSelectedNodes = nullptr);
/** Create an instance of SmMathSymbolNode usable for brackets */
- static SmNode *CreateBracket(SmBracketType eBracketType, bool bIsLeft);
+ static SmNode* CreateBracket(SmBracketType eBracketType, bool bIsLeft);
/** The number of times BeginEdit have been called
* Used to allow nesting of BeginEdit() and EndEdit() sections
@@ -342,11 +349,8 @@ private:
* @param pStartLine Line to take first position in, if PosAfterEdit cannot be found,
* leave it NULL for pLineList.
*/
- void FinishEdit(std::unique_ptr<SmNodeList> pLineList,
- SmStructureNode* pParent,
- int nParentIndex,
- SmCaretPos PosAfterEdit,
- SmNode* pStartLine = nullptr);
+ void FinishEdit(std::unique_ptr<SmNodeList> pLineList, SmStructureNode* pParent,
+ int nParentIndex, SmCaretPos PosAfterEdit, SmNode* pStartLine = nullptr);
/** Request the formula is repainted */
void RequestRepaint();
};
@@ -369,44 +373,47 @@ private:
* Postfix -> node [!]*
* \endcode
*/
-class SmNodeListParser{
+class SmNodeListParser
+{
public:
/** Create an instance of SmNodeListParser */
- SmNodeListParser(){
- pList = nullptr;
- }
+ SmNodeListParser() { pList = nullptr; }
/** Parse a list of nodes to an expression.
*
* Old error nodes will be deleted.
*/
SmNode* Parse(SmNodeList* list);
/** True, if the token is an operator */
- static bool IsOperator(const SmToken &token);
+ static bool IsOperator(const SmToken& token);
/** True, if the token is a relation operator */
- static bool IsRelationOperator(const SmToken &token);
+ static bool IsRelationOperator(const SmToken& token);
/** True, if the token is a sum operator */
- static bool IsSumOperator(const SmToken &token);
+ static bool IsSumOperator(const SmToken& token);
/** True, if the token is a product operator */
- static bool IsProductOperator(const SmToken &token);
+ static bool IsProductOperator(const SmToken& token);
/** True, if the token is a unary operator */
- static bool IsUnaryOperator(const SmToken &token);
+ static bool IsUnaryOperator(const SmToken& token);
/** True, if the token is a postfix operator */
- static bool IsPostfixOperator(const SmToken &token);
+ static bool IsPostfixOperator(const SmToken& token);
+
private:
SmNodeList* pList;
/** Get the current terminal */
- SmNode* Terminal(){
+ SmNode* Terminal()
+ {
if (!pList->empty())
return pList->front();
return nullptr;
}
/** Move to next terminal */
- SmNode* Next(){
+ SmNode* Next()
+ {
pList->pop_front();
return Terminal();
}
/** Take the current terminal */
- SmNode* Take(){
+ SmNode* Take()
+ {
SmNode* pRetVal = Terminal();
Next();
return pRetVal;
@@ -420,7 +427,6 @@ private:
static SmNode* Error();
};
-
#endif // INCLUDED_STARMATH_INC_CURSOR_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx
index 421554834314..300a414d382b 100644
--- a/starmath/inc/edit.hxx
+++ b/starmath/inc/edit.hxx
@@ -38,9 +38,12 @@ class SmEditAccessible;
class CommandEvent;
class Timer;
-namespace svtools { class ColorConfig; }
+namespace svtools
+{
+class ColorConfig;
+}
-void SmGetLeftSelectionPart(const ESelection &rSelection, sal_Int32 &nPara, sal_uInt16 &nPos);
+void SmGetLeftSelectionPart(const ESelection& rSelection, sal_Int32& nPara, sal_uInt16& nPos);
class SmEditWindow final : public vcl::Window, public DropTargetHelper
{
@@ -58,22 +61,22 @@ class SmEditWindow final : public vcl::Window, public DropTargetHelper
virtual void KeyInput(const KeyEvent& rKEvt) override;
virtual void Command(const CommandEvent& rCEvt) override;
- DECL_LINK(ModifyTimerHdl, Timer *, void);
- DECL_LINK(CursorMoveTimerHdl, Timer *, void);
+ DECL_LINK(ModifyTimerHdl, Timer*, void);
+ DECL_LINK(CursorMoveTimerHdl, Timer*, void);
virtual void ApplySettings(vcl::RenderContext&) override;
- virtual void DataChanged( const DataChangedEvent& ) override;
+ virtual void DataChanged(const DataChangedEvent&) override;
virtual void Resize() override;
- virtual void MouseMove(const MouseEvent &rEvt) override;
- virtual void MouseButtonUp(const MouseEvent &rEvt) override;
- virtual void MouseButtonDown(const MouseEvent &rEvt) override;
+ virtual void MouseMove(const MouseEvent& rEvt) override;
+ virtual void MouseButtonUp(const MouseEvent& rEvt) override;
+ virtual void MouseButtonDown(const MouseEvent& rEvt) override;
virtual OUString GetSurroundingText() const override;
virtual Selection GetSurroundingTextSelection() const override;
virtual bool DeleteSurroundingText(const Selection& rSelection) override;
- virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
- virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
+ virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt) override;
+ virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override;
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
DECL_LINK(EditStatusHdl, EditStatus&, void);
@@ -114,10 +117,10 @@ public:
void Delete();
void SelectAll();
void InsertText(const OUString& rText);
- void MarkError(const Point &rPos);
+ void MarkError(const Point& rPos);
void SelNextMark();
void SelPrevMark();
- static bool HasMark(const OUString &rText);
+ static bool HasMark(const OUString& rText);
void Flush() override;
void DeleteEditView();
@@ -132,7 +135,6 @@ public:
using Window::GetAccessible;
};
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/starmath/inc/error.hxx b/starmath/inc/error.hxx
index bd2b7067a91c..dc798f6906e3 100644
--- a/starmath/inc/error.hxx
+++ b/starmath/inc/error.hxx
@@ -44,12 +44,11 @@ enum class SmParseError
NumberExpected
};
-
struct SmErrorDesc
{
SmParseError m_eType;
- SmNode *m_pNode;
- OUString m_aText;
+ SmNode* m_pNode;
+ OUString m_aText;
};
#endif
diff --git a/starmath/inc/smdll.hxx b/starmath/inc/smdll.hxx
index 3408f2fd4414..87e82702c5d9 100644
--- a/starmath/inc/smdll.hxx
+++ b/starmath/inc/smdll.hxx
@@ -23,7 +23,7 @@
namespace SmGlobals
{
- SM_DLLPUBLIC void ensure();
+SM_DLLPUBLIC void ensure();
}
#endif
diff --git a/starmath/inc/types.hxx b/starmath/inc/types.hxx
index 56be51ee92b0..c3313a8a1d9d 100644
--- a/starmath/inc/types.hxx
+++ b/starmath/inc/types.hxx
@@ -21,11 +21,14 @@
#define INCLUDED_STARMATH_INC_TYPES_HXX
#include <sal/types.h>
-#define FONTNAME_MATH "OpenSymbol"
-
-
-enum SmPrintSize { PRINT_SIZE_NORMAL, PRINT_SIZE_SCALED, PRINT_SIZE_ZOOMED };
-
+#define FONTNAME_MATH "OpenSymbol"
+
+enum SmPrintSize
+{
+ PRINT_SIZE_NORMAL,
+ PRINT_SIZE_SCALED,
+ PRINT_SIZE_ZOOMED
+};
// definitions for characters from the 'StarSymbol' font
// (some chars have more than one alias!)