LibreOffice Module sd (master) 1
masterlayoutdlg.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 <masterlayoutdlg.hxx>
21#include <drawdoc.hxx>
22#include <sdpage.hxx>
23#include <osl/diagnose.h>
24
25using namespace ::sd;
26
27MasterLayoutDialog::MasterLayoutDialog(weld::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage)
28 : GenericDialogController(pParent, "modules/simpress/ui/masterlayoutdlg.ui", "MasterLayoutDialog")
29 , mpDoc(pDoc)
30 , mpCurrentPage(pCurrentPage)
31 , mxCBDate(m_xBuilder->weld_check_button("datetime"))
32 , mxCBPageNumber(m_xBuilder->weld_check_button("pagenumber"))
33 , mxCBSlideNumber(m_xBuilder->weld_check_button("slidenumber"))
34 , mxCBHeader(m_xBuilder->weld_check_button("header"))
35 , mxCBFooter(m_xBuilder->weld_check_button("footer"))
36{
38 {
40 }
41
42 if( mpCurrentPage == nullptr )
43 {
45 OSL_FAIL( "MasterLayoutDialog::MasterLayoutDialog() - no current page?" );
46 }
47
48 switch( mpCurrentPage->GetPageKind() )
49 {
51 {
52 mxCBHeader->set_sensitive(false);
53 mxCBPageNumber->set_label(mxCBSlideNumber->get_label());
54 break;
55 }
56 case PageKind::Notes:
57 break;
59 break;
60 }
61
66
67 mxCBHeader->set_active( mbOldHeader );
68 mxCBDate->set_active( mbOldDate );
69 mxCBFooter->set_active( mbOldFooter );
70 mxCBPageNumber->set_active( mbOldPageNumber );
71}
72
74{
75}
76
78{
79 if (GenericDialogController::run() == RET_OK)
81 return RET_OK;
82}
83
85{
86 mpDoc->BegUndo(m_xDialog->get_title());
87
88 if( (mpCurrentPage->GetPageKind() != PageKind::Standard) && (mbOldHeader != mxCBHeader->get_active() ) )
89 {
90 if( mbOldHeader )
92 else
94 }
95
96 if( mbOldFooter != mxCBFooter->get_active() )
97 {
98 if( mbOldFooter )
100 else
102 }
103
104 if( mbOldDate != mxCBDate->get_active() )
105 {
106 if( mbOldDate )
108 else
110 }
111
112 if( mbOldPageNumber != mxCBPageNumber->get_active() )
113 {
114 if( mbOldPageNumber )
116 else
118 }
119
120 mpDoc->EndUndo();
121}
122
124{
126}
127
129{
131}
132
133/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SdPage * GetMasterSdPage(sal_uInt16 nPgNum, PageKind ePgKind)
Definition: drawdoc2.cxx:217
SdrObject * GetPresObj(PresObjKind eObjKind, int nIndex=1, bool bFuzzySearch=false)
returns the nIndex'th object from the given PresObjKind, index starts with 1
Definition: sdpage.cxx:203
PageKind GetPageKind() const
Definition: sdpage.hxx:205
rtl::Reference< SdrObject > CreateDefaultPresObj(PresObjKind eObjKind)
Definition: sdpage.cxx:970
void DestroyDefaultPresObj(PresObjKind eObjKind)
Definition: sdpage.cxx:1055
void BegUndo()
void EndUndo()
SdrPage & TRG_GetMasterPage() const
bool IsMasterPage() const
std::unique_ptr< weld::CheckButton > mxCBHeader
void remove(PresObjKind eKind)
std::unique_ptr< weld::CheckButton > mxCBSlideNumber
SdDrawDocument * mpDoc
void create(PresObjKind eKind)
virtual short run() override
virtual ~MasterLayoutDialog() override
std::unique_ptr< weld::CheckButton > mxCBDate
std::unique_ptr< weld::CheckButton > mxCBFooter
std::unique_ptr< weld::CheckButton > mxCBPageNumber
std::shared_ptr< weld::Dialog > m_xDialog
PresObjKind
Definition: pres.hxx:22
RET_OK