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

Generated by: LCOV version 1.10