1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #include <sfx2/basedlgs.hxx>
21 #include <dstribut.hxx>
22 #include <svx/dialogs.hrc>
23 #include <svx/svddef.hxx>
25 /*************************************************************************
29 \************************************************************************/
31 SvxDistributeDialog::SvxDistributeDialog(weld::Window
* pParent
,
32 const SfxItemSet
& rInAttrs
, SvxDistributeHorizontal eHor
,
33 SvxDistributeVertical eVer
)
34 : SfxSingleTabDialogController(pParent
, &rInAttrs
, "cui/ui/distributiondialog.ui",
37 TabPageParent
pPageParent(get_content_area(), this);
38 mpPage
= VclPtr
<SvxDistributePage
>::Create(pPageParent
, rInAttrs
, eHor
, eVer
);
42 SvxDistributeDialog::~SvxDistributeDialog()
46 /*************************************************************************
50 \************************************************************************/
52 SvxDistributePage::SvxDistributePage(TabPageParent pWindow
,
53 const SfxItemSet
& rInAttrs
, SvxDistributeHorizontal eHor
,
54 SvxDistributeVertical eVer
)
55 : SfxTabPage(pWindow
, "cui/ui/distributionpage.ui", "DistributionPage",
57 , m_eDistributeHor(eHor
)
58 , m_eDistributeVer(eVer
)
59 , m_xBtnHorNone(m_xBuilder
->weld_radio_button("hornone"))
60 , m_xBtnHorLeft(m_xBuilder
->weld_radio_button("horleft"))
61 , m_xBtnHorCenter(m_xBuilder
->weld_radio_button("horcenter"))
62 , m_xBtnHorDistance(m_xBuilder
->weld_radio_button("hordistance"))
63 , m_xBtnHorRight(m_xBuilder
->weld_radio_button("horright"))
64 , m_xBtnVerNone(m_xBuilder
->weld_radio_button("vernone"))
65 , m_xBtnVerTop(m_xBuilder
->weld_radio_button("vertop"))
66 , m_xBtnVerCenter(m_xBuilder
->weld_radio_button("vercenter"))
67 , m_xBtnVerDistance(m_xBuilder
->weld_radio_button("verdistance"))
68 , m_xBtnVerBottom(m_xBuilder
->weld_radio_button("verbottom"))
72 SvxDistributePage::~SvxDistributePage()
76 /*************************************************************************
78 |* read the delivered Item-Set
80 \************************************************************************/
82 void SvxDistributePage::Reset(const SfxItemSet
* )
84 m_xBtnHorNone
->set_active(false);
85 m_xBtnHorLeft
->set_active(false);
86 m_xBtnHorCenter
->set_active(false);
87 m_xBtnHorDistance
->set_active(false);
88 m_xBtnHorRight
->set_active(false);
90 switch(m_eDistributeHor
)
92 case SvxDistributeHorizontal::NONE
: m_xBtnHorNone
->set_active(true); break;
93 case SvxDistributeHorizontal::Left
: m_xBtnHorLeft
->set_active(true); break;
94 case SvxDistributeHorizontal::Center
: m_xBtnHorCenter
->set_active(true); break;
95 case SvxDistributeHorizontal::Distance
: m_xBtnHorDistance
->set_active(true); break;
96 case SvxDistributeHorizontal::Right
: m_xBtnHorRight
->set_active(true); break;
99 m_xBtnVerNone
->set_active(false);
100 m_xBtnVerTop
->set_active(false);
101 m_xBtnVerCenter
->set_active(false);
102 m_xBtnVerDistance
->set_active(false);
103 m_xBtnVerBottom
->set_active(false);
105 switch(m_eDistributeVer
)
107 case SvxDistributeVertical::NONE
: m_xBtnVerNone
->set_active(true); break;
108 case SvxDistributeVertical::Top
: m_xBtnVerTop
->set_active(true); break;
109 case SvxDistributeVertical::Center
: m_xBtnVerCenter
->set_active(true); break;
110 case SvxDistributeVertical::Distance
: m_xBtnVerDistance
->set_active(true); break;
111 case SvxDistributeVertical::Bottom
: m_xBtnVerBottom
->set_active(true); break;
115 /*************************************************************************
117 |* Fill the delivered Item-Set with dialogbox-attributes
119 \************************************************************************/
121 bool SvxDistributePage::FillItemSet( SfxItemSet
* )
123 SvxDistributeHorizontal
eDistributeHor(SvxDistributeHorizontal::NONE
);
124 SvxDistributeVertical
eDistributeVer(SvxDistributeVertical::NONE
);
126 if(m_xBtnHorLeft
->get_active())
127 eDistributeHor
= SvxDistributeHorizontal::Left
;
128 else if(m_xBtnHorCenter
->get_active())
129 eDistributeHor
= SvxDistributeHorizontal::Center
;
130 else if(m_xBtnHorDistance
->get_active())
131 eDistributeHor
= SvxDistributeHorizontal::Distance
;
132 else if(m_xBtnHorRight
->get_active())
133 eDistributeHor
= SvxDistributeHorizontal::Right
;
135 if(m_xBtnVerTop
->get_active())
136 eDistributeVer
= SvxDistributeVertical::Top
;
137 else if(m_xBtnVerCenter
->get_active())
138 eDistributeVer
= SvxDistributeVertical::Center
;
139 else if(m_xBtnVerDistance
->get_active())
140 eDistributeVer
= SvxDistributeVertical::Distance
;
141 else if(m_xBtnVerBottom
->get_active())
142 eDistributeVer
= SvxDistributeVertical::Bottom
;
144 if(eDistributeHor
!= m_eDistributeHor
|| eDistributeVer
!= m_eDistributeVer
)
146 m_eDistributeHor
= eDistributeHor
;
147 m_eDistributeVer
= eDistributeVer
;
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */