1*a1b4a26bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*a1b4a26bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*a1b4a26bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*a1b4a26bSAndrew Rist  * distributed with this work for additional information
6*a1b4a26bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*a1b4a26bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*a1b4a26bSAndrew Rist  * "License"); you may not use this file except in compliance
9*a1b4a26bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*a1b4a26bSAndrew Rist  *
11*a1b4a26bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*a1b4a26bSAndrew Rist  *
13*a1b4a26bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*a1b4a26bSAndrew Rist  * software distributed under the License is distributed on an
15*a1b4a26bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*a1b4a26bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*a1b4a26bSAndrew Rist  * specific language governing permissions and limitations
18*a1b4a26bSAndrew Rist  * under the License.
19*a1b4a26bSAndrew Rist  *
20*a1b4a26bSAndrew Rist  *************************************************************/
21*a1b4a26bSAndrew Rist 
22*a1b4a26bSAndrew Rist 
23cdf0e10cSrcweir package com.sun.star.wizards.report;
24cdf0e10cSrcweir 
25cdf0e10cSrcweir import com.sun.star.awt.XListBox;
26cdf0e10cSrcweir // import com.sun.star.awt.XTextComponent;
27cdf0e10cSrcweir import com.sun.star.lang.EventObject;
28cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory;
29cdf0e10cSrcweir import com.sun.star.wizards.common.*;
30cdf0e10cSrcweir import com.sun.star.wizards.ui.*;
31cdf0e10cSrcweir 
32cdf0e10cSrcweir public class ReportLayouter
33cdf0e10cSrcweir {
34cdf0e10cSrcweir 
35cdf0e10cSrcweir     UnoDialog CurUnoDialog;
36cdf0e10cSrcweir //    static String sOrientationHeader;
37cdf0e10cSrcweir //    static String sOrientVertical;
38cdf0e10cSrcweir //    static String sOrientHorizontal;
39cdf0e10cSrcweir     final int SOTXTTITLE = 28;
40cdf0e10cSrcweir     final int SOCONTENTLST = 29;
41cdf0e10cSrcweir     final static public int SOOPTLANDSCAPE = 30;
42cdf0e10cSrcweir     final static public int SOOPTPORTRAIT = 31;
43cdf0e10cSrcweir     final int SOLAYOUTLST = 32;
44cdf0e10cSrcweir //    static String sReportTitle;
45cdf0e10cSrcweir //    static String slblDataStructure;
46cdf0e10cSrcweir //    static String slblPageLayout;
47cdf0e10cSrcweir //    static String sOrganizeFields;
48cdf0e10cSrcweir     XListBox xContentListBox;
49cdf0e10cSrcweir     XListBox xLayoutListBox;
50cdf0e10cSrcweir     int iOldContentPos;
51cdf0e10cSrcweir     int iOldLayoutPos;
52cdf0e10cSrcweir     // ReportTextDocument CurReportDocument;
53cdf0e10cSrcweir     IReportDocument CurReportDocument;
54cdf0e10cSrcweir     public String[][] LayoutFiles;
55cdf0e10cSrcweir     public String[][] ContentFiles;
56cdf0e10cSrcweir     // private Desktop.OfficePathRetriever curofficepath;
57cdf0e10cSrcweir     Object aOrientationImage;
58cdf0e10cSrcweir     // boolean m_bLandscape = true;
59cdf0e10cSrcweir     private XMultiServiceFactory m_xMSF;
60cdf0e10cSrcweir 
ReportLayouter(XMultiServiceFactory _xMSF, IReportDocument _CurReportDocument, UnoDialog _CurUnoDialog)61cdf0e10cSrcweir     public ReportLayouter(XMultiServiceFactory _xMSF, IReportDocument _CurReportDocument, UnoDialog _CurUnoDialog)
62cdf0e10cSrcweir     {
63cdf0e10cSrcweir         m_xMSF = _xMSF;
64cdf0e10cSrcweir         try
65cdf0e10cSrcweir         {
66cdf0e10cSrcweir             short curtabindex = (short) (100 * ReportWizard.SOTEMPLATEPAGE);
67cdf0e10cSrcweir             this.CurUnoDialog = _CurUnoDialog;
68cdf0e10cSrcweir             this.CurReportDocument = _CurReportDocument;
69cdf0e10cSrcweir             //TODO the constructor for the OfficePathRetriever is redundant and should be instantiated elsewhere
70cdf0e10cSrcweir             // Desktop odesktop = new Desktop();
71cdf0e10cSrcweir             // curofficepath = odesktop.new OfficePathRetriever(m_xMSF);
72cdf0e10cSrcweir             String slblDataStructure = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 15);
73cdf0e10cSrcweir             String slblPageLayout = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 16);
74cdf0e10cSrcweir // String                sOrganizeFields = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 19);
75cdf0e10cSrcweir 
76cdf0e10cSrcweir             String sOrientationHeader = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 22);
77cdf0e10cSrcweir             String sOrientVertical = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 23);
78cdf0e10cSrcweir             String sOrientHorizontal = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 24);
79cdf0e10cSrcweir 
80cdf0e10cSrcweir             // XInterface xUcbInterface = (XInterface) m_xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
81cdf0e10cSrcweir             // XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
82cdf0e10cSrcweir             // boolean bcntexists = xSimpleFileAccess.exists(CurReportDocument.getReportPath() + "/cnt-default.ott");
83cdf0e10cSrcweir             // boolean bstlexists = xSimpleFileAccess.exists(CurReportDocument.getReportPath() + "/stl-default.ott");
84cdf0e10cSrcweir             //      if ((bcntexists == false) || (bstlexists == false))
85cdf0e10cSrcweir             //          throw  new NoValidPathException(CurReportDocument.xMSF);
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 
88cdf0e10cSrcweir             CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblContent",
89cdf0e10cSrcweir                     new String[]
90cdf0e10cSrcweir                     {
91cdf0e10cSrcweir                         PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
92cdf0e10cSrcweir                     },
93cdf0e10cSrcweir                     new Object[]
94cdf0e10cSrcweir                     {
95cdf0e10cSrcweir                         8, slblDataStructure, 95, 27, new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 99
96cdf0e10cSrcweir                     });
97cdf0e10cSrcweir 
98cdf0e10cSrcweir             short iSelPos = 0;
99cdf0e10cSrcweir //                    ContentFiles = FileAccess.getFolderTitles(m_xMSF, "cnt", CurReportDocument.getReportPath());
100cdf0e10cSrcweir             ContentFiles = CurReportDocument.getDataLayout();
101cdf0e10cSrcweir             iSelPos = (short) JavaTools.FieldInList(ContentFiles[1], CurReportDocument.getContentPath());
102cdf0e10cSrcweir             if (iSelPos < 0)
103cdf0e10cSrcweir             {
104cdf0e10cSrcweir                 iSelPos = 0;
105cdf0e10cSrcweir             }
106cdf0e10cSrcweir             iOldContentPos = (int) iSelPos;
107cdf0e10cSrcweir             xContentListBox = CurUnoDialog.insertListBox("lstContent", SOCONTENTLST, new ActionListenerImpl(), new ItemListenerImpl(),
108cdf0e10cSrcweir                     new String[]
109cdf0e10cSrcweir                     {
110cdf0e10cSrcweir                         PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.SELECTED_ITEMS, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
111cdf0e10cSrcweir                     },
112cdf0e10cSrcweir                     new Object[]
113cdf0e10cSrcweir                     {
114cdf0e10cSrcweir                         108, "HID:WIZARDS_HID_DLGREPORT_4_DATALAYOUT", 95, 37, new short[]
115cdf0e10cSrcweir                         {
116cdf0e10cSrcweir                             iSelPos
117cdf0e10cSrcweir                         }, new Integer(ReportWizard.SOTEMPLATEPAGE), ContentFiles[0], new Short(curtabindex++), 99
118cdf0e10cSrcweir                     });
119cdf0e10cSrcweir 
120cdf0e10cSrcweir             CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblLayout",
121cdf0e10cSrcweir                     new String[]
122cdf0e10cSrcweir                     {
123cdf0e10cSrcweir                         PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
124cdf0e10cSrcweir                     },
125cdf0e10cSrcweir                     new Object[]
126cdf0e10cSrcweir                     {
127cdf0e10cSrcweir                         8, slblPageLayout, 205, 27, new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 99
128cdf0e10cSrcweir                     });
129cdf0e10cSrcweir 
130cdf0e10cSrcweir             short iSelLayoutPos = 0;
131cdf0e10cSrcweir //                    LayoutFiles = FileAccess.getFolderTitles(m_xMSF, "stl", CurReportDocument.getReportPath());
132cdf0e10cSrcweir             LayoutFiles = CurReportDocument.getHeaderLayout();
133cdf0e10cSrcweir             iSelLayoutPos = (short) JavaTools.FieldInList(LayoutFiles[1], CurReportDocument.getLayoutPath());
134cdf0e10cSrcweir             if (iSelLayoutPos < 0)
135cdf0e10cSrcweir             {
136cdf0e10cSrcweir                 iSelLayoutPos = (short) JavaTools.FieldInList(LayoutFiles[0], CurReportDocument.getLayoutPath());
137cdf0e10cSrcweir                 if (iSelLayoutPos < 0)
138cdf0e10cSrcweir                 {
139cdf0e10cSrcweir                     iSelLayoutPos = 0;
140cdf0e10cSrcweir                 }
141cdf0e10cSrcweir             }
142cdf0e10cSrcweir             xLayoutListBox = CurUnoDialog.insertListBox("lstLayout", SOLAYOUTLST, new ActionListenerImpl(), new ItemListenerImpl(),
143cdf0e10cSrcweir                     new String[]
144cdf0e10cSrcweir                     {
145cdf0e10cSrcweir                         PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.SELECTED_ITEMS, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
146cdf0e10cSrcweir                     },
147cdf0e10cSrcweir                     new Object[]
148cdf0e10cSrcweir                     {
149cdf0e10cSrcweir                         108, "HID:WIZARDS_HID_DLGREPORT_4_PAGELAYOUT", 205, 37, new short[]
150cdf0e10cSrcweir                         {
151cdf0e10cSrcweir                             iSelLayoutPos
152cdf0e10cSrcweir                         }, new Integer(ReportWizard.SOTEMPLATEPAGE), LayoutFiles[0], new Short(curtabindex++), 99
153cdf0e10cSrcweir                     });
154cdf0e10cSrcweir             iOldLayoutPos = (int) iSelPos;
155cdf0e10cSrcweir             CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblOrientation",
156cdf0e10cSrcweir                     new String[]
157cdf0e10cSrcweir                     {
158cdf0e10cSrcweir                         PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
159cdf0e10cSrcweir                     },
160cdf0e10cSrcweir                     new Object[]
161cdf0e10cSrcweir                     {
162cdf0e10cSrcweir                         8, sOrientationHeader, 95, 148, new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 74
163cdf0e10cSrcweir                     });
164cdf0e10cSrcweir 
165cdf0e10cSrcweir             short m_nLandscapeState = CurReportDocument.getDefaultPageOrientation() == SOOPTLANDSCAPE ? (short) 1 : 0;
166cdf0e10cSrcweir             CurUnoDialog.insertRadioButton("optLandscape", SOOPTLANDSCAPE, new ItemListenerImpl(),
167cdf0e10cSrcweir                     new String[]
168cdf0e10cSrcweir                     {
169cdf0e10cSrcweir                         PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
170cdf0e10cSrcweir                     },
171cdf0e10cSrcweir                     new Object[]
172cdf0e10cSrcweir                     {
173cdf0e10cSrcweir                         10, "HID:WIZARDS_HID_DLGREPORT_4_LANDSCAPE", sOrientHorizontal, 101, 158, new Short(m_nLandscapeState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 60
174cdf0e10cSrcweir                     });
175cdf0e10cSrcweir 
176cdf0e10cSrcweir             short m_nPortraitState = CurReportDocument.getDefaultPageOrientation() == SOOPTPORTRAIT ? (short) 1 : (short) 0;
177cdf0e10cSrcweir             CurUnoDialog.insertRadioButton("optPortrait", SOOPTPORTRAIT, new ItemListenerImpl(),
178cdf0e10cSrcweir                     new String[]
179cdf0e10cSrcweir                     {
180cdf0e10cSrcweir                         PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
181cdf0e10cSrcweir                     },
182cdf0e10cSrcweir                     new Object[]
183cdf0e10cSrcweir                     {
184cdf0e10cSrcweir                         10, "HID:WIZARDS_HID_DLGREPORT_4_PORTRAIT", sOrientVertical, 101, 171, new Short(m_nPortraitState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 60
185cdf0e10cSrcweir                     });
186cdf0e10cSrcweir 
187cdf0e10cSrcweir             aOrientationImage = CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlImageControlModel", "imgOrientation",
188cdf0e10cSrcweir                     new String[]
189cdf0e10cSrcweir                     {
190cdf0e10cSrcweir                         PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
191cdf0e10cSrcweir                     },
192cdf0e10cSrcweir                     new Object[]
193cdf0e10cSrcweir                     {
194cdf0e10cSrcweir                         new Short("0"), 23, 164, 158, Boolean.FALSE, new Integer(ReportWizard.SOTEMPLATEPAGE), 30
195cdf0e10cSrcweir                     });
196cdf0e10cSrcweir 
197cdf0e10cSrcweir             String sNote = ReportWizard.getBlindTextNote(CurReportDocument, CurUnoDialog.m_oResource);
198cdf0e10cSrcweir             CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblBlindTextNote_2",
199cdf0e10cSrcweir                     new String[]
200cdf0e10cSrcweir                     {
201cdf0e10cSrcweir                         PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
202cdf0e10cSrcweir                     },
203cdf0e10cSrcweir                     new Object[]
204cdf0e10cSrcweir                     {
205cdf0e10cSrcweir                         34, sNote, Boolean.TRUE, 205, 148, new Integer(ReportWizard.SOTEMPLATEPAGE), 99
206cdf0e10cSrcweir                     });
207cdf0e10cSrcweir             if (m_nLandscapeState == 1)
208cdf0e10cSrcweir             {
209cdf0e10cSrcweir                 CurUnoDialog.getPeerConfiguration().setImageUrl(aOrientationImage, 1002, 1003);
210cdf0e10cSrcweir             }
211cdf0e10cSrcweir             else
212cdf0e10cSrcweir             {
213cdf0e10cSrcweir                 CurUnoDialog.getPeerConfiguration().setImageUrl(aOrientationImage, 1000, 1001);
214cdf0e10cSrcweir             }
215cdf0e10cSrcweir         }
216cdf0e10cSrcweir         catch (Exception exception)
217cdf0e10cSrcweir         {
218cdf0e10cSrcweir             exception.printStackTrace(System.out);
219cdf0e10cSrcweir         }
220cdf0e10cSrcweir     }
221cdf0e10cSrcweir 
initialize(String _defaultTemplatePath)222cdf0e10cSrcweir     public void initialize(String _defaultTemplatePath)
223cdf0e10cSrcweir     {
224cdf0e10cSrcweir //             CurReportDocument.getDoc().xTextDocument.lockControllers();
225cdf0e10cSrcweir         CurReportDocument.layout_setupRecordSection(_defaultTemplatePath);
226cdf0e10cSrcweir         if (CurUnoDialog.getControlProperty("txtTitle", "Text").equals(PropertyNames.EMPTY_STRING))
227cdf0e10cSrcweir         {
228cdf0e10cSrcweir             String[] sCommandNames = CurReportDocument.getRecordParser().getIncludedCommandNames();
229cdf0e10cSrcweir             CurUnoDialog.setControlProperty("txtTitle", "Text", sCommandNames[0]);
230cdf0e10cSrcweir         }
231cdf0e10cSrcweir         // CurReportDocument.getDoc().oViewHandler.selectFirstPage(CurReportDocument.getDoc().oTextTableHandler);
232cdf0e10cSrcweir         CurReportDocument.layout_selectFirstPage();
233cdf0e10cSrcweir         CurUnoDialog.setFocus("lblContent");
234cdf0e10cSrcweir //            CurReportDocument.getDoc().unlockallControllers();
235cdf0e10cSrcweir     }
236cdf0e10cSrcweir 
237cdf0e10cSrcweir     class ItemListenerImpl implements com.sun.star.awt.XItemListener
238cdf0e10cSrcweir     {
239cdf0e10cSrcweir 
itemStateChanged(com.sun.star.awt.ItemEvent EventObject)240cdf0e10cSrcweir         public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
241cdf0e10cSrcweir         {
242cdf0e10cSrcweir             try
243cdf0e10cSrcweir             {
244cdf0e10cSrcweir                 int iPos;
245cdf0e10cSrcweir                 Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.FALSE);
246cdf0e10cSrcweir                 // LLA: should we lock controllers here?
247cdf0e10cSrcweir                 //                    CurReportDocument.getDoc().xTextDocument.lockControllers();
248cdf0e10cSrcweir                 int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList);
249cdf0e10cSrcweir                 switch (iKey)
250cdf0e10cSrcweir                 {
251cdf0e10cSrcweir                     case SOCONTENTLST:
252cdf0e10cSrcweir                         iPos = xContentListBox.getSelectedItemPos();
253cdf0e10cSrcweir                         if (iPos != iOldContentPos)
254cdf0e10cSrcweir                         {
255cdf0e10cSrcweir                             iOldContentPos = iPos;
256cdf0e10cSrcweir                             CurReportDocument.liveupdate_changeContentTemplate(ContentFiles[1][iPos]);
257cdf0e10cSrcweir                         }
258cdf0e10cSrcweir                         break;
259cdf0e10cSrcweir 
260cdf0e10cSrcweir                     case SOLAYOUTLST:
261cdf0e10cSrcweir                         iPos = xLayoutListBox.getSelectedItemPos();
262cdf0e10cSrcweir                         if (iPos != iOldLayoutPos)
263cdf0e10cSrcweir                         {
264cdf0e10cSrcweir                             iOldLayoutPos = iPos;
265cdf0e10cSrcweir                             CurReportDocument.liveupdate_changeLayoutTemplate(LayoutFiles[1][iPos]/*, Desktop.getBitmapPath(m_xMSF)*/);
266cdf0e10cSrcweir                         }
267cdf0e10cSrcweir                         break;
268cdf0e10cSrcweir 
269cdf0e10cSrcweir                     case SOOPTLANDSCAPE:
270cdf0e10cSrcweir                         // CurReportDocument.getDoc().changePageOrientation(true);
271cdf0e10cSrcweir                         try
272cdf0e10cSrcweir                         {
273cdf0e10cSrcweir                             CurReportDocument.setPageOrientation(SOOPTLANDSCAPE);
274cdf0e10cSrcweir                         }
275cdf0e10cSrcweir                         catch (com.sun.star.lang.IllegalArgumentException e)
276cdf0e10cSrcweir                         {
277cdf0e10cSrcweir                         }
278cdf0e10cSrcweir                         Helper.setUnoPropertyValue(aOrientationImage, PropertyNames.PROPERTY_IMAGEURL, CurUnoDialog.getWizardImageUrl(1002, 1003));
279cdf0e10cSrcweir 
280cdf0e10cSrcweir                         break;
281cdf0e10cSrcweir 
282cdf0e10cSrcweir                     case SOOPTPORTRAIT:
283cdf0e10cSrcweir                         // CurReportDocument.getDoc().changePageOrientation( false);
284cdf0e10cSrcweir                         try
285cdf0e10cSrcweir                         {
286cdf0e10cSrcweir                             CurReportDocument.setPageOrientation(SOOPTPORTRAIT);
287cdf0e10cSrcweir                         }
288cdf0e10cSrcweir                         catch (com.sun.star.lang.IllegalArgumentException e)
289cdf0e10cSrcweir                         {
290cdf0e10cSrcweir                         }
291cdf0e10cSrcweir 
292cdf0e10cSrcweir                         CurUnoDialog.setControlProperty("imgOrientation", PropertyNames.PROPERTY_IMAGEURL, Desktop.getBitmapPath(m_xMSF) + "/portrait.gif");
293cdf0e10cSrcweir                         Helper.setUnoPropertyValue(aOrientationImage, PropertyNames.PROPERTY_IMAGEURL, CurUnoDialog.getWizardImageUrl(1000, 1001));
294cdf0e10cSrcweir                         break;
295cdf0e10cSrcweir 
296cdf0e10cSrcweir                     default:
297cdf0e10cSrcweir                         break;
298cdf0e10cSrcweir                 }
299cdf0e10cSrcweir             }
300cdf0e10cSrcweir             catch (RuntimeException e)
301cdf0e10cSrcweir             {
302cdf0e10cSrcweir                 e.printStackTrace();
303cdf0e10cSrcweir             }
304cdf0e10cSrcweir             // CurReportDocument.getDoc().unlockallControllers();
305cdf0e10cSrcweir             Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.TRUE);
306cdf0e10cSrcweir         }
307cdf0e10cSrcweir 
disposing(EventObject eventObject)308cdf0e10cSrcweir         public void disposing(EventObject eventObject)
309cdf0e10cSrcweir         {
310cdf0e10cSrcweir         }
311cdf0e10cSrcweir     }
312cdf0e10cSrcweir 
313cdf0e10cSrcweir     class ActionListenerImpl implements com.sun.star.awt.XActionListener
314cdf0e10cSrcweir     {
315cdf0e10cSrcweir 
disposing(EventObject eventObject)316cdf0e10cSrcweir         public void disposing(EventObject eventObject)
317cdf0e10cSrcweir         {
318cdf0e10cSrcweir         }
319cdf0e10cSrcweir 
actionPerformed(com.sun.star.awt.ActionEvent actionEvent)320cdf0e10cSrcweir         public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent)
321cdf0e10cSrcweir         {
322cdf0e10cSrcweir             try
323cdf0e10cSrcweir             {
324cdf0e10cSrcweir                 Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.FALSE);
325cdf0e10cSrcweir //                     CurReportDocument.getDoc().xTextDocument.lockControllers();
326cdf0e10cSrcweir                 boolean blandscape = (((Short) CurUnoDialog.getControlProperty("optLandscape", PropertyNames.PROPERTY_STATE)).shortValue() == 1);
327cdf0e10cSrcweir                 CurReportDocument.setPageOrientation((blandscape) ? SOOPTLANDSCAPE : SOOPTPORTRAIT);
328cdf0e10cSrcweir             }
329cdf0e10cSrcweir             catch (Exception exception)
330cdf0e10cSrcweir             {
331cdf0e10cSrcweir                 exception.printStackTrace(System.out);
332cdf0e10cSrcweir             }
333cdf0e10cSrcweir //                CurReportDocument.getDoc().unlockallControllers();
334cdf0e10cSrcweir             Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.TRUE);
335cdf0e10cSrcweir         }
336cdf0e10cSrcweir     }
337cdf0e10cSrcweir }
338