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