Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / svx / svdetc.hxx
blob19ebf31f34680ace3ea0fb033f69fbeb75695fa2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_SVDETC_HXX
21 #define INCLUDED_SVX_SVDETC_HXX
23 #include <rtl/ustring.hxx>
24 #include <editeng/outliner.hxx>
25 #include <svx/svxdllapi.h>
26 #include <tools/link.hxx>
27 #include <tools/fract.hxx>
28 #include <vcl/outdev.hxx>
29 #include <svx/svdobj.hxx>
32 /**
33 * Get ExchangeFormatID of the DrawingEngine.
34 * The data can then be made available via
35 * static bool CopyData(pData,nLen,nFormat);
37 * However, pData/nLen describe an SvMemoryStream in which an SdrModel is
38 * streamed. For its lifetime, the flag SdrModel::SetStreamingSdrModel(true)
39 * is set.
42 class ResMgr;
43 class SdrOutliner;
44 class SdrModel;
45 class SvtSysLocale;
46 class LocaleDataWrapper;
48 namespace com { namespace sun { namespace star { namespace lang {
49 struct Locale;
50 }}}}
52 /**
53 * Create an Outliner with the engine-global default settings on the heap.
54 * If pMod != nullptr, the MapMode of the passed model is used.
55 * The resulting default font height, however, stays the same (the logical
56 * font height is converted).
58 SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner(OutlinerMode nOutlinerMode, SdrModel& rMod);
60 /**
61 * Global default settings for the DrawingEngine.
63 * One should set these default settings as the first
64 * thing at program start, before any other method is called.
66 class SVX_DLLPUBLIC SdrEngineDefaults
68 friend class SdrAttrObj;
69 Color aFontColor;
70 Fraction aMapFraction;
72 private:
73 static SdrEngineDefaults& GetDefaults();
75 public:
76 SdrEngineDefaults();
78 // Default FontColor is COL_BLACK
79 static Color GetFontColor() { return GetDefaults().aFontColor; }
81 // Default FontHeight is 847. The font height uses logical units (MapUnit/MapFraction
82 // see below for further details). The default setting 847/100mm corresponds to about
83 // 24 Point. If e.g. one would use Twips (SetMapUnit(MapUnit::MapTwip)) (20 Twip = 1 Point)
84 // instead, one would need to set the font height to 480, in order to get a 24 Point height.
85 static size_t GetFontHeight() { return 847; }
87 // The MapMode is needed for the global Outliner.
88 // Incidentally, every newly instantiated SdrModel is assigned this MapMode by default.
89 // Default MapUnit is MapUnit::Map100thMM
90 static MapUnit GetMapUnit() { return MapUnit::Map100thMM; }
92 // Default MapFraction is 1/1.
93 static Fraction GetMapFraction() { return GetDefaults().aMapFraction; }
95 // Create an Outliner with the engine-global default values on the heap.
96 // If pMod != nullptr, the MapMode of the passed model is used.
97 // The resulting default font height, however, stays the same (the logical font height is converted).
98 friend SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner(OutlinerMode nOutlinerMode, SdrModel& rMod);
101 class SfxItemSet;
104 * Returns a replacement for an XFillStyle
106 * @returns false for XFILL_NONE and rCol remains unchanged
108 SVX_DLLPUBLIC bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol);
112 * Search an ItemSet for Outliner/EditEngine Items
114 * @returns true, if the set contains such items
116 bool SearchOutlinerItems(const SfxItemSet& rSet, bool bInklDefaults, bool* pbOnlyEE=nullptr);
119 * @returns a new WhichTable, which we need to squash at some point with a delete
121 sal_uInt16* RemoveWhichRange(const sal_uInt16* pOldWhichTable, sal_uInt16 nRangeBeg, sal_uInt16 nRangeEnd);
124 * Helper class for the communication between the dialog
125 * In order to break open Metafiles (sd/source/ui/dlg/brkdlg.cxx),
126 * SdrEditView::DoImportMarkedMtf() and ImpSdrGDIMetaFileImport::DoImport()
128 class SVX_DLLPUBLIC SvdProgressInfo
130 private:
131 size_t m_nSumActionCount; // Sum of all Actions
132 size_t m_nSumCurAction; // Sum of all handled Actions
134 size_t m_nActionCount; // Count of Actions in the current object
135 size_t m_nCurAction; // Count of handled Actions in the current object
137 size_t m_nInsertCount; // Count of to-be-inserted Actions in the current object
138 size_t m_nCurInsert; // Count of already inserted Actions
140 size_t m_nObjCount; // Count of selected objects
141 size_t m_nCurObj; // Current object
143 Link<void*,bool> maLink;
145 public:
146 SvdProgressInfo( const Link<void*,bool>& _pLink );
148 void Init( size_t _nSumActionCount, size_t _nObjCount );
150 void SetNextObject();
152 void SetActionCount( size_t _nActionCount );
153 void SetInsertCount( size_t _nInsertCount );
155 bool ReportActions( size_t nActionCount );
156 void ReportInserts( size_t nInsertCount );
158 size_t GetSumCurAction() const { return m_nSumCurAction; };
159 size_t GetObjCount() const { return m_nObjCount; };
160 size_t GetCurObj() const { return m_nCurObj; };
162 size_t GetActionCount() const { return m_nActionCount; };
163 size_t GetCurAction() const { return m_nCurAction; };
165 size_t GetInsertCount() const { return m_nInsertCount; };
166 size_t GetCurInsert() const { return m_nCurInsert; };
168 void ReportRescales( size_t nRescaleCount );
172 std::vector<Link<SdrObjCreatorParams, SdrObject*>>& ImpGetUserMakeObjHdl();
173 std::vector<Link<SdrObjUserDataCreatorParams, SdrObjUserData*>>& ImpGetUserMakeObjUserDataHdl();
175 class SdrOle2Obj;
176 class AutoTimer;
178 class OLEObjCache
180 std::vector<SdrOle2Obj*> maObjs;
182 size_t nSize;
183 AutoTimer* pTimer;
185 void UnloadOnDemand();
186 static bool UnloadObj( SdrOle2Obj* pObj );
187 DECL_LINK( UnloadCheckHdl, Timer*, void );
189 public:
190 OLEObjCache();
191 SVX_DLLPUBLIC ~OLEObjCache();
193 void InsertObj(SdrOle2Obj* pObj);
194 void RemoveObj(SdrOle2Obj* pObj);
196 SVX_DLLPUBLIC size_t size() const;
197 SVX_DLLPUBLIC SdrOle2Obj* operator[](size_t nPos);
198 SVX_DLLPUBLIC const SdrOle2Obj* operator[](size_t nPos) const;
202 class SVX_DLLPUBLIC SdrGlobalData
204 const SvtSysLocale* pSysLocale; // follows always locale settings
205 const LocaleDataWrapper* pLocaleData; // follows always SysLocale
206 public:
207 std::vector<Link<SdrObjCreatorParams, SdrObject*>>
208 aUserMakeObjHdl;
209 std::vector<Link<SdrObjUserDataCreatorParams, SdrObjUserData*>>
210 aUserMakeObjUserDataHdl;
211 SdrEngineDefaults* pDefaults;
212 ResMgr* pResMgr;
213 OLEObjCache aOLEObjCache;
216 const SvtSysLocale* GetSysLocale(); // follows always locale settings
217 const LocaleDataWrapper* GetLocaleData(); // follows always SysLocale
218 public:
219 SdrGlobalData();
221 OLEObjCache& GetOLEObjCache() { return aOLEObjCache; }
224 SVX_DLLPUBLIC SdrGlobalData & GetSdrGlobalData();
226 namespace sdr
228 SVX_DLLPUBLIC OUString GetResourceString(sal_uInt16 nResID);
232 // #i101872# isolated GetTextEditBackgroundColor for tooling
233 class SdrObjEditView;
235 SVX_DLLPUBLIC Color GetTextEditBackgroundColor(const SdrObjEditView& rView);
238 #endif // INCLUDED_SVX_SVDETC_HXX
240 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */