tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / include / svx / svdetc.hxx
blob5f80ead04e4afe2067d5ca499b78a476e0ad1b31
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 <svx/svdobj.hxx>
27 #include <svl/whichranges.hxx>
28 #include <unotools/syslocale.hxx>
29 #include <memory>
30 #include <o3tl/unit_conversion.hxx>
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::sun::star::lang {
49 struct Locale;
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 SVXCORE_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 font height
72 inline size_t GetFontHeight() { return o3tl::convert(24, o3tl::Length::pt, o3tl::Length::mm100); }
74 // The MapMode is needed for the global Outliner.
75 // Incidentally, every newly instantiated SdrModel is assigned this MapMode by default.
76 // Default MapUnit is MapUnit::Map100thMM
77 inline MapUnit GetMapUnit() { return MapUnit::Map100thMM; }
80 class SfxItemSet;
82 /**
83 * Returns a replacement for an XFillStyle
85 * @returns false for XFILL_NONE and rCol remains unchanged
87 SVXCORE_DLLPUBLIC std::optional<Color> GetDraftFillColor(const SfxItemSet& rSet);
90 /**
91 * Search an ItemSet for Outliner/EditEngine Items
93 * @returns true, if the set contains such items
95 bool SearchOutlinerItems(const SfxItemSet& rSet, bool bInklDefaults, bool* pbOnlyEE=nullptr);
97 /**
98 * @returns a new WhichTable, which we need to squash at some point with a delete
100 WhichRangesContainer RemoveWhichRange(const WhichRangesContainer& pOldWhichTable, sal_uInt16 nRangeBeg, sal_uInt16 nRangeEnd);
103 * Helper class for the communication between the dialog
104 * In order to break open Metafiles (sd/source/ui/dlg/brkdlg.cxx),
105 * SdrEditView::DoImportMarkedMtf() and ImpSdrGDIMetaFileImport::DoImport()
107 class SVXCORE_DLLPUBLIC SvdProgressInfo
109 private:
110 size_t m_nSumCurAction; // Sum of all handled Actions
112 size_t m_nActionCount; // Count of Actions in the current object
113 size_t m_nCurAction; // Count of handled Actions in the current object
115 size_t m_nInsertCount; // Count of to-be-inserted Actions in the current object
116 size_t m_nCurInsert; // Count of already inserted Actions
118 size_t m_nObjCount; // Count of selected objects
119 size_t m_nCurObj; // Current object
121 Link<void*,bool> maLink;
123 public:
124 SvdProgressInfo( const Link<void*,bool>& _pLink );
126 void Init( size_t _nObjCount );
128 void SetNextObject();
130 void SetActionCount( size_t _nActionCount );
131 void SetInsertCount( size_t _nInsertCount );
133 bool ReportActions( size_t nActionCount );
134 void ReportInserts( size_t nInsertCount );
136 size_t GetSumCurAction() const { return m_nSumCurAction; };
137 size_t GetObjCount() const { return m_nObjCount; };
138 size_t GetCurObj() const { return m_nCurObj; };
140 size_t GetActionCount() const { return m_nActionCount; };
141 size_t GetCurAction() const { return m_nCurAction; };
143 size_t GetInsertCount() const { return m_nInsertCount; };
144 size_t GetCurInsert() const { return m_nCurInsert; };
146 void ReportRescales( size_t nRescaleCount );
150 std::vector<Link<SdrObjCreatorParams, rtl::Reference<SdrObject>>>& ImpGetUserMakeObjHdl();
152 class SdrOle2Obj;
153 class AutoTimer;
155 class OLEObjCache
157 std::vector<SdrOle2Obj*> maObjs;
159 size_t nSize;
160 std::unique_ptr<AutoTimer> pTimer;
162 static bool UnloadObj(SdrOle2Obj& rObj);
163 DECL_LINK( UnloadCheckHdl, Timer*, void );
165 public:
166 OLEObjCache();
167 UNLESS_MERGELIBS_MORE(SVXCORE_DLLPUBLIC) ~OLEObjCache();
169 void InsertObj(SdrOle2Obj* pObj);
170 void RemoveObj(SdrOle2Obj* pObj);
172 UNLESS_MERGELIBS_MORE(SVXCORE_DLLPUBLIC) size_t size() const;
173 UNLESS_MERGELIBS_MORE(SVXCORE_DLLPUBLIC) SdrOle2Obj* operator[](size_t nPos);
174 UNLESS_MERGELIBS_MORE(SVXCORE_DLLPUBLIC) const SdrOle2Obj* operator[](size_t nPos) const;
178 class SVXCORE_DLLPUBLIC SdrGlobalData
180 SvtSysLocale maSysLocale; // follows always locale settings
181 public:
182 std::vector<Link<SdrObjCreatorParams, rtl::Reference<SdrObject>>>
183 aUserMakeObjHdl;
184 OLEObjCache aOLEObjCache;
186 SAL_DLLPRIVATE SdrGlobalData();
188 const SvtSysLocale& GetSysLocale() { return maSysLocale; } // follows always locale settings
189 const LocaleDataWrapper& GetLocaleData(); // follows always SysLocale
190 OLEObjCache& GetOLEObjCache() { return aOLEObjCache; }
193 SVXCORE_DLLPUBLIC SdrGlobalData & GetSdrGlobalData();
196 // #i101872# isolated GetTextEditBackgroundColor for tooling
197 class SdrObjEditView;
199 SVXCORE_DLLPUBLIC Color GetTextEditBackgroundColor(const SdrObjEditView& rView);
202 #endif // INCLUDED_SVX_SVDETC_HXX
204 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */