Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / svx / svdetc.hxx
blob9ae29efb5f061478638f8d43e4f7b159dbd5f9ed
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 <svl/whichranges.hxx>
29 #include <unotools/syslocale.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::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 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; }
83 class SfxItemSet;
85 /**
86 * Returns a replacement for an XFillStyle
88 * @returns false for XFILL_NONE and rCol remains unchanged
90 SVXCORE_DLLPUBLIC bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol);
93 /**
94 * Search an ItemSet for Outliner/EditEngine Items
96 * @returns true, if the set contains such items
98 bool SearchOutlinerItems(const SfxItemSet& rSet, bool bInklDefaults, bool* pbOnlyEE=nullptr);
101 * @returns a new WhichTable, which we need to squash at some point with a delete
103 WhichRangesContainer RemoveWhichRange(const WhichRangesContainer& pOldWhichTable, sal_uInt16 nRangeBeg, sal_uInt16 nRangeEnd);
106 * Helper class for the communication between the dialog
107 * In order to break open Metafiles (sd/source/ui/dlg/brkdlg.cxx),
108 * SdrEditView::DoImportMarkedMtf() and ImpSdrGDIMetaFileImport::DoImport()
110 class SVXCORE_DLLPUBLIC SvdProgressInfo
112 private:
113 size_t m_nSumCurAction; // Sum of all handled Actions
115 size_t m_nActionCount; // Count of Actions in the current object
116 size_t m_nCurAction; // Count of handled Actions in the current object
118 size_t m_nInsertCount; // Count of to-be-inserted Actions in the current object
119 size_t m_nCurInsert; // Count of already inserted Actions
121 size_t m_nObjCount; // Count of selected objects
122 size_t m_nCurObj; // Current object
124 Link<void*,bool> maLink;
126 public:
127 SvdProgressInfo( const Link<void*,bool>& _pLink );
129 void Init( size_t _nObjCount );
131 void SetNextObject();
133 void SetActionCount( size_t _nActionCount );
134 void SetInsertCount( size_t _nInsertCount );
136 bool ReportActions( size_t nActionCount );
137 void ReportInserts( size_t nInsertCount );
139 size_t GetSumCurAction() const { return m_nSumCurAction; };
140 size_t GetObjCount() const { return m_nObjCount; };
141 size_t GetCurObj() const { return m_nCurObj; };
143 size_t GetActionCount() const { return m_nActionCount; };
144 size_t GetCurAction() const { return m_nCurAction; };
146 size_t GetInsertCount() const { return m_nInsertCount; };
147 size_t GetCurInsert() const { return m_nCurInsert; };
149 void ReportRescales( size_t nRescaleCount );
153 std::vector<Link<SdrObjCreatorParams, rtl::Reference<SdrObject>>>& ImpGetUserMakeObjHdl();
155 class SdrOle2Obj;
156 class AutoTimer;
158 class OLEObjCache
160 std::vector<SdrOle2Obj*> maObjs;
162 size_t nSize;
163 std::unique_ptr<AutoTimer> pTimer;
165 static bool UnloadObj(SdrOle2Obj& rObj);
166 DECL_LINK( UnloadCheckHdl, Timer*, void );
168 public:
169 OLEObjCache();
170 SVXCORE_DLLPUBLIC ~OLEObjCache();
172 void InsertObj(SdrOle2Obj* pObj);
173 void RemoveObj(SdrOle2Obj* pObj);
175 SVXCORE_DLLPUBLIC size_t size() const;
176 SVXCORE_DLLPUBLIC SdrOle2Obj* operator[](size_t nPos);
177 SVXCORE_DLLPUBLIC const SdrOle2Obj* operator[](size_t nPos) const;
181 class SVXCORE_DLLPUBLIC SdrGlobalData
183 SvtSysLocale maSysLocale; // follows always locale settings
184 public:
185 std::vector<Link<SdrObjCreatorParams, rtl::Reference<SdrObject>>>
186 aUserMakeObjHdl;
187 OLEObjCache aOLEObjCache;
189 SdrGlobalData();
191 const SvtSysLocale& GetSysLocale() { return maSysLocale; } // follows always locale settings
192 const LocaleDataWrapper& GetLocaleData(); // follows always SysLocale
193 OLEObjCache& GetOLEObjCache() { return aOLEObjCache; }
196 SVXCORE_DLLPUBLIC SdrGlobalData & GetSdrGlobalData();
199 // #i101872# isolated GetTextEditBackgroundColor for tooling
200 class SdrObjEditView;
202 SVXCORE_DLLPUBLIC Color GetTextEditBackgroundColor(const SdrObjEditView& rView);
205 #endif // INCLUDED_SVX_SVDETC_HXX
207 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */