LCOV - code coverage report
Current view: top level - svx/inc/svx - svdetc.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 14 15 93.3 %
Date: 2012-08-25 Functions: 10 11 90.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 6 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _SVDETC_HXX
      30                 :            : #define _SVDETC_HXX
      31                 :            : 
      32                 :            : #include <tools/string.hxx>
      33                 :            : 
      34                 :            : #include <vcl/outdev.hxx>
      35                 :            : #include <tools/shl.hxx>
      36                 :            : #include <editeng/outliner.hxx>
      37                 :            : #include "svx/svxdllapi.h"
      38                 :            : 
      39                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      40                 :            : 
      41                 :            : // ExchangeFormat-Id der DrawingEngine holen. Daten koennen dann per
      42                 :            : //   static sal_Bool CopyData(pData,nLen,nFormat);
      43                 :            : // bereitgestellt werden, wobei pData/nLen einen SvMemoryStream beschreiben in
      44                 :            : // dem ein SdrModel gestreamt wird an dem fuer die Zeitdauer des Streamens das
      45                 :            : // Flag SdrModel::SetStreamingSdrModel(sal_True) gesetzt wird.
      46                 :            : // sal_uIntPtr SdrGetExchangeFormat(); -- JP 18.01.99 - dafuer gibt es ein define
      47                 :            : 
      48                 :            : class SdrOutliner;
      49                 :            : class SdrModel;
      50                 :            : class SvtSysLocale;
      51                 :            : class LocaleDataWrapper;
      52                 :            : 
      53                 :            : namespace com { namespace sun { namespace star { namespace lang {
      54                 :            :     struct Locale;
      55                 :            : }}}}
      56                 :            : 
      57                 :            : // Einen Outliner mit den engineglobalen
      58                 :            : // Defaulteinstellungen auf dem Heap erzeugen.
      59                 :            : // Ist pMod<>NULL, dann wird der MapMode des uebergebenen
      60                 :            : // Models verwendet. Die resultierende Default-Fonthoehe bleibt
      61                 :            : // jedoch dieselbe (die logische Fonthoehe wird umgerechnet).
      62                 :            : SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner( sal_uInt16 nOutlinerMode, SdrModel* pMod );
      63                 :            : 
      64                 :            : // Globale Defaulteinstellungen fuer die DrawingEngine.
      65                 :            : // Diese Einstellungen sollte man direkt beim Applikationsstart
      66                 :            : // vornehmen, noch bevor andere Methoden der Engine gerufen werden.
      67                 :            : class SVX_DLLPUBLIC SdrEngineDefaults
      68                 :            : {
      69                 :            : friend class SdrAttrObj;
      70                 :            :     String     aFontName;
      71                 :            :     FontFamily eFontFamily;
      72                 :            :     Color      aFontColor;
      73                 :            :     sal_uIntPtr      nFontHeight;
      74                 :            :     MapUnit    eMapUnit;
      75                 :            :     Fraction   aMapFraction;
      76                 :            : 
      77                 :            : private:
      78                 :            :     static SdrEngineDefaults& GetDefaults();
      79                 :            : 
      80                 :            : public:
      81                 :            :     SdrEngineDefaults();
      82                 :            :     // Default Fontname ist "Times New Roman"
      83                 :            :     static void       SetFontName(const String& rFontName) { GetDefaults().aFontName=rFontName; }
      84                 :            :     static String     GetFontName()                        { return GetDefaults().aFontName; }
      85                 :            :     // Default FontFamily ist FAMILY_ROMAN
      86                 :            :     static void       SetFontFamily(FontFamily eFam)       { GetDefaults().eFontFamily=eFam; }
      87                 :            :     static FontFamily GetFontFamily()                      { return GetDefaults().eFontFamily; }
      88                 :            :     // Default FontColor ist COL_BLACK
      89                 :            :     static void       SetFontColor(const Color& rColor)    { GetDefaults().aFontColor=rColor; }
      90                 :       3428 :     static Color      GetFontColor()                       { return GetDefaults().aFontColor; }
      91                 :            :     // Default FontHeight ist 847. Die Fonthoehe wird in logischen Einheiten
      92                 :            :     // (MapUnit/MapFraction (siehe unten)) angegeben. Die Defaulteinstellung
      93                 :            :     // 847/100mm entspricht also ca. 24 Point. Verwendet man stattdessen
      94                 :            :     // beispielsweise Twips (SetMapUnit(MAP_TWIP)) (20 Twip = 1 Point) muss
      95                 :            :     // man als Fonthoehe 480 angeben um 24 Point als default zu erhalten.
      96                 :            :     static void       SetFontHeight(sal_uIntPtr nHeight)         { GetDefaults().nFontHeight=nHeight; }
      97                 :       2042 :     static sal_uIntPtr      GetFontHeight()                      { return GetDefaults().nFontHeight; }
      98                 :            :     // Der MapMode wird fuer den globalen Outliner benoetigt.
      99                 :            :     // Gleichzeitig bekommt auch jedes neu instanziierte SdrModel
     100                 :            :     // diesen MapMode default zugewiesen.
     101                 :            :     // Default MapUnit ist MAP_100TH_MM
     102                 :            :     static void       SetMapUnit(MapUnit eMap)             { GetDefaults().eMapUnit=eMap; }
     103                 :       3512 :     static MapUnit    GetMapUnit()                         { return GetDefaults().eMapUnit; }
     104                 :            :     // Default MapFraction ist 1/1.
     105                 :            :     static void       SetMapFraction(const Fraction& rMap) { GetDefaults().aMapFraction=rMap; }
     106                 :       3328 :     static Fraction   GetMapFraction()                     { return GetDefaults().aMapFraction; }
     107                 :            : 
     108                 :            :     // Einen Outliner mit den engineglobalen
     109                 :            :     // Defaulteinstellungen auf dem Heap erzeugen.
     110                 :            :     // Ist pMod<>NULL, dann wird der MapMode des uebergebenen
     111                 :            :     // Models verwendet. Die resultierende Default-Fonthoehe bleibt
     112                 :            :     // jedoch dieselbe (die logische Fonthoehe wird umgerechnet).
     113                 :            :     friend SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner( sal_uInt16 nOutlinerMode, SdrModel* pMod );
     114                 :            : };
     115                 :            : 
     116                 :            : class SfxItemSet;
     117                 :            : // Liefert eine Ersatzdarstellung fuer einen XFillStyle
     118                 :            : // Bei XFILL_NONE gibt's sal_False und rCol bleibt unveraendert.
     119                 :            : SVX_DLLPUBLIC bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol);
     120                 :            : 
     121                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     122                 :            : 
     123                 :            : // Ein ItemSet auf Outliner- bzw. EditEngine-Items durchsuchen
     124                 :            : // Liefert sal_True, wenn der Set solchen Items enthaelt.
     125                 :            : sal_Bool SearchOutlinerItems(const SfxItemSet& rSet, sal_Bool bInklDefaults, sal_Bool* pbOnlyEE=NULL);
     126                 :            : 
     127                 :            : // zurueck erhaelt man einen neuen WhichTable den
     128                 :            : // man dann irgendwann mit delete platthauen muss.
     129                 :            : sal_uInt16* RemoveWhichRange(const sal_uInt16* pOldWhichTable, sal_uInt16 nRangeBeg, sal_uInt16 nRangeEnd);
     130                 :            : 
     131                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     132                 :            : 
     133                 :            : class Link;
     134                 :            : 
     135                 :            : // Hilfsklasse zur kommunikation zwischen dem Dialog
     136                 :            : // zum aufbrechen von Metafiles (sd/source/ui/dlg/brkdlg.cxx),
     137                 :            : // SdrEditView::DoImportMarkedMtf() und
     138                 :            : // ImpSdrGDIMetaFileImport::DoImport()
     139                 :            : class SVX_DLLPUBLIC SvdProgressInfo
     140                 :            : {
     141                 :            : private:
     142                 :            :     sal_uIntPtr nSumActionCount;    // Summe aller Actions
     143                 :            :     sal_uIntPtr nSumCurAction;  // Summe aller bearbeiteten Actions
     144                 :            : 
     145                 :            :     sal_uIntPtr nActionCount;       // Anzahl der Actions im akt. Obj.
     146                 :            :     sal_uIntPtr nCurAction;     // Anzahl bearbeiteter Act. im akt. Obj.
     147                 :            : 
     148                 :            :     sal_uIntPtr nInsertCount;       // Anzahl einzufuegender Act. im akt. Obj.
     149                 :            :     sal_uIntPtr nCurInsert;     // Anzahl bereits eingefuegter Actions
     150                 :            : 
     151                 :            :     sal_uIntPtr nObjCount;      // Anzahl der selektierten Objekte
     152                 :            :     sal_uIntPtr nCurObj;            // Aktuelles Objekt
     153                 :            : 
     154                 :            :     Link *pLink;
     155                 :            : 
     156                 :            : public:
     157                 :            :     SvdProgressInfo( Link *_pLink );
     158                 :            : 
     159                 :            :     void Init( sal_uIntPtr _nSumActionCount, sal_uIntPtr _nObjCount );
     160                 :            : 
     161                 :            :     sal_Bool SetNextObject();
     162                 :            : 
     163                 :            :     void SetActionCount( sal_uIntPtr _nActionCount );
     164                 :            :     void SetInsertCount( sal_uIntPtr _nInsertCount );
     165                 :            : 
     166                 :            :     sal_Bool ReportActions( sal_uIntPtr nAnzActions );
     167                 :            :     sal_Bool ReportInserts( sal_uIntPtr nAnzInserts );
     168                 :            : 
     169                 :            :     sal_uIntPtr GetSumActionCount() const { return nSumActionCount; };
     170                 :            :     sal_uIntPtr GetSumCurAction() const { return nSumCurAction; };
     171                 :            :     sal_uIntPtr GetObjCount() const { return nObjCount; };
     172                 :            :     sal_uIntPtr GetCurObj() const { return nCurObj; };
     173                 :            : 
     174                 :            :     sal_uIntPtr GetActionCount() const { return nActionCount; };
     175                 :            :     sal_uIntPtr GetCurAction() const { return nCurAction; };
     176                 :            : 
     177                 :            :     sal_uIntPtr GetInsertCount() const { return nInsertCount; };
     178                 :            :     sal_uIntPtr GetCurInsert() const { return nCurInsert; };
     179                 :            : 
     180                 :            :     void ReportError();
     181                 :            :     sal_Bool ReportRescales( sal_uIntPtr nAnzRescales );
     182                 :            : };
     183                 :            : 
     184                 :            : 
     185                 :            : 
     186                 :            : class SdrLinkList
     187                 :            : {
     188                 :            :     std::vector<Link*> aList;
     189                 :            : protected:
     190                 :            :     unsigned FindEntry(const Link& rLink) const;
     191                 :            : public:
     192                 :        270 :     SdrLinkList(): aList()                   {}
     193         [ #  # ]:          0 :     ~SdrLinkList()                           { Clear(); }
     194                 :            :     SVX_DLLPUBLIC void Clear();
     195                 :       3684 :     unsigned GetLinkCount() const            { return (unsigned)aList.size(); }
     196                 :       2675 :     Link& GetLink(unsigned nNum)             { return *aList[nNum]; }
     197                 :        791 :     const Link& GetLink(unsigned nNum) const { return *aList[nNum]; }
     198                 :            :     void InsertLink(const Link& rLink, unsigned nPos=0xFFFF);
     199                 :            :     void RemoveLink(const Link& rLink);
     200                 :            :     bool HasLink(const Link& rLink) const { return FindEntry(rLink)!=0xFFFF; }
     201                 :            : };
     202                 :            : 
     203                 :            : // Fuer die Factory in SvdObj.CXX
     204                 :            : SdrLinkList& ImpGetUserMakeObjHdl();
     205                 :            : SdrLinkList& ImpGetUserMakeObjUserDataHdl();
     206                 :            : 
     207                 :            : class SdrOle2Obj;
     208                 :            : class AutoTimer;
     209                 :            : 
     210                 :            : class OLEObjCache : public std::vector<SdrOle2Obj*>
     211                 :            : {
     212                 :            :     sal_uIntPtr         nSize;
     213                 :            :     AutoTimer*          pTimer;
     214                 :            : 
     215                 :            :     void UnloadOnDemand();
     216                 :            :     sal_Bool UnloadObj( SdrOle2Obj* pObj );
     217                 :            :     DECL_LINK( UnloadCheckHdl, AutoTimer* );
     218                 :            : 
     219                 :            : public:
     220                 :            :     OLEObjCache();
     221                 :            :     SVX_DLLPUBLIC ~OLEObjCache();
     222                 :            : 
     223                 :            :     void InsertObj(SdrOle2Obj* pObj);
     224                 :            :     void RemoveObj(SdrOle2Obj* pObj);
     225                 :            : };
     226                 :            : 
     227                 :            : 
     228                 :            : class SVX_DLLPUBLIC SdrGlobalData
     229                 :            : {
     230                 :            :     const SvtSysLocale*         pSysLocale;     // follows always locale settings
     231                 :            :     const LocaleDataWrapper*    pLocaleData;    // follows always SysLocale
     232                 :            : public:
     233                 :            :     SdrLinkList         aUserMakeObjHdl;
     234                 :            :     SdrLinkList         aUserMakeObjUserDataHdl;
     235                 :            :     SdrOutliner*        pOutliner;
     236                 :            :     SdrEngineDefaults*  pDefaults;
     237                 :            :     ResMgr*             pResMgr;
     238                 :            :     sal_uIntPtr                 nExchangeFormat;
     239                 :            :     OLEObjCache         aOLEObjCache;
     240                 :            : 
     241                 :            : 
     242                 :            :     const SvtSysLocale*         GetSysLocale();     // follows always locale settings
     243                 :            :     const LocaleDataWrapper*    GetLocaleData();    // follows always SysLocale
     244                 :            : public:
     245                 :            :     SdrGlobalData();
     246                 :            : 
     247                 :        525 :     OLEObjCache&        GetOLEObjCache() { return aOLEObjCache; }
     248                 :            : };
     249                 :            : 
     250                 :      19246 : inline SdrGlobalData& GetSdrGlobalData()
     251                 :            : {
     252                 :      19246 :     void** ppAppData=GetAppData(SHL_SVD);
     253         [ +  + ]:      19246 :     if (*ppAppData==NULL) {
     254         [ +  - ]:        135 :         *ppAppData=new SdrGlobalData;
     255                 :            :     }
     256                 :      19246 :     return *((SdrGlobalData*)*ppAppData);
     257                 :            : }
     258                 :            : 
     259                 :            : namespace sdr
     260                 :            : {
     261                 :            : 
     262                 :            : SVX_DLLPUBLIC String GetResourceString(sal_uInt16 nResID);
     263                 :            : 
     264                 :            : }
     265                 :            : 
     266                 :            : /////////////////////////////////////////////////////////////////////
     267                 :            : // #i101872# isolated GetTextEditBackgroundColor for tooling
     268                 :            : class SdrObjEditView;
     269                 :            : 
     270                 :            : SVX_DLLPUBLIC Color GetTextEditBackgroundColor(const SdrObjEditView& rView);
     271                 :            : 
     272                 :            : /////////////////////////////////////////////////////////////////////
     273                 :            : 
     274                 :            : #endif //_SVDETC_HXX
     275                 :            : 
     276                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10