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