Adjust includes
[LibreOffice.git] / svx / source / svdraw / svdfmtf.hxx
bloba3bd9b16ef403ded64eb90866d527564286c7220
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_SOURCE_SVDRAW_SVDFMTF_HXX
21 #define INCLUDED_SVX_SOURCE_SVDRAW_SVDFMTF_HXX
23 #include <sal/config.h>
25 #include <memory>
27 #include <tools/contnr.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>
34 // Forward Declarations
37 class SfxItemSet;
38 class SdrObjList;
39 class SdrModel;
40 class SdrPage;
41 class SdrObject;
42 class SvdProgressInfo;
45 // Helper Class ImpSdrGDIMetaFileImport
46 class ImpSdrGDIMetaFileImport final
48 ::std::vector< SdrObject* > maTmpList;
49 ScopedVclPtr<VirtualDevice> mpVD;
50 tools::Rectangle maScaleRect;
51 size_t mnMapScalingOfs; // from here on, not edited with MapScaling
52 std::unique_ptr<SfxItemSet> mpLineAttr;
53 std::unique_ptr<SfxItemSet> mpFillAttr;
54 std::unique_ptr<SfxItemSet> mpTextAttr;
55 SdrModel* mpModel;
56 SdrLayerID mnLayer;
57 Color maOldLineColor;
58 sal_Int32 mnLineWidth;
59 basegfx::B2DLineJoin maLineJoin;
60 css::drawing::LineCap maLineCap;
61 XDash maDash;
63 bool mbMov;
64 bool mbSize;
65 Point maOfs;
66 double mfScaleX;
67 double mfScaleY;
68 Fraction maScaleX;
69 Fraction maScaleY;
71 bool mbFntDirty;
73 // to optimize (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> two-in-one
74 bool mbLastObjWasPolyWithoutLine;
75 bool mbNoLine;
76 bool mbNoFill;
78 // to optimize multiple lines into a Polyline
79 bool mbLastObjWasLine;
81 // clipregion
82 basegfx::B2DPolyPolygon maClip;
84 // check for clip and evtl. fill maClip
85 void checkClip();
86 bool isClip() const;
88 // actions
89 void DoAction(MetaLineAction const & rAct);
90 void DoAction(MetaRectAction const & rAct);
91 void DoAction(MetaRoundRectAction const & rAct);
92 void DoAction(MetaEllipseAction const & rAct);
93 void DoAction(MetaArcAction const & rAct);
94 void DoAction(MetaPieAction const & rAct);
95 void DoAction(MetaChordAction const & rAct);
96 void DoAction(MetaPolyLineAction const & rAct);
97 void DoAction(MetaPolygonAction const & rAct);
98 void DoAction(MetaPolyPolygonAction const & rAct);
99 void DoAction(MetaTextAction const & rAct);
100 void DoAction(MetaTextArrayAction const & rAct);
101 void DoAction(MetaStretchTextAction const & rAct);
102 void DoAction(MetaBmpAction const & rAct);
103 void DoAction(MetaBmpScaleAction const & rAct);
104 void DoAction(MetaBmpExAction const & rAct);
105 void DoAction(MetaBmpExScaleAction const & rAct);
106 void DoAction(MetaHatchAction const & rAct);
107 void DoAction(MetaLineColorAction & rAct);
108 void DoAction(MetaMapModeAction & rAct);
109 void DoAction(MetaFillColorAction & rAct) { rAct.Execute(mpVD); }
110 void DoAction(MetaTextColorAction & rAct) { rAct.Execute(mpVD); }
111 void DoAction(MetaTextFillColorAction & rAct) { rAct.Execute(mpVD); }
112 void DoAction(MetaFontAction & rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
113 void DoAction(MetaTextAlignAction & rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
114 void DoAction(MetaClipRegionAction & rAct) { rAct.Execute(mpVD); checkClip(); }
115 void DoAction(MetaRasterOpAction & rAct) { rAct.Execute(mpVD); }
116 void DoAction(MetaPushAction & rAct) { rAct.Execute(mpVD); checkClip(); }
117 void DoAction(MetaPopAction & rAct) { rAct.Execute(mpVD); mbFntDirty = true; checkClip(); }
118 void DoAction(MetaMoveClipRegionAction & rAct) { rAct.Execute(mpVD); checkClip(); }
119 void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(mpVD); checkClip(); }
120 void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(mpVD); checkClip(); }
122 // #i125211# The MetaCommentAction needs to advance (if used), thus
123 // give current metafile and index which may be changed
124 void DoAction(MetaCommentAction const & rAct, GDIMetaFile const & rMtf, sal_uLong& a);
126 // missing actions added
127 void DoAction(MetaTextRectAction const & rAct);
128 void DoAction(MetaBmpScalePartAction const & rAct);
129 void DoAction(MetaBmpExScalePartAction const & rAct);
130 void DoAction(MetaMaskAction const & rAct);
131 void DoAction(MetaMaskScaleAction const & rAct);
132 void DoAction(MetaMaskScalePartAction const & rAct);
133 void DoAction(MetaGradientAction const & rAct);
134 void DoAction(MetaTransparentAction const & rAct);
135 void DoAction(MetaRefPointAction& rAct) { rAct.Execute(mpVD); }
136 void DoAction(MetaTextLineColorAction& rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
137 void DoAction(MetaFloatTransparentAction const & rAct);
138 void DoAction(MetaGradientExAction const & rAct);
139 void DoAction(MetaLayoutModeAction& rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
140 void DoAction(MetaTextLanguageAction& rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
141 void DoAction(MetaOverlineColorAction& rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
143 void ImportText(const Point& rPos, const OUString& rStr, const MetaAction& rAct);
144 void SetAttributes(SdrObject* pObj, bool bForceTextAttr = false);
145 void InsertObj(SdrObject* pObj, bool bScale = true);
146 void MapScaling();
148 // #i73407# reformulation to use new B2DPolygon classes
149 bool CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly);
150 bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon& rPolyPolygon);
152 void DoLoopActions(GDIMetaFile const & rMtf, SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport);
154 // Copy assignment is forbidden and not implemented.
155 ImpSdrGDIMetaFileImport (const ImpSdrGDIMetaFileImport &) = delete;
156 ImpSdrGDIMetaFileImport & operator= (const ImpSdrGDIMetaFileImport &) = delete;
158 public:
159 ImpSdrGDIMetaFileImport(
160 SdrModel& rModel,
161 SdrLayerID nLay,
162 const tools::Rectangle& rRect);
164 size_t DoImport(
165 const GDIMetaFile& rMtf,
166 SdrObjList& rDestList,
167 size_t nInsPos,
168 SvdProgressInfo* pProgrInfo = nullptr);
171 #endif // INCLUDED_SVX_SOURCE_SVDRAW_SVDFMTF_HXX
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */