1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski *
3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file
5*b1cdbd2cSJim Jagielski * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file
7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski *
11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the
17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski * under the License.
19*b1cdbd2cSJim Jagielski *
20*b1cdbd2cSJim Jagielski *************************************************************/
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski
23*b1cdbd2cSJim Jagielski #include "vbapagesetup.hxx"
24*b1cdbd2cSJim Jagielski #include <com/sun/star/text/XText.hpp>
25*b1cdbd2cSJim Jagielski #include <com/sun/star/text/XPageCursor.hpp>
26*b1cdbd2cSJim Jagielski #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
27*b1cdbd2cSJim Jagielski #include <com/sun/star/container/XNameAccess.hpp>
28*b1cdbd2cSJim Jagielski #include <ooo/vba/word/WdSectionStart.hpp>
29*b1cdbd2cSJim Jagielski #include <ooo/vba/word/WdOrientation.hpp>
30*b1cdbd2cSJim Jagielski #include "wordvbahelper.hxx"
31*b1cdbd2cSJim Jagielski
32*b1cdbd2cSJim Jagielski using namespace ::com::sun::star;
33*b1cdbd2cSJim Jagielski using namespace ::ooo::vba;
34*b1cdbd2cSJim Jagielski
SwVbaPageSetup(const uno::Reference<XHelperInterface> & xParent,const uno::Reference<uno::XComponentContext> & xContext,const uno::Reference<frame::XModel> & xModel,const uno::Reference<beans::XPropertySet> & xProps)35*b1cdbd2cSJim Jagielski SwVbaPageSetup::SwVbaPageSetup(const uno::Reference< XHelperInterface >& xParent,
36*b1cdbd2cSJim Jagielski const uno::Reference< uno::XComponentContext >& xContext,
37*b1cdbd2cSJim Jagielski const uno::Reference< frame::XModel >& xModel,
38*b1cdbd2cSJim Jagielski const uno::Reference< beans::XPropertySet >& xProps ) throw (uno::RuntimeException):
39*b1cdbd2cSJim Jagielski SwVbaPageSetup_BASE( xParent, xContext )
40*b1cdbd2cSJim Jagielski {
41*b1cdbd2cSJim Jagielski mxModel.set( xModel, uno::UNO_QUERY_THROW );
42*b1cdbd2cSJim Jagielski mxPageProps.set( xProps, uno::UNO_QUERY_THROW );
43*b1cdbd2cSJim Jagielski mnOrientPortrait = word::WdOrientation::wdOrientPortrait;
44*b1cdbd2cSJim Jagielski mnOrientLandscape = word::WdOrientation::wdOrientLandscape;
45*b1cdbd2cSJim Jagielski }
46*b1cdbd2cSJim Jagielski
getGutter()47*b1cdbd2cSJim Jagielski double SAL_CALL SwVbaPageSetup::getGutter() throw (uno::RuntimeException)
48*b1cdbd2cSJim Jagielski {
49*b1cdbd2cSJim Jagielski // not support in Writer
50*b1cdbd2cSJim Jagielski return 0;
51*b1cdbd2cSJim Jagielski }
52*b1cdbd2cSJim Jagielski
setGutter(double _gutter)53*b1cdbd2cSJim Jagielski void SAL_CALL SwVbaPageSetup::setGutter( double _gutter ) throw (uno::RuntimeException)
54*b1cdbd2cSJim Jagielski {
55*b1cdbd2cSJim Jagielski // default add gutter into left margin
56*b1cdbd2cSJim Jagielski if( _gutter != 0 )
57*b1cdbd2cSJim Jagielski {
58*b1cdbd2cSJim Jagielski double margin = VbaPageSetupBase::getLeftMargin() + _gutter;
59*b1cdbd2cSJim Jagielski VbaPageSetupBase::setLeftMargin( margin );
60*b1cdbd2cSJim Jagielski }
61*b1cdbd2cSJim Jagielski }
62*b1cdbd2cSJim Jagielski
getHeaderDistance()63*b1cdbd2cSJim Jagielski double SAL_CALL SwVbaPageSetup::getHeaderDistance() throw (uno::RuntimeException)
64*b1cdbd2cSJim Jagielski {
65*b1cdbd2cSJim Jagielski sal_Bool isHeaderOn = sal_False;
66*b1cdbd2cSJim Jagielski mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isHeaderOn;
67*b1cdbd2cSJim Jagielski if( !isHeaderOn )
68*b1cdbd2cSJim Jagielski mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")), uno::makeAny( sal_True ) );
69*b1cdbd2cSJim Jagielski return VbaPageSetupBase::getHeaderMargin();
70*b1cdbd2cSJim Jagielski }
71*b1cdbd2cSJim Jagielski
72*b1cdbd2cSJim Jagielski /**
73*b1cdbd2cSJim Jagielski * changes the value of TopMargin to the value of new MS-Word-HeaderDistance. Subtracts the difference
74*b1cdbd2cSJim Jagielski * between old TopMargin and the new headerDistance from the value of HeaderSpacing (which defines the
75*b1cdbd2cSJim Jagielski * space between the header and the body of the text). calculates the new HeaderHeight (= height of the
76*b1cdbd2cSJim Jagielski * header + headerBodyDistance).
77*b1cdbd2cSJim Jagielski *
78*b1cdbd2cSJim Jagielski * @param: headerDistance is the value that is set in MS Word for the distance from the top of the page
79*b1cdbd2cSJim Jagielski * to the header
80*b1cdbd2cSJim Jagielski */
setHeaderDistance(double _headerdistance)81*b1cdbd2cSJim Jagielski void SAL_CALL SwVbaPageSetup::setHeaderDistance( double _headerdistance ) throw (uno::RuntimeException)
82*b1cdbd2cSJim Jagielski {
83*b1cdbd2cSJim Jagielski sal_Int32 newHeaderDistance = Millimeter::getInHundredthsOfOneMillimeter( _headerdistance );
84*b1cdbd2cSJim Jagielski sal_Bool isHeaderOn = sal_False;
85*b1cdbd2cSJim Jagielski sal_Int32 aktTopMargin = 0;
86*b1cdbd2cSJim Jagielski sal_Int32 aktSpacing = 0;
87*b1cdbd2cSJim Jagielski sal_Int32 aktHeaderHeight = 0;
88*b1cdbd2cSJim Jagielski
89*b1cdbd2cSJim Jagielski mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isHeaderOn;
90*b1cdbd2cSJim Jagielski if( !isHeaderOn )
91*b1cdbd2cSJim Jagielski mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")), uno::makeAny( sal_True ) );
92*b1cdbd2cSJim Jagielski
93*b1cdbd2cSJim Jagielski mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))) >>= aktTopMargin;
94*b1cdbd2cSJim Jagielski mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderBodyDistance"))) >>= aktSpacing;
95*b1cdbd2cSJim Jagielski mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))) >>= aktHeaderHeight;
96*b1cdbd2cSJim Jagielski
97*b1cdbd2cSJim Jagielski sal_Int32 newSpacing = aktSpacing - ( newHeaderDistance - aktTopMargin );
98*b1cdbd2cSJim Jagielski sal_Int32 height = aktHeaderHeight - aktSpacing;
99*b1cdbd2cSJim Jagielski sal_Int32 newHeaderHeight = newSpacing + height;
100*b1cdbd2cSJim Jagielski
101*b1cdbd2cSJim Jagielski mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")), uno::makeAny( newHeaderDistance ) );
102*b1cdbd2cSJim Jagielski mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderBodyDistance")), uno::makeAny( newSpacing ) );
103*b1cdbd2cSJim Jagielski mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight")), uno::makeAny( newHeaderHeight ) );
104*b1cdbd2cSJim Jagielski }
105*b1cdbd2cSJim Jagielski
getFooterDistance()106*b1cdbd2cSJim Jagielski double SAL_CALL SwVbaPageSetup::getFooterDistance() throw (uno::RuntimeException)
107*b1cdbd2cSJim Jagielski {
108*b1cdbd2cSJim Jagielski sal_Bool isFooterOn = sal_False;
109*b1cdbd2cSJim Jagielski mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isFooterOn;
110*b1cdbd2cSJim Jagielski if( !isFooterOn )
111*b1cdbd2cSJim Jagielski mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")), uno::makeAny( sal_True ) );
112*b1cdbd2cSJim Jagielski return VbaPageSetupBase::getFooterMargin();
113*b1cdbd2cSJim Jagielski }
114*b1cdbd2cSJim Jagielski
setFooterDistance(double _footerdistance)115*b1cdbd2cSJim Jagielski void SAL_CALL SwVbaPageSetup::setFooterDistance( double _footerdistance ) throw (uno::RuntimeException)
116*b1cdbd2cSJim Jagielski {
117*b1cdbd2cSJim Jagielski sal_Int32 newFooterDistance = Millimeter::getInHundredthsOfOneMillimeter( _footerdistance );
118*b1cdbd2cSJim Jagielski sal_Bool isFooterOn = sal_False;
119*b1cdbd2cSJim Jagielski sal_Int32 aktBottomMargin = 0;
120*b1cdbd2cSJim Jagielski sal_Int32 aktSpacing = 0;
121*b1cdbd2cSJim Jagielski sal_Int32 aktFooterHeight = 0;
122*b1cdbd2cSJim Jagielski
123*b1cdbd2cSJim Jagielski mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isFooterOn;
124*b1cdbd2cSJim Jagielski if( !isFooterOn )
125*b1cdbd2cSJim Jagielski mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")), uno::makeAny( sal_True ) );
126*b1cdbd2cSJim Jagielski
127*b1cdbd2cSJim Jagielski mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))) >>= aktBottomMargin;
128*b1cdbd2cSJim Jagielski mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterBodyDistance"))) >>= aktSpacing;
129*b1cdbd2cSJim Jagielski mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))) >>= aktFooterHeight;
130*b1cdbd2cSJim Jagielski
131*b1cdbd2cSJim Jagielski sal_Int32 newSpacing = aktSpacing - ( newFooterDistance - aktBottomMargin );
132*b1cdbd2cSJim Jagielski sal_Int32 height = aktFooterHeight - aktSpacing;
133*b1cdbd2cSJim Jagielski sal_Int32 newFooterHeight = newSpacing + height;
134*b1cdbd2cSJim Jagielski
135*b1cdbd2cSJim Jagielski mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")), uno::makeAny( newFooterDistance ) );
136*b1cdbd2cSJim Jagielski mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterBodyDistance")), uno::makeAny( newSpacing ) );
137*b1cdbd2cSJim Jagielski mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight")), uno::makeAny( newFooterHeight ) );
138*b1cdbd2cSJim Jagielski }
139*b1cdbd2cSJim Jagielski
getDifferentFirstPageHeaderFooter()140*b1cdbd2cSJim Jagielski sal_Bool SAL_CALL SwVbaPageSetup::getDifferentFirstPageHeaderFooter() throw (uno::RuntimeException)
141*b1cdbd2cSJim Jagielski {
142*b1cdbd2cSJim Jagielski rtl::OUString pageStyle = getStyleOfFirstPage();
143*b1cdbd2cSJim Jagielski if( pageStyle.equalsAscii( "First Page" ) )
144*b1cdbd2cSJim Jagielski return sal_True;
145*b1cdbd2cSJim Jagielski
146*b1cdbd2cSJim Jagielski return sal_False;
147*b1cdbd2cSJim Jagielski }
148*b1cdbd2cSJim Jagielski
setDifferentFirstPageHeaderFooter(sal_Bool status)149*b1cdbd2cSJim Jagielski void SAL_CALL SwVbaPageSetup::setDifferentFirstPageHeaderFooter( sal_Bool status ) throw (uno::RuntimeException)
150*b1cdbd2cSJim Jagielski {
151*b1cdbd2cSJim Jagielski if( status == getDifferentFirstPageHeaderFooter() )
152*b1cdbd2cSJim Jagielski return;
153*b1cdbd2cSJim Jagielski
154*b1cdbd2cSJim Jagielski rtl::OUString newStyle;
155*b1cdbd2cSJim Jagielski if( status )
156*b1cdbd2cSJim Jagielski newStyle = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("First Page") );
157*b1cdbd2cSJim Jagielski else
158*b1cdbd2cSJim Jagielski newStyle = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") );
159*b1cdbd2cSJim Jagielski
160*b1cdbd2cSJim Jagielski uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
161*b1cdbd2cSJim Jagielski sal_Int32 nTopMargin = 0;
162*b1cdbd2cSJim Jagielski xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))) >>= nTopMargin;
163*b1cdbd2cSJim Jagielski sal_Int32 nBottomMargin = 0;
164*b1cdbd2cSJim Jagielski xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))) >>= nBottomMargin;
165*b1cdbd2cSJim Jagielski sal_Int32 nLeftMargin = 0;
166*b1cdbd2cSJim Jagielski xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin"))) >>= nLeftMargin;
167*b1cdbd2cSJim Jagielski sal_Int32 nRightMargin = 0;
168*b1cdbd2cSJim Jagielski xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin"))) >>= nRightMargin;
169*b1cdbd2cSJim Jagielski sal_Int32 nHeaderHeight = 0;
170*b1cdbd2cSJim Jagielski xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))) >>= nHeaderHeight;
171*b1cdbd2cSJim Jagielski sal_Int32 nFooterHeight = 0;
172*b1cdbd2cSJim Jagielski xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))) >>= nFooterHeight;
173*b1cdbd2cSJim Jagielski
174*b1cdbd2cSJim Jagielski sal_Bool isHeaderOn = sal_False;
175*b1cdbd2cSJim Jagielski xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isHeaderOn;
176*b1cdbd2cSJim Jagielski if( isHeaderOn )
177*b1cdbd2cSJim Jagielski {
178*b1cdbd2cSJim Jagielski nTopMargin += nHeaderHeight;
179*b1cdbd2cSJim Jagielski nBottomMargin += nFooterHeight;
180*b1cdbd2cSJim Jagielski xStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")), uno::makeAny( sal_False ) );
181*b1cdbd2cSJim Jagielski xStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")), uno::makeAny( sal_False ) );
182*b1cdbd2cSJim Jagielski }
183*b1cdbd2cSJim Jagielski uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( mxModel ), uno::UNO_QUERY_THROW );
184*b1cdbd2cSJim Jagielski if( xPageCursor->getPage() != 1 )
185*b1cdbd2cSJim Jagielski {
186*b1cdbd2cSJim Jagielski xPageCursor->jumpToFirstPage();
187*b1cdbd2cSJim Jagielski }
188*b1cdbd2cSJim Jagielski
189*b1cdbd2cSJim Jagielski uno::Reference< beans::XPropertySet > xCursorProps( xPageCursor, uno::UNO_QUERY_THROW );
190*b1cdbd2cSJim Jagielski uno::Reference< beans::XPropertySet > xTableProps( xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ), uno::UNO_QUERY );
191*b1cdbd2cSJim Jagielski if( xTableProps.is() )
192*b1cdbd2cSJim Jagielski {
193*b1cdbd2cSJim Jagielski xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ), uno::makeAny( newStyle ) );
194*b1cdbd2cSJim Jagielski }
195*b1cdbd2cSJim Jagielski else
196*b1cdbd2cSJim Jagielski {
197*b1cdbd2cSJim Jagielski xCursorProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ), uno::makeAny( newStyle ) );
198*b1cdbd2cSJim Jagielski }
199*b1cdbd2cSJim Jagielski
200*b1cdbd2cSJim Jagielski uno::Reference< beans::XPropertySet > xFirstPageProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
201*b1cdbd2cSJim Jagielski xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ), uno::makeAny( nTopMargin ) );
202*b1cdbd2cSJim Jagielski xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin") ), uno::makeAny( nBottomMargin ) );
203*b1cdbd2cSJim Jagielski xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ), uno::makeAny( nLeftMargin ) );
204*b1cdbd2cSJim Jagielski xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin") ), uno::makeAny( nRightMargin ) );
205*b1cdbd2cSJim Jagielski }
206*b1cdbd2cSJim Jagielski
getStyleOfFirstPage()207*b1cdbd2cSJim Jagielski rtl::OUString SwVbaPageSetup::getStyleOfFirstPage() throw (uno::RuntimeException)
208*b1cdbd2cSJim Jagielski {
209*b1cdbd2cSJim Jagielski rtl::OUString styleFirstPage;
210*b1cdbd2cSJim Jagielski uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( mxModel ), uno::UNO_QUERY_THROW );
211*b1cdbd2cSJim Jagielski if( xPageCursor->getPage() != 1 )
212*b1cdbd2cSJim Jagielski {
213*b1cdbd2cSJim Jagielski xPageCursor->jumpToFirstPage();
214*b1cdbd2cSJim Jagielski }
215*b1cdbd2cSJim Jagielski
216*b1cdbd2cSJim Jagielski uno::Reference< beans::XPropertySet > xCursorProps( xPageCursor, uno::UNO_QUERY_THROW );
217*b1cdbd2cSJim Jagielski uno::Reference< beans::XPropertySet > xTableProps( xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ), uno::UNO_QUERY );
218*b1cdbd2cSJim Jagielski if( xTableProps.is() )
219*b1cdbd2cSJim Jagielski {
220*b1cdbd2cSJim Jagielski xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ) ) >>= styleFirstPage;
221*b1cdbd2cSJim Jagielski }
222*b1cdbd2cSJim Jagielski else
223*b1cdbd2cSJim Jagielski {
224*b1cdbd2cSJim Jagielski xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ) ) >>= styleFirstPage;
225*b1cdbd2cSJim Jagielski }
226*b1cdbd2cSJim Jagielski return styleFirstPage;
227*b1cdbd2cSJim Jagielski }
228*b1cdbd2cSJim Jagielski
getSectionStart()229*b1cdbd2cSJim Jagielski ::sal_Int32 SAL_CALL SwVbaPageSetup::getSectionStart() throw (uno::RuntimeException)
230*b1cdbd2cSJim Jagielski {
231*b1cdbd2cSJim Jagielski // FIXME:
232*b1cdbd2cSJim Jagielski sal_Int32 wdSectionStart = word::WdSectionStart::wdSectionNewPage;
233*b1cdbd2cSJim Jagielski uno::Reference< container::XNamed > xNamed( mxPageProps, uno::UNO_QUERY_THROW );
234*b1cdbd2cSJim Jagielski rtl::OUString sStyleName = xNamed->getName();
235*b1cdbd2cSJim Jagielski //mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sStyleName;
236*b1cdbd2cSJim Jagielski if( sStyleName.equalsAscii("Left Page") )
237*b1cdbd2cSJim Jagielski wdSectionStart = word::WdSectionStart::wdSectionEvenPage;
238*b1cdbd2cSJim Jagielski else if( sStyleName.equalsAscii("Right Page") )
239*b1cdbd2cSJim Jagielski wdSectionStart = word::WdSectionStart::wdSectionOddPage;
240*b1cdbd2cSJim Jagielski else
241*b1cdbd2cSJim Jagielski wdSectionStart = word::WdSectionStart::wdSectionNewPage;
242*b1cdbd2cSJim Jagielski return wdSectionStart;
243*b1cdbd2cSJim Jagielski }
244*b1cdbd2cSJim Jagielski
setSectionStart(::sal_Int32)245*b1cdbd2cSJim Jagielski void SAL_CALL SwVbaPageSetup::setSectionStart( ::sal_Int32 /*_sectionstart*/ ) throw (uno::RuntimeException)
246*b1cdbd2cSJim Jagielski {
247*b1cdbd2cSJim Jagielski // fail to find corresponding feature in Writer
248*b1cdbd2cSJim Jagielski // #FIXME:
249*b1cdbd2cSJim Jagielski }
250*b1cdbd2cSJim Jagielski
251*b1cdbd2cSJim Jagielski rtl::OUString&
getServiceImplName()252*b1cdbd2cSJim Jagielski SwVbaPageSetup::getServiceImplName()
253*b1cdbd2cSJim Jagielski {
254*b1cdbd2cSJim Jagielski static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaPageSetup") );
255*b1cdbd2cSJim Jagielski return sImplName;
256*b1cdbd2cSJim Jagielski }
257*b1cdbd2cSJim Jagielski
258*b1cdbd2cSJim Jagielski uno::Sequence< rtl::OUString >
getServiceNames()259*b1cdbd2cSJim Jagielski SwVbaPageSetup::getServiceNames()
260*b1cdbd2cSJim Jagielski {
261*b1cdbd2cSJim Jagielski static uno::Sequence< rtl::OUString > aServiceNames;
262*b1cdbd2cSJim Jagielski if ( aServiceNames.getLength() == 0 )
263*b1cdbd2cSJim Jagielski {
264*b1cdbd2cSJim Jagielski aServiceNames.realloc( 1 );
265*b1cdbd2cSJim Jagielski aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.PageSetup" ) );
266*b1cdbd2cSJim Jagielski }
267*b1cdbd2cSJim Jagielski return aServiceNames;
268*b1cdbd2cSJim Jagielski }
269