LCOV - code coverage report
Current view: top level - starmath/inc - document.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 15 0.0 %
Date: 2014-04-14 Functions: 0 15 0.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_STARMATH_INC_DOCUMENT_HXX
      21             : #define INCLUDED_STARMATH_INC_DOCUMENT_HXX
      22             : 
      23             : #define SMDLL   1
      24             : 
      25             : #include <rtl/ustring.hxx>
      26             : #include <rtl/strbuf.hxx>
      27             : #include <sfx2/docfac.hxx>
      28             : #include <sfx2/objsh.hxx>
      29             : #include <sot/storage.hxx>
      30             : #include <svl/lstner.hxx>
      31             : #include <vcl/jobset.hxx>
      32             : #include <vcl/virdev.hxx>
      33             : #include <sax/fshelper.hxx>
      34             : #include <oox/core/filterbase.hxx>
      35             : #include <oox/mathml/import.hxx>
      36             : 
      37             : #include <set>
      38             : 
      39             : #include "format.hxx"
      40             : #include "parse.hxx"
      41             : #include "smmod.hxx"
      42             : 
      43             : class SmNode;
      44             : class SfxMenuBarManager;
      45             : class SfxPrinter;
      46             : class Printer;
      47             : class SmCursor;
      48             : 
      49             : #define STAROFFICE_XML  "StarOffice XML (Math)"
      50             : #define MATHML_XML      "MathML XML (Math)"
      51             : 
      52             : /* Access to printer should happen through this class only
      53             :  * ==========================================================================
      54             :  *
      55             :  * The printer can belong to the document or the OLE-Container. If the document
      56             :  * is an OLE-Document the printer generally belongs to the container too.
      57             :  * But the container maybe works with a different MapUnit than the server.
      58             :  * Referring to the MapMode the printer will be accordingly adjusted in the
      59             :  * constructor and restored in the destructor. This brings that this class
      60             :  * is always allowed to exists only a short time (e.g. while painting).
      61             :  * The control whether the printer is self-generated, gotten from the server
      62             :  * or is NULL then, is taken by the DocShell in the method GetPrt(), for
      63             :  * which the access is friend of the DocShell too.
      64             :  */
      65             : 
      66             : class SmDocShell;
      67             : class EditEngine;
      68             : 
      69             : 
      70             : 
      71             : class SmPrinterAccess
      72             : {
      73             :     Printer* pPrinter;
      74             :     OutputDevice* pRefDev;
      75             : public:
      76             :     SmPrinterAccess( SmDocShell &rDocShell );
      77             :     ~SmPrinterAccess();
      78           0 :     Printer* GetPrinter()  { return pPrinter; }
      79           0 :     OutputDevice* GetRefDev()  { return pRefDev; }
      80             : };
      81             : 
      82             : 
      83             : 
      84             : 
      85             : void SetEditEngineDefaultFonts(SfxItemPool &rEditEngineItemPool);
      86             : 
      87             : 
      88             : 
      89             : class SmDocShell : public SfxObjectShell, public SfxListener
      90             : {
      91             :     friend class SmPrinterAccess;
      92             :     friend class SmModel;
      93             :     friend class SmCursor;
      94             : 
      95             :     OUString            aText;
      96             :     SmFormat            aFormat;
      97             :     SmParser            aInterpreter;
      98             :     OUString            aAccText;
      99             :     SmNode             *pTree;
     100             :     SfxItemPool        *pEditEngineItemPool;
     101             :     EditEngine         *pEditEngine;
     102             :     SfxPrinter         *pPrinter;       //q.v. comment to SmPrinter Access!
     103             :     Printer            *pTmpPrinter;    //ditto
     104             :     sal_uInt16          nModifyCount;
     105             :     bool                bIsFormulaArranged;
     106             :     SmCursor           *pCursor;
     107             :     std::set< OUString >    aUsedSymbols;   // to export used symbols only when saving
     108             : 
     109             : 
     110             : 
     111             :     virtual void SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType,
     112             :                         const SfxHint& rHint, const TypeId& rHintType) SAL_OVERRIDE;
     113             : 
     114             :     bool        WriteAsMathType3( SfxMedium& );
     115             : 
     116             :     virtual void        Draw(OutputDevice *pDevice,
     117             :                              const JobSetup & rSetup,
     118             :                              sal_uInt16 nAspect = ASPECT_CONTENT) SAL_OVERRIDE;
     119             : 
     120             :     virtual void        FillClass(SvGlobalName* pClassName,
     121             :                                   sal_uInt32*  pFormat,
     122             :                                   OUString* pAppName,
     123             :                                   OUString* pFullTypeName,
     124             :                                   OUString* pShortTypeName,
     125             :                                   sal_Int32 nFileFormat,
     126             :                                   bool bTemplate = false ) const SAL_OVERRIDE;
     127             : 
     128             :     virtual sal_Bool        SetData( const OUString& rData );
     129             :     virtual sal_uLong       GetMiscStatus() const SAL_OVERRIDE;
     130             :     virtual void        OnDocumentPrinterChanged( Printer * ) SAL_OVERRIDE;
     131             :     virtual bool        InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) SAL_OVERRIDE;
     132             :     virtual bool        Load( SfxMedium& rMedium ) SAL_OVERRIDE;
     133             :             void        ImplSave(  SvStorageStreamRef xStrm  );
     134             :     virtual bool        Save() SAL_OVERRIDE;
     135             :     virtual bool        SaveAs( SfxMedium& rMedium ) SAL_OVERRIDE;
     136             :     virtual bool        ConvertTo( SfxMedium &rMedium ) SAL_OVERRIDE;
     137             :     virtual bool        SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) SAL_OVERRIDE;
     138             : 
     139             :     Printer             *GetPrt();
     140             :     OutputDevice*       GetRefDev();
     141             : 
     142           0 :     bool                IsFormulaArranged() const { return bIsFormulaArranged; }
     143           0 :     void                SetFormulaArranged(bool bVal) { bIsFormulaArranged = bVal; }
     144             : 
     145             :     virtual bool        ConvertFrom(SfxMedium &rMedium) SAL_OVERRIDE;
     146             : 
     147             :     /** Called whenever the formula is changed
     148             :      * Deletes the current cursor
     149             :      */
     150             :     void                InvalidateCursor();
     151             : 
     152             :     bool writeFormulaOoxml( ::sax_fastparser::FSHelperPtr pSerializer, oox::core::OoxmlVersion version );
     153             :     void writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding);
     154             :     void readFormulaOoxml( oox::formulaimport::XmlStream& stream );
     155             : 
     156             : public:
     157             :     TYPEINFO_OVERRIDE();
     158           0 :     SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START+1)
     159             :     using SotObject::GetInterface;
     160           0 :     SFX_DECL_OBJECTFACTORY();
     161             : 
     162             :                 SmDocShell( const sal_uInt64 i_nSfxCreationFlags );
     163             :     virtual     ~SmDocShell();
     164             : 
     165             :     void        LoadSymbols();
     166             :     void        SaveSymbols();
     167             : 
     168             :     void        ArrangeFormula();
     169             : 
     170             :     //Access for the View. This access is not for the OLE-case!
     171             :     //and for the communication with the SFX!
     172             :     //All internal printer uses should work with the SmPrinterAccess only
     173           0 :     bool        HasPrinter()    { return 0 != pPrinter; }
     174           0 :     SfxPrinter *GetPrinter()    { GetPrt(); return pPrinter; }
     175             :     void        SetPrinter( SfxPrinter * );
     176             : 
     177             :     const OUString GetComment() const;
     178             : 
     179             :     // to replace chars that can not be saved with the document...
     180             :     sal_Bool    ReplaceBadChars();
     181             : 
     182             :     void        UpdateText();
     183             :     void        SetText(const OUString& rBuffer);
     184           0 :     OUString    GetText() { return (aText); }
     185             :     void        SetFormat(SmFormat& rFormat);
     186           0 :     const SmFormat&  GetFormat() { return (aFormat); }
     187             : 
     188             :     void            Parse();
     189           0 :     SmParser &      GetParser() { return aInterpreter; }
     190           0 :     const SmNode *  GetFormulaTree() const  { return pTree; }
     191           0 :     void            SetFormulaTree(SmNode *&rTree) { pTree = rTree; }
     192             : 
     193           0 :     const std::set< OUString > &    GetUsedSymbols() const  { return aUsedSymbols; }
     194             : 
     195             :     OUString        GetAccessibleText();
     196             : 
     197             :     EditEngine &    GetEditEngine();
     198             :     SfxItemPool &   GetEditEngineItemPool();
     199             : 
     200             :     void        DrawFormula(OutputDevice &rDev, Point &rPosition, bool bDrawSelection = false);
     201             :     Size        GetSize();
     202             : 
     203             :     void        Repaint();
     204             : 
     205             :     virtual     ::svl::IUndoManager *GetUndoManager () SAL_OVERRIDE;
     206             : 
     207             :     virtual     SfxItemPool& GetPool() const;
     208             : 
     209             :     void        Execute( SfxRequest& rReq );
     210             :     void        GetState(SfxItemSet &);
     211             : 
     212             :     virtual void SetVisArea (const Rectangle & rVisArea) SAL_OVERRIDE;
     213             :     virtual void SetModified(bool bModified) SAL_OVERRIDE;
     214             : 
     215             :     /** Get a cursor for modifying this document
     216             :      * @remarks Don't store this reference, a new cursor may be made...
     217             :      */
     218             :     SmCursor&   GetCursor();
     219             :     /** True, if cursor have previously been requested and thus
     220             :      * has some sort of position.
     221             :      */
     222           0 :     bool        HasCursor() { return pCursor != NULL; }
     223             : };
     224             : 
     225             : #endif
     226             : 
     227             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10