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>
22 #include "dstribut.hxx"
23 #include <svx/dialogs.hrc>
24 #include <svx/svddef.hxx>
25 #include <dialmgr.hxx>
26 #include <tools/shl.hxx>
28 /*************************************************************************
32 \************************************************************************/
34 SvxDistributeDialog::SvxDistributeDialog(Window
* pParent
,
35 const SfxItemSet
& rInAttrs
, SvxDistributeHorizontal eHor
,
36 SvxDistributeVertical eVer
)
37 : SfxSingleTabDialog(pParent
, rInAttrs
, "DistributionDialog",
38 "cui/ui/distributiondialog.ui")
41 mpPage
= new SvxDistributePage(get_content_area(), rInAttrs
, eHor
, eVer
);
45 /*************************************************************************
49 \************************************************************************/
51 SvxDistributePage::SvxDistributePage(Window
* pWindow
,
52 const SfxItemSet
& rInAttrs
, SvxDistributeHorizontal eHor
,
53 SvxDistributeVertical eVer
)
54 : SvxTabPage(pWindow
, "DistributionPage", "cui/ui/distributionpage.ui",
56 , m_eDistributeHor(eHor
)
57 , m_eDistributeVer(eVer
)
59 get(m_pBtnHorNone
, "hornone");
60 get(m_pBtnHorLeft
, "horleft");
61 get(m_pBtnHorCenter
, "horcenter");
62 get(m_pBtnHorDistance
, "hordistance");
63 get(m_pBtnHorRight
, "horright");
65 get(m_pBtnVerNone
, "vernone");
66 get(m_pBtnVerTop
, "vertop");
67 get(m_pBtnVerCenter
, "vercenter");
68 get(m_pBtnVerDistance
, "verdistance");
69 get(m_pBtnVerBottom
, "verbottom");
72 /*************************************************************************
76 \************************************************************************/
78 SfxTabPage
* SvxDistributePage::Create(Window
* pWindow
, const SfxItemSet
& rAttrs
,
79 SvxDistributeHorizontal eHor
, SvxDistributeVertical eVer
)
81 return new SvxDistributePage(pWindow
, rAttrs
, eHor
, eVer
);
84 void SvxDistributePage::PointChanged(Window
* /*pWindow*/, RECT_POINT
/*eRP*/)
88 /*************************************************************************
90 |* read the delivered Item-Set
92 \************************************************************************/
94 void SvxDistributePage::Reset(const SfxItemSet
& )
96 m_pBtnHorNone
->SetState(false);
97 m_pBtnHorLeft
->SetState(false);
98 m_pBtnHorCenter
->SetState(false);
99 m_pBtnHorDistance
->SetState(false);
100 m_pBtnHorRight
->SetState(false);
102 switch(m_eDistributeHor
)
104 case SvxDistributeHorizontalNone
: m_pBtnHorNone
->SetState(true); break;
105 case SvxDistributeHorizontalLeft
: m_pBtnHorLeft
->SetState(true); break;
106 case SvxDistributeHorizontalCenter
: m_pBtnHorCenter
->SetState(true); break;
107 case SvxDistributeHorizontalDistance
: m_pBtnHorDistance
->SetState(true); break;
108 case SvxDistributeHorizontalRight
: m_pBtnHorRight
->SetState(true); break;
111 m_pBtnVerNone
->SetState(false);
112 m_pBtnVerTop
->SetState(false);
113 m_pBtnVerCenter
->SetState(false);
114 m_pBtnVerDistance
->SetState(false);
115 m_pBtnVerBottom
->SetState(false);
117 switch(m_eDistributeVer
)
119 case SvxDistributeVerticalNone
: m_pBtnVerNone
->SetState(true); break;
120 case SvxDistributeVerticalTop
: m_pBtnVerTop
->SetState(true); break;
121 case SvxDistributeVerticalCenter
: m_pBtnVerCenter
->SetState(true); break;
122 case SvxDistributeVerticalDistance
: m_pBtnVerDistance
->SetState(true); break;
123 case SvxDistributeVerticalBottom
: m_pBtnVerBottom
->SetState(true); break;
127 /*************************************************************************
129 |* Fill the delivered Item-Set with dialogbox-attributes
131 \************************************************************************/
133 bool SvxDistributePage::FillItemSet( SfxItemSet
& )
135 SvxDistributeHorizontal
eDistributeHor(SvxDistributeHorizontalNone
);
136 SvxDistributeVertical
eDistributeVer(SvxDistributeVerticalNone
);
138 if(m_pBtnHorLeft
->IsChecked())
139 eDistributeHor
= SvxDistributeHorizontalLeft
;
140 else if(m_pBtnHorCenter
->IsChecked())
141 eDistributeHor
= SvxDistributeHorizontalCenter
;
142 else if(m_pBtnHorDistance
->IsChecked())
143 eDistributeHor
= SvxDistributeHorizontalDistance
;
144 else if(m_pBtnHorRight
->IsChecked())
145 eDistributeHor
= SvxDistributeHorizontalRight
;
147 if(m_pBtnVerTop
->IsChecked())
148 eDistributeVer
= SvxDistributeVerticalTop
;
149 else if(m_pBtnVerCenter
->IsChecked())
150 eDistributeVer
= SvxDistributeVerticalCenter
;
151 else if(m_pBtnVerDistance
->IsChecked())
152 eDistributeVer
= SvxDistributeVerticalDistance
;
153 else if(m_pBtnVerBottom
->IsChecked())
154 eDistributeVer
= SvxDistributeVerticalBottom
;
156 if(eDistributeHor
!= m_eDistributeHor
|| eDistributeVer
!= m_eDistributeVer
)
158 m_eDistributeHor
= eDistributeHor
;
159 m_eDistributeVer
= eDistributeVer
;
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */