LCOV - code coverage report
Current view: top level - libreoffice/svx/inc/svx - svdetc.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 13 15 86.7 %
Date: 2012-12-17 Functions: 9 11 81.8 %
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 _SVDETC_HXX
      21             : #define _SVDETC_HXX
      22             : 
      23             : #include <tools/string.hxx>
      24             : 
      25             : #include <vcl/outdev.hxx>
      26             : #include <tools/shl.hxx>
      27             : #include <editeng/outliner.hxx>
      28             : #include "svx/svxdllapi.h"
      29             : 
      30             : ////////////////////////////////////////////////////////////////////////////////////////////////////
      31             : 
      32             : // ExchangeFormat-Id der DrawingEngine holen. Daten koennen dann per
      33             : //   static sal_Bool CopyData(pData,nLen,nFormat);
      34             : // bereitgestellt werden, wobei pData/nLen einen SvMemoryStream beschreiben in
      35             : // dem ein SdrModel gestreamt wird an dem fuer die Zeitdauer des Streamens das
      36             : // Flag SdrModel::SetStreamingSdrModel(sal_True) gesetzt wird.
      37             : // sal_uIntPtr SdrGetExchangeFormat(); -- JP 18.01.99 - dafuer gibt es ein define
      38             : 
      39             : class SdrOutliner;
      40             : class SdrModel;
      41             : class SvtSysLocale;
      42             : class LocaleDataWrapper;
      43             : 
      44             : namespace com { namespace sun { namespace star { namespace lang {
      45             :     struct Locale;
      46             : }}}}
      47             : 
      48             : // Einen Outliner mit den engineglobalen
      49             : // Defaulteinstellungen auf dem Heap erzeugen.
      50             : // Ist pMod<>NULL, dann wird der MapMode des uebergebenen
      51             : // Models verwendet. Die resultierende Default-Fonthoehe bleibt
      52             : // jedoch dieselbe (die logische Fonthoehe wird umgerechnet).
      53             : SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner( sal_uInt16 nOutlinerMode, SdrModel* pMod );
      54             : 
      55             : // Globale Defaulteinstellungen fuer die DrawingEngine.
      56             : // Diese Einstellungen sollte man direkt beim Applikationsstart
      57             : // vornehmen, noch bevor andere Methoden der Engine gerufen werden.
      58             : class SVX_DLLPUBLIC SdrEngineDefaults
      59             : {
      60             : friend class SdrAttrObj;
      61             :     String     aFontName;
      62             :     FontFamily eFontFamily;
      63             :     Color      aFontColor;
      64             :     sal_uIntPtr      nFontHeight;
      65             :     MapUnit    eMapUnit;
      66             :     Fraction   aMapFraction;
      67             : 
      68             : private:
      69             :     static SdrEngineDefaults& GetDefaults();
      70             : 
      71             : public:
      72             :     SdrEngineDefaults();
      73             :     // Default Fontname ist "Times New Roman"
      74             :     static void       SetFontName(const String& rFontName) { GetDefaults().aFontName=rFontName; }
      75             :     static String     GetFontName()                        { return GetDefaults().aFontName; }
      76             :     // Default FontFamily ist FAMILY_ROMAN
      77             :     static void       SetFontFamily(FontFamily eFam)       { GetDefaults().eFontFamily=eFam; }
      78             :     static FontFamily GetFontFamily()                      { return GetDefaults().eFontFamily; }
      79             :     // Default FontColor ist COL_BLACK
      80             :     static void       SetFontColor(const Color& rColor)    { GetDefaults().aFontColor=rColor; }
      81         799 :     static Color      GetFontColor()                       { return GetDefaults().aFontColor; }
      82             :     // Default FontHeight ist 847. Die Fonthoehe wird in logischen Einheiten
      83             :     // (MapUnit/MapFraction (siehe unten)) angegeben. Die Defaulteinstellung
      84             :     // 847/100mm entspricht also ca. 24 Point. Verwendet man stattdessen
      85             :     // beispielsweise Twips (SetMapUnit(MAP_TWIP)) (20 Twip = 1 Point) muss
      86             :     // man als Fonthoehe 480 angeben um 24 Point als default zu erhalten.
      87             :     static void       SetFontHeight(sal_uIntPtr nHeight)         { GetDefaults().nFontHeight=nHeight; }
      88         269 :     static sal_uIntPtr      GetFontHeight()                      { return GetDefaults().nFontHeight; }
      89             :     // Der MapMode wird fuer den globalen Outliner benoetigt.
      90             :     // Gleichzeitig bekommt auch jedes neu instanziierte SdrModel
      91             :     // diesen MapMode default zugewiesen.
      92             :     // Default MapUnit ist MAP_100TH_MM
      93             :     static void       SetMapUnit(MapUnit eMap)             { GetDefaults().eMapUnit=eMap; }
      94         852 :     static MapUnit    GetMapUnit()                         { return GetDefaults().eMapUnit; }
      95             :     // Default MapFraction ist 1/1.
      96             :     static void       SetMapFraction(const Fraction& rMap) { GetDefaults().aMapFraction=rMap; }
      97         758 :     static Fraction   GetMapFraction()                     { return GetDefaults().aMapFraction; }
      98             : 
      99             :     // Einen Outliner mit den engineglobalen
     100             :     // Defaulteinstellungen auf dem Heap erzeugen.
     101             :     // Ist pMod<>NULL, dann wird der MapMode des uebergebenen
     102             :     // Models verwendet. Die resultierende Default-Fonthoehe bleibt
     103             :     // jedoch dieselbe (die logische Fonthoehe wird umgerechnet).
     104             :     friend SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner( sal_uInt16 nOutlinerMode, SdrModel* pMod );
     105             : };
     106             : 
     107             : class SfxItemSet;
     108             : // Liefert eine Ersatzdarstellung fuer einen XFillStyle
     109             : // Bei XFILL_NONE gibt's sal_False und rCol bleibt unveraendert.
     110             : SVX_DLLPUBLIC bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol);
     111             : 
     112             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     113             : 
     114             : // Ein ItemSet auf Outliner- bzw. EditEngine-Items durchsuchen
     115             : // Liefert sal_True, wenn der Set solchen Items enthaelt.
     116             : sal_Bool SearchOutlinerItems(const SfxItemSet& rSet, sal_Bool bInklDefaults, sal_Bool* pbOnlyEE=NULL);
     117             : 
     118             : // zurueck erhaelt man einen neuen WhichTable den
     119             : // man dann irgendwann mit delete platthauen muss.
     120             : sal_uInt16* RemoveWhichRange(const sal_uInt16* pOldWhichTable, sal_uInt16 nRangeBeg, sal_uInt16 nRangeEnd);
     121             : 
     122             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     123             : 
     124             : class Link;
     125             : 
     126             : // Hilfsklasse zur kommunikation zwischen dem Dialog
     127             : // zum aufbrechen von Metafiles (sd/source/ui/dlg/brkdlg.cxx),
     128             : // SdrEditView::DoImportMarkedMtf() und
     129             : // ImpSdrGDIMetaFileImport::DoImport()
     130             : class SVX_DLLPUBLIC SvdProgressInfo
     131             : {
     132             : private:
     133             :     sal_uIntPtr nSumActionCount;    // Summe aller Actions
     134             :     sal_uIntPtr nSumCurAction;  // Summe aller bearbeiteten Actions
     135             : 
     136             :     sal_uIntPtr nActionCount;       // Anzahl der Actions im akt. Obj.
     137             :     sal_uIntPtr nCurAction;     // Anzahl bearbeiteter Act. im akt. Obj.
     138             : 
     139             :     sal_uIntPtr nInsertCount;       // Anzahl einzufuegender Act. im akt. Obj.
     140             :     sal_uIntPtr nCurInsert;     // Anzahl bereits eingefuegter Actions
     141             : 
     142             :     sal_uIntPtr nObjCount;      // Anzahl der selektierten Objekte
     143             :     sal_uIntPtr nCurObj;            // Aktuelles Objekt
     144             : 
     145             :     Link *pLink;
     146             : 
     147             : public:
     148             :     SvdProgressInfo( Link *_pLink );
     149             : 
     150             :     void Init( sal_uIntPtr _nSumActionCount, sal_uIntPtr _nObjCount );
     151             : 
     152             :     sal_Bool SetNextObject();
     153             : 
     154             :     void SetActionCount( sal_uIntPtr _nActionCount );
     155             :     void SetInsertCount( sal_uIntPtr _nInsertCount );
     156             : 
     157             :     sal_Bool ReportActions( sal_uIntPtr nAnzActions );
     158             :     sal_Bool ReportInserts( sal_uIntPtr nAnzInserts );
     159             : 
     160             :     sal_uIntPtr GetSumActionCount() const { return nSumActionCount; };
     161             :     sal_uIntPtr GetSumCurAction() const { return nSumCurAction; };
     162             :     sal_uIntPtr GetObjCount() const { return nObjCount; };
     163             :     sal_uIntPtr GetCurObj() const { return nCurObj; };
     164             : 
     165             :     sal_uIntPtr GetActionCount() const { return nActionCount; };
     166             :     sal_uIntPtr GetCurAction() const { return nCurAction; };
     167             : 
     168             :     sal_uIntPtr GetInsertCount() const { return nInsertCount; };
     169             :     sal_uIntPtr GetCurInsert() const { return nCurInsert; };
     170             : 
     171             :     void ReportError();
     172             :     sal_Bool ReportRescales( sal_uIntPtr nAnzRescales );
     173             : };
     174             : 
     175             : 
     176             : 
     177             : class SdrLinkList
     178             : {
     179             :     std::vector<Link*> aList;
     180             : protected:
     181             :     unsigned FindEntry(const Link& rLink) const;
     182             : public:
     183         128 :     SdrLinkList(): aList()                   {}
     184           0 :     ~SdrLinkList()                           { Clear(); }
     185             :     SVX_DLLPUBLIC void Clear();
     186         344 :     unsigned GetLinkCount() const            { return (unsigned)aList.size(); }
     187           0 :     Link& GetLink(unsigned nNum)             { return *aList[nNum]; }
     188         260 :     const Link& GetLink(unsigned nNum) const { return *aList[nNum]; }
     189             :     void InsertLink(const Link& rLink, unsigned nPos=0xFFFF);
     190             :     void RemoveLink(const Link& rLink);
     191             :     bool HasLink(const Link& rLink) const { return FindEntry(rLink)!=0xFFFF; }
     192             : };
     193             : 
     194             : // Fuer die Factory in SvdObj.CXX
     195             : SdrLinkList& ImpGetUserMakeObjHdl();
     196             : SdrLinkList& ImpGetUserMakeObjUserDataHdl();
     197             : 
     198             : class SdrOle2Obj;
     199             : class AutoTimer;
     200             : 
     201             : class OLEObjCache : public std::vector<SdrOle2Obj*>
     202             : {
     203             :     sal_uIntPtr         nSize;
     204             :     AutoTimer*          pTimer;
     205             : 
     206             :     void UnloadOnDemand();
     207             :     sal_Bool UnloadObj( SdrOle2Obj* pObj );
     208             :     DECL_LINK( UnloadCheckHdl, AutoTimer* );
     209             : 
     210             : public:
     211             :     OLEObjCache();
     212             :     SVX_DLLPUBLIC ~OLEObjCache();
     213             : 
     214             :     void InsertObj(SdrOle2Obj* pObj);
     215             :     void RemoveObj(SdrOle2Obj* pObj);
     216             : };
     217             : 
     218             : 
     219             : class SVX_DLLPUBLIC SdrGlobalData
     220             : {
     221             :     const SvtSysLocale*         pSysLocale;     // follows always locale settings
     222             :     const LocaleDataWrapper*    pLocaleData;    // follows always SysLocale
     223             : public:
     224             :     SdrLinkList         aUserMakeObjHdl;
     225             :     SdrLinkList         aUserMakeObjUserDataHdl;
     226             :     SdrOutliner*        pOutliner;
     227             :     SdrEngineDefaults*  pDefaults;
     228             :     ResMgr*             pResMgr;
     229             :     sal_uIntPtr                 nExchangeFormat;
     230             :     OLEObjCache         aOLEObjCache;
     231             : 
     232             : 
     233             :     const SvtSysLocale*         GetSysLocale();     // follows always locale settings
     234             :     const LocaleDataWrapper*    GetLocaleData();    // follows always SysLocale
     235             : public:
     236             :     SdrGlobalData();
     237             : 
     238         748 :     OLEObjCache&        GetOLEObjCache() { return aOLEObjCache; }
     239             : };
     240             : 
     241        4160 : inline SdrGlobalData& GetSdrGlobalData()
     242             : {
     243        4160 :     void** ppAppData=GetAppData(SHL_SVD);
     244        4160 :     if (*ppAppData==NULL) {
     245          64 :         *ppAppData=new SdrGlobalData;
     246             :     }
     247        4160 :     return *((SdrGlobalData*)*ppAppData);
     248             : }
     249             : 
     250             : namespace sdr
     251             : {
     252             : 
     253             : SVX_DLLPUBLIC String GetResourceString(sal_uInt16 nResID);
     254             : 
     255             : }
     256             : 
     257             : /////////////////////////////////////////////////////////////////////
     258             : // #i101872# isolated GetTextEditBackgroundColor for tooling
     259             : class SdrObjEditView;
     260             : 
     261             : SVX_DLLPUBLIC Color GetTextEditBackgroundColor(const SdrObjEditView& rView);
     262             : 
     263             : /////////////////////////////////////////////////////////////////////
     264             : 
     265             : #endif //_SVDETC_HXX
     266             : 
     267             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10