LCOV - code coverage report
Current view: top level - starmath/inc - ElementsDockingWindow.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 5 9 55.6 %
Date: 2015-06-13 12:38:46 Functions: 4 6 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_STARMATH_INC_ELEMENTSDOCKINGWINDOW_HXX
      21             : #define INCLUDED_STARMATH_INC_ELEMENTSDOCKINGWINDOW_HXX
      22             : 
      23             : #include <boost/signals2/signal.hpp>
      24             : #include <sfx2/dockwin.hxx>
      25             : #include <svx/dlgctrl.hxx>
      26             : #include <vcl/scrbar.hxx>
      27             : 
      28             : #include <document.hxx>
      29             : #include <node.hxx>
      30             : #include <memory>
      31             : 
      32             : class SmElement
      33             : {
      34             :     SmNodePointer   mpNode;
      35             :     OUString        maText;
      36             :     OUString        maHelpText;
      37             : public:
      38             :     Point mBoxLocation;
      39             :     Size  mBoxSize;
      40             : 
      41             :     SmElement(SmNodePointer pNode, const OUString& aText, const OUString& aHelpText);
      42             :     virtual ~SmElement();
      43             : 
      44             :     SmNodePointer getNode();
      45           0 :     OUString      getText()
      46             :     {
      47           0 :         return maText;
      48             :     }
      49             : 
      50           0 :     OUString getHelpText()
      51             :     {
      52           0 :         return maHelpText;
      53             :     }
      54             : 
      55         608 :     virtual bool isSeparator()
      56             :     {
      57         608 :         return false;
      58             :     }
      59             : };
      60             : 
      61          68 : class SmElementSeparator : public SmElement
      62             : {
      63             : public:
      64             :     SmElementSeparator();
      65             : 
      66          64 :     virtual bool isSeparator() SAL_OVERRIDE
      67             :     {
      68          64 :         return true;
      69             :     }
      70             : };
      71             : 
      72             : class SmElementsControl : public Control
      73             : {
      74             :     static const sal_uInt16 aUnaryBinaryOperatorsList[][2];
      75             :     static const sal_uInt16 aRelationsList[][2];
      76             :     static const sal_uInt16 aSetOperations[][2];
      77             :     static const sal_uInt16 aFunctions[][2];
      78             :     static const sal_uInt16 aOperators[][2];
      79             :     static const sal_uInt16 aAttributes[][2];
      80             :     static const sal_uInt16 aBrackets[][2];
      81             :     static const sal_uInt16 aFormats[][2];
      82             :     static const sal_uInt16 aOthers[][2];
      83             : 
      84             :     virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle&) SAL_OVERRIDE;
      85             :     virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE;
      86             :     virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
      87             : 
      88             :     typedef std::shared_ptr<SmElement>    SmElementPointer;
      89             :     typedef std::vector< SmElementPointer > SmElementList;
      90             : 
      91             :     SmDocShell*   mpDocShell;
      92             :     SmFormat      maFormat;
      93             :     sal_uInt16    maCurrentSetId;
      94             :     SmElement*    mpCurrentElement;
      95             : 
      96             :     SmElementList maElementList;
      97             :     Size          maMaxElementDimensions;
      98             :     bool          mbVerticalMode;
      99             :     VclPtr< ScrollBar > mxScroll;
     100             : 
     101             :     void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText);
     102             : 
     103             :     void addElements(const sal_uInt16 aElementsArray[][2], sal_uInt16 size);
     104             : 
     105             :     void addSeparator();
     106             : 
     107             :     void build();
     108             : 
     109             : public:
     110             :     SmElementsControl(vcl::Window *pParent);
     111             :     virtual ~SmElementsControl();
     112             :     virtual void dispose() SAL_OVERRIDE;
     113             : 
     114             :     void setElementSetId(sal_uInt16 aSetId);
     115             : 
     116             :     void setVerticalMode(bool bVertical);
     117             : 
     118             :     Size GetOptimalSize() const SAL_OVERRIDE;
     119             : 
     120             :     DECL_LINK( ScrollHdl, void* );
     121             :     void DoScroll(long nDelta);
     122             : 
     123             :     boost::signals2::signal< void ( SmElement* ) > selectedSignal;
     124             : };
     125             : 
     126             : class SmElementsDockingWindow : public SfxDockingWindow
     127             : {
     128             :     static const sal_uInt16 aCategories[];
     129             : 
     130             :     VclPtr<SmElementsControl>  mpElementsControl;
     131             :     VclPtr<ListBox>            mpElementListBox;
     132             : 
     133             :     virtual void Resize() SAL_OVERRIDE;
     134             :     SmViewShell* GetView();
     135             : 
     136             :     void SelectClickHandler(SmElement* pElement);
     137             :     DECL_LINK(ElementSelectedHandle, ListBox*);
     138             : 
     139             : public:
     140             : 
     141             :     SmElementsDockingWindow( SfxBindings* pBindings,
     142             :                              SfxChildWindow* pChildWindow,
     143             :                              vcl::Window* pParent );
     144             :     virtual ~SmElementsDockingWindow();
     145             :     virtual void dispose() SAL_OVERRIDE;
     146             : 
     147             :     virtual void EndDocking( const Rectangle& rReactangle, bool bFloatMode) SAL_OVERRIDE;
     148             :     virtual void ToggleFloatingMode() SAL_OVERRIDE;
     149             : };
     150             : 
     151             : class SmElementsDockingWindowWrapper : public SfxChildWindow
     152             : {
     153             :     SFX_DECL_CHILDWINDOW_WITHID(SmElementsDockingWindowWrapper);
     154             : 
     155             : protected:
     156             :     SmElementsDockingWindowWrapper( vcl::Window* pParentWindow,
     157             :                                     sal_uInt16 nId,
     158             :                                     SfxBindings* pBindings,
     159             :                                     SfxChildWinInfo* pInfo );
     160             :     virtual ~SmElementsDockingWindowWrapper();
     161             : };
     162             : 
     163             : #endif // INCLUDED_STARMATH_INC_ELEMENTSDOCKINGWINDOW_HXX
     164             : 
     165             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11