Update ooo320-m1
[ooovba.git] / svx / source / svdraw / svdfmtf.hxx
blobbb35c7e03ce0d2a1647c76ae3c4eaef6cc36f4b0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: svdfmtf.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SVDFMTF_HXX
32 #define _SVDFMTF_HXX
34 #include <vcl/metaact.hxx>
35 #include <vcl/virdev.hxx>
36 #include <svx/svdobj.hxx>
38 //************************************************************
39 // Vorausdeklarationen
40 //************************************************************
42 class SfxItemSet;
43 class SdrObjList;
44 class SdrModel;
45 class SdrPage;
46 class SdrObject;
47 class SvdProgressInfo;
49 //************************************************************
50 // Hilfsklasse SdrObjRefList
51 //************************************************************
53 class SdrObjRefList
55 Container aList;
56 public:
58 SdrObjRefList()
59 : aList(1024,64,64)
62 void Clear() { aList.Clear(); }
63 ULONG GetObjCount() const { return aList.Count(); }
64 SdrObject* GetObj(ULONG nNum) const { return (SdrObject*)aList.GetObject(nNum); }
65 SdrObject* operator[](ULONG nNum) const { return (SdrObject*)aList.GetObject(nNum); }
66 void InsertObject(SdrObject* pObj, ULONG nPos=CONTAINER_APPEND) { aList.Insert(pObj,nPos); }
67 void RemoveObject(ULONG nPos) { aList.Remove(nPos); }
70 //************************************************************
71 // Hilfsklasse ImpSdrGDIMetaFileImport
72 //************************************************************
74 class ImpSdrGDIMetaFileImport
76 protected:
77 SdrObjRefList aTmpList;
78 VirtualDevice aVD;
79 Rectangle aScaleRect;
80 ULONG nMapScalingOfs; // ab hier nocht nicht mit MapScaling bearbeitet
81 SfxItemSet* pLineAttr;
82 SfxItemSet* pFillAttr;
83 SfxItemSet* pTextAttr;
84 SdrPage* pPage;
85 SdrModel* pModel;
86 SdrLayerID nLayer;
87 Color aOldLineColor;
88 sal_Int32 nLineWidth;
90 sal_Bool bMov;
91 sal_Bool bSize;
92 Point aOfs;
93 double fScaleX;
94 double fScaleY;
95 Fraction aScaleX;
96 Fraction aScaleY;
98 sal_Bool bFntDirty;
100 // fuer Optimierung von (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> aus 2 mach ein
101 sal_Bool bLastObjWasPolyWithoutLine;
102 sal_Bool bNoLine;
103 sal_Bool bNoFill;
105 // fuer Optimierung mehrerer Linien zu einer Polyline
106 sal_Bool bLastObjWasLine;
108 protected:
109 void DoAction(MetaPixelAction & rAct);
110 void DoAction(MetaPointAction & rAct);
111 void DoAction(MetaLineAction & rAct);
112 void DoAction(MetaRectAction & rAct);
113 void DoAction(MetaRoundRectAction & rAct);
114 void DoAction(MetaEllipseAction & rAct);
115 void DoAction(MetaArcAction & rAct);
116 void DoAction(MetaPieAction & rAct);
117 void DoAction(MetaChordAction & rAct);
118 void DoAction(MetaPolyLineAction & rAct);
119 void DoAction(MetaPolygonAction & rAct);
120 void DoAction(MetaPolyPolygonAction & rAct);
121 void DoAction(MetaTextAction & rAct);
122 void DoAction(MetaTextArrayAction & rAct);
123 void DoAction(MetaStretchTextAction & rAct);
124 void DoAction(MetaBmpAction & rAct);
125 void DoAction(MetaBmpScaleAction & rAct);
126 void DoAction(MetaBmpExAction & rAct);
127 void DoAction(MetaBmpExScaleAction & rAct);
128 void DoAction(MetaHatchAction & rAct);
129 void DoAction(MetaLineColorAction & rAct);
130 void DoAction(MetaMapModeAction & rAct);
131 void DoAction(MetaFillColorAction & rAct) { rAct.Execute(&aVD); }
132 void DoAction(MetaTextColorAction & rAct) { rAct.Execute(&aVD); }
133 void DoAction(MetaTextFillColorAction & rAct) { rAct.Execute(&aVD); }
134 void DoAction(MetaFontAction & rAct) { rAct.Execute(&aVD); bFntDirty=TRUE; }
135 void DoAction(MetaTextAlignAction & rAct) { rAct.Execute(&aVD); bFntDirty=TRUE; }
136 void DoAction(MetaClipRegionAction & rAct) { rAct.Execute(&aVD); }
137 void DoAction(MetaRasterOpAction & rAct) { rAct.Execute(&aVD); }
138 void DoAction(MetaPushAction & rAct) { rAct.Execute(&aVD); }
139 void DoAction(MetaPopAction & rAct) { rAct.Execute(&aVD); bFntDirty=TRUE; }
140 void DoAction(MetaMoveClipRegionAction & rAct) { rAct.Execute(&aVD); }
141 void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&aVD); }
142 void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&aVD); }
143 void DoAction(MetaCommentAction& rAct, GDIMetaFile* pMtf);
145 void ImportText( const Point& rPos, const XubString& rStr, const MetaAction& rAct );
146 void SetAttributes(SdrObject* pObj, FASTBOOL bForceTextAttr=FALSE);
147 void InsertObj( SdrObject* pObj, sal_Bool bScale = sal_True );
148 void MapScaling();
150 // #i73407# reformulation to use new B2DPolygon classes
151 bool CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly);
152 bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon& rPolyPolygon);
154 public:
155 ImpSdrGDIMetaFileImport(SdrModel& rModel);
156 ~ImpSdrGDIMetaFileImport();
157 ULONG DoImport(const GDIMetaFile& rMtf, SdrObjList& rDestList, ULONG nInsPos=CONTAINER_APPEND, SvdProgressInfo *pProgrInfo = NULL);
158 void SetLayer(SdrLayerID nLay) { nLayer=nLay; }
159 SdrLayerID GetLayer() const { return nLayer; }
160 void SetScaleRect(const Rectangle& rRect) { aScaleRect=rRect; }
161 const Rectangle& GetScaleRect() const { return aScaleRect; }
164 ////////////////////////////////////////////////////////////////////////////////////////////////////
166 #endif //_SVDFMTF_HXX
167 // eof