LCOV - code coverage report
Current view: top level - sc/source/ui/inc - output.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 11 11 100.0 %
Date: 2014-11-03 Functions: 11 11 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             : 
      20             : #ifndef INCLUDED_SC_SOURCE_UI_INC_OUTPUT_HXX
      21             : #define INCLUDED_SC_SOURCE_UI_INC_OUTPUT_HXX
      22             : 
      23             : #include "address.hxx"
      24             : #include "cellvalue.hxx"
      25             : #include <tools/color.hxx>
      26             : #include <tools/fract.hxx>
      27             : #include <com/sun/star/embed/XEmbeddedObject.hpp>
      28             : #include <drawinglayer/processor2d/baseprocessor2d.hxx>
      29             : 
      30             : namespace sc {
      31             :     struct SpellCheckContext;
      32             : }
      33             : 
      34             : namespace editeng {
      35             :     struct MisspellRanges;
      36             : }
      37             : 
      38             : class Rectangle;
      39             : namespace vcl { class Font; }
      40             : class OutputDevice;
      41             : class EditEngine;
      42             : class ScDocument;
      43             : class ScPatternAttr;
      44             : class SdrObject;
      45             : struct RowInfo;
      46             : struct ScTableInfo;
      47             : class ScTabViewShell;
      48             : class ScPageBreakData;
      49             : class FmFormView;
      50             : class ScFieldEditEngine;
      51             : class SdrPaintWindow;
      52             : 
      53             : #define SC_SCENARIO_HSPACE      60
      54             : #define SC_SCENARIO_VSPACE      50
      55             : 
      56             : enum ScOutputType { OUTTYPE_WINDOW, OUTTYPE_PRINTER };
      57             : 
      58             : class ScFieldEditEngine;
      59             : 
      60             : class ScOutputData
      61             : {
      62             : friend class ScDrawStringsVars;
      63             : private:
      64        2157 :     struct OutputAreaParam
      65             :     {
      66             :         Rectangle   maAlignRect;
      67             :         Rectangle   maClipRect;
      68             :         long        mnColWidth;
      69             :         long        mnLeftClipLength; /// length of the string getting cut off on the left.
      70             :         long        mnRightClipLength; /// length of the string getting cut off on the right.
      71             :         bool        mbLeftClip;
      72             :         bool        mbRightClip;
      73             :     };
      74             : 
      75         605 :     class DrawEditParam
      76             :     {
      77             :     public:
      78             :         SvxCellHorJustify       meHorJustAttr;      ///< alignment attribute
      79             :         SvxCellHorJustify       meHorJustContext;   ///< context depending on attribute, content and direction
      80             :         SvxCellHorJustify       meHorJustResult;    ///< result for EditEngine
      81             :         SvxCellVerJustify       meVerJust;
      82             :         SvxCellJustifyMethod    meHorJustMethod;
      83             :         SvxCellJustifyMethod    meVerJustMethod;
      84             :         SvxCellOrientation      meOrient;
      85             :         SCSIZE                  mnArrY;
      86             :         SCCOL                   mnX;
      87             :         SCROW                   mnY;
      88             :         SCCOL                   mnCellX;
      89             :         SCROW                   mnCellY;
      90             :         SCTAB                   mnTab;
      91             :         long                    mnPosX;
      92             :         long                    mnPosY;
      93             :         long                    mnInitPosX;
      94             :         bool                    mbBreak:1;
      95             :         bool                    mbCellIsValue:1;
      96             :         bool                    mbAsianVertical:1;
      97             :         bool                    mbPixelToLogic:1;
      98             :         bool                    mbHyphenatorSet:1;
      99             :         ScFieldEditEngine*      mpEngine;
     100             :         ScRefCellValue          maCell;
     101             :         const ScPatternAttr*    mpPattern;
     102             :         const SfxItemSet*       mpCondSet;
     103             :         const SfxItemSet*       mpPreviewFontSet;
     104             :         const ScPatternAttr*    mpOldPattern;
     105             :         const SfxItemSet*       mpOldCondSet;
     106             :         const SfxItemSet*       mpOldPreviewFontSet;
     107             :         const RowInfo*          mpThisRowInfo;
     108             :         const std::vector<editeng::MisspellRanges>* mpMisspellRanges;
     109             : 
     110             :         explicit DrawEditParam(const ScPatternAttr* pPattern, const SfxItemSet* pCondSet, bool bCellIsValue);
     111             : 
     112             :         bool readCellContent(ScDocument* pDoc, bool bShowNullValues, bool bShowFormulas, bool bSyntaxMode, bool bUseStyleColor, bool bForceAutoColor, bool& rWrapFields);
     113             :         void setPatternToEngine(bool bUseStyleColor);
     114             :         void calcMargins(long& rTop, long& rLeft, long& rBottom, long& rRight, double nPPTX, double nPPTY) const;
     115             :         void calcPaperSize(Size& rPaperSize, const Rectangle& rAlignRect, double nPPTX, double nPPTY) const;
     116             :         void getEngineSize(ScFieldEditEngine* pEngine, long& rWidth, long& rHeight) const;
     117             :         bool hasLineBreak() const;
     118             :         bool isHyperlinkCell() const;
     119             : 
     120             :         /**
     121             :          * When the text is vertically oriented, the text is either rotated 90
     122             :          * degrees to the right or 90 degrees to the left.   Note that this is
     123             :          * different from being vertically stacked.
     124             :          */
     125             :         bool isVerticallyOriented() const;
     126             : 
     127             :         /**
     128             :          * Calculate offset position for vertically oriented (either
     129             :          * top-bottom or bottom-top orientation) text.
     130             :          *
     131             :          * @param rLogicStart initial position in pixels.  When the call is
     132             :          *                    finished, this parameter will store the new
     133             :          *                    position.
     134             :          */
     135             :         void calcStartPosForVertical(Point& rLogicStart, long nCellWidth, long nEngineWidth, long nTopM, OutputDevice* pRefDevice);
     136             : 
     137             :         void setAlignmentToEngine();
     138             :         bool adjustHorAlignment(ScFieldEditEngine* pEngine);
     139             :         void adjustForRTL();
     140             :         void adjustForHyperlinkInPDF(Point aURLStart, OutputDevice* pDev);
     141             :     };
     142             : 
     143             :     OutputDevice* mpDev;        // Device
     144             :     OutputDevice* mpRefDevice;  // printer if used for preview
     145             :     OutputDevice* pFmtDevice;   // reference for text formatting
     146             :     ScTableInfo& mrTabInfo;
     147             :     RowInfo* pRowInfo;          // Info block
     148             :     SCSIZE nArrCount;           // occupied lines in info block
     149             :     ScDocument* mpDoc;          // Document
     150             :     SCTAB nTab;                 // sheet
     151             :     long nScrX;                 // Output Startpos. (Pixel)
     152             :     long nScrY;
     153             :     long nScrW;                 // Output size (Pixel)
     154             :     long nScrH;
     155             :     long nMirrorW;              // Visible output width for mirroring (default: nScrW)
     156             :     SCCOL nX1;                  // Start-/End coordinates
     157             :     SCROW nY1;                  //  ( incl. hidden )
     158             :     SCCOL nX2;
     159             :     SCROW nY2;
     160             :     SCCOL nVisX1;               // Start-/End coordinates
     161             :     SCROW nVisY1;               //  ( visable range )
     162             :     SCCOL nVisX2;
     163             :     SCROW nVisY2;
     164             :     ScOutputType eType;         // Screen/Printer ...
     165             :     double mnPPTX;              // Pixel per Twips
     166             :     double mnPPTY;
     167             :     Fraction aZoomX;
     168             :     Fraction aZoomY;
     169             : 
     170             :     SdrObject* pEditObj;        // Omit when painting
     171             : 
     172             :     ScTabViewShell* pViewShell; // for connect from visible plug-ins
     173             : 
     174             :     // #114135#
     175             :     FmFormView* pDrawView;      // SdrView to paint to
     176             : 
     177             :     bool bEditMode;             // InPlace edited cell - do not output
     178             :     SCCOL nEditCol;
     179             :     SCROW nEditRow;
     180             : 
     181             :     bool bMetaFile;             // Output to metafile (not pixels!)
     182             :     bool bSingleGrid;           // beim Gitter bChanged auswerten
     183             : 
     184             :     bool bPagebreakMode;        // Page break preview
     185             :     bool bSolidBackground;      // white instead of transparant
     186             : 
     187             :     bool mbUseStyleColor;
     188             :     bool mbForceAutoColor;
     189             : 
     190             :     bool mbSyntaxMode;          // Syntax highlighting
     191             :     Color* pValueColor;
     192             :     Color* pTextColor;
     193             :     Color* pFormulaColor;
     194             : 
     195             :     Color   aGridColor;
     196             : 
     197             :     bool    mbShowNullValues;
     198             :     bool    mbShowFormulas;
     199             :     bool    bShowSpellErrors;   // Show spelling errors in EditObjects
     200             :     bool    bMarkClipped;
     201             : 
     202             :     bool    bSnapPixel;
     203             : 
     204             :     bool    bAnyRotated;        // internal
     205             :     bool    bAnyClipped;        // internal
     206             :     bool    bTabProtected;
     207             :     sal_uInt8   nTabTextDirection;  // EEHorizontalTextDirection values
     208             :     bool    bLayoutRTL;
     209             : 
     210             :     // #i74769# use SdrPaintWindow direct, remember it during BeginDrawLayers/EndDrawLayers
     211             :     SdrPaintWindow*     mpTargetPaintWindow;
     212             :     const sc::SpellCheckContext* mpSpellCheckCxt;
     213             : 
     214             :                             // private methods
     215             : 
     216             :     bool            GetMergeOrigin( SCCOL nX, SCROW nY, SCSIZE nArrY,
     217             :                                     SCCOL& rOverX, SCROW& rOverY, bool bVisRowChanged );
     218             :     bool IsEmptyCellText( RowInfo* pThisRowInfo, SCCOL nX, SCROW nY );
     219             :     void GetVisibleCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScRefCellValue& rCell );
     220             : 
     221             :     bool IsAvailable( SCCOL nX, SCROW nY );
     222             : 
     223             :     void            GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY,
     224             :                                    SCCOL nCellX, SCROW nCellY, long nNeeded,
     225             :                                    const ScPatternAttr& rPattern,
     226             :                                    sal_uInt16 nHorJustify, bool bCellIsValue,
     227             :                                    bool bBreak, bool bOverwrite,
     228             :                                    OutputAreaParam& rParam );
     229             : 
     230             :     void            ShrinkEditEngine( EditEngine& rEngine, const Rectangle& rAlignRect,
     231             :                                     long nLeftM, long nTopM, long nRightM, long nBottomM,
     232             :                                     bool bWidth, sal_uInt16 nOrient, long nAttrRotate, bool bPixelToLogic,
     233             :                                     long& rEngineWidth, long& rEngineHeight, long& rNeededPixel,
     234             :                                     bool& rLeftClip, bool& rRightClip );
     235             : 
     236             :     void SetSyntaxColor( vcl::Font* pFont, const ScRefCellValue& rCell );
     237             :     void SetEditSyntaxColor( EditEngine& rEngine, ScRefCellValue& rCell );
     238             : 
     239             :     double          GetStretch();
     240             : 
     241             :     void            DrawRotatedFrame( const Color* pForceColor );       // pixel
     242             : 
     243             :     drawinglayer::processor2d::BaseProcessor2D*  CreateProcessor2D( );
     244             : 
     245             :     void DrawEditStandard(DrawEditParam& rParam);
     246             :     void DrawEditBottomTop(DrawEditParam& rParam);
     247             :     void DrawEditTopBottom(DrawEditParam& rParam);
     248             :     void DrawEditStacked(DrawEditParam& rParam);
     249             :     void DrawEditAsianVertical(DrawEditParam& rParam);
     250             : 
     251             :     ScFieldEditEngine* CreateOutputEditEngine();
     252             : 
     253             :     void ShowClipMarks( DrawEditParam& rParam, long nEngineHeight, const Size& aCellSize,
     254             :                         bool bMerged, OutputAreaParam& aAreaParam );
     255             : 
     256             :     bool Clip( DrawEditParam& rParam, const Size& aCellSize, OutputAreaParam& aAreaParam,
     257             :                long nEngineHeight, bool bWrapFields);
     258             : 
     259             : public:
     260             :                     ScOutputData( OutputDevice* pNewDev, ScOutputType eNewType,
     261             :                                     ScTableInfo& rTabInfo, ScDocument* pNewDoc,
     262             :                                     SCTAB nNewTab, long nNewScrX, long nNewScrY,
     263             :                                     SCCOL nNewX1, SCROW nNewY1, SCCOL nNewX2, SCROW nNewY2,
     264             :                                     double nPixelPerTwipsX, double nPixelPerTwipsY,
     265             :                                     const Fraction* pZoomX = NULL,
     266             :                                     const Fraction* pZoomY = NULL );
     267             : 
     268             :                     ~ScOutputData();
     269             : 
     270             :     void SetSpellCheckContext( const sc::SpellCheckContext* pCxt );
     271             :     void    SetContentDevice( OutputDevice* pContentDev );
     272             : 
     273          66 :     void    SetRefDevice( OutputDevice* pRDev ) { mpRefDevice = pFmtDevice = pRDev; }
     274          83 :     void    SetFmtDevice( OutputDevice* pRDev ) { pFmtDevice = pRDev; }
     275        1474 :     void    SetEditObject( SdrObject* pObj )    { pEditObj = pObj; }
     276        1474 :     void    SetViewShell( ScTabViewShell* pSh ) { pViewShell = pSh; }
     277             : 
     278             :     // #114135#
     279          78 :     void    SetDrawView( FmFormView* pNew )     { pDrawView = pNew; }
     280             : 
     281        1474 :     void    SetSolidBackground( bool bSet )     { bSolidBackground = bSet; }
     282        1540 :     void    SetUseStyleColor( bool bSet )       { mbUseStyleColor = bSet; }
     283             : 
     284             :     void    SetEditCell( SCCOL nCol, SCROW nRow );
     285             :     void    SetSyntaxMode( bool bNewMode );
     286             :     void    SetMetaFileMode( bool bNewMode );
     287             :     void    SetSingleGrid( bool bNewMode );
     288             :     void    SetGridColor( const Color& rColor );
     289             :     void    SetMarkClipped( bool bSet );
     290             :     void    SetShowNullValues ( bool bSet = true );
     291             :     void    SetShowFormulas   ( bool bSet = true );
     292             :     void    SetShowSpellErrors( bool bSet = true );
     293             :     void    SetMirrorWidth( long nNew );
     294        1542 :     long    GetScrW() const     { return nScrW; }
     295        1540 :     long    GetScrH() const     { return nScrH; }
     296             : 
     297             :     void    SetSnapPixel( bool bSet = true );
     298             : 
     299             :     void    DrawGrid( bool bGrid, bool bPage );
     300             :     void    DrawStrings( bool bPixelToLogic = false );
     301             :     void    DrawDocumentBackground();
     302             :     void    DrawBackground();
     303             :     void    DrawShadow();
     304             :     void    DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBottom);
     305             :     void    DrawFrame();
     306             : 
     307             :                     // with logic MapMode set!
     308             :     void    DrawEdit(bool bPixelToLogic);
     309             : 
     310             :     void    FindRotated();
     311             :     void    DrawRotated(bool bPixelToLogic);        // logical
     312             : 
     313             :     void    DrawClear();
     314             : 
     315             :     // #i72502# printer only command set
     316             :     Point PrePrintDrawingLayer(long nLogStX, long nLogStY );
     317             :     void PostPrintDrawingLayer(const Point& rMMOffset); // #i74768# need offset for FormLayer
     318             :     void PrintDrawingLayer(const sal_uInt16 nLayer, const Point& rMMOffset);
     319             : 
     320             :     // only screen:
     321             :     void    DrawingSingle(const sal_uInt16 nLayer);
     322             :     void    DrawSelectiveObjects(const sal_uInt16 nLayer);
     323             : 
     324             :     bool    SetChangedClip();       // sal_False = not
     325             :     vcl::Region  GetChangedAreaRegion();
     326             : 
     327             :     void    FindChanged();
     328             :     void    SetPagebreakMode( ScPageBreakData* pPageData );
     329             :     void    DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
     330             :                          SCCOL nRefEndX, SCROW nRefEndY,
     331             :                          const Color& rColor, bool bHandle );
     332             :     void    DrawOneChange( SCCOL nRefStartX, SCROW nRefStartY,
     333             :                             SCCOL nRefEndX, SCROW nRefEndY,
     334             :                             const Color& rColor, sal_uInt16 nType );
     335             :     void    DrawChangeTrack();
     336             :     void    DrawClipMarks();
     337             : 
     338             :     void    DrawNoteMarks();
     339             :     void    AddPDFNotes();
     340             : };
     341             : 
     342             : #endif
     343             : 
     344             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10