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 <svl/intitem.hxx>
21 : #include <svx/dialogs.hrc>
22 : #include <svx/drawitem.hxx>
23 :
24 : #include "sdresid.hxx"
25 : #include "dlgpage.hxx"
26 :
27 : #include "DrawDocShell.hxx"
28 : #include <svl/aeitem.hxx>
29 : #include <svx/flagsdef.hxx>
30 : #include <svx/svxdlg.hxx>
31 : #include <editeng/svxenum.hxx>
32 :
33 : /**
34 : * Constructor of tab dialog: appends pages to the dialog
35 : */
36 0 : SdPageDlg::SdPageDlg( SfxObjectShell* pDocSh, vcl::Window* pParent, const SfxItemSet* pAttr, bool bAreaPage ) :
37 : SfxTabDialog ( pParent
38 : ,"DrawPageDialog"
39 : ,"modules/sdraw/ui/drawpagedialog.ui"
40 : , pAttr ),
41 0 : mpDocShell ( pDocSh )
42 : {
43 : SvxColorListItem aColorListItem(*static_cast<const SvxColorListItem*>(
44 0 : ( mpDocShell->GetItem( SID_COLOR_TABLE ) ) ) );
45 : SvxGradientListItem aGradientListItem(*static_cast<const SvxGradientListItem*>(
46 0 : ( mpDocShell->GetItem( SID_GRADIENT_LIST ) ) ) );
47 : SvxBitmapListItem aBitmapListItem(*static_cast<const SvxBitmapListItem*>(
48 0 : ( mpDocShell->GetItem( SID_BITMAP_LIST ) ) ) );
49 : SvxHatchListItem aHatchListItem(*static_cast<const SvxHatchListItem*>(
50 0 : ( mpDocShell->GetItem( SID_HATCH_LIST ) ) ) );
51 :
52 0 : mpColorList = aColorListItem.GetColorList();
53 0 : mpGradientList = aGradientListItem.GetGradientList();
54 0 : mpHatchingList = aHatchListItem.GetHatchList();
55 0 : mpBitmapList = aBitmapListItem.GetBitmapList();
56 :
57 0 : SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
58 : OSL_ENSURE(pFact, "Dialog creation failed!");
59 :
60 0 : mnPage = AddTabPage( "RID_SVXPAGE_PAGE", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), 0 );
61 0 : mnArea = AddTabPage( "RID_SVXPAGE_AREA", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), 0 );
62 :
63 0 : if(!bAreaPage) // I have to add the page before I remove it !
64 0 : RemoveTabPage( "RID_SVXPAGE_AREA" );
65 0 : }
66 :
67 0 : void SdPageDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
68 : {
69 0 : SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
70 0 : if (nId == mnPage)
71 : {
72 0 : aSet.Put (SfxAllEnumItem((const sal_uInt16)SID_ENUM_PAGE_MODE, SVX_PAGE_MODE_PRESENTATION));
73 0 : aSet.Put (SfxAllEnumItem((const sal_uInt16)SID_PAPER_START, PAPER_A0));
74 0 : aSet.Put (SfxAllEnumItem((const sal_uInt16)SID_PAPER_END, PAPER_E));
75 0 : rPage.PageCreated(aSet);
76 : }
77 0 : else if (nId == mnArea)
78 : {
79 0 : aSet.Put (SvxColorListItem(mpColorList,SID_COLOR_TABLE));
80 0 : aSet.Put (SvxGradientListItem(mpGradientList,SID_GRADIENT_LIST));
81 0 : aSet.Put (SvxHatchListItem(mpHatchingList,SID_HATCH_LIST));
82 0 : aSet.Put (SvxBitmapListItem(mpBitmapList,SID_BITMAP_LIST));
83 0 : aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,0));
84 0 : aSet.Put (SfxUInt16Item(SID_DLG_TYPE,1));
85 0 : aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,0));
86 0 : rPage.PageCreated(aSet);
87 0 : }
88 0 : }
89 :
90 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|