LCOV - code coverage report
Current view: top level - starmath/inc - ElementsDockingWindow.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 6 10 60.0 %
Date: 2014-11-03 Functions: 5 7 71.4 %
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/scoped_ptr.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             : 
      31             : class SmElement
      32             : {
      33             :     SmNodePointer   mpNode;
      34             :     OUString        maText;
      35             :     OUString        maHelpText;
      36             : public:
      37             :     Point mBoxLocation;
      38             :     Size  mBoxSize;
      39             : 
      40             :     SmElement(SmNodePointer pNode, const OUString& aText, const OUString& aHelpText);
      41             :     virtual ~SmElement();
      42             : 
      43             :     SmNodePointer getNode();
      44           0 :     OUString      getText()
      45             :     {
      46           0 :         return maText;
      47             :     }
      48             : 
      49           0 :     OUString getHelpText()
      50             :     {
      51           0 :         return maHelpText;
      52             :     }
      53             : 
      54         306 :     virtual bool isSeparator()
      55             :     {
      56         306 :         return false;
      57             :     }
      58             : };
      59             : 
      60         136 : class SmElementSeparator : public SmElement
      61             : {
      62             : public:
      63             :     SmElementSeparator();
      64             : 
      65          34 :     virtual bool isSeparator() SAL_OVERRIDE
      66             :     {
      67          34 :         return true;
      68             :     }
      69             : };
      70             : 
      71             : class SmElementsControl : public Control
      72             : {
      73             :     static const sal_uInt16 aUnaryBinaryOperatorsList[][2];
      74             :     static const sal_uInt16 aRelationsList[][2];
      75             :     static const sal_uInt16 aSetOperations[][2];
      76             :     static const sal_uInt16 aFunctions[][2];
      77             :     static const sal_uInt16 aOperators[][2];
      78             :     static const sal_uInt16 aAttributes[][2];
      79             :     static const sal_uInt16 aBrackets[][2];
      80             :     static const sal_uInt16 aFormats[][2];
      81             :     static const sal_uInt16 aOthers[][2];
      82             : 
      83             :     Link aSelectHdlLink;
      84             : 
      85             :     virtual void Paint(const Rectangle&) SAL_OVERRIDE;
      86             :     virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE;
      87             :     virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
      88             : 
      89             :     typedef boost::shared_ptr<SmElement>    SmElementPointer;
      90             :     typedef std::vector< SmElementPointer > SmElementList;
      91             : 
      92             :     SmDocShell*   mpDocShell;
      93             :     SmFormat      maFormat;
      94             :     sal_uInt16    maCurrentSetId;
      95             :     SmElement*    mpCurrentElement;
      96             : 
      97             :     SmElementList maElementList;
      98             :     Size          maMaxElementDimensions;
      99             :     bool          mbVerticalMode;
     100             :     boost::scoped_ptr< ScrollBar > mpScroll;
     101             : 
     102             :     void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText);
     103             : 
     104             :     void addElements(const sal_uInt16 aElementsArray[][2], sal_uInt16 size);
     105             : 
     106             :     void addSeparator();
     107             : 
     108             :     void build();
     109             : 
     110             : public:
     111             :     SmElementsControl(vcl::Window *pParent, const ResId& rResId);
     112             :     virtual ~SmElementsControl();
     113             : 
     114             :     void setElementSetId(sal_uInt16 aSetId);
     115             : 
     116             :     void setVerticalMode(bool bVertical);
     117             : 
     118          34 :     void SetSelectHdl(const Link& rLink)   { aSelectHdlLink = rLink; }
     119             : 
     120             :     DECL_LINK( ScrollHdl, void* );
     121             :     void DoScroll(long nDelta);
     122             : };
     123             : 
     124             : class SmElementsDockingWindow : public SfxDockingWindow
     125             : {
     126             :     static const sal_uInt16 aCategories[];
     127             : 
     128             :     SmElementsControl   maElementsControl;
     129             :     ListBox             maElementListBox;
     130             : 
     131             :     virtual void Resize() SAL_OVERRIDE;
     132             :     SmViewShell* GetView();
     133             : 
     134             :     DECL_LINK(SelectClickHdl, SmElement*);
     135             :     DECL_LINK(ElementSelectedHandle, ListBox*);
     136             : 
     137             : public:
     138             : 
     139             :     SmElementsDockingWindow( SfxBindings* pBindings,
     140             :                              SfxChildWindow* pChildWindow,
     141             :                              vcl::Window* pParent );
     142             :     virtual ~SmElementsDockingWindow();
     143             : 
     144             :     virtual void EndDocking( const Rectangle& rReactangle, bool bFloatMode) SAL_OVERRIDE;
     145             :     virtual void ToggleFloatingMode() SAL_OVERRIDE;
     146             : };
     147             : 
     148             : class SmElementsDockingWindowWrapper : public SfxChildWindow
     149             : {
     150             :     SFX_DECL_CHILDWINDOW_WITHID(SmElementsDockingWindowWrapper);
     151             : 
     152             : protected:
     153             :     SmElementsDockingWindowWrapper( vcl::Window* pParentWindow,
     154             :                                     sal_uInt16 nId,
     155             :                                     SfxBindings* pBindings,
     156             :                                     SfxChildWinInfo* pInfo );
     157             :     virtual ~SmElementsDockingWindowWrapper();
     158             : };
     159             : 
     160             : #endif // INCLUDED_STARMATH_INC_ELEMENTSDOCKINGWINDOW_HXX
     161             : 
     162             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10