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(Window *pParent, PrintMonitorType eType )
26 : : ModelessDialog(pParent, "PrintMonitorDialog",
27 0 : "modules/swriter/ui/printmonitordialog.ui")
28 : {
29 0 : get(m_pCancel, "cancel");
30 0 : get(m_pDocName, "docname");
31 0 : get(m_pPrinter, "printer");
32 0 : get(m_pPrintInfo, "printinfo");
33 0 : switch (eType)
34 : {
35 : case MONITOR_TYPE_SAVE:
36 0 : SetText(get<FixedText>("alttitle")->GetText());
37 0 : get(m_pPrinting, "saving");
38 0 : break;
39 : case MONITOR_TYPE_PRINT:
40 0 : get(m_pPrinting, "printing");
41 0 : break;
42 : }
43 0 : m_pPrinting->Show();
44 0 : }
45 :
46 : // Progress Indicator for Creation of personalized Mail Merge documents:
47 0 : CreateMonitor::CreateMonitor( Window *pParent )
48 : : ModelessDialog(pParent, "MMCreatingDialog",
49 : "modules/swriter/ui/mmcreatingdialog.ui")
50 : , m_sCountingPattern()
51 : , m_sVariable_Total("%Y")
52 : , m_sVariable_Position("%X")
53 : , m_nTotalCount(0)
54 0 : , m_nCurrentPosition(0)
55 : {
56 0 : get(m_pCancelButton, "cancel");
57 0 : get(m_pCounting, "progress");
58 0 : m_sCountingPattern = m_pCounting->GetText();
59 0 : m_pCounting->SetText("...");
60 0 : }
61 :
62 0 : void CreateMonitor::UpdateCountingText()
63 : {
64 0 : OUString sText(m_sCountingPattern);
65 0 : sText = sText.replaceAll( m_sVariable_Total, OUString::number( m_nTotalCount ) );
66 0 : sText = sText.replaceAll( m_sVariable_Position, OUString::number( m_nCurrentPosition ) );
67 0 : m_pCounting->SetText(sText);
68 0 : }
69 :
70 0 : void CreateMonitor::SetTotalCount( sal_Int32 nTotal )
71 : {
72 0 : m_nTotalCount = nTotal;
73 0 : UpdateCountingText();
74 0 : }
75 :
76 0 : void CreateMonitor::SetCurrentPosition( sal_Int32 nCurrent )
77 : {
78 0 : m_nCurrentPosition = nCurrent;
79 0 : UpdateCountingText();
80 0 : }
81 :
82 0 : void CreateMonitor::SetCancelHdl( const Link& rLink )
83 : {
84 0 : m_pCancelButton->SetClickHdl( rLink );
85 0 : }
86 :
87 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|