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