Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / svx / source / svdraw / svdfmtf.hxx
blobe9c2d317f13be90d28d74877b27f6f3a4a859882
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 ************************************************************************/
29 #ifndef _SVDFMTF_HXX
30 #define _SVDFMTF_HXX
32 #include <vcl/metaact.hxx>
33 #include <vcl/virdev.hxx>
34 #include <svx/svdobj.hxx>
36 //************************************************************
37 // Forward Declarations
38 //************************************************************
40 class SfxItemSet;
41 class SdrObjList;
42 class SdrModel;
43 class SdrPage;
44 class SdrObject;
45 class SvdProgressInfo;
47 //************************************************************
48 // Helper Class SdrObjRefList
49 //************************************************************
51 class SdrObjRefList
53 Container aList;
54 public:
56 SdrObjRefList()
57 : aList(1024,64,64)
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
74 protected:
75 SdrObjRefList aTmpList;
76 VirtualDevice aVD;
77 Rectangle aScaleRect;
78 sal_uLong nMapScalingOfs; // from here on, not edited with MapScaling
79 SfxItemSet* pLineAttr;
80 SfxItemSet* pFillAttr;
81 SfxItemSet* pTextAttr;
82 SdrPage* pPage;
83 SdrModel* pModel;
84 SdrLayerID nLayer;
85 Color aOldLineColor;
86 sal_Int32 nLineWidth;
87 basegfx::B2DLineJoin maLineJoin;
88 XDash maDash;
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 // to optimize (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> two-in-one
101 sal_Bool bLastObjWasPolyWithoutLine;
102 sal_Bool bNoLine;
103 sal_Bool bNoFill;
105 // to optimize multiple lines into a Polyline
106 sal_Bool bLastObjWasLine;
108 protected:
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 );
149 void MapScaling();
151 // #i73407# reformulation to use new B2DPolygon classes
152 bool CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly);
153 bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon& rPolyPolygon);
155 public:
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
168 // eof
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */