LibreOffice Module sd (master) 1
prntopts.cxx
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#include <sdattr.hrc>
21#include <optsitem.hxx>
22#include <prntopts.hxx>
23#include <app.hrc>
24#include <svl/intitem.hxx>
25
30 : SfxTabPage(pPage, pController, "modules/simpress/ui/prntopts.ui", "prntopts", &rInAttrs)
31 , m_xFrmContent(m_xBuilder->weld_frame("contentframe"))
32 , m_xCbxDraw(m_xBuilder->weld_check_button("drawingcb"))
33 , m_xCbxNotes(m_xBuilder->weld_check_button("notecb"))
34 , m_xCbxHandout(m_xBuilder->weld_check_button("handoutcb"))
35 , m_xCbxOutline(m_xBuilder->weld_check_button("outlinecb"))
36 , m_xRbtColor(m_xBuilder->weld_radio_button("defaultrb"))
37 , m_xRbtGrayscale(m_xBuilder->weld_radio_button("grayscalerb"))
38 , m_xRbtBlackWhite(m_xBuilder->weld_radio_button("blackwhiterb"))
39 , m_xCbxPagename(m_xBuilder->weld_check_button("pagenmcb"))
40 , m_xCbxDate(m_xBuilder->weld_check_button("datecb"))
41 , m_xCbxTime(m_xBuilder->weld_check_button("timecb"))
42 , m_xCbxHiddenPages(m_xBuilder->weld_check_button("hiddenpgcb"))
43 , m_xRbtDefault(m_xBuilder->weld_radio_button("pagedefaultrb"))
44 , m_xRbtPagesize(m_xBuilder->weld_radio_button("fittopgrb"))
45 , m_xRbtPagetile(m_xBuilder->weld_radio_button("tilepgrb"))
46 , m_xRbtBooklet(m_xBuilder->weld_radio_button("brouchrb"))
47 , m_xCbxFront(m_xBuilder->weld_check_button("frontcb"))
48 , m_xCbxBack(m_xBuilder->weld_check_button("backcb"))
49 , m_xCbxPaperbin(m_xBuilder->weld_check_button("papertryfrmprntrcb"))
50{
51 Link<weld::Toggleable&,void> aLink = LINK( this, SdPrintOptions, ClickBookletHdl );
52 m_xRbtDefault->connect_toggled( aLink );
53 m_xRbtPagesize->connect_toggled( aLink );
54 m_xRbtPagetile->connect_toggled( aLink );
55 m_xRbtBooklet->connect_toggled( aLink );
56
57 aLink = LINK( this, SdPrintOptions, ClickCheckboxHdl );
58 m_xCbxDraw->connect_toggled( aLink );
59 m_xCbxNotes->connect_toggled( aLink );
60 m_xCbxHandout->connect_toggled( aLink );
61 m_xCbxOutline->connect_toggled( aLink );
62
63#ifndef MACOSX
65#endif
66}
67
69{
70}
71
73{
74 if( m_xCbxDraw->get_state_changed_from_saved() ||
75 m_xCbxNotes->get_state_changed_from_saved() ||
76 m_xCbxHandout->get_state_changed_from_saved() ||
77 m_xCbxOutline->get_state_changed_from_saved() ||
78 m_xCbxDate->get_state_changed_from_saved() ||
79 m_xCbxTime->get_state_changed_from_saved() ||
80 m_xCbxPagename->get_state_changed_from_saved() ||
81 m_xCbxHiddenPages->get_state_changed_from_saved() ||
82 m_xRbtPagesize->get_state_changed_from_saved() ||
83 m_xRbtPagetile->get_state_changed_from_saved() ||
84 m_xRbtBooklet->get_state_changed_from_saved() ||
85 m_xCbxFront->get_state_changed_from_saved() ||
86 m_xCbxBack->get_state_changed_from_saved() ||
87 m_xCbxPaperbin->get_state_changed_from_saved() ||
88 m_xRbtColor->get_state_changed_from_saved() ||
89 m_xRbtGrayscale->get_state_changed_from_saved()||
90 m_xRbtBlackWhite->get_state_changed_from_saved())
91 {
92 SdOptionsPrintItem aOptions;
93
94 aOptions.GetOptionsPrint().SetDraw( m_xCbxDraw->get_active() );
95 aOptions.GetOptionsPrint().SetNotes( m_xCbxNotes->get_active() );
96 aOptions.GetOptionsPrint().SetHandout( m_xCbxHandout->get_active() );
97 aOptions.GetOptionsPrint().SetOutline( m_xCbxOutline->get_active() );
98 aOptions.GetOptionsPrint().SetDate( m_xCbxDate->get_active() );
99 aOptions.GetOptionsPrint().SetTime( m_xCbxTime->get_active() );
100 aOptions.GetOptionsPrint().SetPagename( m_xCbxPagename->get_active() );
101 aOptions.GetOptionsPrint().SetHiddenPages( m_xCbxHiddenPages->get_active() );
102 aOptions.GetOptionsPrint().SetPagesize( m_xRbtPagesize->get_active() );
103 aOptions.GetOptionsPrint().SetPagetile( m_xRbtPagetile->get_active() );
104 aOptions.GetOptionsPrint().SetBooklet( m_xRbtBooklet->get_active() );
105 aOptions.GetOptionsPrint().SetFrontPage( m_xCbxFront->get_active() );
106 aOptions.GetOptionsPrint().SetBackPage( m_xCbxBack->get_active() );
107 aOptions.GetOptionsPrint().SetPaperbin( m_xCbxPaperbin->get_active() );
108
109 sal_uInt16 nQuality = 0; // Standard, also Color
110 if( m_xRbtGrayscale->get_active() )
111 nQuality = 1;
112 if( m_xRbtBlackWhite->get_active() )
113 nQuality = 2;
114 aOptions.GetOptionsPrint().SetOutputQuality( nQuality );
115
116 rAttrs->Put( aOptions );
117
118 return true;
119 }
120 return false;
121}
122
124{
125 const SdOptionsPrintItem* pPrintOpts = rAttrs->GetItemIfSet( ATTR_OPTIONS_PRINT, false);
126 if( pPrintOpts )
127 {
128 m_xCbxDraw->set_active( pPrintOpts->GetOptionsPrint().IsDraw() );
129 m_xCbxNotes->set_active( pPrintOpts->GetOptionsPrint().IsNotes() );
130 m_xCbxHandout->set_active( pPrintOpts->GetOptionsPrint().IsHandout() );
131 m_xCbxOutline->set_active( pPrintOpts->GetOptionsPrint().IsOutline() );
132 m_xCbxDate->set_active( pPrintOpts->GetOptionsPrint().IsDate() );
133 m_xCbxTime->set_active( pPrintOpts->GetOptionsPrint().IsTime() );
134 m_xCbxPagename->set_active( pPrintOpts->GetOptionsPrint().IsPagename() );
135 m_xCbxHiddenPages->set_active( pPrintOpts->GetOptionsPrint().IsHiddenPages() );
136 m_xRbtPagesize->set_active( pPrintOpts->GetOptionsPrint().IsPagesize() );
137 m_xRbtPagetile->set_active( pPrintOpts->GetOptionsPrint().IsPagetile() );
138 m_xRbtBooklet->set_active( pPrintOpts->GetOptionsPrint().IsBooklet() );
139 m_xCbxFront->set_active( pPrintOpts->GetOptionsPrint().IsFrontPage() );
140 m_xCbxBack->set_active( pPrintOpts->GetOptionsPrint().IsBackPage() );
141 m_xCbxPaperbin->set_active( pPrintOpts->GetOptionsPrint().IsPaperbin() );
142
143 if( !m_xRbtPagesize->get_active() &&
144 !m_xRbtPagetile->get_active() &&
145 !m_xRbtBooklet->get_active() )
146 {
147 m_xRbtDefault->set_active(true);
148 }
149
150 sal_uInt16 nQuality = pPrintOpts->GetOptionsPrint().GetOutputQuality();
151 if( nQuality == 0 )
152 m_xRbtColor->set_active(true);
153 else if( nQuality == 1 )
154 m_xRbtGrayscale->set_active(true);
155 else
156 m_xRbtBlackWhite->set_active(true);
157 }
158 m_xCbxDraw->save_state();
159 m_xCbxNotes->save_state();
160 m_xCbxHandout->save_state();
161 m_xCbxOutline->save_state();
162 m_xCbxDate->save_state();
163 m_xCbxTime->save_state();
164 m_xCbxPagename->save_state();
165 m_xCbxHiddenPages->save_state();
166 m_xRbtPagesize->save_state();
167 m_xRbtPagetile->save_state();
168 m_xRbtBooklet->save_state();
169 m_xCbxPaperbin->save_state();
170 m_xRbtColor->save_state();
171 m_xRbtGrayscale->save_state();
172 m_xRbtBlackWhite->save_state();
173
175}
176
177std::unique_ptr<SfxTabPage> SdPrintOptions::Create( weld::Container* pPage, weld::DialogController* pController,
178 const SfxItemSet* rOutAttrs )
179{
180 return std::make_unique<SdPrintOptions>( pPage, pController, *rOutAttrs );
181}
182
183IMPL_LINK(SdPrintOptions, ClickCheckboxHdl, weld::Toggleable&, rCbx, void)
184{
185 // there must be at least one of them checked
186 if( !m_xCbxDraw->get_active() && !m_xCbxNotes->get_active() && !m_xCbxOutline->get_active() && !m_xCbxHandout->get_active() )
187 rCbx.set_active(true);
188
189 updateControls();
190}
191
193{
194 updateControls();
195}
196
198{
199 m_xCbxFront->set_sensitive(m_xRbtBooklet->get_active());
200 m_xCbxBack->set_sensitive(m_xRbtBooklet->get_active());
201
202 m_xCbxDate->set_sensitive( !m_xRbtBooklet->get_active() );
203 m_xCbxTime->set_sensitive( !m_xRbtBooklet->get_active() );
204
205 m_xCbxPagename->set_sensitive( !m_xRbtBooklet->get_active() && (m_xCbxDraw->get_active() || m_xCbxNotes->get_active() || m_xCbxOutline->get_active()) );
206}
207
209{
210 if (m_xCbxNotes->get_visible())
211 {
212 m_xFrmContent->hide();
213 }
214}
215
217#ifdef MACOSX
218 aSet
219#endif
220 )
221{
222#ifdef MACOSX
223 const SfxUInt32Item* pFlagItem = aSet.GetItem<SfxUInt32Item>(SID_SDMODE_FLAG, false);
224 if (pFlagItem)
225 {
226 sal_uInt32 nFlags=pFlagItem->GetValue();
227 if ( ( nFlags & SD_DRAW_MODE ) == SD_DRAW_MODE )
228 SetDrawMode();
229 }
230#else
231 SetDrawMode();
232#endif
233}
234
235/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt32 GetValue() const
SdOptionsPrint & GetOptionsPrint()
Definition: optsitem.hxx:570
bool IsBooklet() const
Definition: optsitem.hxx:526
bool IsTime() const
Definition: optsitem.hxx:518
void SetPaperbin(bool bOn)
Definition: optsitem.hxx:552
bool IsDate() const
Definition: optsitem.hxx:517
bool IsNotes() const
Definition: optsitem.hxx:514
void SetNotes(bool bOn)
Definition: optsitem.hxx:536
void SetFrontPage(bool bOn)
Definition: optsitem.hxx:549
void SetDate(bool bOn)
Definition: optsitem.hxx:539
bool IsHandout() const
Definition: optsitem.hxx:515
void SetBackPage(bool bOn)
Definition: optsitem.hxx:550
void SetBooklet(bool bOn)
Definition: optsitem.hxx:548
void SetPagesize(bool bOn)
Definition: optsitem.hxx:543
void SetHiddenPages(bool bOn)
Definition: optsitem.hxx:542
bool IsOutline() const
Definition: optsitem.hxx:516
void SetDraw(bool bOn)
Definition: optsitem.hxx:535
bool IsFrontPage() const
Definition: optsitem.hxx:527
void SetTime(bool bOn)
Definition: optsitem.hxx:540
bool IsPagename() const
Definition: optsitem.hxx:519
void SetPagename(bool bOn)
Definition: optsitem.hxx:541
void SetOutline(bool bOn)
Definition: optsitem.hxx:538
bool IsPagetile() const
Definition: optsitem.hxx:522
void SetOutputQuality(sal_uInt16 nInQuality)
Definition: optsitem.hxx:553
bool IsPagesize() const
Definition: optsitem.hxx:521
void SetPagetile(bool bOn)
Definition: optsitem.hxx:544
bool IsPaperbin() const
Definition: optsitem.hxx:530
bool IsHiddenPages() const
Definition: optsitem.hxx:520
bool IsDraw() const
Definition: optsitem.hxx:513
void SetHandout(bool bOn)
Definition: optsitem.hxx:537
bool IsBackPage() const
Definition: optsitem.hxx:528
sal_uInt16 GetOutputQuality() const
Definition: optsitem.hxx:531
void updateControls()
Definition: prntopts.cxx:197
std::unique_ptr< weld::CheckButton > m_xCbxDraw
Definition: prntopts.hxx:30
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: prntopts.cxx:216
std::unique_ptr< weld::CheckButton > m_xCbxFront
Definition: prntopts.hxx:45
std::unique_ptr< weld::RadioButton > m_xRbtPagetile
Definition: prntopts.hxx:43
std::unique_ptr< weld::CheckButton > m_xCbxBack
Definition: prntopts.hxx:46
virtual ~SdPrintOptions() override
Definition: prntopts.cxx:68
std::unique_ptr< weld::CheckButton > m_xCbxDate
Definition: prntopts.hxx:38
std::unique_ptr< weld::RadioButton > m_xRbtPagesize
Definition: prntopts.hxx:42
virtual bool FillItemSet(SfxItemSet *) override
Definition: prntopts.cxx:72
std::unique_ptr< weld::RadioButton > m_xRbtDefault
Definition: prntopts.hxx:41
std::unique_ptr< weld::CheckButton > m_xCbxTime
Definition: prntopts.hxx:39
std::unique_ptr< weld::RadioButton > m_xRbtGrayscale
Definition: prntopts.hxx:35
virtual void Reset(const SfxItemSet *) override
Definition: prntopts.cxx:123
std::unique_ptr< weld::CheckButton > m_xCbxHandout
Definition: prntopts.hxx:32
std::unique_ptr< weld::CheckButton > m_xCbxPaperbin
Definition: prntopts.hxx:47
std::unique_ptr< weld::RadioButton > m_xRbtColor
Definition: prntopts.hxx:34
SdPrintOptions(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rInAttrs)
dialog to adjust print options
Definition: prntopts.cxx:29
std::unique_ptr< weld::CheckButton > m_xCbxNotes
Definition: prntopts.hxx:31
std::unique_ptr< weld::Frame > m_xFrmContent
Definition: prntopts.hxx:29
std::unique_ptr< weld::CheckButton > m_xCbxOutline
Definition: prntopts.hxx:33
std::unique_ptr< weld::CheckButton > m_xCbxPagename
Definition: prntopts.hxx:37
std::unique_ptr< weld::CheckButton > m_xCbxHiddenPages
Definition: prntopts.hxx:40
std::unique_ptr< weld::RadioButton > m_xRbtBooklet
Definition: prntopts.hxx:44
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
Definition: prntopts.cxx:177
void SetDrawMode()
Definition: prntopts.cxx:208
std::unique_ptr< weld::RadioButton > m_xRbtBlackWhite
Definition: prntopts.hxx:36
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
IMPL_LINK(SdPrintOptions, ClickCheckboxHdl, weld::Toggleable &, rCbx, void)
Definition: prntopts.cxx:183
IMPL_LINK_NOARG(SdPrintOptions, ClickBookletHdl, weld::Toggleable &, void)
Definition: prntopts.cxx:192