Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _SVDFMTF_HXX
21 : #define _SVDFMTF_HXX
22 :
23 : #include <tools/contnr.hxx>
24 : #include <vcl/metaact.hxx>
25 : #include <vcl/virdev.hxx>
26 : #include <svx/svdobj.hxx>
27 :
28 : //************************************************************
29 : // Forward Declarations
30 : //************************************************************
31 :
32 : class SfxItemSet;
33 : class SdrObjList;
34 : class SdrModel;
35 : class SdrPage;
36 : class SdrObject;
37 : class SvdProgressInfo;
38 :
39 : //************************************************************
40 : // Helper Class ImpSdrGDIMetaFileImport
41 : //************************************************************
42 :
43 : class ImpSdrGDIMetaFileImport
44 : {
45 : protected:
46 : std::vector<SdrObject*> aTmpList;
47 : VirtualDevice aVD;
48 : Rectangle aScaleRect;
49 : size_t nMapScalingOfs; // from here on, not edited with MapScaling
50 : SfxItemSet* pLineAttr;
51 : SfxItemSet* pFillAttr;
52 : SfxItemSet* pTextAttr;
53 : SdrPage* pPage;
54 : SdrModel* pModel;
55 : SdrLayerID nLayer;
56 : Color aOldLineColor;
57 : sal_Int32 nLineWidth;
58 : basegfx::B2DLineJoin maLineJoin;
59 : com::sun::star::drawing::LineCap maLineCap;
60 : XDash maDash;
61 :
62 : sal_Bool bMov;
63 : sal_Bool bSize;
64 : Point aOfs;
65 : double fScaleX;
66 : double fScaleY;
67 : Fraction aScaleX;
68 : Fraction aScaleY;
69 :
70 : sal_Bool bFntDirty;
71 :
72 : // to optimize (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> two-in-one
73 : sal_Bool bLastObjWasPolyWithoutLine;
74 : sal_Bool bNoLine;
75 : sal_Bool bNoFill;
76 :
77 : // to optimize multiple lines into a Polyline
78 : sal_Bool bLastObjWasLine;
79 :
80 : protected:
81 : void DoAction(MetaPixelAction & rAct) const;
82 : void DoAction(MetaPointAction & rAct) const;
83 : void DoAction(MetaLineAction & rAct);
84 : void DoAction(MetaRectAction & rAct);
85 : void DoAction(MetaRoundRectAction & rAct);
86 : void DoAction(MetaEllipseAction & rAct);
87 : void DoAction(MetaArcAction & rAct);
88 : void DoAction(MetaPieAction & rAct);
89 : void DoAction(MetaChordAction & rAct);
90 : void DoAction(MetaPolyLineAction & rAct);
91 : void DoAction(MetaPolygonAction & rAct);
92 : void DoAction(MetaPolyPolygonAction & rAct);
93 : void DoAction(MetaTextAction & rAct);
94 : void DoAction(MetaTextArrayAction & rAct);
95 : void DoAction(MetaStretchTextAction & rAct);
96 : void DoAction(MetaBmpAction & rAct);
97 : void DoAction(MetaBmpScaleAction & rAct);
98 : void DoAction(MetaBmpExAction & rAct);
99 : void DoAction(MetaBmpExScaleAction & rAct);
100 : void DoAction(MetaHatchAction & rAct);
101 : void DoAction(MetaLineColorAction & rAct);
102 : void DoAction(MetaMapModeAction & rAct);
103 0 : void DoAction(MetaFillColorAction & rAct) { rAct.Execute(&aVD); }
104 0 : void DoAction(MetaTextColorAction & rAct) { rAct.Execute(&aVD); }
105 0 : void DoAction(MetaTextFillColorAction & rAct) { rAct.Execute(&aVD); }
106 0 : void DoAction(MetaFontAction & rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; }
107 0 : void DoAction(MetaTextAlignAction & rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; }
108 0 : void DoAction(MetaClipRegionAction & rAct) { rAct.Execute(&aVD); }
109 0 : void DoAction(MetaRasterOpAction & rAct) { rAct.Execute(&aVD); }
110 0 : void DoAction(MetaPushAction & rAct) { rAct.Execute(&aVD); }
111 0 : void DoAction(MetaPopAction & rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; }
112 0 : void DoAction(MetaMoveClipRegionAction & rAct) { rAct.Execute(&aVD); }
113 0 : void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&aVD); }
114 0 : void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&aVD); }
115 : void DoAction(MetaCommentAction& rAct, GDIMetaFile* pMtf);
116 :
117 : void ImportText( const Point& rPos, const XubString& rStr, const MetaAction& rAct );
118 : void SetAttributes(SdrObject* pObj, bool bForceTextAttr = false);
119 : void InsertObj( SdrObject* pObj, sal_Bool bScale = sal_True );
120 : void MapScaling();
121 :
122 : // #i73407# reformulation to use new B2DPolygon classes
123 : bool CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly);
124 : bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon& rPolyPolygon);
125 :
126 : public:
127 : ImpSdrGDIMetaFileImport(SdrModel& rModel);
128 : ~ImpSdrGDIMetaFileImport();
129 : sal_uLong DoImport(const GDIMetaFile& rMtf, SdrObjList& rDestList, sal_uLong nInsPos=CONTAINER_APPEND, SvdProgressInfo *pProgrInfo = NULL);
130 0 : void SetLayer(SdrLayerID nLay) { nLayer=nLay; }
131 : SdrLayerID GetLayer() const { return nLayer; }
132 0 : void SetScaleRect(const Rectangle& rRect) { aScaleRect=rRect; }
133 : const Rectangle& GetScaleRect() const { return aScaleRect; }
134 : };
135 :
136 : #endif //_SVDFMTF_HXX
137 :
138 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|