Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / pagedlg / hfedtdlg.cxx
blobce777e84d7f15133ff4ca7035aec3df847c4b044
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #undef SC_DLLIMPLEMENTATION
25 //------------------------------------------------------------------
27 #include "scitems.hxx"
28 #include <svl/eitem.hxx>
30 #include "hfedtdlg.hxx"
31 #include "global.hxx"
32 #include "globstr.hrc"
33 #include "scresid.hxx"
34 #include "scuitphfedit.hxx"
35 //------------------------------------------------------------------
37 // macros from docsh4.cxx
38 //! use SIDs?
40 #define IS_SHARE_HEADER(set) \
41 ((SfxBoolItem&) \
42 ((SvxSetItem&)(set).Get(ATTR_PAGE_HEADERSET)).GetItemSet(). \
43 Get(ATTR_PAGE_SHARED)).GetValue()
45 #define IS_SHARE_FOOTER(set) \
46 ((SfxBoolItem&) \
47 ((SvxSetItem&)(set).Get(ATTR_PAGE_FOOTERSET)).GetItemSet(). \
48 Get(ATTR_PAGE_SHARED)).GetValue()
50 //==================================================================
52 ScHFEditDlg::ScHFEditDlg( SfxViewFrame* pFrameP,
53 Window* pParent,
54 const SfxItemSet& rCoreSet,
55 const OUString& rPageStyle,
56 const OString& rID, const OUString& rUIXMLDescription )
57 : SfxTabDialog( pFrameP, pParent, rID, rUIXMLDescription, &rCoreSet )
59 eNumType = ((const SvxPageItem&)rCoreSet.Get(ATTR_PAGE)).GetNumType();
61 OUString aTmp = GetText();
63 aTmp += " (" + ScGlobal::GetRscString( STR_PAGESTYLE ) + ": " + rPageStyle + ")";
65 SetText( aTmp );
68 ScHFEditHeaderDlg::ScHFEditHeaderDlg( SfxViewFrame* pFrameP,
69 Window* pParent,
70 const SfxItemSet& rCoreSet,
71 const OUString& rPageStyle)
72 : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
73 "HeaderDialog", "modules/scalc/ui/headerdialog.ui" )
75 AddTabPage( "headerright", ScRightHeaderEditPage::Create, NULL );
76 AddTabPage( "headerleft", ScLeftHeaderEditPage::Create, NULL );
79 ScHFEditFooterDlg::ScHFEditFooterDlg( SfxViewFrame* pFrameP,
80 Window* pParent,
81 const SfxItemSet& rCoreSet,
82 const OUString& rPageStyle)
83 : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
84 "FooterDialog", "modules/scalc/ui/footerdialog.ui" )
86 AddTabPage( "footerright", ScRightFooterEditPage::Create, NULL );
87 AddTabPage( "footerleft", ScLeftFooterEditPage::Create, NULL );
90 ScHFEditLeftHeaderDlg::ScHFEditLeftHeaderDlg( SfxViewFrame* pFrameP,
91 Window* pParent,
92 const SfxItemSet& rCoreSet,
93 const OUString& rPageStyle)
94 : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
95 "LeftHeaderDialog", "modules/scalc/ui/leftheaderdialog.ui" )
97 AddTabPage( "headerleft", ScLeftHeaderEditPage::Create, NULL );
100 ScHFEditRightHeaderDlg::ScHFEditRightHeaderDlg( SfxViewFrame* pFrameP,
101 Window* pParent,
102 const SfxItemSet& rCoreSet,
103 const OUString& rPageStyle)
104 : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
105 "RightHeaderDialog", "modules/scalc/ui/rightheaderdialog.ui" )
107 AddTabPage( "headerright", ScRightHeaderEditPage::Create, NULL );
110 ScHFEditLeftFooterDlg::ScHFEditLeftFooterDlg( SfxViewFrame* pFrameP,
111 Window* pParent,
112 const SfxItemSet& rCoreSet,
113 const OUString& rPageStyle)
114 : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
115 "LeftFooterDialog", "modules/scalc/ui/leftfooterdialog.ui" )
117 AddTabPage( "footerleft", ScLeftFooterEditPage::Create, NULL );
120 ScHFEditRightFooterDlg::ScHFEditRightFooterDlg( SfxViewFrame* pFrameP,
121 Window* pParent,
122 const SfxItemSet& rCoreSet,
123 const OUString& rPageStyle)
124 : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
125 "RightFooterDialog", "modules/scalc/ui/rightfooterdialog.ui" )
127 AddTabPage( "footerright", ScRightFooterEditPage::Create, NULL );
130 ScHFEditSharedHeaderDlg::ScHFEditSharedHeaderDlg( SfxViewFrame* pFrameP,
131 Window* pParent,
132 const SfxItemSet& rCoreSet,
133 const OUString& rPageStyle)
134 : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
135 "SharedHeaderDialog", "modules/scalc/ui/sharedheaderdialog.ui" )
137 AddTabPage( "header", ScRightHeaderEditPage::Create, NULL );
138 AddTabPage( "footerright", ScRightFooterEditPage::Create, NULL );
139 AddTabPage( "footerleft", ScLeftFooterEditPage::Create, NULL );
142 ScHFEditSharedFooterDlg::ScHFEditSharedFooterDlg( SfxViewFrame* pFrameP,
143 Window* pParent,
144 const SfxItemSet& rCoreSet,
145 const OUString& rPageStyle)
146 : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
147 "SharedFooterDialog", "modules/scalc/ui/sharedfooterdialog.ui" )
149 AddTabPage( "headerright", ScRightHeaderEditPage::Create, NULL );
150 AddTabPage( "headerleft", ScLeftHeaderEditPage::Create, NULL );
151 AddTabPage( "footer", ScRightFooterEditPage::Create, NULL );
154 ScHFEditAllDlg::ScHFEditAllDlg( SfxViewFrame* pFrameP,
155 Window* pParent,
156 const SfxItemSet& rCoreSet,
157 const OUString& rPageStyle)
158 : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
159 "AllHeaderFooterDialog", "modules/scalc/ui/allheaderfooterdialog.ui" )
161 AddTabPage( "headerright", ScRightHeaderEditPage::Create, NULL );
162 AddTabPage( "headerleft", ScLeftHeaderEditPage::Create, NULL );
163 AddTabPage( "footerright", ScRightFooterEditPage::Create, NULL );
164 AddTabPage( "footerleft", ScLeftFooterEditPage::Create, NULL );
167 ScHFEditActiveDlg::ScHFEditActiveDlg( SfxViewFrame* pFrameP,
168 Window* pParent,
169 const SfxItemSet& rCoreSet,
170 const OUString& rPageStyle)
171 : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
172 "HeaderFooterDialog", "modules/scalc/ui/headerfooterdialog.ui" )
174 const SvxPageItem& rPageItem = (const SvxPageItem&)
175 rCoreSet.Get(
176 rCoreSet.GetPool()->GetWhich(SID_ATTR_PAGE) );
178 sal_Bool bRightPage = ( SVX_PAGE_LEFT !=
179 SvxPageUsage(rPageItem.GetPageUsage()) );
181 if ( bRightPage )
183 AddTabPage( "header", ScRightHeaderEditPage::Create, NULL );
184 AddTabPage( "footer", ScRightFooterEditPage::Create, NULL );
186 else
188 // #69193a# respect "shared" setting
190 sal_Bool bShareHeader = IS_SHARE_HEADER(rCoreSet);
191 if ( bShareHeader )
192 AddTabPage( "header", ScRightHeaderEditPage::Create, NULL );
193 else
194 AddTabPage( "header", ScLeftHeaderEditPage::Create, NULL );
196 sal_Bool bShareFooter = IS_SHARE_FOOTER(rCoreSet);
197 if ( bShareFooter )
198 AddTabPage( "footer", ScRightFooterEditPage::Create, NULL );
199 else
200 AddTabPage( "footer", ScLeftFooterEditPage::Create, NULL );
204 // -----------------------------------------------------------------------
206 void ScHFEditDlg::PageCreated( sal_uInt16 /* nId */, SfxTabPage& rPage )
208 // kann ja nur ne ScHFEditPage sein...
210 ((ScHFEditPage&)rPage).SetNumType(eNumType);
216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */