LibreOffice Module cui (master)  1
bbdlg.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 <bbdlg.hxx>
21 #include <border.hxx>
22 #include <backgrnd.hxx>
23 #include <svx/svxids.hrc>
24 #include <svl/intitem.hxx>
25 #include <cuitabarea.hxx>
26 
28  const SfxItemSet& rCoreSet,
29  bool bEnableSelector,
30  bool bEnableDrawingLayerFillStyles)
31  : SfxTabDialogController(pParent,
32  bEnableDrawingLayerFillStyles
33  ? OUString("cui/ui/borderareatransparencydialog.ui")
34  : OUString("cui/ui/borderbackgrounddialog.ui"),
35  bEnableDrawingLayerFillStyles
36  ? OString("BorderAreaTransparencyDialog")
37  : OString("BorderBackgroundDialog"),
38  &rCoreSet)
39  , mbEnableBackgroundSelector(bEnableSelector)
40 {
41  AddTabPage("borders", SvxBorderTabPage::Create, nullptr );
42  if (bEnableDrawingLayerFillStyles)
43  {
44  // Here we want full DrawingLayer FillStyle access, so add Area and Transparency TabPages
45  AddTabPage("area", SvxAreaTabPage::Create, nullptr);
46  AddTabPage("transparence", SvxTransparenceTabPage::Create, nullptr);
47  }
48  else
49  {
50  AddTabPage("background", SvxBkgTabPage::Create, nullptr );
51  }
52 }
53 
54 void SvxBorderBackgroundDlg::PageCreated(const OString& rPageId, SfxTabPage& rTabPage)
55 {
56  if (rPageId == "background")
57  {
58  SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
59  // allow switching between Color/graphic
61  aSet.Put(SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_SELECTOR)));
62  rTabPage.PageCreated(aSet);
63  }
64  // inits for Area and Transparency TabPages
65  // The selection attribute lists (XPropertyList derivates, e.g. XColorList for
66  // the color table) need to be added as items (e.g. SvxColorTableItem) to make
67  // these pages find the needed attributes for fill style suggestions.
68  // These are added in SwDocStyleSheet::GetItemSet() for the SfxStyleFamily::Para on
69  // demand, but could also be directly added from the DrawModel.
70  else if (rPageId == "area")
71  {
72  SfxItemSet aNew(
73  *GetInputSetImpl()->GetPool(),
74  svl::Items<SID_COLOR_TABLE, SID_PATTERN_LIST,
75  SID_OFFER_IMPORT, SID_OFFER_IMPORT>{});
76 
77  aNew.Put(*GetInputSetImpl());
78 
79  // add flag for direct graphic content selection
80  aNew.Put(SfxBoolItem(SID_OFFER_IMPORT, true));
81 
82  rTabPage.PageCreated(aNew);
83  }
84  else if (rPageId == "transparence")
85  {
86  rTabPage.PageCreated(*GetInputSetImpl());
87  }
88 }
89 
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvxBorderBackgroundDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, bool bEnableSelector, bool bEnableDrawingLayerFillStyles)
Definition: bbdlg.cxx:27
virtual void PageCreated(const SfxAllItemSet &aSet)
bool mbEnableBackgroundSelector
for Border/Background
Definition: bbdlg.hxx:39
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: border.cxx:547
SfxItemSet * GetInputSetImpl()
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
Definition: tptrans.cxx:247
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
Definition: backgrnd.cxx:1529
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
Definition: tparea.cxx:328
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
virtual void PageCreated(const OString &rPageId, SfxTabPage &rTabPage) override
Definition: bbdlg.cxx:54