1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
32 #include <vcl/metaact.hxx>
33 #include <vcl/virdev.hxx>
34 #include <svx/svdobj.hxx>
36 //************************************************************
37 // Forward Declarations
38 //************************************************************
45 class SvdProgressInfo
;
47 //************************************************************
48 // Helper Class SdrObjRefList
49 //************************************************************
60 void Clear() { aList
.Clear(); }
61 sal_uLong
GetObjCount() const { return aList
.Count(); }
62 SdrObject
* GetObj(sal_uLong nNum
) const { return (SdrObject
*)aList
.GetObject(nNum
); }
63 SdrObject
* operator[](sal_uLong nNum
) const { return (SdrObject
*)aList
.GetObject(nNum
); }
64 void InsertObject(SdrObject
* pObj
, sal_uLong nPos
=CONTAINER_APPEND
) { aList
.Insert(pObj
,nPos
); }
65 void RemoveObject(sal_uLong nPos
) { aList
.Remove(nPos
); }
68 //************************************************************
69 // Helper Class ImpSdrGDIMetaFileImport
70 //************************************************************
72 class ImpSdrGDIMetaFileImport
75 SdrObjRefList aTmpList
;
78 sal_uLong nMapScalingOfs
; // from here on, not edited with MapScaling
79 SfxItemSet
* pLineAttr
;
80 SfxItemSet
* pFillAttr
;
81 SfxItemSet
* pTextAttr
;
87 basegfx::B2DLineJoin maLineJoin
;
100 // to optimize (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> two-in-one
101 sal_Bool bLastObjWasPolyWithoutLine
;
105 // to optimize multiple lines into a Polyline
106 sal_Bool bLastObjWasLine
;
109 void DoAction(MetaPixelAction
& rAct
) const;
110 void DoAction(MetaPointAction
& rAct
) const;
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
=sal_True
; }
135 void DoAction(MetaTextAlignAction
& rAct
) { rAct
.Execute(&aVD
); bFntDirty
=sal_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
=sal_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
);
144 void DoAction(MetaRenderGraphicAction
& rAct
);
146 void ImportText( const Point
& rPos
, const XubString
& rStr
, const MetaAction
& rAct
);
147 void SetAttributes(SdrObject
* pObj
, bool bForceTextAttr
= false);
148 void InsertObj( SdrObject
* pObj
, sal_Bool bScale
= sal_True
);
151 // #i73407# reformulation to use new B2DPolygon classes
152 bool CheckLastLineMerge(const basegfx::B2DPolygon
& rSrcPoly
);
153 bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon
& rPolyPolygon
);
156 ImpSdrGDIMetaFileImport(SdrModel
& rModel
);
157 ~ImpSdrGDIMetaFileImport();
158 sal_uLong
DoImport(const GDIMetaFile
& rMtf
, SdrObjList
& rDestList
, sal_uLong nInsPos
=CONTAINER_APPEND
, SvdProgressInfo
*pProgrInfo
= NULL
);
159 void SetLayer(SdrLayerID nLay
) { nLayer
=nLay
; }
160 SdrLayerID
GetLayer() const { return nLayer
; }
161 void SetScaleRect(const Rectangle
& rRect
) { aScaleRect
=rRect
; }
162 const Rectangle
& GetScaleRect() const { return aScaleRect
; }
165 ////////////////////////////////////////////////////////////////////////////////////////////////////
167 #endif //_SVDFMTF_HXX
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */