1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SVDFMTF_HXX 25 #define _SVDFMTF_HXX 26 27 #include <vcl/metaact.hxx> 28 #include <vcl/virdev.hxx> 29 #include <svx/svdobj.hxx> 30 31 //************************************************************ 32 // Vorausdeklarationen 33 //************************************************************ 34 35 class SfxItemSet; 36 class SdrObjList; 37 class SdrModel; 38 class SdrPage; 39 class SdrObject; 40 class SvdProgressInfo; 41 42 //************************************************************ 43 // Hilfsklasse SdrObjRefList 44 //************************************************************ 45 46 class SdrObjRefList 47 { 48 Container aList; 49 public: 50 51 SdrObjRefList() 52 : aList(1024,64,64) 53 {} 54 55 void Clear() { aList.Clear(); } 56 sal_uLong GetObjCount() const { return aList.Count(); } 57 SdrObject* GetObj(sal_uLong nNum) const { return (SdrObject*)aList.GetObject(nNum); } 58 SdrObject* operator[](sal_uLong nNum) const { return (SdrObject*)aList.GetObject(nNum); } 59 void InsertObject(SdrObject* pObj, sal_uLong nPos=CONTAINER_APPEND) { aList.Insert(pObj,nPos); } 60 void RemoveObject(sal_uLong nPos) { aList.Remove(nPos); } 61 }; 62 63 //************************************************************ 64 // Hilfsklasse ImpSdrGDIMetaFileImport 65 //************************************************************ 66 67 class ImpSdrGDIMetaFileImport 68 { 69 protected: 70 SdrObjRefList aTmpList; 71 VirtualDevice aVD; 72 Rectangle aScaleRect; 73 sal_uLong nMapScalingOfs; // ab hier nocht nicht mit MapScaling bearbeitet 74 SfxItemSet* pLineAttr; 75 SfxItemSet* pFillAttr; 76 SfxItemSet* pTextAttr; 77 SdrPage* pPage; 78 SdrModel* pModel; 79 SdrLayerID nLayer; 80 Color aOldLineColor; 81 sal_Int32 nLineWidth; 82 basegfx::B2DLineJoin maLineJoin; 83 XDash maDash; 84 85 sal_Bool bMov; 86 sal_Bool bSize; 87 Point aOfs; 88 double fScaleX; 89 double fScaleY; 90 Fraction aScaleX; 91 Fraction aScaleY; 92 93 sal_Bool bFntDirty; 94 95 // fuer Optimierung von (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> aus 2 mach ein 96 sal_Bool bLastObjWasPolyWithoutLine; 97 sal_Bool bNoLine; 98 sal_Bool bNoFill; 99 100 // fuer Optimierung mehrerer Linien zu einer Polyline 101 sal_Bool bLastObjWasLine; 102 103 protected: 104 void DoAction(MetaPixelAction & rAct); 105 void DoAction(MetaPointAction & rAct); 106 void DoAction(MetaLineAction & rAct); 107 void DoAction(MetaRectAction & rAct); 108 void DoAction(MetaRoundRectAction & rAct); 109 void DoAction(MetaEllipseAction & rAct); 110 void DoAction(MetaArcAction & rAct); 111 void DoAction(MetaPieAction & rAct); 112 void DoAction(MetaChordAction & rAct); 113 void DoAction(MetaPolyLineAction & rAct); 114 void DoAction(MetaPolygonAction & rAct); 115 void DoAction(MetaPolyPolygonAction & rAct); 116 void DoAction(MetaTextAction & rAct); 117 void DoAction(MetaTextArrayAction & rAct); 118 void DoAction(MetaStretchTextAction & rAct); 119 void DoAction(MetaBmpAction & rAct); 120 void DoAction(MetaBmpScaleAction & rAct); 121 void DoAction(MetaBmpExAction & rAct); 122 void DoAction(MetaBmpExScaleAction & rAct); 123 void DoAction(MetaHatchAction & rAct); 124 void DoAction(MetaLineColorAction & rAct); 125 void DoAction(MetaMapModeAction & rAct); 126 void DoAction(MetaFillColorAction & rAct) { rAct.Execute(&aVD); } 127 void DoAction(MetaTextColorAction & rAct) { rAct.Execute(&aVD); } 128 void DoAction(MetaTextFillColorAction & rAct) { rAct.Execute(&aVD); } 129 void DoAction(MetaFontAction & rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; } 130 void DoAction(MetaTextAlignAction & rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; } 131 void DoAction(MetaClipRegionAction & rAct) { rAct.Execute(&aVD); } 132 void DoAction(MetaRasterOpAction & rAct) { rAct.Execute(&aVD); } 133 void DoAction(MetaPushAction & rAct) { rAct.Execute(&aVD); } 134 void DoAction(MetaPopAction & rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; } 135 void DoAction(MetaMoveClipRegionAction & rAct) { rAct.Execute(&aVD); } 136 void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&aVD); } 137 void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&aVD); } 138 void DoAction(MetaCommentAction& rAct, GDIMetaFile* pMtf); 139 140 void ImportText( const Point& rPos, const XubString& rStr, const MetaAction& rAct ); 141 void SetAttributes(SdrObject* pObj, FASTBOOL bForceTextAttr=sal_False); 142 void InsertObj( SdrObject* pObj, sal_Bool bScale = sal_True ); 143 void MapScaling(); 144 145 // #i73407# reformulation to use new B2DPolygon classes 146 bool CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly); 147 bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon& rPolyPolygon); 148 149 public: 150 ImpSdrGDIMetaFileImport(SdrModel& rModel); 151 ~ImpSdrGDIMetaFileImport(); 152 sal_uLong DoImport(const GDIMetaFile& rMtf, SdrObjList& rDestList, sal_uLong nInsPos=CONTAINER_APPEND, SvdProgressInfo *pProgrInfo = NULL); 153 void SetLayer(SdrLayerID nLay) { nLayer=nLay; } 154 SdrLayerID GetLayer() const { return nLayer; } 155 void SetScaleRect(const Rectangle& rRect) { aScaleRect=rRect; } 156 const Rectangle& GetScaleRect() const { return aScaleRect; } 157 }; 158 159 //////////////////////////////////////////////////////////////////////////////////////////////////// 160 161 #endif //_SVDFMTF_HXX 162 // eof 163