1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
30 #include <o3tl/unit_conversion.hxx>
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)
46 class LocaleDataWrapper
;
48 namespace com::sun::star::lang
{
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
);
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
; }
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
);
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);
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
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
;
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();
157 std::vector
<SdrOle2Obj
*> maObjs
;
160 std::unique_ptr
<AutoTimer
> pTimer
;
162 static bool UnloadObj(SdrOle2Obj
& rObj
);
163 DECL_LINK( UnloadCheckHdl
, Timer
*, void );
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
182 std::vector
<Link
<SdrObjCreatorParams
, rtl::Reference
<SdrObject
>>>
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: */