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

Generated by: LCOV version 1.10