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