bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / svx / svdetc.hxx
blob94d3db0240ee6737a29cc1985e9dcf64a318ea3b
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>
30 #include <memory>
33 /**
34 * Get ExchangeFormatID of the DrawingEngine.
35 * The data can then be made available via
36 * static bool CopyData(pData,nLen,nFormat);
38 * However, pData/nLen describe an SvMemoryStream in which an SdrModel is
39 * streamed. For its lifetime, the flag SdrModel::SetStreamingSdrModel(true)
40 * is set.
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 std::unique_ptr<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 namespace SdrEngineDefaults
68 // Default FontColor is COL_AUTO
69 inline Color GetFontColor() { return COL_AUTO; }
71 // Default FontHeight is 847. The font height uses logical units (MapUnit/MapFraction
72 // see below for further details). The default setting 847/100mm corresponds to about
73 // 24 Point. If e.g. one would use Twips (SetMapUnit(MapUnit::MapTwip)) (20 Twip = 1 Point)
74 // instead, one would need to set the font height to 480, in order to get a 24 Point height.
75 inline size_t GetFontHeight() { return 847; }
77 // The MapMode is needed for the global Outliner.
78 // Incidentally, every newly instantiated SdrModel is assigned this MapMode by default.
79 // Default MapUnit is MapUnit::Map100thMM
80 inline MapUnit GetMapUnit() { return MapUnit::Map100thMM; }
82 // Default MapFraction is 1/1.
83 inline Fraction GetMapFraction() { return Fraction(1, 1); }
86 class SfxItemSet;
88 /**
89 * Returns a replacement for an XFillStyle
91 * @returns false for XFILL_NONE and rCol remains unchanged
93 SVX_DLLPUBLIC bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol);
96 /**
97 * Search an ItemSet for Outliner/EditEngine Items
99 * @returns true, if the set contains such items
101 bool SearchOutlinerItems(const SfxItemSet& rSet, bool bInklDefaults, bool* pbOnlyEE=nullptr);
104 * @returns a new WhichTable, which we need to squash at some point with a delete
106 std::unique_ptr<sal_uInt16[]> RemoveWhichRange(const sal_uInt16* pOldWhichTable, sal_uInt16 nRangeBeg, sal_uInt16 nRangeEnd);
109 * Helper class for the communication between the dialog
110 * In order to break open Metafiles (sd/source/ui/dlg/brkdlg.cxx),
111 * SdrEditView::DoImportMarkedMtf() and ImpSdrGDIMetaFileImport::DoImport()
113 class SVX_DLLPUBLIC SvdProgressInfo
115 private:
116 size_t m_nSumCurAction; // Sum of all handled Actions
118 size_t m_nActionCount; // Count of Actions in the current object
119 size_t m_nCurAction; // Count of handled Actions in the current object
121 size_t m_nInsertCount; // Count of to-be-inserted Actions in the current object
122 size_t m_nCurInsert; // Count of already inserted Actions
124 size_t m_nObjCount; // Count of selected objects
125 size_t m_nCurObj; // Current object
127 Link<void*,bool> maLink;
129 public:
130 SvdProgressInfo( const Link<void*,bool>& _pLink );
132 void Init( size_t _nObjCount );
134 void SetNextObject();
136 void SetActionCount( size_t _nActionCount );
137 void SetInsertCount( size_t _nInsertCount );
139 bool ReportActions( size_t nActionCount );
140 void ReportInserts( size_t nInsertCount );
142 size_t GetSumCurAction() const { return m_nSumCurAction; };
143 size_t GetObjCount() const { return m_nObjCount; };
144 size_t GetCurObj() const { return m_nCurObj; };
146 size_t GetActionCount() const { return m_nActionCount; };
147 size_t GetCurAction() const { return m_nCurAction; };
149 size_t GetInsertCount() const { return m_nInsertCount; };
150 size_t GetCurInsert() const { return m_nCurInsert; };
152 void ReportRescales( size_t nRescaleCount );
156 std::vector<Link<SdrObjCreatorParams, SdrObject*>>& ImpGetUserMakeObjHdl();
158 class SdrOle2Obj;
159 class AutoTimer;
161 class OLEObjCache
163 std::vector<SdrOle2Obj*> maObjs;
165 size_t nSize;
166 std::unique_ptr<AutoTimer> pTimer;
168 static bool UnloadObj( SdrOle2Obj* pObj );
169 DECL_LINK( UnloadCheckHdl, Timer*, void );
171 public:
172 OLEObjCache();
173 SVX_DLLPUBLIC ~OLEObjCache();
175 void InsertObj(SdrOle2Obj* pObj);
176 void RemoveObj(SdrOle2Obj* pObj);
178 SVX_DLLPUBLIC size_t size() const;
179 SVX_DLLPUBLIC SdrOle2Obj* operator[](size_t nPos);
180 SVX_DLLPUBLIC const SdrOle2Obj* operator[](size_t nPos) const;
184 class SVX_DLLPUBLIC SdrGlobalData
186 const SvtSysLocale* pSysLocale; // follows always locale settings
187 const LocaleDataWrapper* pLocaleData; // follows always SysLocale
188 public:
189 std::vector<Link<SdrObjCreatorParams, SdrObject*>>
190 aUserMakeObjHdl;
191 OLEObjCache aOLEObjCache;
194 const SvtSysLocale* GetSysLocale(); // follows always locale settings
195 const LocaleDataWrapper* GetLocaleData(); // follows always SysLocale
196 public:
197 SdrGlobalData();
199 OLEObjCache& GetOLEObjCache() { return aOLEObjCache; }
202 SVX_DLLPUBLIC SdrGlobalData & GetSdrGlobalData();
205 // #i101872# isolated GetTextEditBackgroundColor for tooling
206 class SdrObjEditView;
208 SVX_DLLPUBLIC Color GetTextEditBackgroundColor(const SdrObjEditView& rView);
211 #endif // INCLUDED_SVX_SVDETC_HXX
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */