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 : #include "wrtsh.hxx"
21 :
22 : #include "dbui.hrc"
23 : #include "dbui.hxx"
24 :
25 0 : PrintMonitor::PrintMonitor(vcl::Window *pParent, bool modal, PrintMonitorType eType )
26 : : CancelableDialog(pParent, modal, "PrintMonitorDialog",
27 0 : "modules/swriter/ui/printmonitordialog.ui")
28 : {
29 0 : get(m_pDocName, "docname");
30 0 : get(m_pPrinter, "printer");
31 0 : get(m_pPrintInfo, "printinfo");
32 0 : switch (eType)
33 : {
34 : case MONITOR_TYPE_SAVE:
35 0 : SetText(get<FixedText>("alttitle")->GetText());
36 0 : get(m_pPrinting, "saving");
37 0 : break;
38 : case MONITOR_TYPE_PRINT:
39 0 : get(m_pPrinting, "printing");
40 0 : break;
41 : }
42 0 : m_pPrinting->Show();
43 0 : }
44 :
45 0 : PrintMonitor::~PrintMonitor()
46 : {
47 0 : disposeOnce();
48 0 : }
49 :
50 0 : void PrintMonitor::dispose()
51 : {
52 0 : m_pDocName.clear();
53 0 : m_pPrinting.clear();
54 0 : m_pPrinter.clear();
55 0 : m_pPrintInfo.clear();
56 :
57 0 : CancelableDialog::dispose();
58 0 : }
59 :
60 : // Progress Indicator for Creation of personalized Mail Merge documents:
61 0 : CreateMonitor::CreateMonitor( vcl::Window *pParent, bool modal )
62 : : CancelableDialog(pParent, modal, "MMCreatingDialog",
63 : "modules/swriter/ui/mmcreatingdialog.ui")
64 : , m_sCountingPattern()
65 : , m_sVariable_Total("%Y")
66 : , m_sVariable_Position("%X")
67 : , m_nTotalCount(0)
68 0 : , m_nCurrentPosition(0)
69 : {
70 0 : get(m_pCounting, "progress");
71 0 : m_sCountingPattern = m_pCounting->GetText();
72 0 : m_pCounting->SetText("...");
73 0 : }
74 :
75 0 : CreateMonitor::~CreateMonitor()
76 : {
77 0 : disposeOnce();
78 0 : }
79 :
80 0 : void CreateMonitor::dispose()
81 : {
82 0 : m_pCancelButton.clear();
83 0 : m_pCounting.clear();
84 :
85 0 : CancelableDialog::dispose();
86 0 : }
87 :
88 0 : void CreateMonitor::UpdateCountingText()
89 : {
90 0 : OUString sText(m_sCountingPattern);
91 0 : sText = sText.replaceAll( m_sVariable_Total, OUString::number( m_nTotalCount ) );
92 0 : sText = sText.replaceAll( m_sVariable_Position, OUString::number( m_nCurrentPosition ) );
93 0 : m_pCounting->SetText(sText);
94 0 : }
95 :
96 0 : void CreateMonitor::SetTotalCount( sal_Int32 nTotal )
97 : {
98 0 : m_nTotalCount = nTotal;
99 0 : UpdateCountingText();
100 0 : }
101 :
102 0 : void CreateMonitor::SetCurrentPosition( sal_Int32 nCurrent )
103 : {
104 0 : m_nCurrentPosition = nCurrent;
105 0 : UpdateCountingText();
106 0 : }
107 :
108 0 : CancelableDialog::CancelableDialog( vcl::Window *pParent, bool modal,
109 : const OUString& rID, const OUString& rUIXMLDescription )
110 : : Dialog( pParent , rID, rUIXMLDescription,
111 : modal ? WINDOW_MODALDIALOG : WINDOW_MODELESSDIALOG )
112 0 : , mbModal( modal )
113 : {
114 0 : get(m_pCancelButton, "cancel");
115 0 : }
116 :
117 0 : CancelableDialog::~CancelableDialog()
118 : {
119 0 : disposeOnce();
120 0 : }
121 :
122 0 : void CancelableDialog::dispose()
123 : {
124 0 : EndDialog( 0 );
125 0 : m_pCancelButton.clear();
126 :
127 0 : Dialog::dispose();
128 0 : }
129 :
130 0 : void CancelableDialog::SetCancelHdl( const Link<>& rLink )
131 : {
132 0 : m_pCancelButton->SetClickHdl( rLink );
133 0 : }
134 :
135 0 : void CancelableDialog::Show()
136 : {
137 0 : if (mbModal)
138 0 : StartExecuteModal( Link<>() );
139 : else
140 0 : Dialog::Show();
141 177 : }
142 :
143 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|