LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/svx - ruler.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2012-12-27 Functions: 1 1 100.0 %
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             : #ifndef _SVX_RULER_HXX
      20             : #define _SVX_RULER_HXX
      21             : 
      22             : #include <vcl/menu.hxx>
      23             : #include <svtools/ruler.hxx>
      24             : #include <svl/lstner.hxx>
      25             : #include "svx/svxdllapi.h"
      26             : 
      27             : class SvxProtectItem;
      28             : class SvxRulerItem;
      29             : class SfxBindings;
      30             : class SvxLongLRSpaceItem;
      31             : class SvxLongULSpaceItem;
      32             : class SvxTabStopItem;
      33             : class SvxLRSpaceItem;
      34             : class SvxPagePosSizeItem;
      35             : class SvxColumnItem;
      36             : class SfxRectangleItem;
      37             : class SvxObjectItem;
      38             : class SfxBoolItem;
      39             : struct SvxRuler_Impl;
      40             : 
      41             : class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
      42             : {
      43             :     friend class SvxRulerItem;
      44             :     using Window::Notify;
      45             : 
      46             :     SvxRulerItem **pCtrlItem;
      47             :     SvxLongLRSpaceItem *pLRSpaceItem;  // left and right edge
      48             :     SfxRectangleItem *pMinMaxItem; // maxima for dragging
      49             :     SvxLongULSpaceItem *pULSpaceItem;  // upper and lower edge
      50             :     SvxTabStopItem *pTabStopItem;  // tab stops
      51             :     SvxLRSpaceItem *pParaItem;     // paragraphs
      52             :     SvxLRSpaceItem *pParaBorderItem; // border distance
      53             :     SvxPagePosSizeItem *pPagePosItem; // page distance to the rule
      54             :     SvxColumnItem *pColumnItem;    // columns
      55             :     SvxObjectItem *pObjectItem;    // object
      56             :     Window *pEditWin;
      57             :     SvxRuler_Impl *pRuler_Imp;
      58             :     sal_Bool bAppSetNullOffset :1;
      59             :     sal_Bool bHorz :1;
      60             :     long lLogicNullOffset;      // in logic coordinates
      61             :     long lAppNullOffset;        // in logic coordinates
      62             :     long lMinFrame;             // minimal frame width in pixels
      63             :     long lInitialDragPos;
      64             :     sal_uInt16 nFlags;
      65             :     enum {
      66             :         NONE = 0x0000,
      67             :         DRAG_OBJECT =  0x0001,
      68             :         // reduce size of the last column, shift
      69             :         DRAG_OBJECT_SIZE_LINEAR = 0x0002,
      70             :         DRAG_OBJECT_SIZE_PROPORTIONAL = 0x0004, // proportional, Ctrl
      71             :         // only current line (table; Shift-Ctrl)
      72             :         DRAG_OBJECT_ACTLINE_ONLY = 0x0008,
      73             :         // currently same key assignment
      74             :         DRAG_OBJECT_LEFT_INDENT_ONLY = DRAG_OBJECT_SIZE_PROPORTIONAL
      75             :         }
      76             :     nDragType;
      77             :     sal_uInt16 nDefTabType;
      78             :     sal_uInt16 nTabCount;
      79             :     sal_uInt16 nTabBufSize;
      80             :     long lDefTabDist;
      81             :     long lTabPos;
      82             :     RulerTab *pTabs;            // tab positions in pixel
      83             :     RulerIndent *pIndents;      // paragraph margins in pixel
      84             :     RulerBorder *pBorders;
      85             :     sal_uInt16 nBorderCount;
      86             :     RulerBorder *pObjectBorders;
      87             :     SfxBindings *pBindings;
      88             :     long nDragOffset;
      89             :     long nMaxLeft;
      90             :     long nMaxRight;
      91             :     sal_Bool bValid;
      92             :     sal_Bool bListening;
      93             :     sal_Bool bActive;
      94             :     void StartListening_Impl();
      95             :     long GetCorrectedDragPos( sal_Bool bLeft = sal_True, sal_Bool bRight = sal_True );
      96             :     void DrawLine_Impl(long &lTabPos, int, sal_Bool Hori=sal_True);
      97             :     sal_uInt16 GetObjectBordersOff(sal_uInt16 nIdx) const;
      98             : 
      99             :     // page borders or surrounding frame
     100             :     void UpdateFrame(const SvxLongLRSpaceItem *);
     101             :     void UpdateFrame(const SvxLongULSpaceItem *);
     102             :     void UpdateFrameMinMax(const SfxRectangleItem *);
     103             :     // paragraph indentations
     104             :     void UpdatePara(const SvxLRSpaceItem *);
     105             :     // Border distance
     106             :     void UpdateParaBorder(const SvxLRSpaceItem *);
     107             :     // Tabs
     108             :     void Update(const SvxTabStopItem *);
     109             :     // page position and width
     110             :     void Update(const SvxPagePosSizeItem *);
     111             :     // columns
     112             :     void Update(const SvxColumnItem *, sal_uInt16 nSID);
     113             :     // object selection
     114             :     void Update(const SvxObjectItem *);
     115             :     // protect
     116             :     void Update( const SvxProtectItem* );
     117             :     // left-to-right text
     118             :     void UpdateTextRTL( const SfxBoolItem* );
     119             :     // paragraph indentations
     120             :     void UpdatePara();
     121             :     void UpdateTabs();
     122             :     void UpdatePage();
     123             :     void UpdateFrame();
     124             :     void UpdateColumns();
     125             :     void UpdateObject();
     126             : 
     127             :     long PixelHAdjust(long lPos, long lPos2) const;
     128             :     long PixelVAdjust(long lPos, long lPos2) const;
     129             :     long PixelAdjust(long lPos, long lPos2) const;
     130             : 
     131             :     long ConvertHPosPixel(long lPos) const;
     132             :     long ConvertVPosPixel(long lPos) const;
     133             :     long ConvertHSizePixel(long lSize) const;
     134             :     long ConvertVSizePixel(long lSize) const;
     135             : 
     136             :     long ConvertPosPixel(long lPos) const;
     137             :     long ConvertSizePixel(long lSize) const;
     138             : 
     139             :     long ConvertHPosLogic(long lPos) const;
     140             :     long ConvertVPosLogic(long lPos) const;
     141             :     long ConvertHSizeLogic(long lSize) const;
     142             :     long ConvertVSizeLogic(long lSize) const;
     143             : 
     144             :     long ConvertPosLogic(long lPos) const;
     145             :     long ConvertSizeLogic(long lSize) const;
     146             : 
     147             :     long GetFirstLineIndent() const;
     148             :     long GetLeftIndent() const;
     149             :     long GetRightIndent() const;
     150             :     long GetLogicRightIndent() const;
     151             :     long GetPageWidth() const;
     152             : 
     153             :     inline long GetLeftFrameMargin() const;
     154             :     long GetRightFrameMargin() const;
     155             : 
     156             :     void CalcMinMax();
     157             : 
     158             :     void EvalModifier();
     159             :     void DragMargin1();
     160             :     //adjust the left margin either after DragMargin1() or after DragBorders()
     161             :     void AdjustMargin1(long lDiff);
     162             :     void DragMargin2();
     163             :     void DragIndents();
     164             :     void DragTabs();
     165             :     void DragBorders();
     166             :     void DragObjectBorder();
     167             : 
     168             :     void ApplyMargins();
     169             :     void ApplyIndents();
     170             :     void ApplyTabs();
     171             :     void ApplyBorders();
     172             :     void ApplyObject();
     173             : 
     174             :     long GetFrameLeft() const;
     175             :     void SetFrameLeft(long);
     176             : 
     177             :     long GetLeftMin() const;
     178             :     long GetRightMax() const;
     179             : 
     180             :     DECL_LINK( TabMenuSelect, Menu * );
     181             :     DECL_LINK( MenuSelect, Menu * );
     182             :     void PrepareProportional_Impl(RulerType);
     183             : 
     184             :     sal_uInt16 GetNextVisible(sal_uInt16 nColumn);
     185             :     sal_uInt16 GetPrevVisible(sal_uInt16 nColumn);
     186             : 
     187             :     void Update();
     188             : 
     189             : enum UpdateType {
     190             :     MOVE_ALL,
     191             :     MOVE_LEFT,
     192             :     MOVE_RIGHT
     193             :     };
     194             :     void UpdateParaContents_Impl(long lDiff, UpdateType = MOVE_ALL);
     195             : protected:
     196             :     virtual void    Command( const CommandEvent& rCEvt );
     197             :     virtual void    Click();
     198             :     virtual long    StartDrag();
     199             :     virtual void    Drag();
     200             :     virtual void    EndDrag();
     201             :     virtual void    ExtraDown();
     202             :     virtual void    MouseMove( const MouseEvent& rMEvt );
     203             : 
     204             :     virtual void    Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
     205             : 
     206             :     // calculation of boundary values for object borders
     207             :     // values refer to the page
     208             :     virtual sal_Bool    CalcLimits(long &nMax1, long &nMax2, sal_Bool bFirst) const;
     209             :     sal_Bool IsActLastColumn(
     210             :         sal_Bool bForceDontConsiderHidden = sal_False, sal_uInt16 nAct=USHRT_MAX) const ;
     211             :     sal_Bool IsActFirstColumn(
     212             :         sal_Bool bForceDontConsiderHidden = sal_False, sal_uInt16 nAct=USHRT_MAX) const;
     213             :     sal_uInt16 GetActLeftColumn(
     214             :         sal_Bool bForceDontConsiderHidden = sal_False, sal_uInt16 nAct=USHRT_MAX ) const;
     215             :     sal_uInt16 GetActRightColumn (
     216             :         sal_Bool bForceDontConsiderHidden = sal_False, sal_uInt16 nAct=USHRT_MAX ) const;
     217             :     long CalcPropMaxRight(sal_uInt16 nCol=USHRT_MAX) const;
     218             : 
     219             : public:
     220             : #define     SVXRULER_SUPPORT_TABS                       0x0001
     221             : #define     SVXRULER_SUPPORT_PARAGRAPH_MARGINS          0x0002
     222             : #define     SVXRULER_SUPPORT_BORDERS                    0x0004
     223             : #define     SVXRULER_SUPPORT_OBJECT                     0x0008
     224             : #define     SVXRULER_SUPPORT_SET_NULLOFFSET             0x0010
     225             : #define     SVXRULER_SUPPORT_NEGATIVE_MARGINS           0x0020
     226             : #define     SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL 0x0040
     227             : #define     SVXRULER_SUPPORT_REDUCED_METRIC             0x0080 //shorten the context menu to select metric
     228             : 
     229             :     SvxRuler(Window* pParent,
     230             :              Window *pEditWin,
     231             :              sal_uInt16 nRulerFlags,
     232             :              SfxBindings &rBindings,
     233             :              WinBits nWinStyle = WB_STDRULER);
     234             :     ~SvxRuler();
     235             : 
     236             :     void SetMinFrameSize(long lSize);
     237             :     long GetMinFrameSize() const ;
     238             : 
     239             :     sal_uInt16 GetRulerFlags() const { return nFlags; }
     240             : 
     241             :     void SetDefTabDist(long);
     242             : 
     243             :     // set/get NullOffset in logic units
     244             :     void SetNullOffsetLogic(long lOff = 0);
     245             :     long GetNullOffsetLogic() const { return lAppNullOffset; }
     246             : 
     247             :     void SetActive(sal_Bool bOn = sal_True);
     248             :     sal_Bool IsActive() const { return bActive; }
     249             : 
     250        2360 :     void ForceUpdate() { Update(); }
     251             : 
     252             :     //#i24363# tab stops relative to indent
     253             :     void SetTabsRelativeToIndent( sal_Bool bRel = sal_True );
     254             : };
     255             : 
     256             : #endif
     257             : 
     258             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10