1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: svdfmtf.hxx,v $
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 ************************************************************************/
34 #include <vcl/metaact.hxx>
35 #include <vcl/virdev.hxx>
36 #include <svx/svdobj.hxx>
38 //************************************************************
39 // Vorausdeklarationen
40 //************************************************************
47 class SvdProgressInfo
;
49 //************************************************************
50 // Hilfsklasse SdrObjRefList
51 //************************************************************
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
77 SdrObjRefList aTmpList
;
80 ULONG nMapScalingOfs
; // ab hier nocht nicht mit MapScaling bearbeitet
81 SfxItemSet
* pLineAttr
;
82 SfxItemSet
* pFillAttr
;
83 SfxItemSet
* pTextAttr
;
100 // fuer Optimierung von (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> aus 2 mach ein
101 sal_Bool bLastObjWasPolyWithoutLine
;
105 // fuer Optimierung mehrerer Linien zu einer Polyline
106 sal_Bool bLastObjWasLine
;
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
);
150 // #i73407# reformulation to use new B2DPolygon classes
151 bool CheckLastLineMerge(const basegfx::B2DPolygon
& rSrcPoly
);
152 bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon
& rPolyPolygon
);
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