Bump version to 6.4-15
[LibreOffice.git] / include / svx / svdetc.hxx
blob895fc9d957897ca677913422f208d6d6960468b8
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 <editeng/outliner.hxx>
24 #include <svx/svxdllapi.h>
25 #include <tools/link.hxx>
26 #include <tools/fract.hxx>
27 #include <svx/svdobj.hxx>
28 #include <memory>
31 /**
32 * Get ExchangeFormatID of the DrawingEngine.
33 * The data can then be made available via
34 * static bool CopyData(pData,nLen,nFormat);
36 * However, pData/nLen describe an SvMemoryStream in which an SdrModel is
37 * streamed. For its lifetime, the flag SdrModel::SetStreamingSdrModel(true)
38 * is set.
41 class SdrOutliner;
42 class SdrModel;
43 class SvtSysLocale;
44 class LocaleDataWrapper;
46 namespace com { namespace sun { namespace star { namespace lang {
47 struct Locale;
48 }}}}
50 /**
51 * Create an Outliner with the engine-global default settings on the heap.
52 * If pMod != nullptr, the MapMode of the passed model is used.
53 * The resulting default font height, however, stays the same (the logical
54 * font height is converted).
56 SVX_DLLPUBLIC std::unique_ptr<SdrOutliner> SdrMakeOutliner(OutlinerMode nOutlinerMode, SdrModel& rMod);
58 /**
59 * Global default settings for the DrawingEngine.
61 * One should set these default settings as the first
62 * thing at program start, before any other method is called.
64 namespace SdrEngineDefaults
66 // Default FontColor is COL_AUTO
67 inline Color GetFontColor() { return COL_AUTO; }
69 // Default FontHeight is 847. The font height uses logical units (MapUnit/MapFraction
70 // see below for further details). The default setting 847/100mm corresponds to about
71 // 24 Point. If e.g. one would use Twips (SetMapUnit(MapUnit::MapTwip)) (20 Twip = 1 Point)
72 // instead, one would need to set the font height to 480, in order to get a 24 Point height.
73 inline size_t GetFontHeight() { return 847; }
75 // The MapMode is needed for the global Outliner.
76 // Incidentally, every newly instantiated SdrModel is assigned this MapMode by default.
77 // Default MapUnit is MapUnit::Map100thMM
78 inline MapUnit GetMapUnit() { return MapUnit::Map100thMM; }
80 // Default MapFraction is 1/1.
81 inline Fraction GetMapFraction() { return Fraction(1, 1); }
84 class SfxItemSet;
86 /**
87 * Returns a replacement for an XFillStyle
89 * @returns false for XFILL_NONE and rCol remains unchanged
91 SVX_DLLPUBLIC bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol);
94 /**
95 * Search an ItemSet for Outliner/EditEngine Items
97 * @returns true, if the set contains such items
99 bool SearchOutlinerItems(const SfxItemSet& rSet, bool bInklDefaults, bool* pbOnlyEE=nullptr);
102 * @returns a new WhichTable, which we need to squash at some point with a delete
104 std::unique_ptr<sal_uInt16[]> RemoveWhichRange(const sal_uInt16* pOldWhichTable, sal_uInt16 nRangeBeg, sal_uInt16 nRangeEnd);
107 * Helper class for the communication between the dialog
108 * In order to break open Metafiles (sd/source/ui/dlg/brkdlg.cxx),
109 * SdrEditView::DoImportMarkedMtf() and ImpSdrGDIMetaFileImport::DoImport()
111 class SVX_DLLPUBLIC SvdProgressInfo
113 private:
114 size_t m_nSumCurAction; // Sum of all handled Actions
116 size_t m_nActionCount; // Count of Actions in the current object
117 size_t m_nCurAction; // Count of handled Actions in the current object
119 size_t m_nInsertCount; // Count of to-be-inserted Actions in the current object
120 size_t m_nCurInsert; // Count of already inserted Actions
122 size_t m_nObjCount; // Count of selected objects
123 size_t m_nCurObj; // Current object
125 Link<void*,bool> maLink;
127 public:
128 SvdProgressInfo( const Link<void*,bool>& _pLink );
130 void Init( size_t _nObjCount );
132 void SetNextObject();
134 void SetActionCount( size_t _nActionCount );
135 void SetInsertCount( size_t _nInsertCount );
137 bool ReportActions( size_t nActionCount );
138 void ReportInserts( size_t nInsertCount );
140 size_t GetSumCurAction() const { return m_nSumCurAction; };
141 size_t GetObjCount() const { return m_nObjCount; };
142 size_t GetCurObj() const { return m_nCurObj; };
144 size_t GetActionCount() const { return m_nActionCount; };
145 size_t GetCurAction() const { return m_nCurAction; };
147 size_t GetInsertCount() const { return m_nInsertCount; };
148 size_t GetCurInsert() const { return m_nCurInsert; };
150 void ReportRescales( size_t nRescaleCount );
154 std::vector<Link<SdrObjCreatorParams, SdrObject*>>& ImpGetUserMakeObjHdl();
156 class SdrOle2Obj;
157 class AutoTimer;
159 class OLEObjCache
161 std::vector<SdrOle2Obj*> maObjs;
163 size_t nSize;
164 std::unique_ptr<AutoTimer> pTimer;
166 static bool UnloadObj( SdrOle2Obj* pObj );
167 DECL_LINK( UnloadCheckHdl, Timer*, void );
169 public:
170 OLEObjCache();
171 SVX_DLLPUBLIC ~OLEObjCache();
173 void InsertObj(SdrOle2Obj* pObj);
174 void RemoveObj(SdrOle2Obj* pObj);
176 SVX_DLLPUBLIC size_t size() const;
177 SVX_DLLPUBLIC SdrOle2Obj* operator[](size_t nPos);
178 SVX_DLLPUBLIC const SdrOle2Obj* operator[](size_t nPos) const;
182 class SVX_DLLPUBLIC SdrGlobalData
184 const SvtSysLocale* pSysLocale; // follows always locale settings
185 const LocaleDataWrapper* pLocaleData; // follows always SysLocale
186 public:
187 std::vector<Link<SdrObjCreatorParams, SdrObject*>>
188 aUserMakeObjHdl;
189 OLEObjCache aOLEObjCache;
192 const SvtSysLocale* GetSysLocale(); // follows always locale settings
193 const LocaleDataWrapper* GetLocaleData(); // follows always SysLocale
194 public:
195 SdrGlobalData();
197 OLEObjCache& GetOLEObjCache() { return aOLEObjCache; }
200 SVX_DLLPUBLIC SdrGlobalData & GetSdrGlobalData();
203 // #i101872# isolated GetTextEditBackgroundColor for tooling
204 class SdrObjEditView;
206 SVX_DLLPUBLIC Color GetTextEditBackgroundColor(const SdrObjEditView& rView);
209 #endif // INCLUDED_SVX_SVDETC_HXX
211 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */