LibreOffice Module svx (master)  1
svdfmtf.hxx
Go to the documentation of this file.
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 INCLUDED_SVX_SOURCE_SVDRAW_SVDFMTF_HXX
21 #define INCLUDED_SVX_SOURCE_SVDRAW_SVDFMTF_HXX
22 
23 #include <sal/config.h>
24 
25 #include <memory>
26 
27 #include <svl/itemset.hxx>
28 #include <tools/fract.hxx>
29 #include <vcl/metaact.hxx>
30 #include <vcl/virdev.hxx>
31 #include <svx/svdobj.hxx>
32 #include <svx/xdash.hxx>
33 
34 // Forward Declarations
35 
36 
37 class SfxItemSet;
38 class SdrObjList;
39 class SdrModel;
40 class SdrPage;
41 class SdrObject;
42 class SvdProgressInfo;
43 
44 
45 // Helper Class ImpSdrGDIMetaFileImport
47 {
48  ::std::vector< SdrObject* > maTmpList;
51  size_t mnMapScalingOfs; // from here on, not edited with MapScaling
52  std::unique_ptr<SfxItemSet> mpLineAttr;
53  std::unique_ptr<SfxItemSet> mpFillAttr;
54  std::unique_ptr<SfxItemSet> mpTextAttr;
58  sal_Int32 mnLineWidth;
60  css::drawing::LineCap maLineCap;
62 
63  bool mbMov;
64  bool mbSize;
66  double mfScaleX;
67  double mfScaleY;
70 
71  bool mbFntDirty;
72 
73  // to optimize (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> two-in-one
75  bool mbNoLine;
76  bool mbNoFill;
77 
78  // to optimize multiple lines into a Polyline
80 
81  // clipregion
83 
84  // check for clip and evtl. fill maClip
85  void checkClip();
86  bool isClip() const;
87 
88  // actions
89  void DoAction(MetaLineAction const & rAct);
90  void DoAction(MetaRectAction const & rAct);
91  void DoAction(MetaRoundRectAction const & rAct);
92  void DoAction(MetaEllipseAction const & rAct);
93  void DoAction(MetaArcAction const & rAct);
94  void DoAction(MetaPieAction const & rAct);
95  void DoAction(MetaChordAction const & rAct);
96  void DoAction(MetaPolyLineAction const & rAct);
97  void DoAction(MetaPolygonAction const & rAct);
98  void DoAction(MetaPolyPolygonAction const & rAct);
99  void DoAction(MetaTextAction const & rAct);
100  void DoAction(MetaTextArrayAction const & rAct);
101  void DoAction(MetaStretchTextAction const & rAct);
102  void DoAction(MetaBmpAction const & rAct);
103  void DoAction(MetaBmpScaleAction const & rAct);
104  void DoAction(MetaBmpExAction const & rAct);
105  void DoAction(MetaBmpExScaleAction const & rAct);
106  void DoAction(MetaHatchAction const & rAct);
107  void DoAction(MetaLineColorAction & rAct);
108  void DoAction(MetaMapModeAction & rAct);
109  void DoAction(MetaFillColorAction & rAct) { rAct.Execute(mpVD); }
110  void DoAction(MetaTextColorAction & rAct) { rAct.Execute(mpVD); }
111  void DoAction(MetaTextFillColorAction & rAct) { rAct.Execute(mpVD); }
112  void DoAction(MetaFontAction & rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
113  void DoAction(MetaTextAlignAction & rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
114  void DoAction(MetaClipRegionAction & rAct) { rAct.Execute(mpVD); checkClip(); }
115  void DoAction(MetaRasterOpAction & rAct) { rAct.Execute(mpVD); }
116  void DoAction(MetaPushAction & rAct) { rAct.Execute(mpVD); checkClip(); }
117  void DoAction(MetaPopAction & rAct) { rAct.Execute(mpVD); mbFntDirty = true; checkClip(); }
118  void DoAction(MetaMoveClipRegionAction & rAct) { rAct.Execute(mpVD); checkClip(); }
119  void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(mpVD); checkClip(); }
120  void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(mpVD); checkClip(); }
121 
122  // #i125211# The MetaCommentAction needs to advance (if used), thus
123  // give current metafile and index which may be changed
124  void DoAction(MetaCommentAction const & rAct, GDIMetaFile const & rMtf, sal_uLong& a);
125 
126  // missing actions added
127  void DoAction(MetaTextRectAction const & rAct);
128  void DoAction(MetaBmpScalePartAction const & rAct);
129  void DoAction(MetaBmpExScalePartAction const & rAct);
130  void DoAction(MetaMaskAction const & rAct);
131  void DoAction(MetaMaskScaleAction const & rAct);
132  void DoAction(MetaMaskScalePartAction const & rAct);
133  void DoAction(MetaGradientAction const & rAct);
134  void DoAction(MetaTransparentAction const & rAct);
135  void DoAction(MetaRefPointAction& rAct) { rAct.Execute(mpVD); }
136  void DoAction(MetaTextLineColorAction& rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
137  void DoAction(MetaFloatTransparentAction const & rAct);
138  void DoAction(MetaGradientExAction const & rAct);
139  void DoAction(MetaLayoutModeAction& rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
140  void DoAction(MetaTextLanguageAction& rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
141  void DoAction(MetaOverlineColorAction& rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
142 
143  void ImportText(const Point& rPos, const OUString& rStr, const MetaAction& rAct);
144  void SetAttributes(SdrObject* pObj, bool bForceTextAttr = false);
145  void InsertObj(SdrObject* pObj, bool bScale = true);
146  void MapScaling();
147 
148  // #i73407# reformulation to use new B2DPolygon classes
149  bool CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly);
150  bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon& rPolyPolygon);
151 
152  void DoLoopActions(GDIMetaFile const & rMtf, SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport);
153 
154  // Copy assignment is forbidden and not implemented.
157 
158 public:
160  SdrModel& rModel,
161  SdrLayerID nLay,
162  const tools::Rectangle& rRect);
163 
164  size_t DoImport(
165  const GDIMetaFile& rMtf,
166  SdrObjList& rDestList,
167  size_t nInsPos,
168  SvdProgressInfo* pProgrInfo = nullptr);
169 };
170 
171 #endif // INCLUDED_SVX_SOURCE_SVDRAW_SVDFMTF_HXX
172 
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void DoAction(MetaTextColorAction &rAct)
Definition: svdfmtf.hxx:110
void ImportText(const Point &rPos, const OUString &rStr, const MetaAction &rAct)
Definition: svdfmtf.cxx:1002
sal_uIntPtr sal_uLong
std::unique_ptr< SfxItemSet > mpTextAttr
Definition: svdfmtf.hxx:54
void DoAction(MetaTextFillColorAction &rAct)
Definition: svdfmtf.hxx:111
void DoAction(MetaClipRegionAction &rAct)
Definition: svdfmtf.hxx:114
void DoLoopActions(GDIMetaFile const &rMtf, SvdProgressInfo *pProgrInfo, sal_uInt32 *pActionsToReport)
Definition: svdfmtf.cxx:118
void SetAttributes(SdrObject *pObj, bool bForceTextAttr=false)
Definition: svdfmtf.cxx:315
basegfx::B2DLineJoin maLineJoin
Definition: svdfmtf.hxx:59
void DoAction(MetaLineAction const &rAct)
Definition: svdfmtf.cxx:662
void DoAction(MetaFontAction &rAct)
Definition: svdfmtf.hxx:112
void DoAction(MetaRasterOpAction &rAct)
Definition: svdfmtf.hxx:115
void DoAction(MetaTextLanguageAction &rAct)
Definition: svdfmtf.hxx:140
void DoAction(MetaPopAction &rAct)
Definition: svdfmtf.hxx:117
void DoAction(MetaTextLineColorAction &rAct)
Definition: svdfmtf.hxx:136
Definition: xdash.hxx:31
tools::Rectangle maScaleRect
Definition: svdfmtf.hxx:50
void InsertObj(SdrObject *pObj, bool bScale=true)
Definition: svdfmtf.cxx:447
void DoAction(MetaPushAction &rAct)
Definition: svdfmtf.hxx:116
size_t DoImport(const GDIMetaFile &rMtf, SdrObjList &rDestList, size_t nInsPos, SvdProgressInfo *pProgrInfo=nullptr)
Definition: svdfmtf.cxx:210
void DoAction(MetaTextAlignAction &rAct)
Definition: svdfmtf.hxx:113
Helper class for the communication between the dialog In order to break open Metafiles (sd/source/ui/...
Definition: svdetc.hxx:111
void DoAction(MetaISectRectClipRegionAction &rAct)
Definition: svdfmtf.hxx:119
void DoAction(MetaMoveClipRegionAction &rAct)
Definition: svdfmtf.hxx:118
void DoAction(MetaISectRegionClipRegionAction &rAct)
Definition: svdfmtf.hxx:120
void DoAction(MetaFillColorAction &rAct)
Definition: svdfmtf.hxx:109
virtual void Execute(OutputDevice *pOut) override
std::unique_ptr< SfxItemSet > mpFillAttr
Definition: svdfmtf.hxx:53
Abstract DrawObject.
Definition: svdobj.hxx:312
ImpSdrGDIMetaFileImport & operator=(const ImpSdrGDIMetaFileImport &)=delete
void DoAction(MetaLayoutModeAction &rAct)
Definition: svdfmtf.hxx:139
bool isClip() const
Definition: svdfmtf.cxx:904
::std::vector< SdrObject * > maTmpList
Definition: svdfmtf.hxx:48
std::unique_ptr< SfxItemSet > mpLineAttr
Definition: svdfmtf.hxx:52
basegfx::B2DPolyPolygon maClip
Definition: svdfmtf.hxx:82
bool CheckLastLineMerge(const basegfx::B2DPolygon &rSrcPoly)
Definition: svdfmtf.cxx:785
bool mbLastObjWasPolyWithoutLine
Definition: svdfmtf.hxx:74
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:366
void DoAction(MetaRefPointAction &rAct)
Definition: svdfmtf.hxx:135
bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon &rPolyPolygon)
Definition: svdfmtf.cxx:857
ImpSdrGDIMetaFileImport(const ImpSdrGDIMetaFileImport &)=delete
void DoAction(MetaOverlineColorAction &rAct)
Definition: svdfmtf.hxx:141
css::drawing::LineCap maLineCap
Definition: svdfmtf.hxx:60
ScopedVclPtr< VirtualDevice > mpVD
Definition: svdfmtf.hxx:49