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 <sfx2/basedlgs.hxx>
21 : #include <cuires.hrc>
22 : #include "dstribut.hxx"
23 : #include <svx/dialogs.hrc>
24 : #include <svx/svddef.hxx>
25 : #include <dialmgr.hxx>
26 : #include <tools/shl.hxx>
27 :
28 : /*************************************************************************
29 : |*
30 : |* Dialog
31 : |*
32 : \************************************************************************/
33 :
34 0 : SvxDistributeDialog::SvxDistributeDialog(Window* pParent,
35 : const SfxItemSet& rInAttrs, SvxDistributeHorizontal eHor,
36 : SvxDistributeVertical eVer)
37 : : SfxSingleTabDialog(pParent, rInAttrs, "DistributionDialog",
38 : "cui/ui/distributiondialog.ui")
39 0 : , mpPage(NULL)
40 : {
41 0 : mpPage = new SvxDistributePage(get_content_area(), rInAttrs, eHor, eVer);
42 0 : SetTabPage(mpPage);
43 0 : }
44 :
45 : /*************************************************************************
46 : |*
47 : |* Tabpage
48 : |*
49 : \************************************************************************/
50 :
51 0 : SvxDistributePage::SvxDistributePage(Window* pWindow,
52 : const SfxItemSet& rInAttrs, SvxDistributeHorizontal eHor,
53 : SvxDistributeVertical eVer)
54 : : SvxTabPage(pWindow, "DistributionPage", "cui/ui/distributionpage.ui",
55 : rInAttrs)
56 : , m_eDistributeHor(eHor)
57 0 : , m_eDistributeVer(eVer)
58 : {
59 0 : get(m_pBtnHorNone, "hornone");
60 0 : get(m_pBtnHorLeft, "horleft");
61 0 : get(m_pBtnHorCenter, "horcenter");
62 0 : get(m_pBtnHorDistance, "hordistance");
63 0 : get(m_pBtnHorRight, "horright");
64 :
65 0 : get(m_pBtnVerNone, "vernone");
66 0 : get(m_pBtnVerTop, "vertop");
67 0 : get(m_pBtnVerCenter, "vercenter");
68 0 : get(m_pBtnVerDistance, "verdistance");
69 0 : get(m_pBtnVerBottom, "verbottom");
70 0 : }
71 :
72 : /*************************************************************************
73 : |*
74 : |* create the tabpage
75 : |*
76 : \************************************************************************/
77 :
78 0 : SfxTabPage* SvxDistributePage::Create(Window* pWindow, const SfxItemSet& rAttrs,
79 : SvxDistributeHorizontal eHor, SvxDistributeVertical eVer)
80 : {
81 0 : return new SvxDistributePage(pWindow, rAttrs, eHor, eVer);
82 : }
83 :
84 0 : void SvxDistributePage::PointChanged(Window* /*pWindow*/, RECT_POINT /*eRP*/)
85 : {
86 0 : }
87 :
88 : /*************************************************************************
89 : |*
90 : |* read the delivered Item-Set
91 : |*
92 : \************************************************************************/
93 :
94 0 : void SvxDistributePage::Reset(const SfxItemSet& )
95 : {
96 0 : m_pBtnHorNone->SetState(false);
97 0 : m_pBtnHorLeft->SetState(false);
98 0 : m_pBtnHorCenter->SetState(false);
99 0 : m_pBtnHorDistance->SetState(false);
100 0 : m_pBtnHorRight->SetState(false);
101 :
102 0 : switch(m_eDistributeHor)
103 : {
104 0 : case SvxDistributeHorizontalNone : m_pBtnHorNone->SetState(true); break;
105 0 : case SvxDistributeHorizontalLeft : m_pBtnHorLeft->SetState(true); break;
106 0 : case SvxDistributeHorizontalCenter : m_pBtnHorCenter->SetState(true); break;
107 0 : case SvxDistributeHorizontalDistance : m_pBtnHorDistance->SetState(true); break;
108 0 : case SvxDistributeHorizontalRight : m_pBtnHorRight->SetState(true); break;
109 : }
110 :
111 0 : m_pBtnVerNone->SetState(false);
112 0 : m_pBtnVerTop->SetState(false);
113 0 : m_pBtnVerCenter->SetState(false);
114 0 : m_pBtnVerDistance->SetState(false);
115 0 : m_pBtnVerBottom->SetState(false);
116 :
117 0 : switch(m_eDistributeVer)
118 : {
119 0 : case SvxDistributeVerticalNone : m_pBtnVerNone->SetState(true); break;
120 0 : case SvxDistributeVerticalTop : m_pBtnVerTop->SetState(true); break;
121 0 : case SvxDistributeVerticalCenter : m_pBtnVerCenter->SetState(true); break;
122 0 : case SvxDistributeVerticalDistance : m_pBtnVerDistance->SetState(true); break;
123 0 : case SvxDistributeVerticalBottom : m_pBtnVerBottom->SetState(true); break;
124 : }
125 0 : }
126 :
127 : /*************************************************************************
128 : |*
129 : |* Fill the delivered Item-Set with dialogbox-attributes
130 : |*
131 : \************************************************************************/
132 :
133 0 : bool SvxDistributePage::FillItemSet( SfxItemSet& )
134 : {
135 0 : SvxDistributeHorizontal eDistributeHor(SvxDistributeHorizontalNone);
136 0 : SvxDistributeVertical eDistributeVer(SvxDistributeVerticalNone);
137 :
138 0 : if(m_pBtnHorLeft->IsChecked())
139 0 : eDistributeHor = SvxDistributeHorizontalLeft;
140 0 : else if(m_pBtnHorCenter->IsChecked())
141 0 : eDistributeHor = SvxDistributeHorizontalCenter;
142 0 : else if(m_pBtnHorDistance->IsChecked())
143 0 : eDistributeHor = SvxDistributeHorizontalDistance;
144 0 : else if(m_pBtnHorRight->IsChecked())
145 0 : eDistributeHor = SvxDistributeHorizontalRight;
146 :
147 0 : if(m_pBtnVerTop->IsChecked())
148 0 : eDistributeVer = SvxDistributeVerticalTop;
149 0 : else if(m_pBtnVerCenter->IsChecked())
150 0 : eDistributeVer = SvxDistributeVerticalCenter;
151 0 : else if(m_pBtnVerDistance->IsChecked())
152 0 : eDistributeVer = SvxDistributeVerticalDistance;
153 0 : else if(m_pBtnVerBottom->IsChecked())
154 0 : eDistributeVer = SvxDistributeVerticalBottom;
155 :
156 0 : if(eDistributeHor != m_eDistributeHor || eDistributeVer != m_eDistributeVer)
157 : {
158 0 : m_eDistributeHor = eDistributeHor;
159 0 : m_eDistributeVer = eDistributeVer;
160 0 : return true;
161 : }
162 :
163 0 : return false;
164 0 : }
165 :
166 :
167 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|