xref: /aoo42x/main/svx/source/svdraw/svdfmtf.hxx (revision 690281a1)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVDFMTF_HXX
25 #define _SVDFMTF_HXX
26 
27 #include <vcl/metaact.hxx>
28 #include <vcl/virdev.hxx>
29 #include <svx/svdobj.hxx>
30 
31 //************************************************************
32 //   Vorausdeklarationen
33 //************************************************************
34 
35 class SfxItemSet;
36 class SdrObjList;
37 class SdrModel;
38 class SdrPage;
39 class SdrObject;
40 class SvdProgressInfo;
41 
42 //************************************************************
43 //   Hilfsklasse ImpSdrGDIMetaFileImport
44 //************************************************************
45 
46 class ImpSdrGDIMetaFileImport
47 {
48 protected:
49     ::std::vector< SdrObject* > maTmpList;
50 	VirtualDevice				maVD;
51 	Rectangle					maScaleRect;
52 	sal_uLong					mnMapScalingOfs; // ab hier nocht nicht mit MapScaling bearbeitet
53 	SfxItemSet*					mpLineAttr;
54 	SfxItemSet*					mpFillAttr;
55 	SfxItemSet*					mpTextAttr;
56 	SdrModel*					mpModel;
57 	SdrLayerID					mnLayer;
58 	Color						maOldLineColor;
59 	sal_Int32					mnLineWidth;
60 	basegfx::B2DLineJoin		maLineJoin;
61 	com::sun::star::drawing::LineCap    maLineCap;
62 	XDash						maDash;
63 
64 	bool                        mbMov;
65 	bool                        mbSize;
66 	Point						maOfs;
67     double                      mfScaleX;
68     double                      mfScaleY;
69 	Fraction					maScaleX;
70 	Fraction					maScaleY;
71 
72 	bool                        mbFntDirty;
73 
74 	// fuer Optimierung von (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> aus 2 mach ein
75 	bool                        mbLastObjWasPolyWithoutLine;
76 	bool                        mbNoLine;
77 	bool                        mbNoFill;
78 
79 	// fuer Optimierung mehrerer Linien zu einer Polyline
80 	bool                        mbLastObjWasLine;
81 
82     // clipregion
83     basegfx::B2DPolyPolygon     maClip;
84 
85 protected:
86     // ckeck for clip and evtl. fill maClip
87     void checkClip();
88     bool isClip() const;
89 
90     // actions
91 	void DoAction(MetaPixelAction			& rAct);
92 	void DoAction(MetaPointAction			& rAct);
93 	void DoAction(MetaLineAction			& rAct);
94 	void DoAction(MetaRectAction			& rAct);
95 	void DoAction(MetaRoundRectAction		& rAct);
96 	void DoAction(MetaEllipseAction			& rAct);
97 	void DoAction(MetaArcAction				& rAct);
98 	void DoAction(MetaPieAction				& rAct);
99 	void DoAction(MetaChordAction			& rAct);
100 	void DoAction(MetaPolyLineAction		& rAct);
101 	void DoAction(MetaPolygonAction			& rAct);
102 	void DoAction(MetaPolyPolygonAction		& rAct);
103 	void DoAction(MetaTextAction			& rAct);
104 	void DoAction(MetaTextArrayAction		& rAct);
105 	void DoAction(MetaStretchTextAction		& rAct);
106 	void DoAction(MetaBmpAction				& rAct);
107 	void DoAction(MetaBmpScaleAction		& rAct);
108 	void DoAction(MetaBmpExAction			& rAct);
109 	void DoAction(MetaBmpExScaleAction		& rAct);
110 	void DoAction(MetaHatchAction			& rAct);
111 	void DoAction(MetaLineColorAction		& rAct);
112 	void DoAction(MetaMapModeAction			& rAct);
DoAction(MetaFillColorAction & rAct)113 	void DoAction(MetaFillColorAction		& rAct) { rAct.Execute(&maVD); }
DoAction(MetaTextColorAction & rAct)114 	void DoAction(MetaTextColorAction		& rAct) { rAct.Execute(&maVD); }
DoAction(MetaTextFillColorAction & rAct)115 	void DoAction(MetaTextFillColorAction	& rAct) { rAct.Execute(&maVD); }
DoAction(MetaFontAction & rAct)116 	void DoAction(MetaFontAction			& rAct) { rAct.Execute(&maVD); mbFntDirty = true; }
DoAction(MetaTextAlignAction & rAct)117 	void DoAction(MetaTextAlignAction		& rAct) { rAct.Execute(&maVD); mbFntDirty = true; }
DoAction(MetaClipRegionAction & rAct)118 	void DoAction(MetaClipRegionAction		& rAct) { rAct.Execute(&maVD); checkClip(); }
DoAction(MetaRasterOpAction & rAct)119 	void DoAction(MetaRasterOpAction		& rAct) { rAct.Execute(&maVD); }
DoAction(MetaPushAction & rAct)120 	void DoAction(MetaPushAction			& rAct) { rAct.Execute(&maVD); checkClip(); }
DoAction(MetaPopAction & rAct)121 	void DoAction(MetaPopAction				& rAct) { rAct.Execute(&maVD); mbFntDirty = true; checkClip(); }
DoAction(MetaMoveClipRegionAction & rAct)122 	void DoAction(MetaMoveClipRegionAction	& rAct) { rAct.Execute(&maVD); checkClip(); }
DoAction(MetaISectRectClipRegionAction & rAct)123 	void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&maVD); checkClip(); }
DoAction(MetaISectRegionClipRegionAction & rAct)124 	void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&maVD); checkClip(); }
125 
126     // #i125211# The MetaCommentAction needs to advance (if used), thus
127     // give current metafile and index which may be changed
128     void DoAction(MetaCommentAction& rAct, GDIMetaFile& rMtf, sal_uLong& a);
129 
130     // missing actions added
131     void DoAction(MetaTextRectAction& rAct);
132     void DoAction(MetaBmpScalePartAction& rAct);
133     void DoAction(MetaBmpExScalePartAction& rAct);
134     void DoAction(MetaMaskAction& rAct);
135     void DoAction(MetaMaskScaleAction& rAct);
136     void DoAction(MetaMaskScalePartAction& rAct);
137     void DoAction(MetaGradientAction& rAct);
138     void DoAction(MetaWallpaperAction& rAct);
139     void DoAction(MetaTransparentAction& rAct);
140     void DoAction(MetaEPSAction& rAct);
DoAction(MetaRefPointAction & rAct)141     void DoAction(MetaRefPointAction& rAct)  { rAct.Execute(&maVD); }
DoAction(MetaTextLineColorAction & rAct)142     void DoAction(MetaTextLineColorAction& rAct)  { rAct.Execute(&maVD); mbFntDirty = true; }
143     void DoAction(MetaTextLineAction& rAct);
144     void DoAction(MetaFloatTransparentAction& rAct);
145     void DoAction(MetaGradientExAction& rAct);
DoAction(MetaLayoutModeAction & rAct)146     void DoAction(MetaLayoutModeAction& rAct)  { rAct.Execute(&maVD); mbFntDirty = true; }
DoAction(MetaTextLanguageAction & rAct)147     void DoAction(MetaTextLanguageAction& rAct)  { rAct.Execute(&maVD); mbFntDirty = true; }
DoAction(MetaOverlineColorAction & rAct)148     void DoAction(MetaOverlineColorAction& rAct)  { rAct.Execute(&maVD); mbFntDirty = true; }
149 
150 	void ImportText(const Point& rPos, const XubString& rStr, const MetaAction& rAct);
151 	void SetAttributes(SdrObject* pObj, bool bForceTextAttr = false);
152 	void InsertObj(SdrObject* pObj, bool bScale = true);
153 	void MapScaling();
154 
155 	// #i73407# reformulation to use new B2DPolygon classes
156 	bool CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly);
157 	bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon& rPolyPolygon);
158 
159     void DoLoopActions(GDIMetaFile& rMtf, SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport);
160 
161 public:
162 	ImpSdrGDIMetaFileImport(
163         SdrModel& rModel,
164         SdrLayerID nLay,
165         const Rectangle& rRect);
166 	~ImpSdrGDIMetaFileImport();
167 
168     sal_uInt32 DoImport(
169         const GDIMetaFile& rMtf,
170         SdrObjList& rDestList,
171         sal_uInt32 nInsPos = CONTAINER_APPEND,
172         SvdProgressInfo* pProgrInfo = 0);
173 };
174 
175 ////////////////////////////////////////////////////////////////////////////////////////////////////
176 
177 #endif //_SVDFMTF_HXX
178 // eof
179