/src/libreoffice/svx/source/svdraw/svdfmtf.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #ifndef INCLUDED_SVX_SOURCE_SVDRAW_SVDFMTF_HXX |
21 | | #define INCLUDED_SVX_SOURCE_SVDRAW_SVDFMTF_HXX |
22 | | |
23 | | #include <sal/config.h> |
24 | | |
25 | | #include <memory> |
26 | | |
27 | | #include <svl/itemset.hxx> |
28 | | #include <tools/fract.hxx> |
29 | | #include <vcl/metaact.hxx> |
30 | | #include <vcl/virdev.hxx> |
31 | | #include <svx/svdobj.hxx> |
32 | | #include <svx/xdash.hxx> |
33 | | |
34 | | // Forward Declarations |
35 | | |
36 | | |
37 | | class SdrObjList; |
38 | | class SdrModel; |
39 | | class SvdProgressInfo; |
40 | | |
41 | | |
42 | | // Helper Class ImpSdrGDIMetaFileImport |
43 | | class ImpSdrGDIMetaFileImport final |
44 | | { |
45 | | ::std::vector< rtl::Reference<SdrObject> > maTmpList; |
46 | | ScopedVclPtr<VirtualDevice> mpVD; |
47 | | MapMode maPrefMapMode; |
48 | | tools::Rectangle maScaleRect; |
49 | | std::unique_ptr<SfxItemSet> mpLineAttr; |
50 | | std::unique_ptr<SfxItemSet> mpFillAttr; |
51 | | std::unique_ptr<SfxItemSet> mpTextAttr; |
52 | | SdrModel* mpModel; |
53 | | SdrLayerID mnLayer; |
54 | | Color maOldLineColor; |
55 | | sal_Int32 mnLineWidth; |
56 | | basegfx::B2DLineJoin maLineJoin; |
57 | | css::drawing::LineCap maLineCap; |
58 | | XDash maDash; |
59 | | |
60 | | bool mbMov; |
61 | | bool mbSize; |
62 | | Point maOfs; |
63 | | double mfScaleX; |
64 | | double mfScaleY; |
65 | | double maScaleX; |
66 | | double maScaleY; |
67 | | |
68 | | bool mbFntDirty; |
69 | | |
70 | | // to optimize (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> two-in-one |
71 | | bool mbLastObjWasPolyWithoutLine; |
72 | | bool mbNoLine; |
73 | | bool mbNoFill; |
74 | | |
75 | | // to optimize multiple lines into a Polyline |
76 | | bool mbLastObjWasLine; |
77 | | |
78 | | // clipregion |
79 | | basegfx::B2DPolyPolygon maClip; |
80 | | |
81 | | // check for clip and evtl. fill maClip |
82 | | void checkClip(); |
83 | | bool isClip() const; |
84 | | |
85 | | // actions |
86 | | void DoAction(MetaLineAction const & rAct); |
87 | | void DoAction(MetaRectAction const & rAct); |
88 | | void DoAction(MetaRoundRectAction const & rAct); |
89 | | void DoAction(MetaEllipseAction const & rAct); |
90 | | void DoAction(MetaArcAction const & rAct); |
91 | | void DoAction(MetaPieAction const & rAct); |
92 | | void DoAction(MetaChordAction const & rAct); |
93 | | void DoAction(MetaPolyLineAction const & rAct); |
94 | | void DoAction(MetaPolygonAction const & rAct); |
95 | | void DoAction(MetaPolyPolygonAction const & rAct); |
96 | | void DoAction(MetaTextAction const & rAct); |
97 | | void DoAction(MetaTextArrayAction const & rAct); |
98 | | void DoAction(MetaStretchTextAction const & rAct); |
99 | | void DoAction(MetaBmpAction const & rAct); |
100 | | void DoAction(MetaBmpScaleAction const & rAct); |
101 | | void DoAction(MetaBmpExAction const & rAct); |
102 | | void DoAction(MetaBmpExScaleAction const & rAct); |
103 | | void DoAction(MetaHatchAction const & rAct); |
104 | | void DoAction(MetaLineColorAction & rAct); |
105 | | void DoAction(MetaMapModeAction & rAct); |
106 | 0 | void DoAction(MetaFillColorAction & rAct) { rAct.Execute(mpVD); } |
107 | 0 | void DoAction(MetaTextColorAction & rAct) { rAct.Execute(mpVD); } |
108 | 0 | void DoAction(MetaTextFillColorAction & rAct) { rAct.Execute(mpVD); } |
109 | 0 | void DoAction(MetaFontAction & rAct) { rAct.Execute(mpVD); mbFntDirty = true; } |
110 | 0 | void DoAction(MetaTextAlignAction & rAct) { rAct.Execute(mpVD); mbFntDirty = true; } |
111 | 0 | void DoAction(MetaClipRegionAction & rAct) { rAct.Execute(mpVD); checkClip(); } |
112 | 0 | void DoAction(MetaRasterOpAction & rAct) { rAct.Execute(mpVD); } |
113 | 0 | void DoAction(MetaPushAction & rAct) { rAct.Execute(mpVD); checkClip(); } |
114 | 0 | void DoAction(MetaPopAction & rAct) { rAct.Execute(mpVD); mbFntDirty = true; checkClip(); } |
115 | 0 | void DoAction(MetaMoveClipRegionAction & rAct) { rAct.Execute(mpVD); checkClip(); } |
116 | 0 | void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(mpVD); checkClip(); } |
117 | 0 | void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(mpVD); checkClip(); } |
118 | | |
119 | | // #i125211# The MetaCommentAction needs to advance (if used), thus |
120 | | // give current metafile and index which may be changed |
121 | | void DoAction(MetaCommentAction const & rAct, GDIMetaFile const & rMtf, size_t& a); |
122 | | |
123 | | // missing actions added |
124 | | void DoAction(MetaTextRectAction const & rAct); |
125 | | void DoAction(MetaBmpScalePartAction const & rAct); |
126 | | void DoAction(MetaBmpExScalePartAction const & rAct); |
127 | | void DoAction(MetaMaskAction const & rAct); |
128 | | void DoAction(MetaMaskScaleAction const & rAct); |
129 | | void DoAction(MetaMaskScalePartAction const & rAct); |
130 | | void DoAction(MetaGradientAction const & rAct); |
131 | | void DoAction(MetaTransparentAction const & rAct); |
132 | 0 | void DoAction(MetaRefPointAction& rAct) { rAct.Execute(mpVD); } |
133 | 0 | void DoAction(MetaTextLineColorAction& rAct) { rAct.Execute(mpVD); mbFntDirty = true; } |
134 | | void DoAction(MetaFloatTransparentAction const & rAct); |
135 | | void DoAction(MetaGradientExAction const & rAct); |
136 | 0 | void DoAction(MetaLayoutModeAction& rAct) { rAct.Execute(mpVD); mbFntDirty = true; } |
137 | 0 | void DoAction(MetaTextLanguageAction& rAct) { rAct.Execute(mpVD); mbFntDirty = true; } |
138 | 0 | void DoAction(MetaOverlineColorAction& rAct) { rAct.Execute(mpVD); mbFntDirty = true; } |
139 | | |
140 | | void ImportText(const Point& rPos, const OUString& rStr, const MetaAction& rAct); |
141 | | void SetAttributes(SdrObject* pObj, bool bForceTextAttr = false); |
142 | | void InsertObj(SdrObject* pObj, bool bScale = true); |
143 | | |
144 | | // #i73407# reformulation to use new B2DPolygon classes |
145 | | bool CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly); |
146 | | bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon& rPolyPolygon); |
147 | | |
148 | | void DoLoopActions(GDIMetaFile const & rMtf, SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport); |
149 | | |
150 | | // map from current virtual device mapmode to original mapmode |
151 | | Size implMap(const Size& rSz) const; |
152 | | Point implMap(const Point& rPt) const; |
153 | | basegfx::B2DHomMatrix implMapMatrix() const; |
154 | | |
155 | | // Copy assignment is forbidden and not implemented. |
156 | | ImpSdrGDIMetaFileImport (const ImpSdrGDIMetaFileImport &) = delete; |
157 | | ImpSdrGDIMetaFileImport & operator= (const ImpSdrGDIMetaFileImport &) = delete; |
158 | | |
159 | | public: |
160 | | ImpSdrGDIMetaFileImport( |
161 | | SdrModel& rModel, |
162 | | SdrLayerID nLay, |
163 | | const tools::Rectangle& rRect); |
164 | | |
165 | | size_t DoImport( |
166 | | const GDIMetaFile& rMtf, |
167 | | SdrObjList& rDestList, |
168 | | size_t nInsPos, |
169 | | SvdProgressInfo* pProgrInfo = nullptr); |
170 | | }; |
171 | | |
172 | | #endif // INCLUDED_SVX_SOURCE_SVDRAW_SVDFMTF_HXX |
173 | | |
174 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |