Files
libreoffice/starmath/inc/document.hxx

229 lines
7.8 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2010-10-18 12:55:43 +01:00
#ifndef INCLUDED_STARMATH_INC_DOCUMENT_HXX
#define INCLUDED_STARMATH_INC_DOCUMENT_HXX
2000-09-18 16:07:07 +00:00
#include <rtl/ustring.hxx>
#include <rtl/strbuf.hxx>
#include <sfx2/docfac.hxx>
2000-09-18 16:07:07 +00:00
#include <sfx2/objsh.hxx>
#include <sot/storage.hxx>
#include <svl/lstner.hxx>
#include <vcl/jobset.hxx>
2000-09-18 16:07:07 +00:00
#include <vcl/virdev.hxx>
#include <sax/fshelper.hxx>
#include <oox/core/filterbase.hxx>
#include <oox/mathml/import.hxx>
2009-04-27 05:45:59 +00:00
#include <set>
2000-09-18 16:07:07 +00:00
#include "format.hxx"
#include "parse.hxx"
#include "smmod.hxx"
#include "smdllapi.hxx"
2000-09-18 16:07:07 +00:00
class SmNode;
class SfxMenuBarManager;
2000-09-18 16:07:07 +00:00
class SfxPrinter;
class Printer;
class SmCursor;
2000-09-18 16:07:07 +00:00
2001-03-19 09:24:37 +00:00
#define STAROFFICE_XML "StarOffice XML (Math)"
#define MATHML_XML "MathML XML (Math)"
/* Access to printer should happen through this class only
2000-09-18 16:07:07 +00:00
* ==========================================================================
*
* The printer can belong to the document or the OLE-Container. If the document
* is an OLE-Document the printer generally belongs to the container too.
2014-03-29 18:44:37 +01:00
* But the container maybe works with a different MapUnit than the server.
* Referring to the MapMode the printer will be accordingly adjusted in the
* constructor and restored in the destructor. This brings that this class
* is always allowed to exists only a short time (e.g. while painting).
* The control whether the printer is self-generated, gotten from the server
* or is NULL then, is taken by the DocShell in the method GetPrt(), for
* which the access is friend of the DocShell too.
*/
2000-09-18 16:07:07 +00:00
class SmDocShell;
class EditEngine;
2000-09-18 16:07:07 +00:00
2009-04-27 05:45:59 +00:00
2000-09-18 16:07:07 +00:00
class SmPrinterAccess
{
VclPtr<Printer> pPrinter;
VclPtr<OutputDevice> pRefDev;
2000-09-18 16:07:07 +00:00
public:
SmPrinterAccess( SmDocShell &rDocShell );
~SmPrinterAccess();
Printer* GetPrinter() { return pPrinter.get(); }
OutputDevice* GetRefDev() { return pRefDev.get(); }
2000-09-18 16:07:07 +00:00
};
2011-06-28 16:41:42 +01:00
void SetEditEngineDefaultFonts(SfxItemPool &rEditEngineItemPool);
2000-09-18 16:07:07 +00:00
class SM_DLLPUBLIC SmDocShell : public SfxObjectShell, public SfxListener
2000-09-18 16:07:07 +00:00
{
friend class SmPrinterAccess;
friend class SmModel;
friend class SmCursor;
2000-09-18 16:07:07 +00:00
OUString aText;
2000-09-18 16:07:07 +00:00
SmFormat aFormat;
SmParser aInterpreter;
OUString aAccText;
2000-09-18 16:07:07 +00:00
SmNode *pTree;
SfxItemPool *pEditEngineItemPool;
EditEngine *pEditEngine;
VclPtr<SfxPrinter> pPrinter; //q.v. comment to SmPrinter Access!
VclPtr<Printer> pTmpPrinter; //ditto
2011-02-07 13:06:08 +01:00
sal_uInt16 nModifyCount;
bool bIsFormulaArranged;
SmCursor *pCursor;
std::set< OUString > aUsedSymbols; // to export used symbols only when saving
2000-09-18 16:07:07 +00:00
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) SAL_OVERRIDE;
2000-09-18 16:07:07 +00:00
bool WriteAsMathType3( SfxMedium& );
2000-09-18 16:07:07 +00:00
virtual void Draw(OutputDevice *pDevice,
const JobSetup & rSetup,
sal_uInt16 nAspect = ASPECT_CONTENT) SAL_OVERRIDE;
2000-09-18 16:07:07 +00:00
virtual void FillClass(SvGlobalName* pClassName,
SotClipboardFormatId* pFormat,
OUString* pAppName,
OUString* pFullTypeName,
OUString* pShortTypeName,
CWS-TOOLING: integrate CWS fwk92 2008-12-04 14:43:28 +0100 oc r264844 : #i96788# 2008-12-03 02:15:17 +0100 fredrikh r264734 : i96817 2008-12-02 16:42:46 +0100 tbo r264720 : #i96763# changes to password dialog for framework, math, global 2008-11-26 16:26:28 +0100 mav r264418 : #i93617# fix typo 2008-11-26 16:13:03 +0100 mav r264411 : #i93617# fix the linux scenario 2008-11-25 17:58:01 +0100 mav r264323 : #i93617# fix the windows problems 2008-11-25 17:51:33 +0100 mav r264321 : #i93617# fix the windows problems 2008-11-21 16:01:18 +0100 mav r264145 : #i78753# integrate the patch 2008-11-21 14:08:32 +0100 mav r264136 : #i93617# integrate the patch 2008-11-21 13:01:56 +0100 mav r264127 : #i82947# integrate the patch 2008-11-20 18:14:19 +0100 mav r264092 : #i95793# look for import filter 2008-11-18 15:23:44 +0100 pb r263776 : fix: #i92579# #i92583# SvxSecurity/SearchPage: more space for controls 2008-11-18 15:21:39 +0100 pb r263774 : fix: #i92579# #i92583# SvxSecurity/SearchPage: more space for controls 2008-11-18 15:18:54 +0100 pb r263772 : fix: #i92583# SvxSearchPage::InitControls_Impl() added 2008-11-18 15:16:07 +0100 pb r263771 : fix: #i92579# columns calculated newly 2008-11-18 11:09:28 +0100 mav r263751 : #i21923# small fixes 2008-11-17 17:22:04 +0100 mav r263730 : #i21923# integrate the patch 2008-11-17 14:29:02 +0100 mav r263723 : #i21923# integrate the patch 2008-11-13 16:46:08 +0100 mav r263653 : #i88127# integrate the patch 2008-11-13 14:46:56 +0100 mav r263645 : #i54638# integrate the patch 2008-11-11 13:11:03 +0100 pb r263554 : fix: #i93142# disable maRecommReadOnlyCB on read-only documents 2008-11-10 13:30:58 +0100 pb r263516 : fix: #i93833# Mozilla Plug-in -> Browser Plug-in 2008-11-10 13:29:10 +0100 pb r263515 : fix: #i93833# Mozilla Plug-in -> Browser Plug-in 2008-11-10 06:10:11 +0100 pb r263505 : fix: #i94937# now .uno.ExtendedHelp without image 2008-11-04 20:52:50 +0100 mav r263337 : migrate cws fwk92 to svn
2008-12-12 12:52:51 +00:00
sal_Int32 nFileFormat,
bool bTemplate = false ) const SAL_OVERRIDE;
2000-09-18 16:07:07 +00:00
virtual sal_uLong GetMiscStatus() const SAL_OVERRIDE;
virtual void OnDocumentPrinterChanged( Printer * ) SAL_OVERRIDE;
virtual bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) SAL_OVERRIDE;
virtual bool Load( SfxMedium& rMedium ) SAL_OVERRIDE;
virtual bool Save() SAL_OVERRIDE;
virtual bool SaveAs( SfxMedium& rMedium ) SAL_OVERRIDE;
virtual bool ConvertTo( SfxMedium &rMedium ) SAL_OVERRIDE;
virtual bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) SAL_OVERRIDE;
2000-09-18 16:07:07 +00:00
Printer *GetPrt();
OutputDevice* GetRefDev();
2000-09-18 16:07:07 +00:00
bool IsFormulaArranged() const { return bIsFormulaArranged; }
void SetFormulaArranged(bool bVal) { bIsFormulaArranged = bVal; }
2000-09-18 16:07:07 +00:00
virtual bool ConvertFrom(SfxMedium &rMedium) SAL_OVERRIDE;
/** Called whenever the formula is changed
* Deletes the current cursor
*/
void InvalidateCursor();
bool writeFormulaOoxml( ::sax_fastparser::FSHelperPtr pSerializer, oox::core::OoxmlVersion version );
void writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding);
void readFormulaOoxml( oox::formulaimport::XmlStream& stream );
2000-09-18 16:07:07 +00:00
public:
TYPEINFO_OVERRIDE();
SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START+1)
SFX_DECL_OBJECTFACTORY();
2000-09-18 16:07:07 +00:00
private:
/// SfxInterface initializer.
static void InitInterface_Impl();
public:
SmDocShell( SfxModelFlags i_nSfxCreationFlags );
2000-09-18 16:07:07 +00:00
virtual ~SmDocShell();
static void LoadSymbols();
static void SaveSymbols();
2000-09-18 16:07:07 +00:00
void ArrangeFormula();
//Access for the View. This access is not for the OLE-case!
//and for the communication with the SFX!
//All internal printer uses should work with the SmPrinterAccess only
bool HasPrinter() { return pPrinter != nullptr; }
2000-09-18 16:07:07 +00:00
SfxPrinter *GetPrinter() { GetPrt(); return pPrinter; }
void SetPrinter( SfxPrinter * );
const OUString GetComment() const;
2000-09-18 16:07:07 +00:00
// to replace chars that can not be saved with the document...
bool ReplaceBadChars();
void UpdateText();
void SetText(const OUString& rBuffer);
OUString GetText() { return aText; }
2000-09-18 16:07:07 +00:00
void SetFormat(SmFormat& rFormat);
const SmFormat& GetFormat() { return aFormat; }
2000-09-18 16:07:07 +00:00
void Parse();
SmParser & GetParser() { return aInterpreter; }
const SmNode * GetFormulaTree() const { return pTree; }
void SetFormulaTree(SmNode *&rTree) { pTree = rTree; }
const std::set< OUString > & GetUsedSymbols() const { return aUsedSymbols; }
OUString GetAccessibleText();
2002-05-24 06:48:49 +00:00
EditEngine & GetEditEngine();
SfxItemPool & GetEditEngineItemPool();
2000-09-18 16:07:07 +00:00
void DrawFormula(OutputDevice &rDev, Point &rPosition, bool bDrawSelection = false);
2000-09-18 16:07:07 +00:00
Size GetSize();
void Repaint();
2000-09-18 16:07:07 +00:00
virtual ::svl::IUndoManager *GetUndoManager () SAL_OVERRIDE;
2000-09-18 16:07:07 +00:00
static SfxItemPool& GetPool();
2000-09-18 16:07:07 +00:00
void Execute( SfxRequest& rReq );
void GetState(SfxItemSet &);
virtual void SetVisArea (const Rectangle & rVisArea) SAL_OVERRIDE;
virtual void SetModified(bool bModified) SAL_OVERRIDE;
/** Get a cursor for modifying this document
* @remarks Don't store this reference, a new cursor may be made...
*/
SmCursor& GetCursor();
/** True, if cursor have previously been requested and thus
* has some sort of position.
*/
bool HasCursor() { return pCursor != NULL; }
2000-09-18 16:07:07 +00:00
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */