LibreOffice Module sw (master) 1
printdata.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#ifndef INCLUDED_SW_INC_PRINTDATA_HXX
20#define INCLUDED_SW_INC_PRINTDATA_HXX
21
22#include <sal/types.h>
23#include <rtl/ustring.hxx>
24#include <vcl/print.hxx>
25#include <sfx2/objsh.hxx>
26
28#include <map>
29#include <vector>
30#include <utility>
31#include <memory>
32
33class SwDoc;
34class SwDocShell;
35class SetGetExpFields;
36class SwViewOption;
38class SwViewShell;
39class SwRenderData;
40
42enum class SwPostItMode
43{
44 NONE = 0,
45 Only = 1,
46 EndDoc = 2,
47 EndPage = 3,
48 InMargins = 4
49};
50
51
53{
54 const SwRenderData * m_pRenderData; // not owner
55
56public:
57
60 //#i81434# - printing of hidden text
67
69 OUString m_sFaxName;
70
72 {
73 m_pRenderData = nullptr;
74
82 m_bPrintEmptyPages = true;
83
92
94 }
95
96 virtual ~SwPrintData() {}
97
98 SwPrintData(SwPrintData const &) = default;
99 SwPrintData(SwPrintData &&) = default;
100 SwPrintData & operator =(SwPrintData const &) = default;
102
103 bool operator==(const SwPrintData& rData)const
104 {
105 return
107 m_bPrintTable == rData.m_bPrintTable &&
108 m_bPrintDraw == rData.m_bPrintDraw &&
121 m_sFaxName == rData.m_sFaxName &&
124 }
125
128 const SwRenderData & GetRenderData() const { return *m_pRenderData; }
129 void SetRenderData( const SwRenderData *pData ) { m_pRenderData = pData; }
130
131 bool IsPrintGraphic() const { return m_bPrintGraphic; }
132 bool IsPrintTable() const { return m_bPrintTable; }
133 bool IsPrintDraw() const { return m_bPrintDraw; }
134 bool IsPrintControl() const { return m_bPrintControl; }
135 bool IsPrintLeftPage() const { return m_bPrintLeftPages; }
136 bool IsPrintRightPage() const { return m_bPrintRightPages; }
137 bool IsPrintReverse() const { return m_bPrintReverse; }
138 bool IsPaperFromSetup() const { return m_bPaperFromSetup; }
139 bool IsPrintEmptyPages() const { return m_bPrintEmptyPages; }
140 bool IsPrintProspect() const { return m_bPrintProspect; }
143 bool IsPrintBlackFont() const { return m_bPrintBlackFont; }
144 bool IsPrintSingleJobs() const { return m_bPrintSingleJobs; }
146 const OUString& GetFaxName() const { return m_sFaxName; }
147 bool IsPrintHiddenText() const { return m_bPrintHiddenText; }
149
151 void SetPrintTable( bool b ) { doSetModified(); m_bPrintTable = b; }
152 void SetPrintDraw( bool b ) { doSetModified(); m_bPrintDraw = b; }
165 void SetFaxName( const OUString& rSet ) { m_sFaxName = rSet; }
168
169 virtual void doSetModified () {}
170};
171
173{
176
177public:
178 SwPrintUIOptions( sal_uInt16 nCurrentPage, bool bWeb, bool bSwSrcView, bool bHasSelection, bool bHasPostIts, const SwPrintData &rDefaultPrintData );
179 virtual ~SwPrintUIOptions();
180
181 bool processPropertiesAndCheckFormat( const css::uno::Sequence< css::beans::PropertyValue >& i_rNewProp );
182
183 bool IsPrintFormControls() const { return getBoolValue( "PrintControls", m_rDefaultPrintData.m_bPrintControl ); }
184 bool IsPrintPageBackground() const { return getBoolValue( "PrintPageBackground", m_rDefaultPrintData.m_bPrintPageBackground ); }
185 bool IsPrintProspect() const { return getBoolValue( "PrintProspect", m_rDefaultPrintData.m_bPrintProspect ); }
186 bool IsPrintProspectRTL() const { return getIntValue( "PrintProspectRTL", m_rDefaultPrintData.m_bPrintProspectRTL ? 1 : 0 ) != 0; }
187 bool IsPrintTextPlaceholders() const { return getBoolValue( "PrintTextPlaceholder", m_rDefaultPrintData.m_bPrintTextPlaceholder ); }
188 bool IsPrintHiddenText() const { return getBoolValue( "PrintHiddenText", m_rDefaultPrintData.m_bPrintHiddenText ); }
190 SwPostItMode GetPrintPostItsType() const { return static_cast< SwPostItMode >(getIntValue( "PrintAnnotationMode", static_cast<sal_uInt16>(m_rDefaultPrintData.m_nPrintPostIts) )); }
191 bool IsPaperFromSetup() const { return getBoolValue( "PrintPaperFromSetup", m_rDefaultPrintData.m_bPaperFromSetup ); }
192
193 bool IsPrintLeftPages() const;
194 bool IsPrintRightPages() const;
195 bool IsPrintEmptyPages( bool bIsPDFExport ) const;
196 bool IsPrintGraphics() const;
197 bool IsPrintDrawings() const;
198};
199
204{
208
210 std::map< sal_Int32, sal_Int32 > m_aPrinterPaperTrays;
211
215 std::vector< sal_Int32 > m_aPagesToPrint;
216
219 std::vector< std::pair< sal_Int32, sal_Int32 > > m_aPagePairs;
220
221 OUString m_aPageRange;
222
226
228 std::unique_ptr<SwViewOptionAdjust_Impl> m_pViewOptionAdjust;
229
230 std::unique_ptr<SwPrintData> m_pPrtOptions;
231
232public:
233
234 // PostIt relevant data
236 std::unique_ptr<SetGetExpFields> m_pPostItFields;
238 std::unique_ptr<SwViewShell> m_pPostItShell;
239
240public:
241 SwRenderData();
243
244 bool HasPostItData() const { return m_pPostItShell != nullptr; }
245 void CreatePostItData( SwDoc& rDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev );
246 void DeletePostItData();
247
250
251 bool IsViewOptionAdjust() const { return m_pViewOptionAdjust != nullptr; }
252 bool NeedNewViewOptionAdjust( const SwViewShell& ) const;
253 void ViewOptionAdjustStart( SwViewShell &rSh, const SwViewOption &rViewOptions);
254 void ViewOptionAdjust( SwPrintData const* const pPrtOptions, bool setShowPlaceHoldersInPDF );
257
258 bool HasSwPrtOptions() const { return m_pPrtOptions != nullptr; }
259 SwPrintData const* GetSwPrtOptions() const { return m_pPrtOptions.get(); }
260 void MakeSwPrtOptions( SwDocShell const*const pDocShell,
261 SwPrintUIOptions const*const pOpt, bool const bIsPDFExport );
262
263 typedef std::vector< std::pair< sal_Int32, sal_Int32 > > PagePairsVec_t;
264
267
270 std::map< sal_Int32, sal_Int32 >& GetPrinterPaperTrays() { return m_aPrinterPaperTrays; }
271 const std::map< sal_Int32, sal_Int32 >& GetPrinterPaperTrays() const { return m_aPrinterPaperTrays; }
272
276 std::vector< sal_Int32 > & GetPagesToPrint() { return m_aPagesToPrint; }
277 const std::vector< sal_Int32 > & GetPagesToPrint() const { return m_aPagesToPrint; }
278
282
283 const OUString& GetPageRange() const { return m_aPageRange; }
284 void SetPageRange( const OUString &rRange ) { m_aPageRange = rRange; }
285};
286
287namespace sw {
288
289void InitPrintOptionsFromApplication(SwPrintData & o_rData, bool const bWeb);
290
291}
292
293#endif // INCLUDED_SW_INC_PRINTDATA_HXX
294
295/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: doc.hxx:192
SwPostItMode GetPrintPostIts() const
Definition: printdata.hxx:145
void SetPrintReverse(bool b)
Definition: printdata.hxx:156
bool m_bPrintControl
Definition: printdata.hxx:58
bool IsPrintReverse() const
Definition: printdata.hxx:137
bool m_bPrintEmptyPages
Print empty pages.
Definition: printdata.hxx:66
bool m_bPrintTextPlaceholder
Definition: printdata.hxx:61
void SetPrintHiddenText(bool b)
Definition: printdata.hxx:166
void SetPrintTable(bool b)
Definition: printdata.hxx:151
bool IsPrintBlackFont() const
Definition: printdata.hxx:143
bool IsPrintLeftPage() const
Definition: printdata.hxx:135
virtual ~SwPrintData()
Definition: printdata.hxx:96
bool m_bPaperFromSetup
Definition: printdata.hxx:64
bool m_bPrintTable
Definition: printdata.hxx:58
void SetPrintRightPage(bool b)
Definition: printdata.hxx:155
void SetPrintBlackFont(bool b)
Definition: printdata.hxx:163
bool IsPrintProspect() const
Definition: printdata.hxx:140
bool m_bPrintProspect
Definition: printdata.hxx:62
void SetFaxName(const OUString &rSet)
Definition: printdata.hxx:165
void SetPrintLeftPage(bool b)
Definition: printdata.hxx:154
void SetPaperFromSetup(bool b)
Definition: printdata.hxx:157
bool m_bPrintBlackFont
Definition: printdata.hxx:59
void SetRenderData(const SwRenderData *pData)
Definition: printdata.hxx:129
bool IsPrintRightPage() const
Definition: printdata.hxx:136
SwPrintData(SwPrintData const &)=default
bool IsPrintControl() const
Definition: printdata.hxx:134
SwPrintData(SwPrintData &&)=default
OUString m_sFaxName
Definition: printdata.hxx:69
bool IsPrintTextPlaceholder() const
Definition: printdata.hxx:148
void SetPrintProspect_RTL(bool b)
Definition: printdata.hxx:161
virtual void doSetModified()
Definition: printdata.hxx:169
bool IsPaperFromSetup() const
Definition: printdata.hxx:138
bool m_bPrintReverse
Definition: printdata.hxx:62
void SetPrintDraw(bool b)
Definition: printdata.hxx:152
bool m_bPrintPageBackground
Definition: printdata.hxx:58
void SetPrintSingleJobs(bool b)
Definition: printdata.hxx:164
bool IsPrintProspectRTL() const
Definition: printdata.hxx:141
const SwRenderData * m_pRenderData
Definition: printdata.hxx:54
void SetPrintTextPlaceholder(bool b)
Definition: printdata.hxx:167
bool m_bPrintDraw
Definition: printdata.hxx:58
SwPrintData & operator=(SwPrintData const &)=default
void SetPrintGraphic(bool b)
Definition: printdata.hxx:150
bool operator==(const SwPrintData &rData) const
Definition: printdata.hxx:103
bool m_bPrintRightPages
Definition: printdata.hxx:62
bool IsPrintEmptyPages() const
Definition: printdata.hxx:139
bool m_bPrintLeftPages
Definition: printdata.hxx:62
void SetPrintControl(bool b)
Definition: printdata.hxx:153
bool IsPrintSingleJobs() const
Definition: printdata.hxx:144
void SetPrintPostIts(SwPostItMode n)
Definition: printdata.hxx:159
bool IsPrintGraphic() const
Definition: printdata.hxx:131
bool m_bPrintProspectRTL
Definition: printdata.hxx:63
void SetPrintProspect(bool b)
Definition: printdata.hxx:160
void SetPrintEmptyPages(bool b)
Definition: printdata.hxx:158
SwPostItMode m_nPrintPostIts
Definition: printdata.hxx:68
bool IsPrintDraw() const
Definition: printdata.hxx:133
bool IsPrintPageBackground() const
Definition: printdata.hxx:142
bool IsPrintHiddenText() const
Definition: printdata.hxx:147
void SetPrintPageBackground(bool b)
Definition: printdata.hxx:162
bool m_bPrintGraphic
Definition: printdata.hxx:58
const OUString & GetFaxName() const
Definition: printdata.hxx:146
bool m_bPrintSingleJobs
Definition: printdata.hxx:64
const SwRenderData & GetRenderData() const
Note: in the context where this class is used the pointers should always be valid during the lifetime...
Definition: printdata.hxx:128
bool IsPrintTable() const
Definition: printdata.hxx:132
bool m_bPrintHiddenText
Definition: printdata.hxx:61
virtual ~SwPrintUIOptions()
Definition: printdata.cxx:366
bool IsPrintLeftPages() const
Definition: printdata.cxx:370
bool processPropertiesAndCheckFormat(const css::uno::Sequence< css::beans::PropertyValue > &i_rNewProp)
Definition: printdata.cxx:425
SwPrintUIOptions(sal_uInt16 nCurrentPage, bool bWeb, bool bSwSrcView, bool bHasSelection, bool bHasPostIts, const SwPrintData &rDefaultPrintData)
Definition: printdata.cxx:155
const SwPrintData & m_rDefaultPrintData
Definition: printdata.hxx:175
bool IsPrintGraphics() const
Definition: printdata.cxx:405
bool IsPrintRightPages() const
Definition: printdata.cxx:384
bool IsPrintEmptyPages(bool bIsPDFExport) const
Definition: printdata.cxx:395
bool IsPrintFormControls() const
Definition: printdata.hxx:183
bool IsPrintHiddenText() const
Definition: printdata.hxx:188
bool IsPrintProspect() const
Definition: printdata.hxx:185
bool IsPrintDrawings() const
Definition: printdata.cxx:415
bool IsPrintTextPlaceholders() const
Definition: printdata.hxx:187
SwPostItMode GetPrintPostItsType() const
Definition: printdata.hxx:190
bool IsPaperFromSetup() const
Definition: printdata.hxx:191
VclPtr< OutputDevice > m_pLast
Definition: printdata.hxx:174
bool IsPrintPageBackground() const
Definition: printdata.hxx:184
bool IsPrintWithBlackTextColor() const
Definition: printdata.hxx:189
bool IsPrintProspectRTL() const
Definition: printdata.hxx:186
A class that stores temporary data that is needed for rendering the document.
Definition: printdata.hxx:204
const o3tl::sorted_vector< sal_Int32 > & GetValidPagesSet() const
Definition: printdata.hxx:266
void DeletePostItData()
Definition: printdata.cxx:64
bool IsViewOptionAdjust() const
Definition: printdata.hxx:251
void ViewOptionAdjust(SwPrintData const *const pPrtOptions, bool setShowPlaceHoldersInPDF)
Definition: printdata.cxx:99
PagePairsVec_t & GetPagePairsForProspectPrinting()
used for prospect printing only
Definition: printdata.hxx:280
const std::map< sal_Int32, sal_Int32 > & GetPrinterPaperTrays() const
Definition: printdata.hxx:271
bool HasPostItData() const
Definition: printdata.hxx:244
std::vector< sal_Int32 > m_aPagesToPrint
vector of pages and their order to be printed (duplicates and any order allowed!) (see 'render' in un...
Definition: printdata.hxx:215
o3tl::sorted_vector< sal_Int32 > m_aValidPages
pages valid for printing (according to the current settings) This set of pages does NOT depend on the...
Definition: printdata.hxx:207
std::unique_ptr< SetGetExpFields > m_pPostItFields
an array of "SetGetExpField *" sorted by page and line numbers
Definition: printdata.hxx:236
OUString m_aPageRange
Definition: printdata.hxx:221
SwPrintData const * GetSwPrtOptions() const
Definition: printdata.hxx:259
SfxObjectShellLock const & GetTempDocShell() const
Definition: printdata.hxx:248
const PagePairsVec_t & GetPagePairsForProspectPrinting() const
Definition: printdata.hxx:281
void SetPageRange(const OUString &rRange)
Definition: printdata.hxx:284
void ViewOptionAdjustStop()
Definition: printdata.cxx:104
std::map< sal_Int32, sal_Int32 > & GetPrinterPaperTrays()
a map for printer paper tray numbers to use for each document page a value of -1 for the tray means t...
Definition: printdata.hxx:270
void ViewOptionAdjustStart(SwViewShell &rSh, const SwViewOption &rViewOptions)
Definition: printdata.cxx:88
const std::vector< sal_Int32 > & GetPagesToPrint() const
Definition: printdata.hxx:277
std::vector< std::pair< sal_Int32, sal_Int32 > > m_aPagePairs
for prospect printing: the pairs of pages to be printed together on a single prospect page.
Definition: printdata.hxx:219
void CreatePostItData(SwDoc &rDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev)
Definition: printdata.cxx:49
bool HasSwPrtOptions() const
Definition: printdata.hxx:258
std::unique_ptr< SwPrintData > m_pPrtOptions
Definition: printdata.hxx:230
void SetTempDocShell(SfxObjectShellLock const &)
Definition: printdata.cxx:78
std::map< sal_Int32, sal_Int32 > m_aPrinterPaperTrays
printer paper tray to use for each of the m_aValidPages above
Definition: printdata.hxx:210
std::unique_ptr< SwViewShell > m_pPostItShell
this contains a SwDoc with the post-it content
Definition: printdata.hxx:238
void MakeSwPrtOptions(SwDocShell const *const pDocShell, SwPrintUIOptions const *const pOpt, bool const bIsPDFExport)
Definition: printdata.cxx:114
bool NeedNewViewOptionAdjust(const SwViewShell &) const
Definition: printdata.cxx:83
void ViewOptionAdjustCrashPreventionKludge()
Definition: printdata.cxx:109
std::vector< std::pair< sal_Int32, sal_Int32 > > PagePairsVec_t
Definition: printdata.hxx:263
o3tl::sorted_vector< sal_Int32 > & GetValidPagesSet()
Definition: printdata.hxx:265
std::unique_ptr< SwViewOptionAdjust_Impl > m_pViewOptionAdjust
the view options to be applied for printing
Definition: printdata.hxx:228
std::vector< sal_Int32 > & GetPagesToPrint()
used for 'normal' printing A page value of 0 as entry indicates that this page is not from the docume...
Definition: printdata.hxx:276
SfxObjectShellLock m_xTempDocShell
temp print document – must live longer than m_pViewOptionAdjust! also this is a Lock and not a Ref be...
Definition: printdata.hxx:225
const OUString & GetPageRange() const
Definition: printdata.hxx:283
bool getBoolValue(const OUString &i_rPropertyName, bool i_bDefault) const
sal_Int64 getIntValue(const OUString &i_rPropertyName, sal_Int64 i_nDefault) const
sal_Int64 n
std::unique_ptr< sal_Int32[]> pData
NONE
Dialog to specify the properties of date form field.
void InitPrintOptionsFromApplication(SwPrintData &o_rData, bool const bWeb)
Definition: view.cxx:1975
SwPostItMode
this must match the definitions in css::text::NotePrintMode
Definition: printdata.hxx:43
static SfxItemSet & rSet