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, PrintMonitorType eType )
26 : : CancelableModelessDialog(pParent, "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 : // Progress Indicator for Creation of personalized Mail Merge documents:
46 0 : CreateMonitor::CreateMonitor( vcl::Window *pParent )
47 : : CancelableModelessDialog(pParent, "MMCreatingDialog",
48 : "modules/swriter/ui/mmcreatingdialog.ui")
49 : , m_sCountingPattern()
50 : , m_sVariable_Total("%Y")
51 : , m_sVariable_Position("%X")
52 : , m_nTotalCount(0)
53 0 : , m_nCurrentPosition(0)
54 : {
55 0 : get(m_pCounting, "progress");
56 0 : m_sCountingPattern = m_pCounting->GetText();
57 0 : m_pCounting->SetText("...");
58 0 : }
59 :
60 0 : void CreateMonitor::UpdateCountingText()
61 : {
62 0 : OUString sText(m_sCountingPattern);
63 0 : sText = sText.replaceAll( m_sVariable_Total, OUString::number( m_nTotalCount ) );
64 0 : sText = sText.replaceAll( m_sVariable_Position, OUString::number( m_nCurrentPosition ) );
65 0 : m_pCounting->SetText(sText);
66 0 : }
67 :
68 0 : void CreateMonitor::SetTotalCount( sal_Int32 nTotal )
69 : {
70 0 : m_nTotalCount = nTotal;
71 0 : UpdateCountingText();
72 0 : }
73 :
74 0 : void CreateMonitor::SetCurrentPosition( sal_Int32 nCurrent )
75 : {
76 0 : m_nCurrentPosition = nCurrent;
77 0 : UpdateCountingText();
78 0 : }
79 :
80 0 : CancelableModelessDialog::CancelableModelessDialog( vcl::Window *pParent,
81 : const OString& rID, const OUString& rUIXMLDescription )
82 0 : : ModelessDialog( pParent , rID, rUIXMLDescription )
83 : {
84 0 : get(m_pCancelButton, "cancel");
85 0 : }
86 :
87 0 : void CancelableModelessDialog::SetCancelHdl( const Link& rLink )
88 : {
89 0 : m_pCancelButton->SetClickHdl( rLink );
90 270 : }
91 :
92 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|