xref: /trunk/main/cui/source/tabpages/bbdlg.cxx (revision 56b35d86)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_cui.hxx"
26 
27 // include ---------------------------------------------------------------
28 #include <tools/shl.hxx>
29 #include <svx/dialogs.hrc>
30 #include <cuires.hrc>
31 #include "page.hrc"
32 
33 #include "bbdlg.hxx"
34 #include "border.hxx"
35 #include "backgrnd.hxx"
36 #include <dialmgr.hxx>
37 
38 //UUUU
39 #include "cuitabarea.hxx"
40 
41 // class SvxBorderBackgroundDlg ------------------------------------------
42 
SvxBorderBackgroundDlg(Window * pParent,const SfxItemSet & rCoreSet,bool bEnableSelector,bool bEnableDrawingLayerFillStyles)43 SvxBorderBackgroundDlg::SvxBorderBackgroundDlg(Window *pParent,
44     const SfxItemSet& rCoreSet,
45     bool bEnableSelector,
46     bool bEnableDrawingLayerFillStyles)
47 :   SfxTabDialog(
48         pParent,
49         CUI_RES(
50             bEnableDrawingLayerFillStyles ? RID_SVXDLG_BBDLG_AREA_TRANS : RID_SVXDLG_BBDLG_BACKGROUND),
51         &rCoreSet),
52     mbEnableBackgroundSelector(bEnableSelector),
53     mbEnableDrawingLayerFillStyles(bEnableDrawingLayerFillStyles)
54 {
55     FreeResource();
56     AddTabPage(RID_SVXPAGE_BORDER,SvxBorderTabPage::Create,0);
57 
58     if(mbEnableDrawingLayerFillStyles)
59     {
60         //UUUU Here we want full DrawingLayer FillStyle access, so add Area and Transparency TabPages
61         AddTabPage( RID_SVXPAGE_AREA, SvxAreaTabPage::Create, 0 );
62         AddTabPage( RID_SVXPAGE_TRANSPARENCE, SvxTransparenceTabPage::Create,  0);
63     }
64     else
65     {
66         //UUUU Use the more simple Background TabPage
67         AddTabPage(RID_SVXPAGE_BACKGROUND, SvxBackgroundTabPage::Create, 0);
68     }
69 }
70 
71 // -----------------------------------------------------------------------
72 
~SvxBorderBackgroundDlg()73 SvxBorderBackgroundDlg::~SvxBorderBackgroundDlg()
74 {
75 }
76 
77 // -----------------------------------------------------------------------
78 
PageCreated(sal_uInt16 nPageId,SfxTabPage & rTabPage)79 void SvxBorderBackgroundDlg::PageCreated(sal_uInt16 nPageId, SfxTabPage& rTabPage)
80 {
81     switch(nPageId)
82     {
83         case RID_SVXPAGE_BACKGROUND:
84         {
85             // allow switching between Color/graphic
86             if(mbEnableBackgroundSelector)
87             {
88                 static_cast< SvxBackgroundTabPage& >(rTabPage).ShowSelector();
89             }
90             break;
91         }
92 
93         //UUUU inits for Area and Transparency TabPages
94         // The selection attribute lists (XPropertyList derivates, e.g. XColorList for
95         // the color table) need to be added as items (e.g. SvxColorTableItem) to make
96         // these pages find the needed attributes for fill style suggestions.
97         // These are added in SwDocStyleSheet::GetItemSet() for the SFX_STYLE_FAMILY_PARA on
98         // demand, but could also be directly added from the DrawModel.
99         case RID_SVXPAGE_AREA:
100         {
101             SfxItemSet aNew(
102                 *GetInputSetImpl()->GetPool(),
103                 SID_COLOR_TABLE, SID_BITMAP_LIST,
104                 SID_OFFER_IMPORT, SID_OFFER_IMPORT,
105                 0, 0);
106 
107             aNew.Put(*GetInputSetImpl());
108 
109             // add flag for direct graphic content selection
110             aNew.Put(SfxBoolItem(SID_OFFER_IMPORT, true));
111 
112             rTabPage.PageCreated(aNew);
113             break;
114         }
115         case RID_SVXPAGE_TRANSPARENCE:
116         {
117             rTabPage.PageCreated(*GetInputSetImpl());
118             break;
119         }
120     }
121 }
122 
123 //eof
124