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 ImpSdrGDIMetaFileImport 44 //************************************************************ 45 46 class ImpSdrGDIMetaFileImport 47 { 48 protected: 49 ::std::vector< SdrObject* > maTmpList; 50 VirtualDevice maVD; 51 Rectangle maScaleRect; 52 sal_uLong mnMapScalingOfs; // ab hier nocht nicht mit MapScaling bearbeitet 53 SfxItemSet* mpLineAttr; 54 SfxItemSet* mpFillAttr; 55 SfxItemSet* mpTextAttr; 56 SdrModel* mpModel; 57 SdrLayerID mnLayer; 58 Color maOldLineColor; 59 sal_Int32 mnLineWidth; 60 basegfx::B2DLineJoin maLineJoin; 61 com::sun::star::drawing::LineCap maLineCap; 62 XDash maDash; 63 64 bool mbMov; 65 bool mbSize; 66 Point maOfs; 67 double mfScaleX; 68 double mfScaleY; 69 Fraction maScaleX; 70 Fraction maScaleY; 71 72 bool mbFntDirty; 73 74 // fuer Optimierung von (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> aus 2 mach ein 75 bool mbLastObjWasPolyWithoutLine; 76 bool mbNoLine; 77 bool mbNoFill; 78 79 // fuer Optimierung mehrerer Linien zu einer Polyline 80 bool mbLastObjWasLine; 81 82 // clipregion 83 basegfx::B2DPolyPolygon maClip; 84 85 protected: 86 // ckeck for clip and evtl. fill maClip 87 void checkClip(); 88 bool isClip() const; 89 90 // actions 91 void DoAction(MetaPixelAction & rAct); 92 void DoAction(MetaPointAction & rAct); 93 void DoAction(MetaLineAction & rAct); 94 void DoAction(MetaRectAction & rAct); 95 void DoAction(MetaRoundRectAction & rAct); 96 void DoAction(MetaEllipseAction & rAct); 97 void DoAction(MetaArcAction & rAct); 98 void DoAction(MetaPieAction & rAct); 99 void DoAction(MetaChordAction & rAct); 100 void DoAction(MetaPolyLineAction & rAct); 101 void DoAction(MetaPolygonAction & rAct); 102 void DoAction(MetaPolyPolygonAction & rAct); 103 void DoAction(MetaTextAction & rAct); 104 void DoAction(MetaTextArrayAction & rAct); 105 void DoAction(MetaStretchTextAction & rAct); 106 void DoAction(MetaBmpAction & rAct); 107 void DoAction(MetaBmpScaleAction & rAct); 108 void DoAction(MetaBmpExAction & rAct); 109 void DoAction(MetaBmpExScaleAction & rAct); 110 void DoAction(MetaHatchAction & rAct); 111 void DoAction(MetaLineColorAction & rAct); 112 void DoAction(MetaMapModeAction & rAct); DoAction(MetaFillColorAction & rAct)113 void DoAction(MetaFillColorAction & rAct) { rAct.Execute(&maVD); } DoAction(MetaTextColorAction & rAct)114 void DoAction(MetaTextColorAction & rAct) { rAct.Execute(&maVD); } DoAction(MetaTextFillColorAction & rAct)115 void DoAction(MetaTextFillColorAction & rAct) { rAct.Execute(&maVD); } DoAction(MetaFontAction & rAct)116 void DoAction(MetaFontAction & rAct) { rAct.Execute(&maVD); mbFntDirty = true; } DoAction(MetaTextAlignAction & rAct)117 void DoAction(MetaTextAlignAction & rAct) { rAct.Execute(&maVD); mbFntDirty = true; } DoAction(MetaClipRegionAction & rAct)118 void DoAction(MetaClipRegionAction & rAct) { rAct.Execute(&maVD); checkClip(); } DoAction(MetaRasterOpAction & rAct)119 void DoAction(MetaRasterOpAction & rAct) { rAct.Execute(&maVD); } DoAction(MetaPushAction & rAct)120 void DoAction(MetaPushAction & rAct) { rAct.Execute(&maVD); checkClip(); } DoAction(MetaPopAction & rAct)121 void DoAction(MetaPopAction & rAct) { rAct.Execute(&maVD); mbFntDirty = true; checkClip(); } DoAction(MetaMoveClipRegionAction & rAct)122 void DoAction(MetaMoveClipRegionAction & rAct) { rAct.Execute(&maVD); checkClip(); } DoAction(MetaISectRectClipRegionAction & rAct)123 void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&maVD); checkClip(); } DoAction(MetaISectRegionClipRegionAction & rAct)124 void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&maVD); checkClip(); } 125 void DoAction(MetaCommentAction& rAct, GDIMetaFile* pMtf); 126 127 // missing actions added 128 void DoAction(MetaTextRectAction& rAct); 129 void DoAction(MetaBmpScalePartAction& rAct); 130 void DoAction(MetaBmpExScalePartAction& rAct); 131 void DoAction(MetaMaskAction& rAct); 132 void DoAction(MetaMaskScaleAction& rAct); 133 void DoAction(MetaMaskScalePartAction& rAct); 134 void DoAction(MetaGradientAction& rAct); 135 void DoAction(MetaWallpaperAction& rAct); 136 void DoAction(MetaTransparentAction& rAct); 137 void DoAction(MetaEPSAction& rAct); DoAction(MetaRefPointAction & rAct)138 void DoAction(MetaRefPointAction& rAct) { rAct.Execute(&maVD); } DoAction(MetaTextLineColorAction & rAct)139 void DoAction(MetaTextLineColorAction& rAct) { rAct.Execute(&maVD); mbFntDirty = true; } 140 void DoAction(MetaTextLineAction& rAct); 141 void DoAction(MetaFloatTransparentAction& rAct); 142 void DoAction(MetaGradientExAction& rAct); DoAction(MetaLayoutModeAction & rAct)143 void DoAction(MetaLayoutModeAction& rAct) { rAct.Execute(&maVD); mbFntDirty = true; } DoAction(MetaTextLanguageAction & rAct)144 void DoAction(MetaTextLanguageAction& rAct) { rAct.Execute(&maVD); mbFntDirty = true; } DoAction(MetaOverlineColorAction & rAct)145 void DoAction(MetaOverlineColorAction& rAct) { rAct.Execute(&maVD); mbFntDirty = true; } 146 147 void ImportText(const Point& rPos, const XubString& rStr, const MetaAction& rAct); 148 void SetAttributes(SdrObject* pObj, bool bForceTextAttr = false); 149 void InsertObj(SdrObject* pObj, bool bScale = true); 150 void MapScaling(); 151 152 // #i73407# reformulation to use new B2DPolygon classes 153 bool CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly); 154 bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon& rPolyPolygon); 155 156 void DoLoopActions(GDIMetaFile& rMtf, SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport); 157 158 public: 159 ImpSdrGDIMetaFileImport( 160 SdrModel& rModel, 161 SdrLayerID nLay, 162 const Rectangle& rRect); 163 ~ImpSdrGDIMetaFileImport(); 164 165 sal_uInt32 DoImport( 166 const GDIMetaFile& rMtf, 167 SdrObjList& rDestList, 168 sal_uInt32 nInsPos = CONTAINER_APPEND, 169 SvdProgressInfo* pProgrInfo = 0); 170 }; 171 172 //////////////////////////////////////////////////////////////////////////////////////////////////// 173 174 #endif //_SVDFMTF_HXX 175 // eof 176