xref: /AOO41X/main/sw/source/ui/frmdlg/frmpage.cxx (revision efeef26f81c84063fb0a91bde3856d4a51172d90)
1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*efeef26fSAndrew Rist  * distributed with this work for additional information
6*efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17*efeef26fSAndrew Rist  * specific language governing permissions and limitations
18*efeef26fSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*efeef26fSAndrew Rist  *************************************************************/
21*efeef26fSAndrew Rist 
22*efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION
27cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <com/sun/star/embed/Aspects.hpp>
31cdf0e10cSrcweir #include <com/sun/star/embed/EmbedMisc.hpp>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <cmdid.h>
34cdf0e10cSrcweir #include <helpid.h>
35cdf0e10cSrcweir #include <hintids.hxx>
36cdf0e10cSrcweir #include <vcl/msgbox.hxx>
37cdf0e10cSrcweir #include <vcl/mnemonic.hxx>
38cdf0e10cSrcweir #include <svl/urihelper.hxx>
39cdf0e10cSrcweir #include <svl/stritem.hxx>
40cdf0e10cSrcweir #include <svx/htmlmode.hxx>
41cdf0e10cSrcweir #include <editeng/sizeitem.hxx>
42cdf0e10cSrcweir #include <editeng/opaqitem.hxx>
43cdf0e10cSrcweir #include <editeng/protitem.hxx>
44cdf0e10cSrcweir #include <editeng/prntitem.hxx>
45cdf0e10cSrcweir #include <editeng/brshitem.hxx>
46cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
47cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
48cdf0e10cSrcweir #include <svx/swframevalidation.hxx>
49cdf0e10cSrcweir #include <sot/clsids.hxx>
50cdf0e10cSrcweir 
51cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
52cdf0e10cSrcweir #include <fmturl.hxx>
53cdf0e10cSrcweir #include <fmteiro.hxx>
54cdf0e10cSrcweir #include <fmtcnct.hxx>
55cdf0e10cSrcweir #include <view.hxx>
56cdf0e10cSrcweir #include <wrtsh.hxx>
57cdf0e10cSrcweir #include <swmodule.hxx>
58cdf0e10cSrcweir #include <uitool.hxx>
59cdf0e10cSrcweir #include <docsh.hxx>
60cdf0e10cSrcweir #include <viewopt.hxx>
61cdf0e10cSrcweir #include <frmatr.hxx>
62cdf0e10cSrcweir #include <frmdlg.hxx>
63cdf0e10cSrcweir #include <frmmgr.hxx>
64cdf0e10cSrcweir #include <frmpage.hxx>
65cdf0e10cSrcweir #include <wrap.hxx>
66cdf0e10cSrcweir #include <colmgr.hxx>
67cdf0e10cSrcweir #include <grfatr.hxx>
68cdf0e10cSrcweir #include <uiitems.hxx>
69cdf0e10cSrcweir // OD 19.09.2003 #i18732#
70cdf0e10cSrcweir #include <fmtfollowtextflow.hxx>
71cdf0e10cSrcweir 
72cdf0e10cSrcweir #include <frmui.hrc>
73cdf0e10cSrcweir #include <frmpage.hrc>
74cdf0e10cSrcweir #include <sfx2/filedlghelper.hxx>
75cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
76cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
77cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
78cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
79cdf0e10cSrcweir #include <svtools/filter.hxx>
80cdf0e10cSrcweir 
81cdf0e10cSrcweir using namespace ::com::sun::star;
82cdf0e10cSrcweir using ::rtl::OUString;
83cdf0e10cSrcweir using namespace ::sfx2;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir #define SwFPos SvxSwFramePosString
86cdf0e10cSrcweir 
87cdf0e10cSrcweir struct FrmMap
88cdf0e10cSrcweir {
89cdf0e10cSrcweir     SvxSwFramePosString::StringId eStrId;
90cdf0e10cSrcweir     SvxSwFramePosString::StringId eMirrorStrId;
91cdf0e10cSrcweir 	sal_uInt16 nAlign;
92cdf0e10cSrcweir 	sal_uLong  nLBRelations;
93cdf0e10cSrcweir };
94cdf0e10cSrcweir 
95cdf0e10cSrcweir struct RelationMap
96cdf0e10cSrcweir {
97cdf0e10cSrcweir     SvxSwFramePosString::StringId eStrId;
98cdf0e10cSrcweir     SvxSwFramePosString::StringId eMirrorStrId;
99cdf0e10cSrcweir 	sal_uLong  nLBRelation;
100cdf0e10cSrcweir 	sal_uInt16 nRelation;
101cdf0e10cSrcweir };
102cdf0e10cSrcweir 
103cdf0e10cSrcweir struct StringIdPair_Impl
104cdf0e10cSrcweir {
105cdf0e10cSrcweir     SvxSwFramePosString::StringId eHori;
106cdf0e10cSrcweir     SvxSwFramePosString::StringId eVert;
107cdf0e10cSrcweir };
108cdf0e10cSrcweir 
109cdf0e10cSrcweir #define MAX_PERCENT_WIDTH   254L
110cdf0e10cSrcweir #define MAX_PERCENT_HEIGHT  254L
111cdf0e10cSrcweir 
112cdf0e10cSrcweir // OD 19.09.2003 #i18732# - change order of alignments
113cdf0e10cSrcweir #define LB_FRAME                0x00000001L // Textbereich des Absatzes
114cdf0e10cSrcweir #define LB_PRTAREA				0x00000002L	// Textbereich des Absatzes + Einzuege
115cdf0e10cSrcweir #define LB_VERT_FRAME           0x00000004L // Vertikaler Textbereich des Absatzes
116cdf0e10cSrcweir #define LB_VERT_PRTAREA         0x00000008L // Vertikaler Textbereich des Absatzes + Einzuege
117cdf0e10cSrcweir #define LB_REL_FRM_LEFT         0x00000010L // Linker Absatzrand
118cdf0e10cSrcweir #define LB_REL_FRM_RIGHT        0x00000020L // Rechter Absatzrand
119cdf0e10cSrcweir 
120cdf0e10cSrcweir #define LB_REL_PG_LEFT          0x00000040L // Linker Seitenrand
121cdf0e10cSrcweir #define LB_REL_PG_RIGHT         0x00000080L    // Rechter Seitenrand
122cdf0e10cSrcweir #define LB_REL_PG_FRAME         0x00000100L // Gesamte Seite
123cdf0e10cSrcweir #define LB_REL_PG_PRTAREA       0x00000200L    // Textbereich der Seite
124cdf0e10cSrcweir 
125cdf0e10cSrcweir #define LB_FLY_REL_PG_LEFT      0x00000400L    // Linker Rahmenrand
126cdf0e10cSrcweir #define LB_FLY_REL_PG_RIGHT     0x00000800L    // Rechter Rahmenrand
127cdf0e10cSrcweir #define LB_FLY_REL_PG_FRAME     0x00001000L    // Gesamte Rahmen
128cdf0e10cSrcweir #define LB_FLY_REL_PG_PRTAREA   0x00002000L    // Rahmeninneres
129cdf0e10cSrcweir 
130cdf0e10cSrcweir #define LB_REL_BASE				0x00010000L	// Zeichenausrichtung Basis
131cdf0e10cSrcweir #define LB_REL_CHAR				0x00020000L	// Zeichenausrichtung Zeichen
132cdf0e10cSrcweir #define LB_REL_ROW				0x00040000L	// Zeichenausrichtung Zeile
133cdf0e10cSrcweir 
134cdf0e10cSrcweir // OD 10.11.2003 #i22305#
135cdf0e10cSrcweir #define LB_FLY_VERT_FRAME       0x00100000L // vertical entire frame
136cdf0e10cSrcweir #define LB_FLY_VERT_PRTAREA     0x00200000L // vertical frame text area
137cdf0e10cSrcweir 
138cdf0e10cSrcweir // OD 11.11.2003 #i22341#
139cdf0e10cSrcweir #define LB_VERT_LINE            0x00400000L // vertical text line
140cdf0e10cSrcweir 
141cdf0e10cSrcweir static RelationMap __FAR_DATA aRelationMap[] =
142cdf0e10cSrcweir {
143cdf0e10cSrcweir     {SwFPos::FRAME,  SwFPos::FRAME, LB_FRAME, text::RelOrientation::FRAME},
144cdf0e10cSrcweir     {SwFPos::PRTAREA,           SwFPos::PRTAREA,                LB_PRTAREA,             text::RelOrientation::PRINT_AREA},
145cdf0e10cSrcweir     {SwFPos::REL_PG_LEFT,       SwFPos::MIR_REL_PG_LEFT,        LB_REL_PG_LEFT,         text::RelOrientation::PAGE_LEFT},
146cdf0e10cSrcweir     {SwFPos::REL_PG_RIGHT,      SwFPos::MIR_REL_PG_RIGHT,       LB_REL_PG_RIGHT,        text::RelOrientation::PAGE_RIGHT},
147cdf0e10cSrcweir     {SwFPos::REL_FRM_LEFT,      SwFPos::MIR_REL_FRM_LEFT,       LB_REL_FRM_LEFT,        text::RelOrientation::FRAME_LEFT},
148cdf0e10cSrcweir     {SwFPos::REL_FRM_RIGHT,     SwFPos::MIR_REL_FRM_RIGHT,      LB_REL_FRM_RIGHT,       text::RelOrientation::FRAME_RIGHT},
149cdf0e10cSrcweir     {SwFPos::REL_PG_FRAME,      SwFPos::REL_PG_FRAME,           LB_REL_PG_FRAME,        text::RelOrientation::PAGE_FRAME},
150cdf0e10cSrcweir     {SwFPos::REL_PG_PRTAREA,    SwFPos::REL_PG_PRTAREA,         LB_REL_PG_PRTAREA,      text::RelOrientation::PAGE_PRINT_AREA},
151cdf0e10cSrcweir     {SwFPos::REL_CHAR,          SwFPos::REL_CHAR,               LB_REL_CHAR,            text::RelOrientation::CHAR},
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     {SwFPos::FLY_REL_PG_LEFT,       SwFPos::FLY_MIR_REL_PG_LEFT,    LB_FLY_REL_PG_LEFT,     text::RelOrientation::PAGE_LEFT},
154cdf0e10cSrcweir     {SwFPos::FLY_REL_PG_RIGHT,      SwFPos::FLY_MIR_REL_PG_RIGHT,   LB_FLY_REL_PG_RIGHT,    text::RelOrientation::PAGE_RIGHT},
155cdf0e10cSrcweir     {SwFPos::FLY_REL_PG_FRAME,      SwFPos::FLY_REL_PG_FRAME,       LB_FLY_REL_PG_FRAME,    text::RelOrientation::PAGE_FRAME},
156cdf0e10cSrcweir     {SwFPos::FLY_REL_PG_PRTAREA,    SwFPos::FLY_REL_PG_PRTAREA,     LB_FLY_REL_PG_PRTAREA,  text::RelOrientation::PAGE_PRINT_AREA},
157cdf0e10cSrcweir 
158cdf0e10cSrcweir     {SwFPos::REL_BORDER,        SwFPos::REL_BORDER,             LB_VERT_FRAME,          text::RelOrientation::FRAME},
159cdf0e10cSrcweir     {SwFPos::REL_PRTAREA,       SwFPos::REL_PRTAREA,            LB_VERT_PRTAREA,        text::RelOrientation::PRINT_AREA},
160cdf0e10cSrcweir 
161cdf0e10cSrcweir     // OD 10.11.2003 #i22305#
162cdf0e10cSrcweir     {SwFPos::FLY_REL_PG_FRAME,      SwFPos::FLY_REL_PG_FRAME,   LB_FLY_VERT_FRAME,      text::RelOrientation::FRAME},
163cdf0e10cSrcweir     {SwFPos::FLY_REL_PG_PRTAREA,    SwFPos::FLY_REL_PG_PRTAREA,     LB_FLY_VERT_PRTAREA,    text::RelOrientation::PRINT_AREA},
164cdf0e10cSrcweir 
165cdf0e10cSrcweir     // OD 11.11.2003 #i22341#
166cdf0e10cSrcweir     {SwFPos::REL_LINE,  SwFPos::REL_LINE,   LB_VERT_LINE,   text::RelOrientation::TEXT_LINE}
167cdf0e10cSrcweir };
168cdf0e10cSrcweir 
169cdf0e10cSrcweir static RelationMap __FAR_DATA aAsCharRelationMap[] =
170cdf0e10cSrcweir {
171cdf0e10cSrcweir     {SwFPos::REL_BASE,  SwFPos::REL_BASE,   LB_REL_BASE,    text::RelOrientation::FRAME},
172cdf0e10cSrcweir     {SwFPos::REL_CHAR,   SwFPos::REL_CHAR,   LB_REL_CHAR,   text::RelOrientation::FRAME},
173cdf0e10cSrcweir     {SwFPos::REL_ROW,    SwFPos::REL_ROW,   LB_REL_ROW,     text::RelOrientation::FRAME}
174cdf0e10cSrcweir };
175cdf0e10cSrcweir 
176cdf0e10cSrcweir /*--------------------------------------------------------------------
177cdf0e10cSrcweir 	Beschreibung: Seite verankert
178cdf0e10cSrcweir  --------------------------------------------------------------------*/
179cdf0e10cSrcweir 
180cdf0e10cSrcweir #define HORI_PAGE_REL	(LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_PG_LEFT| \
181cdf0e10cSrcweir 						LB_REL_PG_RIGHT)
182cdf0e10cSrcweir 
183cdf0e10cSrcweir static FrmMap __FAR_DATA aHPageMap[] =
184cdf0e10cSrcweir {
185cdf0e10cSrcweir     {SwFPos::LEFT,          SwFPos::MIR_LEFT,       text::HoriOrientation::LEFT,      HORI_PAGE_REL},
186cdf0e10cSrcweir     {SwFPos::RIGHT,         SwFPos::MIR_RIGHT,      text::HoriOrientation::RIGHT,     HORI_PAGE_REL},
187cdf0e10cSrcweir     {SwFPos::CENTER_HORI,   SwFPos::CENTER_HORI,    text::HoriOrientation::CENTER,    HORI_PAGE_REL},
188cdf0e10cSrcweir     {SwFPos::FROMLEFT,      SwFPos::MIR_FROMLEFT,   text::HoriOrientation::NONE,      HORI_PAGE_REL}
189cdf0e10cSrcweir };
190cdf0e10cSrcweir 
191cdf0e10cSrcweir static FrmMap __FAR_DATA aHPageHtmlMap[] =
192cdf0e10cSrcweir {
193cdf0e10cSrcweir     {SwFPos::FROMLEFT,      SwFPos::MIR_FROMLEFT,   text::HoriOrientation::NONE,      LB_REL_PG_FRAME}
194cdf0e10cSrcweir };
195cdf0e10cSrcweir 
196cdf0e10cSrcweir #define VERT_PAGE_REL	(LB_REL_PG_FRAME|LB_REL_PG_PRTAREA)
197cdf0e10cSrcweir 
198cdf0e10cSrcweir static FrmMap __FAR_DATA aVPageMap[] =
199cdf0e10cSrcweir {
200cdf0e10cSrcweir     {SwFPos::TOP,           SwFPos::TOP,            text::VertOrientation::TOP,       VERT_PAGE_REL},
201cdf0e10cSrcweir     {SwFPos::BOTTOM,        SwFPos::BOTTOM,         text::VertOrientation::BOTTOM,    VERT_PAGE_REL},
202cdf0e10cSrcweir     {SwFPos::CENTER_VERT,   SwFPos::CENTER_VERT,    text::VertOrientation::CENTER,    VERT_PAGE_REL},
203cdf0e10cSrcweir     {SwFPos::FROMTOP,       SwFPos::FROMTOP,        text::VertOrientation::NONE,      VERT_PAGE_REL}
204cdf0e10cSrcweir };
205cdf0e10cSrcweir 
206cdf0e10cSrcweir static FrmMap __FAR_DATA aVPageHtmlMap[] =
207cdf0e10cSrcweir {
208cdf0e10cSrcweir     {SwFPos::FROMTOP,       SwFPos::FROMTOP,        text::VertOrientation::NONE,      LB_REL_PG_FRAME}
209cdf0e10cSrcweir };
210cdf0e10cSrcweir 
211cdf0e10cSrcweir /*--------------------------------------------------------------------
212cdf0e10cSrcweir 	Beschreibung: Rahmen verankert
213cdf0e10cSrcweir  --------------------------------------------------------------------*/
214cdf0e10cSrcweir 
215cdf0e10cSrcweir #define HORI_FRAME_REL	(LB_FLY_REL_PG_FRAME|LB_FLY_REL_PG_PRTAREA| \
216cdf0e10cSrcweir 						LB_FLY_REL_PG_LEFT|LB_FLY_REL_PG_RIGHT)
217cdf0e10cSrcweir 
218cdf0e10cSrcweir static FrmMap __FAR_DATA aHFrameMap[] =
219cdf0e10cSrcweir {
220cdf0e10cSrcweir     {SwFPos::LEFT,          SwFPos::MIR_LEFT,       text::HoriOrientation::LEFT,  HORI_FRAME_REL},
221cdf0e10cSrcweir     {SwFPos::RIGHT,         SwFPos::MIR_RIGHT,      text::HoriOrientation::RIGHT,     HORI_FRAME_REL},
222cdf0e10cSrcweir     {SwFPos::CENTER_HORI,   SwFPos::CENTER_HORI,    text::HoriOrientation::CENTER,    HORI_FRAME_REL},
223cdf0e10cSrcweir     {SwFPos::FROMLEFT,      SwFPos::MIR_FROMLEFT,   text::HoriOrientation::NONE,      HORI_FRAME_REL}
224cdf0e10cSrcweir };
225cdf0e10cSrcweir 
226cdf0e10cSrcweir static FrmMap __FAR_DATA aHFlyHtmlMap[] =
227cdf0e10cSrcweir {
228cdf0e10cSrcweir     {SwFPos::LEFT,          SwFPos::MIR_LEFT,       text::HoriOrientation::LEFT,      LB_FLY_REL_PG_FRAME},
229cdf0e10cSrcweir     {SwFPos::FROMLEFT,      SwFPos::MIR_FROMLEFT,   text::HoriOrientation::NONE,      LB_FLY_REL_PG_FRAME}
230cdf0e10cSrcweir };
231cdf0e10cSrcweir 
232cdf0e10cSrcweir // OD 19.09.2003 #i18732# - own vertical alignment map for to frame anchored objects
233cdf0e10cSrcweir // OD 10.11.2003 #i22305#
234cdf0e10cSrcweir #define VERT_FRAME_REL   (LB_FLY_VERT_FRAME|LB_FLY_VERT_PRTAREA)
235cdf0e10cSrcweir 
236cdf0e10cSrcweir static FrmMap __FAR_DATA aVFrameMap[] =
237cdf0e10cSrcweir {
238cdf0e10cSrcweir     {SwFPos::TOP,           SwFPos::TOP,            text::VertOrientation::TOP,       VERT_FRAME_REL},
239cdf0e10cSrcweir     {SwFPos::BOTTOM,        SwFPos::BOTTOM,         text::VertOrientation::BOTTOM,    VERT_FRAME_REL},
240cdf0e10cSrcweir     {SwFPos::CENTER_VERT,   SwFPos::CENTER_VERT,    text::VertOrientation::CENTER,    VERT_FRAME_REL},
241cdf0e10cSrcweir     {SwFPos::FROMTOP,       SwFPos::FROMTOP,        text::VertOrientation::NONE,      VERT_FRAME_REL}
242cdf0e10cSrcweir };
243cdf0e10cSrcweir 
244cdf0e10cSrcweir static FrmMap __FAR_DATA aVFlyHtmlMap[] =
245cdf0e10cSrcweir {
246cdf0e10cSrcweir     // OD 10.11.2003 #i22305#
247cdf0e10cSrcweir     {SwFPos::TOP,           SwFPos::TOP,            text::VertOrientation::TOP,       LB_FLY_VERT_FRAME},
248cdf0e10cSrcweir     {SwFPos::FROMTOP,       SwFPos::FROMTOP,        text::VertOrientation::NONE,      LB_FLY_VERT_FRAME}
249cdf0e10cSrcweir };
250cdf0e10cSrcweir 
251cdf0e10cSrcweir /*--------------------------------------------------------------------
252cdf0e10cSrcweir 	Beschreibung: Absatz verankert
253cdf0e10cSrcweir  --------------------------------------------------------------------*/
254cdf0e10cSrcweir 
255cdf0e10cSrcweir #define HORI_PARA_REL	(LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \
256cdf0e10cSrcweir 						LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \
257cdf0e10cSrcweir 						LB_REL_FRM_RIGHT)
258cdf0e10cSrcweir 
259cdf0e10cSrcweir static FrmMap __FAR_DATA aHParaMap[] =
260cdf0e10cSrcweir {
261cdf0e10cSrcweir     {SwFPos::LEFT,          SwFPos::MIR_LEFT,       text::HoriOrientation::LEFT,      HORI_PARA_REL},
262cdf0e10cSrcweir     {SwFPos::RIGHT,         SwFPos::MIR_RIGHT,      text::HoriOrientation::RIGHT,     HORI_PARA_REL},
263cdf0e10cSrcweir     {SwFPos::CENTER_HORI,   SwFPos::CENTER_HORI,    text::HoriOrientation::CENTER,    HORI_PARA_REL},
264cdf0e10cSrcweir     {SwFPos::FROMLEFT,      SwFPos::MIR_FROMLEFT,   text::HoriOrientation::NONE,      HORI_PARA_REL}
265cdf0e10cSrcweir };
266cdf0e10cSrcweir 
267cdf0e10cSrcweir #define HTML_HORI_PARA_REL	(LB_FRAME|LB_PRTAREA)
268cdf0e10cSrcweir 
269cdf0e10cSrcweir static FrmMap __FAR_DATA aHParaHtmlMap[] =
270cdf0e10cSrcweir {
271cdf0e10cSrcweir     {SwFPos::LEFT,  SwFPos::LEFT,   text::HoriOrientation::LEFT,      HTML_HORI_PARA_REL},
272cdf0e10cSrcweir     {SwFPos::RIGHT, SwFPos::RIGHT,  text::HoriOrientation::RIGHT,     HTML_HORI_PARA_REL}
273cdf0e10cSrcweir };
274cdf0e10cSrcweir 
275cdf0e10cSrcweir static FrmMap __FAR_DATA aHParaHtmlAbsMap[] =
276cdf0e10cSrcweir {
277cdf0e10cSrcweir     {SwFPos::LEFT,          SwFPos::MIR_LEFT,       text::HoriOrientation::LEFT,      HTML_HORI_PARA_REL},
278cdf0e10cSrcweir     {SwFPos::RIGHT,         SwFPos::MIR_RIGHT,      text::HoriOrientation::RIGHT,     HTML_HORI_PARA_REL}
279cdf0e10cSrcweir };
280cdf0e10cSrcweir 
281cdf0e10cSrcweir // OD 19.09.2003 #i18732# - allow vertical alignment at page areas
282cdf0e10cSrcweir #define VERT_PARA_REL   (LB_VERT_FRAME|LB_VERT_PRTAREA| \
283cdf0e10cSrcweir                          LB_REL_PG_FRAME|LB_REL_PG_PRTAREA)
284cdf0e10cSrcweir 
285cdf0e10cSrcweir static FrmMap __FAR_DATA aVParaMap[] =
286cdf0e10cSrcweir {
287cdf0e10cSrcweir     {SwFPos::TOP,           SwFPos::TOP,            text::VertOrientation::TOP,       VERT_PARA_REL},
288cdf0e10cSrcweir     {SwFPos::BOTTOM,        SwFPos::BOTTOM,         text::VertOrientation::BOTTOM,    VERT_PARA_REL},
289cdf0e10cSrcweir     {SwFPos::CENTER_VERT,   SwFPos::CENTER_VERT,    text::VertOrientation::CENTER,    VERT_PARA_REL},
290cdf0e10cSrcweir     {SwFPos::FROMTOP,       SwFPos::FROMTOP,        text::VertOrientation::NONE,      VERT_PARA_REL}
291cdf0e10cSrcweir };
292cdf0e10cSrcweir 
293cdf0e10cSrcweir static FrmMap __FAR_DATA aVParaHtmlMap[] =
294cdf0e10cSrcweir {
295cdf0e10cSrcweir     {SwFPos::TOP,           SwFPos::TOP,            text::VertOrientation::TOP,       LB_VERT_PRTAREA}
296cdf0e10cSrcweir };
297cdf0e10cSrcweir 
298cdf0e10cSrcweir /*--------------------------------------------------------------------
299cdf0e10cSrcweir 	Beschreibung: Relativ zum Zeichen verankert
300cdf0e10cSrcweir  --------------------------------------------------------------------*/
301cdf0e10cSrcweir 
302cdf0e10cSrcweir #define HORI_CHAR_REL	(LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \
303cdf0e10cSrcweir 						LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \
304cdf0e10cSrcweir 						LB_REL_FRM_RIGHT|LB_REL_CHAR)
305cdf0e10cSrcweir 
306cdf0e10cSrcweir static FrmMap __FAR_DATA aHCharMap[] =
307cdf0e10cSrcweir {
308cdf0e10cSrcweir     {SwFPos::LEFT,          SwFPos::MIR_LEFT,       text::HoriOrientation::LEFT,      HORI_CHAR_REL},
309cdf0e10cSrcweir     {SwFPos::RIGHT,         SwFPos::MIR_RIGHT,      text::HoriOrientation::RIGHT,     HORI_CHAR_REL},
310cdf0e10cSrcweir     {SwFPos::CENTER_HORI,   SwFPos::CENTER_HORI,    text::HoriOrientation::CENTER,    HORI_CHAR_REL},
311cdf0e10cSrcweir     {SwFPos::FROMLEFT,      SwFPos::MIR_FROMLEFT,   text::HoriOrientation::NONE,      HORI_CHAR_REL}
312cdf0e10cSrcweir };
313cdf0e10cSrcweir 
314cdf0e10cSrcweir #define HTML_HORI_CHAR_REL	(LB_FRAME|LB_PRTAREA|LB_REL_CHAR)
315cdf0e10cSrcweir 
316cdf0e10cSrcweir static FrmMap __FAR_DATA aHCharHtmlMap[] =
317cdf0e10cSrcweir {
318cdf0e10cSrcweir     {SwFPos::LEFT,          SwFPos::LEFT,           text::HoriOrientation::LEFT,      HTML_HORI_CHAR_REL},
319cdf0e10cSrcweir     {SwFPos::RIGHT,         SwFPos::RIGHT,          text::HoriOrientation::RIGHT,     HTML_HORI_CHAR_REL}
320cdf0e10cSrcweir };
321cdf0e10cSrcweir 
322cdf0e10cSrcweir static FrmMap __FAR_DATA aHCharHtmlAbsMap[] =
323cdf0e10cSrcweir {
324cdf0e10cSrcweir     {SwFPos::LEFT,          SwFPos::MIR_LEFT,       text::HoriOrientation::LEFT,      LB_PRTAREA|LB_REL_CHAR},
325cdf0e10cSrcweir     {SwFPos::RIGHT,         SwFPos::MIR_RIGHT,      text::HoriOrientation::RIGHT,     LB_PRTAREA},
326cdf0e10cSrcweir     {SwFPos::FROMLEFT,      SwFPos::MIR_FROMLEFT,   text::HoriOrientation::NONE,      LB_REL_PG_FRAME}
327cdf0e10cSrcweir };
328cdf0e10cSrcweir 
329cdf0e10cSrcweir // OD 19.09.2003 #i18732# - allow vertical alignment at page areas
330cdf0e10cSrcweir // OD 12.11.2003 #i22341# - handle <LB_REL_CHAR> on its own
331cdf0e10cSrcweir #define VERT_CHAR_REL   (LB_VERT_FRAME|LB_VERT_PRTAREA| \
332cdf0e10cSrcweir                          LB_REL_PG_FRAME|LB_REL_PG_PRTAREA)
333cdf0e10cSrcweir 
334cdf0e10cSrcweir static FrmMap __FAR_DATA aVCharMap[] =
335cdf0e10cSrcweir {
336cdf0e10cSrcweir     // OD 11.11.2003 #i22341#
337cdf0e10cSrcweir     // introduce mappings for new vertical alignment at top of line <LB_VERT_LINE>
338cdf0e10cSrcweir     // and correct mapping for vertical alignment at character for position <FROM_BOTTOM>
339cdf0e10cSrcweir     // Note: Because of these adjustments the map becomes ambigous in its values
340cdf0e10cSrcweir     //       <eStrId>/<eMirrorStrId> and <nAlign>. These ambiguities are considered
341cdf0e10cSrcweir     //       in the methods <SwFrmPage::FillRelLB(..)>, <SwFrmPage::GetAlignment(..)>
342cdf0e10cSrcweir     //       and <SwFrmPage::FillPosLB(..)>
343cdf0e10cSrcweir     {SwFPos::TOP,           SwFPos::TOP,            text::VertOrientation::TOP,           VERT_CHAR_REL|LB_REL_CHAR},
344cdf0e10cSrcweir     {SwFPos::BOTTOM,        SwFPos::BOTTOM,         text::VertOrientation::BOTTOM,        VERT_CHAR_REL|LB_REL_CHAR},
345cdf0e10cSrcweir     {SwFPos::BELOW,         SwFPos::BELOW,          text::VertOrientation::CHAR_BOTTOM,   LB_REL_CHAR},
346cdf0e10cSrcweir     {SwFPos::CENTER_VERT,   SwFPos::CENTER_VERT,    text::VertOrientation::CENTER,        VERT_CHAR_REL|LB_REL_CHAR},
347cdf0e10cSrcweir     {SwFPos::FROMTOP,       SwFPos::FROMTOP,        text::VertOrientation::NONE,          VERT_CHAR_REL},
348cdf0e10cSrcweir     {SwFPos::FROMBOTTOM,    SwFPos::FROMBOTTOM,     text::VertOrientation::NONE,          LB_REL_CHAR|LB_VERT_LINE},
349cdf0e10cSrcweir     {SwFPos::TOP,           SwFPos::TOP,            text::VertOrientation::LINE_TOP,      LB_VERT_LINE},
350cdf0e10cSrcweir     {SwFPos::BOTTOM,        SwFPos::BOTTOM,         text::VertOrientation::LINE_BOTTOM,   LB_VERT_LINE},
351cdf0e10cSrcweir     {SwFPos::CENTER_VERT,   SwFPos::CENTER_VERT,    text::VertOrientation::LINE_CENTER,   LB_VERT_LINE}
352cdf0e10cSrcweir };
353cdf0e10cSrcweir 
354cdf0e10cSrcweir 
355cdf0e10cSrcweir static FrmMap __FAR_DATA aVCharHtmlMap[] =
356cdf0e10cSrcweir {
357cdf0e10cSrcweir     {SwFPos::BELOW,         SwFPos::BELOW,          text::VertOrientation::CHAR_BOTTOM,   LB_REL_CHAR}
358cdf0e10cSrcweir };
359cdf0e10cSrcweir 
360cdf0e10cSrcweir static FrmMap __FAR_DATA aVCharHtmlAbsMap[] =
361cdf0e10cSrcweir {
362cdf0e10cSrcweir     {SwFPos::TOP,           SwFPos::TOP,            text::VertOrientation::TOP,           LB_REL_CHAR},
363cdf0e10cSrcweir     {SwFPos::BELOW,             SwFPos::BELOW,          text::VertOrientation::CHAR_BOTTOM,   LB_REL_CHAR}
364cdf0e10cSrcweir };
365cdf0e10cSrcweir /*--------------------------------------------------------------------
366cdf0e10cSrcweir 	Beschreibung: Als Zeichen verankert
367cdf0e10cSrcweir  --------------------------------------------------------------------*/
368cdf0e10cSrcweir 
369cdf0e10cSrcweir static FrmMap __FAR_DATA aVAsCharMap[] =
370cdf0e10cSrcweir {
371cdf0e10cSrcweir     {SwFPos::TOP,               SwFPos::TOP,            text::VertOrientation::TOP,           LB_REL_BASE},
372cdf0e10cSrcweir     {SwFPos::BOTTOM,        SwFPos::BOTTOM,         text::VertOrientation::BOTTOM,        LB_REL_BASE},
373cdf0e10cSrcweir     {SwFPos::CENTER_VERT,   SwFPos::CENTER_VERT,    text::VertOrientation::CENTER,        LB_REL_BASE},
374cdf0e10cSrcweir 
375cdf0e10cSrcweir     {SwFPos::TOP,               SwFPos::TOP,            text::VertOrientation::CHAR_TOP,      LB_REL_CHAR},
376cdf0e10cSrcweir     {SwFPos::BOTTOM,        SwFPos::BOTTOM,         text::VertOrientation::CHAR_BOTTOM,   LB_REL_CHAR},
377cdf0e10cSrcweir     {SwFPos::CENTER_VERT,   SwFPos::CENTER_VERT,    text::VertOrientation::CHAR_CENTER,   LB_REL_CHAR},
378cdf0e10cSrcweir 
379cdf0e10cSrcweir     {SwFPos::TOP,               SwFPos::TOP,            text::VertOrientation::LINE_TOP,      LB_REL_ROW},
380cdf0e10cSrcweir     {SwFPos::BOTTOM,        SwFPos::BOTTOM,         text::VertOrientation::LINE_BOTTOM,   LB_REL_ROW},
381cdf0e10cSrcweir     {SwFPos::CENTER_VERT,   SwFPos::CENTER_VERT,    text::VertOrientation::LINE_CENTER,   LB_REL_ROW},
382cdf0e10cSrcweir 
383cdf0e10cSrcweir     {SwFPos::FROMBOTTOM,    SwFPos::FROMBOTTOM,     text::VertOrientation::NONE,          LB_REL_BASE}
384cdf0e10cSrcweir };
385cdf0e10cSrcweir 
386cdf0e10cSrcweir static FrmMap __FAR_DATA aVAsCharHtmlMap[] =
387cdf0e10cSrcweir {
388cdf0e10cSrcweir     {SwFPos::TOP,               SwFPos::TOP,            text::VertOrientation::TOP,           LB_REL_BASE},
389cdf0e10cSrcweir     {SwFPos::CENTER_VERT,   SwFPos::CENTER_VERT,    text::VertOrientation::CENTER,        LB_REL_BASE},
390cdf0e10cSrcweir 
391cdf0e10cSrcweir     {SwFPos::TOP,               SwFPos::TOP,            text::VertOrientation::CHAR_TOP,      LB_REL_CHAR},
392cdf0e10cSrcweir 
393cdf0e10cSrcweir     {SwFPos::TOP,               SwFPos::TOP,            text::VertOrientation::LINE_TOP,      LB_REL_ROW},
394cdf0e10cSrcweir     {SwFPos::BOTTOM,        SwFPos::BOTTOM,         text::VertOrientation::LINE_BOTTOM,   LB_REL_ROW},
395cdf0e10cSrcweir     {SwFPos::CENTER_VERT,   SwFPos::CENTER_VERT,    text::VertOrientation::LINE_CENTER,   LB_REL_ROW}
396cdf0e10cSrcweir };
397cdf0e10cSrcweir 
398cdf0e10cSrcweir static sal_uInt16 __FAR_DATA aPageRg[] = {
399cdf0e10cSrcweir 	RES_FRM_SIZE, RES_FRM_SIZE,
400cdf0e10cSrcweir 	RES_VERT_ORIENT, RES_ANCHOR,
401cdf0e10cSrcweir 	RES_COL, RES_COL,
402cdf0e10cSrcweir     RES_FOLLOW_TEXT_FLOW, RES_FOLLOW_TEXT_FLOW,
403cdf0e10cSrcweir 	0
404cdf0e10cSrcweir };
405cdf0e10cSrcweir static sal_uInt16 __FAR_DATA aAddPgRg[] = {
406cdf0e10cSrcweir 	RES_PROTECT, 			RES_PROTECT,
407cdf0e10cSrcweir 	RES_PRINT, 				RES_PRINT,
408cdf0e10cSrcweir 	FN_SET_FRM_NAME,		FN_SET_FRM_NAME,
409cdf0e10cSrcweir 	FN_SET_FRM_ALT_NAME,	FN_SET_FRM_ALT_NAME,
410cdf0e10cSrcweir 	0
411cdf0e10cSrcweir };
412cdf0e10cSrcweir 
413cdf0e10cSrcweir /*--------------------------------------------------------------------
414cdf0e10cSrcweir 	Beschreibung:
415cdf0e10cSrcweir  --------------------------------------------------------------------*/
416cdf0e10cSrcweir 
417cdf0e10cSrcweir size_t lcl_GetFrmMapCount( const FrmMap* pMap)
418cdf0e10cSrcweir {
419cdf0e10cSrcweir 	if ( pMap )
420cdf0e10cSrcweir 	{
421cdf0e10cSrcweir 		int aSizeOf = sizeof(FrmMap);
422cdf0e10cSrcweir 		if( pMap == aVParaHtmlMap)
423cdf0e10cSrcweir 			return sizeof(aVParaHtmlMap) / aSizeOf;
424cdf0e10cSrcweir 		if( pMap == aVAsCharHtmlMap)
425cdf0e10cSrcweir 			return sizeof(aVAsCharHtmlMap) / aSizeOf;
426cdf0e10cSrcweir 		if( pMap == aHParaHtmlMap)
427cdf0e10cSrcweir 			return sizeof(aHParaHtmlMap) / aSizeOf;
428cdf0e10cSrcweir 		if( pMap == aHParaHtmlAbsMap)
429cdf0e10cSrcweir 			return sizeof(aHParaHtmlAbsMap) / aSizeOf;
430cdf0e10cSrcweir 		if ( pMap == aVPageMap )
431cdf0e10cSrcweir 			return sizeof(aVPageMap) / aSizeOf;
432cdf0e10cSrcweir 		if ( pMap == aVPageHtmlMap )
433cdf0e10cSrcweir 			return sizeof(aVPageHtmlMap) / aSizeOf;
434cdf0e10cSrcweir 		if ( pMap == aVAsCharMap )
435cdf0e10cSrcweir 			return sizeof(aVAsCharMap) / aSizeOf;
436cdf0e10cSrcweir 		if ( pMap == aVParaMap )
437cdf0e10cSrcweir 			return sizeof(aVParaMap) / aSizeOf;
438cdf0e10cSrcweir 		if ( pMap == aHParaMap )
439cdf0e10cSrcweir 			return sizeof(aHParaMap) / aSizeOf;
440cdf0e10cSrcweir 		if ( pMap == aHFrameMap )
441cdf0e10cSrcweir 			return sizeof(aHFrameMap) / aSizeOf;
442cdf0e10cSrcweir         // OD 19.09.2003 #i18732# - own vertical alignment map for to frame anchored objects
443cdf0e10cSrcweir         if ( pMap == aVFrameMap )
444cdf0e10cSrcweir             return sizeof(aVFrameMap) / aSizeOf;
445cdf0e10cSrcweir 		if ( pMap == aHCharMap )
446cdf0e10cSrcweir 			return sizeof(aHCharMap) / aSizeOf;
447cdf0e10cSrcweir 		if ( pMap == aHCharHtmlMap )
448cdf0e10cSrcweir 			return sizeof(aHCharHtmlMap) / aSizeOf;
449cdf0e10cSrcweir 		if ( pMap == aHCharHtmlAbsMap )
450cdf0e10cSrcweir 			return sizeof(aHCharHtmlAbsMap) / aSizeOf;
451cdf0e10cSrcweir 		if ( pMap == aVCharMap )
452cdf0e10cSrcweir 			return sizeof(aVCharMap) / aSizeOf;
453cdf0e10cSrcweir 		if ( pMap == aVCharHtmlMap )
454cdf0e10cSrcweir 			return sizeof(aVCharHtmlMap) / aSizeOf;
455cdf0e10cSrcweir 		if ( pMap == aVCharHtmlAbsMap )
456cdf0e10cSrcweir 			return sizeof(aVCharHtmlAbsMap) / aSizeOf;
457cdf0e10cSrcweir 		if ( pMap == aHPageHtmlMap )
458cdf0e10cSrcweir 			return sizeof(aHPageHtmlMap) / aSizeOf;
459cdf0e10cSrcweir 		if ( pMap == aHFlyHtmlMap )
460cdf0e10cSrcweir 			return sizeof(aHFlyHtmlMap) / aSizeOf;
461cdf0e10cSrcweir 		if ( pMap == aVFlyHtmlMap )
462cdf0e10cSrcweir 			return sizeof(aVFlyHtmlMap) / aSizeOf;
463cdf0e10cSrcweir 		return sizeof(aHPageMap) / aSizeOf;
464cdf0e10cSrcweir 	}
465cdf0e10cSrcweir 	return 0;
466cdf0e10cSrcweir }
467cdf0e10cSrcweir /* -----------------------------08.08.2002 14:45------------------------------
468cdf0e10cSrcweir 
469cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
470cdf0e10cSrcweir void lcl_InsertVectors(ListBox& rBox,
471cdf0e10cSrcweir     const ::std::vector< String >& rPrev, const ::std::vector< String >& rThis,
472cdf0e10cSrcweir     const ::std::vector< String >& rNext, const ::std::vector< String >& rRemain)
473cdf0e10cSrcweir {
474cdf0e10cSrcweir     ::std::vector< String >::const_iterator aIt;
475cdf0e10cSrcweir     sal_uInt16 nEntry = 0;
476cdf0e10cSrcweir     for(aIt = rPrev.begin(); aIt != rPrev.end(); aIt++)
477cdf0e10cSrcweir         nEntry = rBox.InsertEntry(*aIt);
478cdf0e10cSrcweir     for(aIt = rThis.begin(); aIt != rThis.end(); aIt++)
479cdf0e10cSrcweir         nEntry = rBox.InsertEntry(*aIt);
480cdf0e10cSrcweir     for(aIt = rNext.begin(); aIt != rNext.end(); aIt++)
481cdf0e10cSrcweir         nEntry = rBox.InsertEntry(*aIt);
482cdf0e10cSrcweir     rBox.SetSeparatorPos(nEntry);
483cdf0e10cSrcweir 	//now insert all strings sorted
484cdf0e10cSrcweir 	sal_uInt16 nStartPos = rBox.GetEntryCount();
485cdf0e10cSrcweir 
486cdf0e10cSrcweir     for(aIt = rPrev.begin(); aIt != rPrev.end(); aIt++)
487cdf0e10cSrcweir 		::InsertStringSorted(*aIt, rBox, nStartPos );
488cdf0e10cSrcweir     for(aIt = rThis.begin(); aIt != rThis.end(); aIt++)
489cdf0e10cSrcweir 		::InsertStringSorted(*aIt, rBox, nStartPos );
490cdf0e10cSrcweir     for(aIt = rNext.begin(); aIt != rNext.end(); aIt++)
491cdf0e10cSrcweir 		::InsertStringSorted(*aIt, rBox, nStartPos );
492cdf0e10cSrcweir     for(aIt = rRemain.begin(); aIt != rRemain.end(); aIt++)
493cdf0e10cSrcweir 		::InsertStringSorted(*aIt, rBox, nStartPos );
494cdf0e10cSrcweir }
495cdf0e10cSrcweir 
496cdf0e10cSrcweir /* -----------------------------20.08.2002 16:12------------------------------
497cdf0e10cSrcweir 
498cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
499cdf0e10cSrcweir // --> OD 2009-08-31 #mongolianlayout#
500cdf0e10cSrcweir // add input parameter
501cdf0e10cSrcweir SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL(SvxSwFramePosString::StringId eStringId, sal_Bool bVertical, sal_Bool bVerticalL2R, sal_Bool bRTL)
502cdf0e10cSrcweir {
503cdf0e10cSrcweir     //special handling of STR_FROMLEFT
504cdf0e10cSrcweir     if ( SwFPos::FROMLEFT == eStringId )
505cdf0e10cSrcweir     {
506cdf0e10cSrcweir         eStringId = bVertical
507cdf0e10cSrcweir                     ? ( bRTL
508cdf0e10cSrcweir                         ? SwFPos::FROMBOTTOM
509cdf0e10cSrcweir                         : SwFPos::FROMTOP )
510cdf0e10cSrcweir                     : ( bRTL
511cdf0e10cSrcweir                         ? SwFPos::FROMRIGHT
512cdf0e10cSrcweir                         : SwFPos::FROMLEFT );
513cdf0e10cSrcweir         return eStringId;
514cdf0e10cSrcweir     }
515cdf0e10cSrcweir     // --> OD 2009-08-31 #mongolianlayout#
516cdf0e10cSrcweir     // special handling of STR_FROMTOP in case of mongolianlayout (vertical left-to-right)
517cdf0e10cSrcweir     if ( SwFPos::FROMTOP == eStringId &&
518cdf0e10cSrcweir          bVertical && bVerticalL2R )
519cdf0e10cSrcweir     {
520cdf0e10cSrcweir         eStringId = SwFPos::FROMLEFT;
521cdf0e10cSrcweir         return eStringId;
522cdf0e10cSrcweir     }
523cdf0e10cSrcweir     // <--
524cdf0e10cSrcweir     if ( bVertical )
525cdf0e10cSrcweir     {
526cdf0e10cSrcweir         //exchange horizontal strings with vertical strings and vice versa
527cdf0e10cSrcweir         static const StringIdPair_Impl aHoriIds[] =
528cdf0e10cSrcweir         {
529cdf0e10cSrcweir             {SwFPos::LEFT,           SwFPos::TOP},
530cdf0e10cSrcweir             {SwFPos::RIGHT,          SwFPos::BOTTOM},
531cdf0e10cSrcweir             {SwFPos::CENTER_HORI,    SwFPos::CENTER_VERT},
532cdf0e10cSrcweir             {SwFPos::FROMTOP,        SwFPos::FROMRIGHT},
533cdf0e10cSrcweir             {SwFPos::REL_PG_LEFT,    SwFPos::REL_PG_TOP},
534cdf0e10cSrcweir             {SwFPos::REL_PG_RIGHT,   SwFPos::REL_PG_BOTTOM} ,
535cdf0e10cSrcweir             {SwFPos::REL_FRM_LEFT,   SwFPos::REL_FRM_TOP},
536cdf0e10cSrcweir             {SwFPos::REL_FRM_RIGHT,  SwFPos::REL_FRM_BOTTOM}
537cdf0e10cSrcweir         };
538cdf0e10cSrcweir         static const StringIdPair_Impl aVertIds[] =
539cdf0e10cSrcweir         {
540cdf0e10cSrcweir             {SwFPos::TOP,            SwFPos::RIGHT},
541cdf0e10cSrcweir             {SwFPos::BOTTOM,         SwFPos::LEFT },
542cdf0e10cSrcweir             {SwFPos::CENTER_VERT,    SwFPos::CENTER_HORI},
543cdf0e10cSrcweir             {SwFPos::FROMTOP,        SwFPos::FROMRIGHT },
544cdf0e10cSrcweir             {SwFPos::REL_PG_TOP,     SwFPos::REL_PG_LEFT },
545cdf0e10cSrcweir             {SwFPos::REL_PG_BOTTOM,  SwFPos::REL_PG_RIGHT } ,
546cdf0e10cSrcweir             {SwFPos::REL_FRM_TOP,    SwFPos::REL_FRM_LEFT },
547cdf0e10cSrcweir             {SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT }
548cdf0e10cSrcweir         };
549cdf0e10cSrcweir         // --> OD 2009-08-31 #monglianlayout#
550cdf0e10cSrcweir         static const StringIdPair_Impl aVertL2RIds[] =
551cdf0e10cSrcweir         {
552cdf0e10cSrcweir             {SwFPos::TOP,            SwFPos::LEFT },
553cdf0e10cSrcweir             {SwFPos::BOTTOM,         SwFPos::RIGHT },
554cdf0e10cSrcweir             {SwFPos::CENTER_VERT,    SwFPos::CENTER_HORI },
555cdf0e10cSrcweir             {SwFPos::FROMTOP,        SwFPos::FROMLEFT },
556cdf0e10cSrcweir             {SwFPos::REL_PG_TOP,     SwFPos::REL_PG_LEFT },
557cdf0e10cSrcweir             {SwFPos::REL_PG_BOTTOM,  SwFPos::REL_PG_RIGHT } ,
558cdf0e10cSrcweir             {SwFPos::REL_FRM_TOP,    SwFPos::REL_FRM_LEFT },
559cdf0e10cSrcweir             {SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT }
560cdf0e10cSrcweir         };
561cdf0e10cSrcweir         // <--
562cdf0e10cSrcweir         sal_uInt16 nIndex;
563cdf0e10cSrcweir         for(nIndex = 0; nIndex < sizeof(aHoriIds) / sizeof(StringIdPair_Impl); ++nIndex)
564cdf0e10cSrcweir         {
565cdf0e10cSrcweir             if(aHoriIds[nIndex].eHori == eStringId)
566cdf0e10cSrcweir             {
567cdf0e10cSrcweir                 eStringId = aHoriIds[nIndex].eVert;
568cdf0e10cSrcweir                 return eStringId;
569cdf0e10cSrcweir             }
570cdf0e10cSrcweir         }
571cdf0e10cSrcweir         nIndex = 0;
572cdf0e10cSrcweir         for(nIndex = 0; nIndex < sizeof(aVertIds) / sizeof(StringIdPair_Impl); ++nIndex)
573cdf0e10cSrcweir         {
574cdf0e10cSrcweir             // --> OD 2009-08-31 #mongolianlayout#
575cdf0e10cSrcweir             if ( !bVerticalL2R )
576cdf0e10cSrcweir             {
577cdf0e10cSrcweir                 if(aVertIds[nIndex].eHori == eStringId)
578cdf0e10cSrcweir                 {
579cdf0e10cSrcweir                     eStringId = aVertIds[nIndex].eVert;
580cdf0e10cSrcweir                     break;
581cdf0e10cSrcweir                 }
582cdf0e10cSrcweir             }
583cdf0e10cSrcweir             else
584cdf0e10cSrcweir             {
585cdf0e10cSrcweir                 if(aVertL2RIds[nIndex].eHori == eStringId)
586cdf0e10cSrcweir                 {
587cdf0e10cSrcweir                     eStringId = aVertL2RIds[nIndex].eVert;
588cdf0e10cSrcweir                     break;
589cdf0e10cSrcweir                 }
590cdf0e10cSrcweir             }
591cdf0e10cSrcweir             // <--
592cdf0e10cSrcweir         }
593cdf0e10cSrcweir     }
594cdf0e10cSrcweir     return eStringId;
595cdf0e10cSrcweir }
596cdf0e10cSrcweir 
597cdf0e10cSrcweir // OD 12.11.2003 #i22341# - helper method in order to determine all possible
598cdf0e10cSrcweir // listbox relations in a relation map for a given relation
599cdf0e10cSrcweir sal_uLong lcl_GetLBRelationsForRelations( const sal_uInt16 _nRel )
600cdf0e10cSrcweir {
601cdf0e10cSrcweir     sal_uLong nLBRelations = 0L;
602cdf0e10cSrcweir 
603cdf0e10cSrcweir     sal_uInt16 nRelMapSize = sizeof(aRelationMap) / sizeof(RelationMap);
604cdf0e10cSrcweir     for ( sal_uInt16 nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos )
605cdf0e10cSrcweir     {
606cdf0e10cSrcweir         if ( aRelationMap[nRelMapPos].nRelation == _nRel )
607cdf0e10cSrcweir         {
608cdf0e10cSrcweir             nLBRelations |= aRelationMap[nRelMapPos].nLBRelation;
609cdf0e10cSrcweir         }
610cdf0e10cSrcweir     }
611cdf0e10cSrcweir 
612cdf0e10cSrcweir     return nLBRelations;
613cdf0e10cSrcweir }
614cdf0e10cSrcweir 
615cdf0e10cSrcweir // OD 14.11.2003 #i22341# - helper method on order to determine all possible
616cdf0e10cSrcweir // listbox relations in a relation map for a given string ID
617cdf0e10cSrcweir sal_uLong lcl_GetLBRelationsForStrID( const FrmMap* _pMap,
618cdf0e10cSrcweir                                   const SvxSwFramePosString::StringId _eStrId,
619cdf0e10cSrcweir                                   const bool _bUseMirrorStr )
620cdf0e10cSrcweir {
621cdf0e10cSrcweir     sal_uLong nLBRelations = 0L;
622cdf0e10cSrcweir 
623cdf0e10cSrcweir     size_t nRelMapSize = lcl_GetFrmMapCount( _pMap );
624cdf0e10cSrcweir     for ( size_t nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos )
625cdf0e10cSrcweir     {
626cdf0e10cSrcweir         if ( ( !_bUseMirrorStr && _pMap[nRelMapPos].eStrId == _eStrId ) ||
627cdf0e10cSrcweir              ( _bUseMirrorStr && _pMap[nRelMapPos].eMirrorStrId == _eStrId ) )
628cdf0e10cSrcweir         {
629cdf0e10cSrcweir             nLBRelations |= _pMap[nRelMapPos].nLBRelations;
630cdf0e10cSrcweir         }
631cdf0e10cSrcweir     }
632cdf0e10cSrcweir 
633cdf0e10cSrcweir     return nLBRelations;
634cdf0e10cSrcweir }
635cdf0e10cSrcweir 
636cdf0e10cSrcweir /*--------------------------------------------------------------------
637cdf0e10cSrcweir 	Beschreibung:	StandardRahmenTabPage
638cdf0e10cSrcweir  --------------------------------------------------------------------*/
639cdf0e10cSrcweir 
640cdf0e10cSrcweir namespace
641cdf0e10cSrcweir {
642cdf0e10cSrcweir 	void HandleAutoCB( sal_Bool _bChecked, FixedText& _rFT_man, FixedText& _rFT_auto )
643cdf0e10cSrcweir 	{
644cdf0e10cSrcweir 		_rFT_man.Show( !_bChecked );
645cdf0e10cSrcweir 		_rFT_auto.Show( _bChecked );
646cdf0e10cSrcweir 	}
647cdf0e10cSrcweir }
648cdf0e10cSrcweir 
649cdf0e10cSrcweir 
650cdf0e10cSrcweir SwFrmPage::SwFrmPage ( Window *pParent, const SfxItemSet &rSet ) :
651cdf0e10cSrcweir 	SfxTabPage		(pParent, SW_RES(TP_FRM_STD), rSet),
652cdf0e10cSrcweir 
653cdf0e10cSrcweir     aSizeFL         (this, SW_RES(FL_SIZE)),
654cdf0e10cSrcweir     aWidthFT        (this, SW_RES(FT_WIDTH)),
655cdf0e10cSrcweir 	aWidthAutoFT	(this, SW_RES(FT_WIDTH_AUTO)),
656cdf0e10cSrcweir 	aWidthED		(this, SW_RES(ED_WIDTH)),
657cdf0e10cSrcweir 	aRelWidthCB		(this, SW_RES(CB_REL_WIDTH)),
658cdf0e10cSrcweir 	aAutoWidthCB	(this, SW_RES(CB_AUTOWIDTH)),
659cdf0e10cSrcweir 	aHeightFT		(this, SW_RES(FT_HEIGHT)),
660cdf0e10cSrcweir 	aHeightAutoFT	(this, SW_RES(FT_HEIGHT_AUTO)),
661cdf0e10cSrcweir 	aHeightED		(this, SW_RES(ED_HEIGHT)),
662cdf0e10cSrcweir 	aRelHeightCB	(this, SW_RES(CB_REL_HEIGHT)),
663cdf0e10cSrcweir 	aAutoHeightCB	(this, SW_RES(CB_AUTOHEIGHT)),
664cdf0e10cSrcweir 	aFixedRatioCB	(this, SW_RES(CB_FIXEDRATIO)),
665cdf0e10cSrcweir     aRealSizeBT     (this, SW_RES(BT_REALSIZE)),
666cdf0e10cSrcweir 
667cdf0e10cSrcweir     aTypeSepFL     (this, SW_RES(FL_TYPE_SEP)),
668cdf0e10cSrcweir     aTypeFL        (this, SW_RES(FL_TYPE)),
669cdf0e10cSrcweir     aAnchorAtPageRB (this, SW_RES(RB_ANCHOR_PAGE)),
670cdf0e10cSrcweir 	aAnchorAtParaRB	(this, SW_RES(RB_ANCHOR_PARA)),
671cdf0e10cSrcweir 	aAnchorAtCharRB	(this, SW_RES(RB_ANCHOR_AT_CHAR)),
672cdf0e10cSrcweir 	aAnchorAsCharRB	(this, SW_RES(RB_ANCHOR_AS_CHAR)),
673cdf0e10cSrcweir 	aAnchorAtFrameRB(this, SW_RES(RB_ANCHOR_FRAME)),
674cdf0e10cSrcweir 
675cdf0e10cSrcweir     aPositionFL     (this, SW_RES(FL_POSITION)),
676cdf0e10cSrcweir 	aHorizontalFT	(this, SW_RES(FT_HORIZONTAL)),
677cdf0e10cSrcweir 	aHorizontalDLB	(this, SW_RES(DLB_HORIZONTAL)),
678cdf0e10cSrcweir 	aAtHorzPosFT	(this, SW_RES(FT_AT_HORZ_POS)),
679cdf0e10cSrcweir 	aAtHorzPosED	(this, SW_RES(ED_AT_HORZ_POS)),
680cdf0e10cSrcweir 	aHoriRelationFT (this, SW_RES(FT_HORI_RELATION)),
681cdf0e10cSrcweir 	aHoriRelationLB (this, SW_RES(LB_HORI_RELATION)),
682cdf0e10cSrcweir 	aMirrorPagesCB  (this, SW_RES(CB_MIRROR)),
683cdf0e10cSrcweir 	aVerticalFT		(this, SW_RES(FT_VERTICAL)),
684cdf0e10cSrcweir 	aVerticalDLB	(this, SW_RES(DLB_VERTICAL)),
685cdf0e10cSrcweir 	aAtVertPosFT	(this, SW_RES(FT_AT_VERT_POS)),
686cdf0e10cSrcweir 	aAtVertPosED	(this, SW_RES(ED_AT_VERT_POS)),
687cdf0e10cSrcweir 	aVertRelationFT (this, SW_RES(FT_VERT_RELATION)),
688cdf0e10cSrcweir 	aVertRelationLB (this, SW_RES(LB_VERT_RELATION)),
689cdf0e10cSrcweir     // OD 19.09.2003 #i18732# - new checkbox
690cdf0e10cSrcweir     aFollowTextFlowCB(this, SW_RES(CB_FOLLOWTEXTFLOW)),
691cdf0e10cSrcweir 
692cdf0e10cSrcweir     aExampleWN      (this, SW_RES(WN_BSP)),
693cdf0e10cSrcweir 
694cdf0e10cSrcweir     bAtHorzPosModified( sal_False ),
695cdf0e10cSrcweir     bAtVertPosModified( sal_False ),
696cdf0e10cSrcweir     bFormat(sal_False),
697cdf0e10cSrcweir     bNew(sal_True),
698cdf0e10cSrcweir     bNoModifyHdl(sal_True),
699cdf0e10cSrcweir     // --> OD 2009-08-31 #mongolianlayout# - no used
700cdf0e10cSrcweir //    bVerticalChanged(FALSE),
701cdf0e10cSrcweir     // <--
702cdf0e10cSrcweir     bIsVerticalFrame(sal_False),
703cdf0e10cSrcweir     // --> OD 2009-08-31 #mongolianlayou#
704cdf0e10cSrcweir     bIsVerticalL2R(sal_False),
705cdf0e10cSrcweir     // <--
706cdf0e10cSrcweir     bIsInRightToLeft(sal_False),
707cdf0e10cSrcweir     bHtmlMode(sal_False),
708cdf0e10cSrcweir     nHtmlMode(0),
709cdf0e10cSrcweir     nDlgType(0),
710cdf0e10cSrcweir     nUpperBorder(0),
711cdf0e10cSrcweir 	nLowerBorder(0),
712cdf0e10cSrcweir     fWidthHeightRatio(1.0),
713cdf0e10cSrcweir     // OD 12.11.2003 #i22341#
714cdf0e10cSrcweir     mpToCharCntntPos( NULL ),
715cdf0e10cSrcweir 
716cdf0e10cSrcweir     nOldH(text::HoriOrientation::CENTER),
717cdf0e10cSrcweir     nOldHRel(text::RelOrientation::FRAME),
718cdf0e10cSrcweir     nOldV(text::VertOrientation::TOP),
719cdf0e10cSrcweir     nOldVRel(text::RelOrientation::PRINT_AREA),
720cdf0e10cSrcweir     pVMap( 0 ),
721cdf0e10cSrcweir     pHMap( 0 ),
722cdf0e10cSrcweir     m_bAllowVertPositioning( true ),
723cdf0e10cSrcweir     m_bIsMathOLE( false ),
724cdf0e10cSrcweir     m_bIsMathBaselineAlignment( true )
725cdf0e10cSrcweir {
726cdf0e10cSrcweir 	FreeResource();
727cdf0e10cSrcweir 	SetExchangeSupport();
728cdf0e10cSrcweir 
729cdf0e10cSrcweir 	aRealSizeBT.SetAccessibleRelationMemberOf(&aSizeFL);
730cdf0e10cSrcweir 
731cdf0e10cSrcweir 	Link aLk = LINK(this, SwFrmPage, RangeModifyHdl);
732cdf0e10cSrcweir 	aWidthED.	 SetLoseFocusHdl( aLk );
733cdf0e10cSrcweir 	aHeightED.	 SetLoseFocusHdl( aLk );
734cdf0e10cSrcweir 	aAtHorzPosED.SetLoseFocusHdl( aLk );
735cdf0e10cSrcweir 	aAtVertPosED.SetLoseFocusHdl( aLk );
736cdf0e10cSrcweir     // OD 25.09.2003 #i18732# - click handler for new checkbox
737cdf0e10cSrcweir     aFollowTextFlowCB.SetClickHdl( aLk );
738cdf0e10cSrcweir 
739cdf0e10cSrcweir 	aLk = LINK(this, SwFrmPage, ModifyHdl);
740cdf0e10cSrcweir 	aWidthED.	 SetModifyHdl( aLk );
741cdf0e10cSrcweir 	aHeightED.	 SetModifyHdl( aLk );
742cdf0e10cSrcweir 	aAtHorzPosED.SetModifyHdl( aLk );
743cdf0e10cSrcweir 	aAtVertPosED.SetModifyHdl( aLk );
744cdf0e10cSrcweir 
745cdf0e10cSrcweir 	aLk = LINK(this, SwFrmPage, AnchorTypeHdl);
746cdf0e10cSrcweir 	aAnchorAtPageRB.SetClickHdl( aLk );
747cdf0e10cSrcweir 	aAnchorAtParaRB.SetClickHdl( aLk );
748cdf0e10cSrcweir 	aAnchorAtCharRB.SetClickHdl( aLk );
749cdf0e10cSrcweir 	aAnchorAsCharRB.SetClickHdl( aLk );
750cdf0e10cSrcweir 	aAnchorAtFrameRB.SetClickHdl( aLk );
751cdf0e10cSrcweir 
752cdf0e10cSrcweir 	aHorizontalDLB.SetSelectHdl(LINK(this, SwFrmPage, PosHdl));
753cdf0e10cSrcweir 	aVerticalDLB.  SetSelectHdl(LINK(this, SwFrmPage, PosHdl));
754cdf0e10cSrcweir 
755cdf0e10cSrcweir 	aHoriRelationLB.SetSelectHdl(LINK(this, SwFrmPage, RelHdl));
756cdf0e10cSrcweir 	aVertRelationLB.SetSelectHdl(LINK(this, SwFrmPage, RelHdl));
757cdf0e10cSrcweir 
758cdf0e10cSrcweir 	aMirrorPagesCB.SetClickHdl(LINK(this, SwFrmPage, MirrorHdl));
759cdf0e10cSrcweir 
760cdf0e10cSrcweir 	aLk = LINK(this, SwFrmPage, RelSizeClickHdl);
761cdf0e10cSrcweir 	aRelWidthCB.SetClickHdl( aLk );
762cdf0e10cSrcweir 	aRelHeightCB.SetClickHdl( aLk );
763cdf0e10cSrcweir 
764cdf0e10cSrcweir 	aAutoWidthCB.SetClickHdl( LINK( this, SwFrmPage, AutoWidthClickHdl ) );
765cdf0e10cSrcweir 	aAutoHeightCB.SetClickHdl( LINK( this, SwFrmPage, AutoHeightClickHdl ) );
766cdf0e10cSrcweir }
767cdf0e10cSrcweir 
768cdf0e10cSrcweir /*--------------------------------------------------------------------
769cdf0e10cSrcweir 	Beschreibung:	Dtor
770cdf0e10cSrcweir  --------------------------------------------------------------------*/
771cdf0e10cSrcweir 
772cdf0e10cSrcweir SwFrmPage::~SwFrmPage()
773cdf0e10cSrcweir {
774cdf0e10cSrcweir }
775cdf0e10cSrcweir 
776cdf0e10cSrcweir SfxTabPage* SwFrmPage::Create(Window *pParent, const SfxItemSet &rSet)
777cdf0e10cSrcweir {
778cdf0e10cSrcweir 	return new SwFrmPage( pParent, rSet );
779cdf0e10cSrcweir }
780cdf0e10cSrcweir 
781cdf0e10cSrcweir namespace
782cdf0e10cSrcweir {
783cdf0e10cSrcweir 	void MoveControl( Control& _rCtrl, long _nOffsetY )
784cdf0e10cSrcweir 	{
785cdf0e10cSrcweir 		Point aPt( _rCtrl.GetPosPixel() );
786cdf0e10cSrcweir 		aPt.Move( 0, _nOffsetY );
787cdf0e10cSrcweir 		_rCtrl.SetPosPixel( aPt );
788cdf0e10cSrcweir 	}
789cdf0e10cSrcweir }
790cdf0e10cSrcweir 
791cdf0e10cSrcweir void SwFrmPage::EnableGraficMode( void )
792cdf0e10cSrcweir {
793cdf0e10cSrcweir     // #i39692# mustn't be called more than once
794cdf0e10cSrcweir     if(!aRealSizeBT.IsVisible())
795cdf0e10cSrcweir     {
796cdf0e10cSrcweir         long nOffset1 = aRelWidthCB.GetPosPixel().Y() - aAutoWidthCB.GetPosPixel().Y();
797cdf0e10cSrcweir         long nOffset2 = nOffset1 + aRelHeightCB.GetPosPixel().Y() - aAutoHeightCB.GetPosPixel().Y();
798cdf0e10cSrcweir 
799cdf0e10cSrcweir         MoveControl( aHeightFT, nOffset1 );
800cdf0e10cSrcweir         MoveControl( aHeightED, nOffset1 );
801cdf0e10cSrcweir         MoveControl( aRelHeightCB, nOffset1 );
802cdf0e10cSrcweir         MoveControl( aFixedRatioCB, nOffset2 );
803cdf0e10cSrcweir 
804cdf0e10cSrcweir         aWidthFT.Show();
805cdf0e10cSrcweir         aWidthAutoFT.Hide();
806cdf0e10cSrcweir         aAutoHeightCB.Hide();
807cdf0e10cSrcweir 
808cdf0e10cSrcweir         aHeightFT.Show();
809cdf0e10cSrcweir         aHeightAutoFT.Hide();
810cdf0e10cSrcweir         aAutoWidthCB.Hide();
811cdf0e10cSrcweir 
812cdf0e10cSrcweir         aRealSizeBT.Show();
813cdf0e10cSrcweir     }
814cdf0e10cSrcweir }
815cdf0e10cSrcweir 
816cdf0e10cSrcweir void SwFrmPage::Reset( const SfxItemSet &rSet )
817cdf0e10cSrcweir {
818cdf0e10cSrcweir 
819cdf0e10cSrcweir 	SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell() :
820cdf0e10cSrcweir 			((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell();
821cdf0e10cSrcweir 
822cdf0e10cSrcweir 	nHtmlMode = ::GetHtmlMode(pSh->GetView().GetDocShell());
823cdf0e10cSrcweir 	bHtmlMode = nHtmlMode & HTMLMODE_ON ? sal_True : sal_False;
824cdf0e10cSrcweir 
825cdf0e10cSrcweir 	FieldUnit aMetric = ::GetDfltMetric(bHtmlMode);
826cdf0e10cSrcweir 	SetMetric( aWidthED, aMetric );
827cdf0e10cSrcweir 	SetMetric( aHeightED, aMetric );
828cdf0e10cSrcweir 	SetMetric( aAtHorzPosED, aMetric );
829cdf0e10cSrcweir 	SetMetric( aAtVertPosED, aMetric );
830cdf0e10cSrcweir 
831cdf0e10cSrcweir 	const SfxPoolItem* pItem = NULL;
832cdf0e10cSrcweir 
833cdf0e10cSrcweir 	const SwFmtAnchor& rAnchor = (const SwFmtAnchor&)rSet.Get(RES_ANCHOR);
834cdf0e10cSrcweir 
835cdf0e10cSrcweir     if (SFX_ITEM_SET == rSet.GetItemState(FN_OLE_IS_MATH, sal_False, &pItem))
836cdf0e10cSrcweir         m_bIsMathOLE = ((const SfxBoolItem*)pItem)->GetValue();
837cdf0e10cSrcweir     if (SFX_ITEM_SET == rSet.GetItemState(FN_MATH_BASELINE_ALIGNMENT, sal_False, &pItem))
838cdf0e10cSrcweir         m_bIsMathBaselineAlignment = ((const SfxBoolItem*)pItem)->GetValue();
839cdf0e10cSrcweir     EnableVerticalPositioning( !(m_bIsMathOLE && m_bIsMathBaselineAlignment
840cdf0e10cSrcweir             && FLY_AS_CHAR == rAnchor.GetAnchorId()) );
841cdf0e10cSrcweir 
842cdf0e10cSrcweir 	if (bFormat)
843cdf0e10cSrcweir 	{
844cdf0e10cSrcweir 		// Bei Formaten keine Ankerbearbeitung
845cdf0e10cSrcweir 		aAnchorAtPageRB.Enable( sal_False );
846cdf0e10cSrcweir 		aAnchorAtParaRB.Enable( sal_False );
847cdf0e10cSrcweir 		aAnchorAtCharRB.Enable( sal_False );
848cdf0e10cSrcweir 		aAnchorAsCharRB.Enable( sal_False );
849cdf0e10cSrcweir 		aAnchorAtFrameRB.Enable( sal_False );
850cdf0e10cSrcweir         aTypeFL.Enable( sal_False );
851cdf0e10cSrcweir 		aFixedRatioCB.Enable(sal_False);
852cdf0e10cSrcweir 	}
853cdf0e10cSrcweir     else
854cdf0e10cSrcweir     {
855cdf0e10cSrcweir         if (rAnchor.GetAnchorId() != FLY_AT_FLY && !pSh->IsFlyInFly())
856cdf0e10cSrcweir             aAnchorAtFrameRB.Hide();
857cdf0e10cSrcweir         // --> OD 2009-08-31 #mongolianlayout#
858cdf0e10cSrcweir //        if ( !bVerticalChanged && pSh->IsFrmVertical(sal_True, bIsInRightToLeft) )
859cdf0e10cSrcweir         if ( pSh->IsFrmVertical( sal_True, bIsInRightToLeft, bIsVerticalL2R ) )
860cdf0e10cSrcweir         // <--
861cdf0e10cSrcweir         {
862cdf0e10cSrcweir             String sHLabel = aHorizontalFT.GetText();
863cdf0e10cSrcweir             aHorizontalFT.SetText(aVerticalFT.GetText());
864cdf0e10cSrcweir             aVerticalFT.SetText(sHLabel);
865cdf0e10cSrcweir             bIsVerticalFrame = sal_True;
866cdf0e10cSrcweir         }
867cdf0e10cSrcweir     }
868cdf0e10cSrcweir 
869cdf0e10cSrcweir     if ( nDlgType == DLG_FRM_GRF || nDlgType == DLG_FRM_OLE )
870cdf0e10cSrcweir 	{
871cdf0e10cSrcweir 		ASSERT(pSh , "shell not found");
872cdf0e10cSrcweir 		//OS: nur fuer die Variante Einfuegen/Grafik/Eigenschaften
873cdf0e10cSrcweir 		if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_GRF_REALSIZE, sal_False, &pItem))
874cdf0e10cSrcweir 			aGrfSize = ((const SvxSizeItem*)pItem)->GetSize();
875cdf0e10cSrcweir 		else
876cdf0e10cSrcweir 			pSh->GetGrfSize( aGrfSize );
877cdf0e10cSrcweir 
878cdf0e10cSrcweir 		if ( !bNew )
879cdf0e10cSrcweir 		{
880cdf0e10cSrcweir 			aRealSizeBT.SetClickHdl(LINK(this, SwFrmPage, RealSizeHdl));
881cdf0e10cSrcweir 			EnableGraficMode();
882cdf0e10cSrcweir 		}
883cdf0e10cSrcweir //		else
884cdf0e10cSrcweir //          aTypeFL.SetSizePixel(Size(aTypeFL.GetSizePixel().Width(), aSizeFL.GetSizePixel().Height()));
885cdf0e10cSrcweir 
886cdf0e10cSrcweir 		if ( nDlgType == DLG_FRM_GRF )
887cdf0e10cSrcweir 			aFixedRatioCB.Check( sal_False );
888cdf0e10cSrcweir 		else
889cdf0e10cSrcweir 		{
890cdf0e10cSrcweir 			if ( bNew )
891cdf0e10cSrcweir 				SetText( SW_RESSTR(STR_OLE_INSERT));
892cdf0e10cSrcweir 			else
893cdf0e10cSrcweir 				SetText( SW_RESSTR(STR_OLE_EDIT));
894cdf0e10cSrcweir 		}
895cdf0e10cSrcweir 	}
896cdf0e10cSrcweir 	else
897cdf0e10cSrcweir 	{
898cdf0e10cSrcweir //      aTypeFL.SetSizePixel(Size(aTypeFL.GetSizePixel().Width(), aSizeFL.GetSizePixel().Height()));
899cdf0e10cSrcweir 		aGrfSize = ((const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE)).GetSize();
900cdf0e10cSrcweir 	}
901cdf0e10cSrcweir 
902cdf0e10cSrcweir 	//Prozenteingabe ermoeglichen.
903cdf0e10cSrcweir 	aWidthED. SetBaseValue( aWidthED.Normalize(aGrfSize.Width()), FUNIT_TWIP );
904cdf0e10cSrcweir 	aHeightED.SetBaseValue( aHeightED.Normalize(aGrfSize.Height()), FUNIT_TWIP );
905cdf0e10cSrcweir 	//the available space is not yet known so the RefValue has to be calculated from size and relative size values
906cdf0e10cSrcweir     //this is needed only if relative values are already set
907cdf0e10cSrcweir 
908cdf0e10cSrcweir     const SwFmtFrmSize& rFrmSize = (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE);
909cdf0e10cSrcweir 
910cdf0e10cSrcweir     if (rFrmSize.GetWidthPercent() != 0xff && rFrmSize.GetWidthPercent() != 0)
911cdf0e10cSrcweir     {
912cdf0e10cSrcweir         //calculate the rerference value from the with and relative width values
913cdf0e10cSrcweir         sal_Int32 nSpace = rFrmSize.GetWidth() * 100 / rFrmSize.GetWidthPercent();
914cdf0e10cSrcweir         aWidthED. SetRefValue( nSpace );
915cdf0e10cSrcweir     }
916cdf0e10cSrcweir 
917cdf0e10cSrcweir     if (rFrmSize.GetHeightPercent() != 0xff && rFrmSize.GetHeightPercent() != 0)
918cdf0e10cSrcweir     {
919cdf0e10cSrcweir         //calculate the rerference value from the with and relative width values
920cdf0e10cSrcweir         sal_Int32 nSpace = rFrmSize.GetHeight() * 100 / rFrmSize.GetHeightPercent();
921cdf0e10cSrcweir         aHeightED.SetRefValue( nSpace );
922cdf0e10cSrcweir     }
923cdf0e10cSrcweir 
924cdf0e10cSrcweir 	// Allgemeiner Initialisierungteil
925cdf0e10cSrcweir 	switch(rAnchor.GetAnchorId())
926cdf0e10cSrcweir     {
927cdf0e10cSrcweir         case FLY_AT_PAGE: aAnchorAtPageRB.Check(); break;
928cdf0e10cSrcweir         case FLY_AT_PARA: aAnchorAtParaRB.Check(); break;
929cdf0e10cSrcweir         case FLY_AT_CHAR: aAnchorAtCharRB.Check(); break;
930cdf0e10cSrcweir         case FLY_AS_CHAR: aAnchorAsCharRB.Check(); break;
931cdf0e10cSrcweir 		case FLY_AT_FLY: aAnchorAtFrameRB.Check();break;
932cdf0e10cSrcweir         default:; //prevent warning
933cdf0e10cSrcweir 	}
934cdf0e10cSrcweir 
935cdf0e10cSrcweir     // OD 12.11.2003 #i22341# - determine content position of character
936cdf0e10cSrcweir     // Note: content position can be NULL
937cdf0e10cSrcweir     mpToCharCntntPos = rAnchor.GetCntntAnchor();
938cdf0e10cSrcweir 
939cdf0e10cSrcweir     // OD 19.09.2003 #i18732# - init checkbox value
940cdf0e10cSrcweir     {
941cdf0e10cSrcweir         const bool bFollowTextFlow =
942cdf0e10cSrcweir             static_cast<const SwFmtFollowTextFlow&>(rSet.Get(RES_FOLLOW_TEXT_FLOW)).GetValue();
943cdf0e10cSrcweir         aFollowTextFlowCB.Check( bFollowTextFlow );
944cdf0e10cSrcweir     }
945cdf0e10cSrcweir 
946cdf0e10cSrcweir     if(bHtmlMode)
947cdf0e10cSrcweir 	{
948cdf0e10cSrcweir 		if(nDlgType == DLG_FRM_STD &&
949cdf0e10cSrcweir 				0 == (nHtmlMode & HTMLMODE_FULL_ABS_POS))
950cdf0e10cSrcweir 		{
951cdf0e10cSrcweir 			aHeightFT	.Enable( sal_False );
952cdf0e10cSrcweir 			aHeightED	.Enable( sal_False );
953cdf0e10cSrcweir 			aRelHeightCB.Enable( sal_False );
954cdf0e10cSrcweir 		}
955cdf0e10cSrcweir 		if( 0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS))
956cdf0e10cSrcweir         {
957cdf0e10cSrcweir             if (GetAnchor() == FLY_AT_PAGE)
958cdf0e10cSrcweir             {
959cdf0e10cSrcweir 				aAnchorAtParaRB.Check();
960cdf0e10cSrcweir 			}
961cdf0e10cSrcweir 			aAnchorAtPageRB.Enable(sal_False);
962cdf0e10cSrcweir 		}
963cdf0e10cSrcweir 		aAutoHeightCB.Enable(sal_False);
964cdf0e10cSrcweir 		aAutoWidthCB.Enable(sal_False);
965cdf0e10cSrcweir 		aMirrorPagesCB.Show(sal_False);
966cdf0e10cSrcweir 		if(nDlgType == DLG_FRM_STD)
967cdf0e10cSrcweir 			aFixedRatioCB.Enable(sal_False);
968cdf0e10cSrcweir         // OD 19.09.2003 #i18732# - hide checkbox in HTML mode
969cdf0e10cSrcweir         aFollowTextFlowCB.Show(sal_False);
970cdf0e10cSrcweir 	}
971cdf0e10cSrcweir     else
972cdf0e10cSrcweir     {
973cdf0e10cSrcweir         // OD 06.11.2003 #i18732# correct enable/disable of check box 'Mirror on..'
974cdf0e10cSrcweir         aMirrorPagesCB.Enable(!aAnchorAsCharRB.IsChecked());
975cdf0e10cSrcweir 
976cdf0e10cSrcweir         // OD 06.11.2003 #i18732# - enable/disable check box 'Follow text flow'.
977cdf0e10cSrcweir         // OD 10.11.2003 #i22305# - enable check box 'Follow text
978cdf0e10cSrcweir         // flow' also for anchor type to-frame.
979cdf0e10cSrcweir         aFollowTextFlowCB.Enable( aAnchorAtParaRB.IsChecked() ||
980cdf0e10cSrcweir                                   aAnchorAtCharRB.IsChecked() ||
981cdf0e10cSrcweir                                   aAnchorAtFrameRB.IsChecked() );
982cdf0e10cSrcweir     }
983cdf0e10cSrcweir 
984cdf0e10cSrcweir 	Init( rSet, sal_True );
985cdf0e10cSrcweir     aAtVertPosED.SaveValue();
986cdf0e10cSrcweir 	aAtHorzPosED.SaveValue();
987cdf0e10cSrcweir     // OD 19.09.2003 #i18732#
988cdf0e10cSrcweir     aFollowTextFlowCB.SaveValue();
989cdf0e10cSrcweir 
990cdf0e10cSrcweir 	bNoModifyHdl = sal_False;
991cdf0e10cSrcweir     //lock PercentFields
992cdf0e10cSrcweir     aWidthED.LockAutoCalculation(sal_True);
993cdf0e10cSrcweir     aHeightED.LockAutoCalculation(sal_True);
994cdf0e10cSrcweir     RangeModifyHdl(&aWidthED);  // Alle Maximalwerte initial setzen
995cdf0e10cSrcweir     aHeightED.LockAutoCalculation(sal_False);
996cdf0e10cSrcweir     aWidthED.LockAutoCalculation(sal_False);
997cdf0e10cSrcweir 
998cdf0e10cSrcweir 	aAutoHeightCB.SaveValue();
999cdf0e10cSrcweir 	aAutoWidthCB.SaveValue();
1000cdf0e10cSrcweir 
1001cdf0e10cSrcweir     SwTwips nWidth  = static_cast< SwTwips >(aWidthED.DenormalizePercent(aWidthED.GetValue(FUNIT_TWIP)));
1002cdf0e10cSrcweir     SwTwips nHeight = static_cast< SwTwips >(aHeightED.DenormalizePercent(aHeightED.GetValue(FUNIT_TWIP)));
1003cdf0e10cSrcweir     fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0;
1004cdf0e10cSrcweir }
1005cdf0e10cSrcweir 
1006cdf0e10cSrcweir 
1007cdf0e10cSrcweir /*--------------------------------------------------------------------
1008cdf0e10cSrcweir 	Beschreibung:	Attribute in den Set stopfen bei OK
1009cdf0e10cSrcweir  --------------------------------------------------------------------*/
1010cdf0e10cSrcweir 
1011cdf0e10cSrcweir sal_Bool SwFrmPage::FillItemSet(SfxItemSet &rSet)
1012cdf0e10cSrcweir {
1013cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1014cdf0e10cSrcweir 	SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell()
1015cdf0e10cSrcweir 						: ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell();
1016cdf0e10cSrcweir 	ASSERT( pSh , "shell not found");
1017cdf0e10cSrcweir 	const SfxItemSet& rOldSet = GetItemSet();
1018cdf0e10cSrcweir 	const SfxPoolItem* pOldItem = 0;
1019cdf0e10cSrcweir 
1020cdf0e10cSrcweir 	RndStdIds eAnchorId = (RndStdIds)GetAnchor();
1021cdf0e10cSrcweir 
1022cdf0e10cSrcweir 	if ( !bFormat )
1023cdf0e10cSrcweir 	{
1024cdf0e10cSrcweir 		pOldItem = GetOldItem(rSet, RES_ANCHOR);
1025cdf0e10cSrcweir 		if (bNew || !pOldItem || eAnchorId != ((const SwFmtAnchor*)pOldItem)->GetAnchorId())
1026cdf0e10cSrcweir 		{
1027cdf0e10cSrcweir 			SwFmtAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() );
1028cdf0e10cSrcweir 			bRet = 0 != rSet.Put( aAnc );
1029cdf0e10cSrcweir 		}
1030cdf0e10cSrcweir 	}
1031cdf0e10cSrcweir 
1032cdf0e10cSrcweir 	if ( pHMap )
1033cdf0e10cSrcweir 	{
1034cdf0e10cSrcweir 		SwFmtHoriOrient aHoriOrient( (const SwFmtHoriOrient&)
1035cdf0e10cSrcweir 												rOldSet.Get(RES_HORI_ORIENT) );
1036cdf0e10cSrcweir 
1037cdf0e10cSrcweir 		sal_uInt16 nMapPos = GetMapPos(pHMap, aHorizontalDLB);
1038cdf0e10cSrcweir         short nAlign = GetAlignment(pHMap, nMapPos, aHorizontalDLB, aHoriRelationLB);
1039cdf0e10cSrcweir         short nRel = GetRelation(pHMap, aHoriRelationLB);
1040cdf0e10cSrcweir 
1041cdf0e10cSrcweir         const sal_Int16 eHOri = nAlign;
1042cdf0e10cSrcweir         const sal_Int16 eRel  = nRel;
1043cdf0e10cSrcweir 
1044cdf0e10cSrcweir 		aHoriOrient.SetHoriOrient( eHOri );
1045cdf0e10cSrcweir 		aHoriOrient.SetRelationOrient( eRel );
1046cdf0e10cSrcweir 		aHoriOrient.SetPosToggle(aMirrorPagesCB.IsChecked());
1047cdf0e10cSrcweir 
1048cdf0e10cSrcweir 		sal_Bool bMod = aAtHorzPosED.GetText() != aAtHorzPosED.GetSavedValue();
1049cdf0e10cSrcweir 		bMod |= aMirrorPagesCB.GetState() != aMirrorPagesCB.GetSavedValue();
1050cdf0e10cSrcweir 
1051cdf0e10cSrcweir         if ( eHOri == text::HoriOrientation::NONE &&
1052cdf0e10cSrcweir 			 (bNew || (bAtHorzPosModified || bMod) || nOldH != eHOri ) )
1053cdf0e10cSrcweir 		{
1054cdf0e10cSrcweir             SwTwips nX = static_cast< SwTwips >(aAtHorzPosED.Denormalize(aAtHorzPosED.GetValue(FUNIT_TWIP)));
1055cdf0e10cSrcweir 			aHoriOrient.SetPos( nX );
1056cdf0e10cSrcweir 		}
1057cdf0e10cSrcweir 
1058cdf0e10cSrcweir 		pOldItem = GetOldItem(rSet, FN_HORI_ORIENT);
1059cdf0e10cSrcweir 		sal_Bool bSame = sal_False;
1060cdf0e10cSrcweir 		if ((bNew == bFormat) && pOldItem)
1061cdf0e10cSrcweir 		{
1062cdf0e10cSrcweir              bSame = static_cast< sal_Bool >(aHoriOrient == (SwFmtHoriOrient&)*pOldItem);
1063cdf0e10cSrcweir 		}
1064cdf0e10cSrcweir 		if ((bNew && !bFormat) || ((bAtHorzPosModified || bMod) && !bSame))
1065cdf0e10cSrcweir 		{
1066cdf0e10cSrcweir 			bRet |= 0 != rSet.Put( aHoriOrient );
1067cdf0e10cSrcweir 		}
1068cdf0e10cSrcweir 	}
1069cdf0e10cSrcweir 
1070cdf0e10cSrcweir 	if ( pVMap )
1071cdf0e10cSrcweir 	{
1072cdf0e10cSrcweir 		// Ausrichtung Vertikal
1073cdf0e10cSrcweir 		SwFmtVertOrient aVertOrient( (const SwFmtVertOrient&)
1074cdf0e10cSrcweir 												rOldSet.Get(RES_VERT_ORIENT) );
1075cdf0e10cSrcweir 
1076cdf0e10cSrcweir 		sal_uInt16 nMapPos = GetMapPos(pVMap, aVerticalDLB);
1077cdf0e10cSrcweir         short nAlign = GetAlignment(pVMap, nMapPos, aVerticalDLB, aVertRelationLB);
1078cdf0e10cSrcweir         short nRel = GetRelation(pVMap, aVertRelationLB);
1079cdf0e10cSrcweir 
1080cdf0e10cSrcweir         const sal_Int16     eVOri = nAlign;
1081cdf0e10cSrcweir         const sal_Int16     eRel  = nRel;
1082cdf0e10cSrcweir 
1083cdf0e10cSrcweir         aVertOrient.SetVertOrient    ( eVOri);
1084cdf0e10cSrcweir 		aVertOrient.SetRelationOrient( eRel );
1085cdf0e10cSrcweir 
1086cdf0e10cSrcweir 		sal_Bool bMod = aAtVertPosED.GetText() != aAtVertPosED.GetSavedValue();
1087cdf0e10cSrcweir 
1088cdf0e10cSrcweir         if ( eVOri == text::VertOrientation::NONE &&
1089cdf0e10cSrcweir 			 ( bNew || (bAtVertPosModified || bMod) || nOldV != eVOri) )
1090cdf0e10cSrcweir 		{
1091cdf0e10cSrcweir 			// Vertikale Position
1092cdf0e10cSrcweir 			// fuer zeichengebundene Rahmen Offset umrechenen
1093cdf0e10cSrcweir             SwTwips nY = static_cast< SwTwips >(aAtVertPosED.Denormalize(aAtVertPosED.GetValue(FUNIT_TWIP)));
1094cdf0e10cSrcweir             if (eAnchorId == FLY_AS_CHAR)
1095cdf0e10cSrcweir             {
1096cdf0e10cSrcweir 				nY *= -1;
1097cdf0e10cSrcweir             }
1098cdf0e10cSrcweir 			aVertOrient.SetPos( nY );
1099cdf0e10cSrcweir 		}
1100cdf0e10cSrcweir 		pOldItem = GetOldItem(rSet, FN_VERT_ORIENT);
1101cdf0e10cSrcweir 		sal_Bool bSame = sal_False;
1102cdf0e10cSrcweir 		if((bNew == bFormat) && pOldItem)
1103cdf0e10cSrcweir 		{
1104cdf0e10cSrcweir              bSame = static_cast< sal_Bool >( bFormat ?
1105cdf0e10cSrcweir 				aVertOrient.GetVertOrient() == ((SwFmtVertOrient*)pOldItem)->GetVertOrient() &&
1106cdf0e10cSrcweir 				aVertOrient.GetRelationOrient() == ((SwFmtVertOrient*)pOldItem)->GetRelationOrient() &&
1107cdf0e10cSrcweir 				aVertOrient.GetPos() == ((SwFmtVertOrient*)pOldItem)->GetPos()
1108cdf0e10cSrcweir 
1109cdf0e10cSrcweir                     : aVertOrient == (SwFmtVertOrient&)*pOldItem );
1110cdf0e10cSrcweir 		}
1111cdf0e10cSrcweir 		if( ( bNew && !bFormat ) || ((bAtVertPosModified || bMod) && !bSame ))
1112cdf0e10cSrcweir 		{
1113cdf0e10cSrcweir 			bRet |= 0 != rSet.Put( aVertOrient );
1114cdf0e10cSrcweir 		}
1115cdf0e10cSrcweir 	}
1116cdf0e10cSrcweir 
1117cdf0e10cSrcweir 	//Size setzen
1118cdf0e10cSrcweir 	//Neuer Sonderfall: Ist die Groesse von pMgr(0, 0), so werden die
1119cdf0e10cSrcweir 	//Eigenschaften fuer eine Grafik festgelegt, die noch gar nicht geladen
1120cdf0e10cSrcweir 	//ist. Dann wird hier kein SetSize() gemacht, wenn die
1121cdf0e10cSrcweir 	//Groesseneinstellungen vom Anwender nicht veraendert wurden.
1122cdf0e10cSrcweir 	const SwFmtFrmSize& rOldSize = (const SwFmtFrmSize& )rOldSet.Get(RES_FRM_SIZE);
1123cdf0e10cSrcweir 	SwFmtFrmSize aSz( rOldSize );
1124cdf0e10cSrcweir 
1125cdf0e10cSrcweir /*	// Folgende Zeilen nur zum debuggen:
1126cdf0e10cSrcweir 	sal_Bool bModified = aWidthED.IsValueModified();
1127cdf0e10cSrcweir 	sal_uInt16 nOldWidth = rOldSize.GetWidth ();
1128cdf0e10cSrcweir 	sal_uInt16 nWidth = aWidthED .GetValue();
1129cdf0e10cSrcweir 	sal_uInt16 nMinWidth = aWidthED .GetMin();*/
1130cdf0e10cSrcweir 
1131cdf0e10cSrcweir 	sal_Bool bValueModified = (aWidthED.IsValueModified() || aHeightED.IsValueModified());
1132cdf0e10cSrcweir 	sal_Bool bCheckChanged = (aRelWidthCB.GetSavedValue() != aRelWidthCB.IsChecked()
1133cdf0e10cSrcweir 						|| aRelHeightCB.GetSavedValue() != aRelHeightCB.IsChecked());
1134cdf0e10cSrcweir 
1135cdf0e10cSrcweir 	sal_Bool bLegalValue = !(!rOldSize.GetWidth () && !rOldSize.GetHeight() &&
1136cdf0e10cSrcweir 							aWidthED .GetValue() == aWidthED .GetMin() &&
1137cdf0e10cSrcweir 							aHeightED.GetValue() == aHeightED.GetMin());
1138cdf0e10cSrcweir 
1139cdf0e10cSrcweir 	if ((bNew && !bFormat) || ((bValueModified || bCheckChanged) && bLegalValue))
1140cdf0e10cSrcweir 	{
1141cdf0e10cSrcweir         sal_Int64 nNewWidth  = aWidthED.DenormalizePercent(aWidthED.GetRealValue(FUNIT_TWIP));
1142cdf0e10cSrcweir         sal_Int64 nNewHeight = aHeightED.DenormalizePercent(aHeightED.GetRealValue(FUNIT_TWIP));
1143cdf0e10cSrcweir         aSz.SetWidth (static_cast< SwTwips >(nNewWidth));
1144cdf0e10cSrcweir         aSz.SetHeight(static_cast< SwTwips >(nNewHeight));
1145cdf0e10cSrcweir 
1146cdf0e10cSrcweir 		if (aRelWidthCB.IsChecked())
1147cdf0e10cSrcweir 		{
1148cdf0e10cSrcweir             aSz.SetWidthPercent((sal_uInt8)Min( static_cast< sal_Int64 >(MAX_PERCENT_WIDTH), aWidthED.Convert(aWidthED.NormalizePercent(nNewWidth), FUNIT_TWIP, FUNIT_CUSTOM)));
1149cdf0e10cSrcweir 		}
1150cdf0e10cSrcweir 		else
1151cdf0e10cSrcweir 			aSz.SetWidthPercent(0);
1152cdf0e10cSrcweir 		if (aRelHeightCB.IsChecked())
1153cdf0e10cSrcweir             aSz.SetHeightPercent((sal_uInt8)Min(static_cast< sal_Int64 >(MAX_PERCENT_HEIGHT), aHeightED.Convert(aHeightED.NormalizePercent(nNewHeight), FUNIT_TWIP, FUNIT_CUSTOM)));
1154cdf0e10cSrcweir 		else
1155cdf0e10cSrcweir 			aSz.SetHeightPercent(0);
1156cdf0e10cSrcweir 
1157cdf0e10cSrcweir 		if (aFixedRatioCB.IsChecked() && (aRelWidthCB.IsChecked() ^ aRelHeightCB.IsChecked()))
1158cdf0e10cSrcweir 		{
1159cdf0e10cSrcweir 			if (aRelWidthCB.IsChecked())
1160cdf0e10cSrcweir 				aSz.SetHeightPercent(0xff);
1161cdf0e10cSrcweir 			else
1162cdf0e10cSrcweir 				aSz.SetWidthPercent(0xff);
1163cdf0e10cSrcweir 		}
1164cdf0e10cSrcweir 	}
1165cdf0e10cSrcweir 	if( !IsInGraficMode() )
1166cdf0e10cSrcweir 	{
1167cdf0e10cSrcweir 		if( aAutoHeightCB.GetState() != aAutoHeightCB.GetSavedValue() )
1168cdf0e10cSrcweir 		{
1169cdf0e10cSrcweir 			SwFrmSize eFrmSize = (SwFrmSize) aAutoHeightCB.IsChecked()? ATT_MIN_SIZE : ATT_FIX_SIZE;
1170cdf0e10cSrcweir 			if( eFrmSize != aSz.GetHeightSizeType() )
1171cdf0e10cSrcweir                 aSz.SetHeightSizeType(eFrmSize);
1172cdf0e10cSrcweir 		}
1173cdf0e10cSrcweir 		if( aAutoWidthCB.GetState() != aAutoWidthCB.GetSavedValue() )
1174cdf0e10cSrcweir 		{
1175cdf0e10cSrcweir 			SwFrmSize eFrmSize = (SwFrmSize) aAutoWidthCB.IsChecked()? ATT_MIN_SIZE : ATT_FIX_SIZE;
1176cdf0e10cSrcweir             if( eFrmSize != aSz.GetWidthSizeType() )
1177cdf0e10cSrcweir                 aSz.SetWidthSizeType( eFrmSize );
1178cdf0e10cSrcweir 		}
1179cdf0e10cSrcweir 	}
1180cdf0e10cSrcweir 	if( !bFormat && aFixedRatioCB.GetSavedValue() != aFixedRatioCB.IsChecked())
1181cdf0e10cSrcweir 		bRet |= 0 != rSet.Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, aFixedRatioCB.IsChecked()));
1182cdf0e10cSrcweir 
1183cdf0e10cSrcweir 	pOldItem = GetOldItem(rSet, RES_FRM_SIZE);
1184cdf0e10cSrcweir 
1185cdf0e10cSrcweir 	if ((pOldItem && aSz != *pOldItem) || (!pOldItem && !bFormat) ||
1186cdf0e10cSrcweir 			(bFormat &&
1187cdf0e10cSrcweir 				(aSz.GetWidth() > 0 || aSz.GetWidthPercent() > 0) &&
1188cdf0e10cSrcweir 					(aSz.GetHeight() > 0 || aSz.GetHeightPercent() > 0)))
1189cdf0e10cSrcweir 	{
1190cdf0e10cSrcweir         if (aSz.GetHeightSizeType() == ATT_VAR_SIZE)    // VAR_SIZE gibts nicht bei Rahmen
1191cdf0e10cSrcweir             aSz.SetHeightSizeType(ATT_MIN_SIZE);        // Bug #45776 (Vorlagen ohne Breite/Hoehe)
1192cdf0e10cSrcweir 
1193cdf0e10cSrcweir 		bRet |= 0 != rSet.Put( aSz );
1194cdf0e10cSrcweir 	}
1195cdf0e10cSrcweir     // OD 19.09.2003 #i18732#
1196cdf0e10cSrcweir     if(aFollowTextFlowCB.IsChecked() != aFollowTextFlowCB.GetSavedValue())
1197cdf0e10cSrcweir     {
1198cdf0e10cSrcweir         bRet |= 0 != rSet.Put(SwFmtFollowTextFlow(aFollowTextFlowCB.IsChecked()));
1199cdf0e10cSrcweir     }
1200cdf0e10cSrcweir 	return bRet;
1201cdf0e10cSrcweir }
1202cdf0e10cSrcweir 
1203cdf0e10cSrcweir /*--------------------------------------------------------------------
1204cdf0e10cSrcweir 	Beschreibung:	Horizontale und vertikale Pos initialisieren
1205cdf0e10cSrcweir  --------------------------------------------------------------------*/
1206cdf0e10cSrcweir 
1207cdf0e10cSrcweir void SwFrmPage::InitPos(RndStdIds eId,
1208cdf0e10cSrcweir 								sal_uInt16 nH,
1209cdf0e10cSrcweir 								sal_uInt16 nHRel,
1210cdf0e10cSrcweir 								sal_uInt16 nV,
1211cdf0e10cSrcweir 								sal_uInt16 nVRel,
1212cdf0e10cSrcweir 								long   nX,
1213cdf0e10cSrcweir 								long   nY)
1214cdf0e10cSrcweir {
1215cdf0e10cSrcweir 	sal_uInt16 nPos = aVerticalDLB.GetSelectEntryPos();
1216cdf0e10cSrcweir 	if ( nPos != LISTBOX_ENTRY_NOTFOUND && pVMap )
1217cdf0e10cSrcweir 	{
1218cdf0e10cSrcweir 		nOldV	 = pVMap[nPos].nAlign;
1219cdf0e10cSrcweir 
1220cdf0e10cSrcweir 		nPos = aVertRelationLB.GetSelectEntryPos();
1221cdf0e10cSrcweir 		if (nPos != LISTBOX_ENTRY_NOTFOUND)
1222cdf0e10cSrcweir 			nOldVRel = ((RelationMap *)aVertRelationLB.GetEntryData(nPos))->nRelation;
1223cdf0e10cSrcweir 	}
1224cdf0e10cSrcweir 
1225cdf0e10cSrcweir 	nPos = aHorizontalDLB.GetSelectEntryPos();
1226cdf0e10cSrcweir 	if ( nPos != LISTBOX_ENTRY_NOTFOUND && pHMap )
1227cdf0e10cSrcweir 	{
1228cdf0e10cSrcweir 		nOldH	 = pHMap[nPos].nAlign;
1229cdf0e10cSrcweir 
1230cdf0e10cSrcweir 		nPos = aHoriRelationLB.GetSelectEntryPos();
1231cdf0e10cSrcweir 		if (nPos != LISTBOX_ENTRY_NOTFOUND)
1232cdf0e10cSrcweir 			nOldHRel = ((RelationMap *)aHoriRelationLB.GetEntryData(nPos))->nRelation;
1233cdf0e10cSrcweir 	}
1234cdf0e10cSrcweir 
1235cdf0e10cSrcweir 	sal_Bool bEnable = sal_True;
1236cdf0e10cSrcweir     if ( eId == FLY_AT_PAGE )
1237cdf0e10cSrcweir 	{
1238cdf0e10cSrcweir 		pVMap = bHtmlMode ? aVPageHtmlMap : aVPageMap;
1239cdf0e10cSrcweir 		pHMap = bHtmlMode ? aHPageHtmlMap : aHPageMap;
1240cdf0e10cSrcweir 	}
1241cdf0e10cSrcweir     else if ( eId == FLY_AT_FLY )
1242cdf0e10cSrcweir 	{
1243cdf0e10cSrcweir         // OD 19.09.2003 #i18732# - own vertical alignment map for to frame
1244cdf0e10cSrcweir         // anchored objects.
1245cdf0e10cSrcweir         pVMap = bHtmlMode ? aVFlyHtmlMap : aVFrameMap;
1246cdf0e10cSrcweir 		pHMap = bHtmlMode ? aHFlyHtmlMap : aHFrameMap;
1247cdf0e10cSrcweir 	}
1248cdf0e10cSrcweir     else if ( eId == FLY_AT_PARA )
1249cdf0e10cSrcweir 	{
1250cdf0e10cSrcweir 		if(bHtmlMode)
1251cdf0e10cSrcweir 		{
1252cdf0e10cSrcweir 			pVMap = aVParaHtmlMap;
1253cdf0e10cSrcweir 			pHMap = nHtmlMode & HTMLMODE_SOME_ABS_POS ? aHParaHtmlAbsMap : aHParaHtmlMap;
1254cdf0e10cSrcweir 		}
1255cdf0e10cSrcweir 		else
1256cdf0e10cSrcweir 		{
1257cdf0e10cSrcweir 			pVMap = aVParaMap;
1258cdf0e10cSrcweir 			pHMap = aHParaMap;
1259cdf0e10cSrcweir 		}
1260cdf0e10cSrcweir 	}
1261cdf0e10cSrcweir     else if ( eId == FLY_AT_CHAR )
1262cdf0e10cSrcweir 	{
1263cdf0e10cSrcweir 		if(bHtmlMode)
1264cdf0e10cSrcweir 		{
1265cdf0e10cSrcweir 			pVMap = nHtmlMode & HTMLMODE_SOME_ABS_POS ? aVCharHtmlAbsMap	: aVCharHtmlMap;
1266cdf0e10cSrcweir 			pHMap = nHtmlMode & HTMLMODE_SOME_ABS_POS ? aHCharHtmlAbsMap	: aHCharHtmlMap;
1267cdf0e10cSrcweir 		}
1268cdf0e10cSrcweir 		else
1269cdf0e10cSrcweir 		{
1270cdf0e10cSrcweir 			pVMap = aVCharMap;
1271cdf0e10cSrcweir 			pHMap = aHCharMap;
1272cdf0e10cSrcweir 		}
1273cdf0e10cSrcweir 	}
1274cdf0e10cSrcweir     else if ( eId == FLY_AS_CHAR )
1275cdf0e10cSrcweir 	{
1276cdf0e10cSrcweir 		pVMap = bHtmlMode ? aVAsCharHtmlMap 	: aVAsCharMap;
1277cdf0e10cSrcweir 		pHMap = 0;
1278cdf0e10cSrcweir 		bEnable = sal_False;
1279cdf0e10cSrcweir 	}
1280cdf0e10cSrcweir 	aHorizontalDLB.Enable( bEnable );
1281cdf0e10cSrcweir 	aHorizontalFT.Enable( bEnable );
1282cdf0e10cSrcweir 
1283cdf0e10cSrcweir 	// aktuelle Pos selektieren
1284cdf0e10cSrcweir 	// Horizontal
1285cdf0e10cSrcweir 	if ( nH == USHRT_MAX )
1286cdf0e10cSrcweir 	{
1287cdf0e10cSrcweir 		nH 	  = nOldH;
1288cdf0e10cSrcweir 		nHRel = nOldHRel;
1289cdf0e10cSrcweir 	}
1290cdf0e10cSrcweir     // OD 12.11.2003 #i22341# - pass <nHRel> as 3rd parameter to method <FillPosLB>
1291cdf0e10cSrcweir     sal_uInt16 nMapPos = FillPosLB(pHMap, nH, nHRel, aHorizontalDLB);
1292cdf0e10cSrcweir     FillRelLB(pHMap, nMapPos, nH, nHRel, aHoriRelationLB, aHoriRelationFT);
1293cdf0e10cSrcweir 
1294cdf0e10cSrcweir 	// Vertikal
1295cdf0e10cSrcweir 	if ( nV == USHRT_MAX )
1296cdf0e10cSrcweir 	{
1297cdf0e10cSrcweir 		nV	  = nOldV;
1298cdf0e10cSrcweir 		nVRel = nOldVRel;
1299cdf0e10cSrcweir 	}
1300cdf0e10cSrcweir     // OD 12.11.2003 #i22341# - pass <nVRel> as 3rd parameter to method <FillPosLB>
1301cdf0e10cSrcweir     nMapPos = FillPosLB(pVMap, nV, nVRel, aVerticalDLB);
1302cdf0e10cSrcweir     FillRelLB(pVMap, nMapPos, nV, nVRel, aVertRelationLB, aVertRelationFT);
1303cdf0e10cSrcweir 
1304cdf0e10cSrcweir 	// Edits init
1305cdf0e10cSrcweir     bEnable = nH == text::HoriOrientation::NONE && eId != FLY_AS_CHAR;
1306cdf0e10cSrcweir 	if (!bEnable)
1307cdf0e10cSrcweir 	{
1308cdf0e10cSrcweir 		aAtHorzPosED.SetValue( 0, FUNIT_TWIP );
1309cdf0e10cSrcweir 		if (nX != LONG_MAX && bHtmlMode)
1310cdf0e10cSrcweir 			aAtHorzPosED.SetModifyFlag();
1311cdf0e10cSrcweir 	}
1312cdf0e10cSrcweir 	else
1313cdf0e10cSrcweir 	{
1314cdf0e10cSrcweir 		if (nX != LONG_MAX)
1315cdf0e10cSrcweir 			aAtHorzPosED.SetValue( aAtHorzPosED.Normalize(nX), FUNIT_TWIP );
1316cdf0e10cSrcweir 	}
1317cdf0e10cSrcweir 	aAtHorzPosFT.Enable( bEnable );
1318cdf0e10cSrcweir 	aAtHorzPosED.Enable( bEnable );
1319cdf0e10cSrcweir 
1320cdf0e10cSrcweir     bEnable = nV == text::VertOrientation::NONE;
1321cdf0e10cSrcweir 	if ( !bEnable )
1322cdf0e10cSrcweir 	{
1323cdf0e10cSrcweir 		aAtVertPosED.SetValue( 0, FUNIT_TWIP );
1324cdf0e10cSrcweir 		if(nY != LONG_MAX && bHtmlMode)
1325cdf0e10cSrcweir 			aAtVertPosED.SetModifyFlag();
1326cdf0e10cSrcweir 	}
1327cdf0e10cSrcweir 	else
1328cdf0e10cSrcweir 	{
1329cdf0e10cSrcweir         if ( eId == FLY_AS_CHAR )
1330cdf0e10cSrcweir 		{
1331cdf0e10cSrcweir 			if ( nY == LONG_MAX )
1332cdf0e10cSrcweir 				nY = 0;
1333cdf0e10cSrcweir 			else
1334cdf0e10cSrcweir 				nY *= -1;
1335cdf0e10cSrcweir 		}
1336cdf0e10cSrcweir 		if ( nY != LONG_MAX )
1337cdf0e10cSrcweir 			aAtVertPosED.SetValue( aAtVertPosED.Normalize(nY), FUNIT_TWIP );
1338cdf0e10cSrcweir 	}
1339cdf0e10cSrcweir 	aAtVertPosFT.Enable( bEnable && m_bAllowVertPositioning );
1340cdf0e10cSrcweir 	aAtVertPosED.Enable( bEnable && m_bAllowVertPositioning );
1341cdf0e10cSrcweir 	UpdateExample();
1342cdf0e10cSrcweir }
1343cdf0e10cSrcweir 
1344cdf0e10cSrcweir /*--------------------------------------------------------------------
1345cdf0e10cSrcweir 	Beschreibung:
1346cdf0e10cSrcweir  --------------------------------------------------------------------*/
1347cdf0e10cSrcweir 
1348cdf0e10cSrcweir sal_uInt16 SwFrmPage::FillPosLB(const FrmMap* _pMap,
1349cdf0e10cSrcweir                             const sal_uInt16 _nAlign,
1350cdf0e10cSrcweir                             const sal_uInt16 _nRel,
1351cdf0e10cSrcweir                             ListBox& _rLB )
1352cdf0e10cSrcweir {
1353cdf0e10cSrcweir 	String sSelEntry, sOldEntry;
1354cdf0e10cSrcweir     sOldEntry = _rLB.GetSelectEntry();
1355cdf0e10cSrcweir 
1356cdf0e10cSrcweir     _rLB.Clear();
1357cdf0e10cSrcweir 
1358cdf0e10cSrcweir     // OD 12.11.2003 #i22341# - determine all possible listbox relations for
1359cdf0e10cSrcweir     // given relation for map <aVCharMap>
1360cdf0e10cSrcweir     const sal_uLong nLBRelations = (_pMap != aVCharMap)
1361cdf0e10cSrcweir                                ? 0L
1362cdf0e10cSrcweir                                : ::lcl_GetLBRelationsForRelations( _nRel );
1363cdf0e10cSrcweir 
1364cdf0e10cSrcweir     // Listbox fuellen
1365cdf0e10cSrcweir     size_t nCount = ::lcl_GetFrmMapCount(_pMap);
1366cdf0e10cSrcweir     for (size_t i = 0; _pMap && i < nCount; ++i)
1367cdf0e10cSrcweir 	{
1368cdf0e10cSrcweir //		#61359# Warum nicht von links/von innen bzw. von oben?
1369cdf0e10cSrcweir //      if (!bFormat || (pMap[i].eStrId != SwFPos::FROMLEFT && pMap[i].eStrId != SwFPos::FROMTOP))
1370cdf0e10cSrcweir 		{
1371cdf0e10cSrcweir             SvxSwFramePosString::StringId eStrId = aMirrorPagesCB.IsChecked() ? _pMap[i].eMirrorStrId : _pMap[i].eStrId;
1372cdf0e10cSrcweir             // --> OD 2009-08-31 #mongolianlayout#
1373cdf0e10cSrcweir             eStrId = lcl_ChangeResIdToVerticalOrRTL( eStrId,
1374cdf0e10cSrcweir                                                      bIsVerticalFrame,
1375cdf0e10cSrcweir                                                      bIsVerticalL2R,
1376cdf0e10cSrcweir                                                      bIsInRightToLeft);
1377cdf0e10cSrcweir             // <--
1378cdf0e10cSrcweir             String sEntry(aFramePosString.GetString(eStrId));
1379cdf0e10cSrcweir 			if (_rLB.GetEntryPos(sEntry) == LISTBOX_ENTRY_NOTFOUND)
1380cdf0e10cSrcweir             {
1381cdf0e10cSrcweir 				// bei zeichengebundenen Rahmen keine doppelten Eintraege einfuegen
1382cdf0e10cSrcweir                 _rLB.InsertEntry(sEntry);
1383cdf0e10cSrcweir             }
1384cdf0e10cSrcweir             // OD 12.11.2003 #i22341# - add condition to handle map <aVCharMap>
1385cdf0e10cSrcweir             // that is ambigous in the alignment.
1386cdf0e10cSrcweir             if ( _pMap[i].nAlign == _nAlign &&
1387cdf0e10cSrcweir                  ( !(_pMap == aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) )
1388cdf0e10cSrcweir             {
1389cdf0e10cSrcweir 				sSelEntry = sEntry;
1390cdf0e10cSrcweir             }
1391cdf0e10cSrcweir 		}
1392cdf0e10cSrcweir 	}
1393cdf0e10cSrcweir 
1394cdf0e10cSrcweir     _rLB.SelectEntry(sSelEntry);
1395cdf0e10cSrcweir     if (!_rLB.GetSelectEntryCount())
1396cdf0e10cSrcweir         _rLB.SelectEntry(sOldEntry);
1397cdf0e10cSrcweir 
1398cdf0e10cSrcweir     if (!_rLB.GetSelectEntryCount())
1399cdf0e10cSrcweir         _rLB.SelectEntryPos(0);
1400cdf0e10cSrcweir 
1401cdf0e10cSrcweir     PosHdl(&_rLB);
1402cdf0e10cSrcweir 
1403cdf0e10cSrcweir     return GetMapPos(_pMap, _rLB);
1404cdf0e10cSrcweir }
1405cdf0e10cSrcweir 
1406cdf0e10cSrcweir /*--------------------------------------------------------------------
1407cdf0e10cSrcweir 	Beschreibung:
1408cdf0e10cSrcweir  --------------------------------------------------------------------*/
1409cdf0e10cSrcweir sal_uLong SwFrmPage::FillRelLB( const FrmMap* _pMap,
1410cdf0e10cSrcweir                             const sal_uInt16 _nLBSelPos,
1411cdf0e10cSrcweir                             const sal_uInt16 _nAlign,
1412cdf0e10cSrcweir                             sal_uInt16 _nRel,
1413cdf0e10cSrcweir                             ListBox& _rLB,
1414cdf0e10cSrcweir                             FixedText& _rFT )
1415cdf0e10cSrcweir {
1416cdf0e10cSrcweir 	String sSelEntry;
1417cdf0e10cSrcweir 	sal_uLong  nLBRelations = 0;
1418cdf0e10cSrcweir     size_t nMapCount = ::lcl_GetFrmMapCount(_pMap);
1419cdf0e10cSrcweir 
1420cdf0e10cSrcweir     _rLB.Clear();
1421cdf0e10cSrcweir 
1422cdf0e10cSrcweir     if (_nLBSelPos < nMapCount)
1423cdf0e10cSrcweir 	{
1424cdf0e10cSrcweir         if (_pMap == aVAsCharHtmlMap || _pMap == aVAsCharMap)
1425cdf0e10cSrcweir 		{
1426cdf0e10cSrcweir             String sOldEntry(_rLB.GetSelectEntry());
1427cdf0e10cSrcweir 			sal_uInt16 nRelCount = sizeof(aAsCharRelationMap) / sizeof(RelationMap);
1428cdf0e10cSrcweir             SvxSwFramePosString::StringId eStrId = _pMap[_nLBSelPos].eStrId;
1429cdf0e10cSrcweir 
1430cdf0e10cSrcweir             for (size_t nMapPos = 0; nMapPos < nMapCount; nMapPos++)
1431cdf0e10cSrcweir 			{
1432cdf0e10cSrcweir                 if (_pMap[nMapPos].eStrId == eStrId)
1433cdf0e10cSrcweir 				{
1434cdf0e10cSrcweir                     nLBRelations = _pMap[nMapPos].nLBRelations;
1435cdf0e10cSrcweir 					for (sal_uInt16 nRelPos = 0; nRelPos < nRelCount; nRelPos++)
1436cdf0e10cSrcweir 					{
1437cdf0e10cSrcweir 						if (nLBRelations & aAsCharRelationMap[nRelPos].nLBRelation)
1438cdf0e10cSrcweir 						{
1439cdf0e10cSrcweir                             SvxSwFramePosString::StringId sStrId1 = aAsCharRelationMap[nRelPos].eStrId;
1440cdf0e10cSrcweir 
1441cdf0e10cSrcweir                             // --> OD 2009-08-31 #mongolianlayout#
1442cdf0e10cSrcweir                             sStrId1 =
1443cdf0e10cSrcweir                                 lcl_ChangeResIdToVerticalOrRTL( sStrId1,
1444cdf0e10cSrcweir                                                                 bIsVerticalFrame,
1445cdf0e10cSrcweir                                                                 bIsVerticalL2R,
1446cdf0e10cSrcweir                                                                 bIsInRightToLeft);
1447cdf0e10cSrcweir                             // <--
1448cdf0e10cSrcweir                             String sEntry = aFramePosString.GetString(sStrId1);
1449cdf0e10cSrcweir                             sal_uInt16 nPos = _rLB.InsertEntry(sEntry);
1450cdf0e10cSrcweir                             _rLB.SetEntryData(nPos, &aAsCharRelationMap[nRelPos]);
1451cdf0e10cSrcweir                             if (_pMap[nMapPos].nAlign == _nAlign)
1452cdf0e10cSrcweir 								sSelEntry = sEntry;
1453cdf0e10cSrcweir 							break;
1454cdf0e10cSrcweir 						}
1455cdf0e10cSrcweir 					}
1456cdf0e10cSrcweir 				}
1457cdf0e10cSrcweir 			}
1458cdf0e10cSrcweir 			if (sSelEntry.Len())
1459cdf0e10cSrcweir                 _rLB.SelectEntry(sSelEntry);
1460cdf0e10cSrcweir 			else
1461cdf0e10cSrcweir 			{
1462cdf0e10cSrcweir                 _rLB.SelectEntry(sOldEntry);
1463cdf0e10cSrcweir 
1464cdf0e10cSrcweir                 if (!_rLB.GetSelectEntryCount())
1465cdf0e10cSrcweir 				{
1466cdf0e10cSrcweir                     for (sal_uInt16 i = 0; i < _rLB.GetEntryCount(); i++)
1467cdf0e10cSrcweir 					{
1468cdf0e10cSrcweir                         RelationMap *pEntry = (RelationMap *)_rLB.GetEntryData(i);
1469cdf0e10cSrcweir 						if (pEntry->nLBRelation == LB_REL_CHAR)	// Default
1470cdf0e10cSrcweir 						{
1471cdf0e10cSrcweir                             _rLB.SelectEntryPos(i);
1472cdf0e10cSrcweir 							break;
1473cdf0e10cSrcweir 						}
1474cdf0e10cSrcweir 					}
1475cdf0e10cSrcweir 				}
1476cdf0e10cSrcweir 			}
1477cdf0e10cSrcweir 		}
1478cdf0e10cSrcweir 		else
1479cdf0e10cSrcweir 		{
1480cdf0e10cSrcweir 			sal_uInt16 nRelCount = sizeof(aRelationMap) / sizeof(RelationMap);
1481cdf0e10cSrcweir 
1482cdf0e10cSrcweir             // OD 14.11.2003 #i22341# - special handling for map <aVCharMap>,
1483cdf0e10cSrcweir             // because its ambigous in its <eStrId>/<eMirrorStrId>.
1484cdf0e10cSrcweir             if ( _pMap == aVCharMap )
1485cdf0e10cSrcweir             {
1486cdf0e10cSrcweir                 nLBRelations = ::lcl_GetLBRelationsForStrID( _pMap,
1487cdf0e10cSrcweir                                              ( aMirrorPagesCB.IsChecked()
1488cdf0e10cSrcweir                                                ? _pMap[_nLBSelPos].eMirrorStrId
1489cdf0e10cSrcweir                                                : _pMap[_nLBSelPos].eStrId),
1490cdf0e10cSrcweir                                              aMirrorPagesCB.IsChecked() );
1491cdf0e10cSrcweir             }
1492cdf0e10cSrcweir             else
1493cdf0e10cSrcweir             {
1494cdf0e10cSrcweir                 nLBRelations = _pMap[_nLBSelPos].nLBRelations;
1495cdf0e10cSrcweir             }
1496cdf0e10cSrcweir 
1497cdf0e10cSrcweir 			for (sal_uLong nBit = 1; nBit < 0x80000000; nBit <<= 1)
1498cdf0e10cSrcweir 			{
1499cdf0e10cSrcweir 				if (nLBRelations & nBit)
1500cdf0e10cSrcweir 				{
1501cdf0e10cSrcweir 					for (sal_uInt16 nRelPos = 0; nRelPos < nRelCount; nRelPos++)
1502cdf0e10cSrcweir 					{
1503cdf0e10cSrcweir 						if (aRelationMap[nRelPos].nLBRelation == nBit)
1504cdf0e10cSrcweir 						{
1505cdf0e10cSrcweir                             SvxSwFramePosString::StringId eStrId1 = aMirrorPagesCB.IsChecked() ?
1506cdf0e10cSrcweir                                             aRelationMap[nRelPos].eMirrorStrId : aRelationMap[nRelPos].eStrId;
1507cdf0e10cSrcweir                             // --> OD 2009-08-31 #mongolianlayout#
1508cdf0e10cSrcweir                             eStrId1 =
1509cdf0e10cSrcweir                                 lcl_ChangeResIdToVerticalOrRTL( eStrId1,
1510cdf0e10cSrcweir                                                                 bIsVerticalFrame,
1511cdf0e10cSrcweir                                                                 bIsVerticalL2R,
1512cdf0e10cSrcweir                                                                 bIsInRightToLeft);
1513cdf0e10cSrcweir                             // <--
1514cdf0e10cSrcweir                             String sEntry = aFramePosString.GetString(eStrId1);
1515cdf0e10cSrcweir                             sal_uInt16 nPos = _rLB.InsertEntry(sEntry);
1516cdf0e10cSrcweir                             _rLB.SetEntryData(nPos, &aRelationMap[nRelPos]);
1517cdf0e10cSrcweir                             if (!sSelEntry.Len() && aRelationMap[nRelPos].nRelation == _nRel)
1518cdf0e10cSrcweir 								sSelEntry = sEntry;
1519cdf0e10cSrcweir 						}
1520cdf0e10cSrcweir 					}
1521cdf0e10cSrcweir 				}
1522cdf0e10cSrcweir 			}
1523cdf0e10cSrcweir 			if (sSelEntry.Len())
1524cdf0e10cSrcweir                 _rLB.SelectEntry(sSelEntry);
1525cdf0e10cSrcweir 			else
1526cdf0e10cSrcweir 			{
1527cdf0e10cSrcweir 				// Warscheinlich Ankerwechsel. Daher aehnliche Relation suchen
1528cdf0e10cSrcweir                 switch (_nRel)
1529cdf0e10cSrcweir 				{
1530cdf0e10cSrcweir                     case text::RelOrientation::FRAME:           _nRel = text::RelOrientation::PAGE_FRAME;   break;
1531cdf0e10cSrcweir                     case text::RelOrientation::PRINT_AREA:      _nRel = text::RelOrientation::PAGE_PRINT_AREA; break;
1532cdf0e10cSrcweir                     case text::RelOrientation::PAGE_LEFT:       _nRel = text::RelOrientation::FRAME_LEFT;   break;
1533cdf0e10cSrcweir                     case text::RelOrientation::PAGE_RIGHT:      _nRel = text::RelOrientation::FRAME_RIGHT;  break;
1534cdf0e10cSrcweir                     case text::RelOrientation::FRAME_LEFT:      _nRel = text::RelOrientation::PAGE_LEFT;    break;
1535cdf0e10cSrcweir                     case text::RelOrientation::FRAME_RIGHT:     _nRel = text::RelOrientation::PAGE_RIGHT;   break;
1536cdf0e10cSrcweir                     case text::RelOrientation::PAGE_FRAME:      _nRel = text::RelOrientation::FRAME;          break;
1537cdf0e10cSrcweir                     case text::RelOrientation::PAGE_PRINT_AREA: _nRel = text::RelOrientation::PRINT_AREA;        break;
1538cdf0e10cSrcweir 
1539cdf0e10cSrcweir 					default:
1540cdf0e10cSrcweir                         if (_rLB.GetEntryCount())
1541cdf0e10cSrcweir 						{
1542cdf0e10cSrcweir                             RelationMap *pEntry = (RelationMap *)_rLB.GetEntryData(_rLB.GetEntryCount() - 1);
1543cdf0e10cSrcweir                             _nRel = pEntry->nRelation;
1544cdf0e10cSrcweir 						}
1545cdf0e10cSrcweir 						break;
1546cdf0e10cSrcweir 				}
1547cdf0e10cSrcweir 
1548cdf0e10cSrcweir                 for (sal_uInt16 i = 0; i < _rLB.GetEntryCount(); i++)
1549cdf0e10cSrcweir 				{
1550cdf0e10cSrcweir                     RelationMap *pEntry = (RelationMap *)_rLB.GetEntryData(i);
1551cdf0e10cSrcweir                     if (pEntry->nRelation == _nRel)
1552cdf0e10cSrcweir 					{
1553cdf0e10cSrcweir                         _rLB.SelectEntryPos(i);
1554cdf0e10cSrcweir 						break;
1555cdf0e10cSrcweir 					}
1556cdf0e10cSrcweir 				}
1557cdf0e10cSrcweir 
1558cdf0e10cSrcweir                 if (!_rLB.GetSelectEntryCount())
1559cdf0e10cSrcweir                     _rLB.SelectEntryPos(0);
1560cdf0e10cSrcweir 			}
1561cdf0e10cSrcweir 		}
1562cdf0e10cSrcweir 	}
1563cdf0e10cSrcweir 
1564cdf0e10cSrcweir     const bool bEnable = _rLB.GetEntryCount() != 0
1565cdf0e10cSrcweir             && (&_rLB != &aVertRelationLB || m_bAllowVertPositioning);
1566cdf0e10cSrcweir     _rLB.Enable( bEnable );
1567cdf0e10cSrcweir     _rFT.Enable( bEnable );
1568cdf0e10cSrcweir 
1569cdf0e10cSrcweir     RelHdl(&_rLB);
1570cdf0e10cSrcweir 
1571cdf0e10cSrcweir 	return nLBRelations;
1572cdf0e10cSrcweir }
1573cdf0e10cSrcweir 
1574cdf0e10cSrcweir /*--------------------------------------------------------------------
1575cdf0e10cSrcweir 	Beschreibung:
1576cdf0e10cSrcweir  --------------------------------------------------------------------*/
1577cdf0e10cSrcweir 
1578cdf0e10cSrcweir short SwFrmPage::GetRelation(FrmMap * /*pMap*/, ListBox &rRelationLB)
1579cdf0e10cSrcweir {
1580cdf0e10cSrcweir     short nRel = 0;
1581cdf0e10cSrcweir 	sal_uInt16 nPos = rRelationLB.GetSelectEntryPos();
1582cdf0e10cSrcweir 
1583cdf0e10cSrcweir 	if (nPos != LISTBOX_ENTRY_NOTFOUND)
1584cdf0e10cSrcweir 	{
1585cdf0e10cSrcweir 		RelationMap *pEntry = (RelationMap *)rRelationLB.GetEntryData(nPos);
1586cdf0e10cSrcweir 		nRel = pEntry->nRelation;
1587cdf0e10cSrcweir 	}
1588cdf0e10cSrcweir 
1589cdf0e10cSrcweir 	return nRel;
1590cdf0e10cSrcweir }
1591cdf0e10cSrcweir 
1592cdf0e10cSrcweir /*--------------------------------------------------------------------
1593cdf0e10cSrcweir 	Beschreibung:
1594cdf0e10cSrcweir  --------------------------------------------------------------------*/
1595cdf0e10cSrcweir 
1596cdf0e10cSrcweir short SwFrmPage::GetAlignment(FrmMap *pMap, sal_uInt16 nMapPos,
1597cdf0e10cSrcweir         ListBox &/*rAlignLB*/, ListBox &rRelationLB)
1598cdf0e10cSrcweir {
1599cdf0e10cSrcweir     short nAlign = 0;
1600cdf0e10cSrcweir 
1601cdf0e10cSrcweir     // OD 14.11.2003 #i22341# - special handling also for map <aVCharMap>,
1602cdf0e10cSrcweir     // because it contains ambigous items for alignment
1603cdf0e10cSrcweir     if ( pMap == aVAsCharHtmlMap || pMap == aVAsCharMap ||
1604cdf0e10cSrcweir          pMap == aVCharMap )
1605cdf0e10cSrcweir 	{
1606cdf0e10cSrcweir 		if (rRelationLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND)
1607cdf0e10cSrcweir 		{
1608cdf0e10cSrcweir 			sal_uLong  nRel = ((RelationMap *)rRelationLB.GetEntryData(rRelationLB.GetSelectEntryPos()))->nLBRelation;
1609cdf0e10cSrcweir             size_t nMapCount = ::lcl_GetFrmMapCount(pMap);
1610cdf0e10cSrcweir             SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId;
1611cdf0e10cSrcweir 
1612cdf0e10cSrcweir             for (size_t i = 0; i < nMapCount; i++)
1613cdf0e10cSrcweir 			{
1614cdf0e10cSrcweir                 if (pMap[i].eStrId == eStrId)
1615cdf0e10cSrcweir 				{
1616cdf0e10cSrcweir 					sal_uLong nLBRelations = pMap[i].nLBRelations;
1617cdf0e10cSrcweir 					if (nLBRelations & nRel)
1618cdf0e10cSrcweir 					{
1619cdf0e10cSrcweir 						nAlign = pMap[i].nAlign;
1620cdf0e10cSrcweir 						break;
1621cdf0e10cSrcweir 					}
1622cdf0e10cSrcweir 				}
1623cdf0e10cSrcweir 			}
1624cdf0e10cSrcweir 		}
1625cdf0e10cSrcweir 	}
1626cdf0e10cSrcweir 	else if (pMap)
1627cdf0e10cSrcweir 		nAlign = pMap[nMapPos].nAlign;
1628cdf0e10cSrcweir 
1629cdf0e10cSrcweir 	return nAlign;
1630cdf0e10cSrcweir }
1631cdf0e10cSrcweir 
1632cdf0e10cSrcweir /*--------------------------------------------------------------------
1633cdf0e10cSrcweir 	Beschreibung:
1634cdf0e10cSrcweir  --------------------------------------------------------------------*/
1635cdf0e10cSrcweir 
1636cdf0e10cSrcweir sal_uInt16 SwFrmPage::GetMapPos( const FrmMap *pMap, ListBox &rAlignLB )
1637cdf0e10cSrcweir {
1638cdf0e10cSrcweir 	sal_uInt16 nMapPos = 0;
1639cdf0e10cSrcweir 	sal_uInt16 nLBSelPos = rAlignLB.GetSelectEntryPos();
1640cdf0e10cSrcweir 
1641cdf0e10cSrcweir 	if (nLBSelPos != LISTBOX_ENTRY_NOTFOUND)
1642cdf0e10cSrcweir 	{
1643cdf0e10cSrcweir 		if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap)
1644cdf0e10cSrcweir 		{
1645cdf0e10cSrcweir             size_t nMapCount = ::lcl_GetFrmMapCount(pMap);
1646cdf0e10cSrcweir 			String sSelEntry(rAlignLB.GetSelectEntry());
1647cdf0e10cSrcweir 
1648cdf0e10cSrcweir             for (size_t i = 0; i < nMapCount; i++)
1649cdf0e10cSrcweir 			{
1650cdf0e10cSrcweir                 SvxSwFramePosString::StringId eResId = pMap[i].eStrId;
1651cdf0e10cSrcweir 
1652cdf0e10cSrcweir                 String sEntry = aFramePosString.GetString(eResId);
1653cdf0e10cSrcweir 				sEntry = MnemonicGenerator::EraseAllMnemonicChars( sEntry );
1654cdf0e10cSrcweir 
1655cdf0e10cSrcweir 				if (sEntry == sSelEntry)
1656cdf0e10cSrcweir 				{
1657cdf0e10cSrcweir                     nMapPos = static_cast< sal_uInt16 >(i);
1658cdf0e10cSrcweir 					break;
1659cdf0e10cSrcweir 				}
1660cdf0e10cSrcweir 			}
1661cdf0e10cSrcweir 		}
1662cdf0e10cSrcweir 		else
1663cdf0e10cSrcweir 			nMapPos = nLBSelPos;
1664cdf0e10cSrcweir 	}
1665cdf0e10cSrcweir 
1666cdf0e10cSrcweir 	return nMapPos;
1667cdf0e10cSrcweir }
1668cdf0e10cSrcweir 
1669cdf0e10cSrcweir /*--------------------------------------------------------------------
1670cdf0e10cSrcweir 	Beschreibung:
1671cdf0e10cSrcweir  --------------------------------------------------------------------*/
1672cdf0e10cSrcweir 
1673cdf0e10cSrcweir RndStdIds SwFrmPage::GetAnchor()
1674cdf0e10cSrcweir {
1675cdf0e10cSrcweir     RndStdIds nRet = FLY_AT_PAGE;
1676cdf0e10cSrcweir 	if(aAnchorAtParaRB.IsChecked())
1677cdf0e10cSrcweir     {
1678cdf0e10cSrcweir         nRet = FLY_AT_PARA;
1679cdf0e10cSrcweir     }
1680cdf0e10cSrcweir 	else if(aAnchorAtCharRB.IsChecked())
1681cdf0e10cSrcweir     {
1682cdf0e10cSrcweir         nRet = FLY_AT_CHAR;
1683cdf0e10cSrcweir     }
1684cdf0e10cSrcweir 	else if(aAnchorAsCharRB.IsChecked())
1685cdf0e10cSrcweir     {
1686cdf0e10cSrcweir         nRet = FLY_AS_CHAR;
1687cdf0e10cSrcweir     }
1688cdf0e10cSrcweir 	else if(aAnchorAtFrameRB.IsChecked())
1689cdf0e10cSrcweir     {
1690cdf0e10cSrcweir 		nRet = FLY_AT_FLY;
1691cdf0e10cSrcweir     }
1692cdf0e10cSrcweir 	return nRet;
1693cdf0e10cSrcweir }
1694cdf0e10cSrcweir 
1695cdf0e10cSrcweir /*--------------------------------------------------------------------
1696cdf0e10cSrcweir 	Beschreibung:	Bsp - Update
1697cdf0e10cSrcweir  --------------------------------------------------------------------*/
1698cdf0e10cSrcweir 
1699cdf0e10cSrcweir void SwFrmPage::ActivatePage(const SfxItemSet& rSet)
1700cdf0e10cSrcweir {
1701cdf0e10cSrcweir 	bNoModifyHdl = sal_True;
1702cdf0e10cSrcweir 	Init(rSet);
1703cdf0e10cSrcweir 	bNoModifyHdl = sal_False;
1704cdf0e10cSrcweir     //lock PercentFields
1705cdf0e10cSrcweir     aWidthED.LockAutoCalculation(sal_True);
1706cdf0e10cSrcweir     aHeightED.LockAutoCalculation(sal_True);
1707cdf0e10cSrcweir     RangeModifyHdl(&aWidthED);  // Alle Maximalwerte initial setzen
1708cdf0e10cSrcweir     aHeightED.LockAutoCalculation(sal_False);
1709cdf0e10cSrcweir     aWidthED.LockAutoCalculation(sal_False);
1710cdf0e10cSrcweir     aFollowTextFlowCB.SaveValue();
1711cdf0e10cSrcweir }
1712cdf0e10cSrcweir 
1713cdf0e10cSrcweir int SwFrmPage::DeactivatePage(SfxItemSet * _pSet)
1714cdf0e10cSrcweir {
1715cdf0e10cSrcweir     if ( _pSet )
1716cdf0e10cSrcweir 	{
1717cdf0e10cSrcweir         FillItemSet( *_pSet );
1718cdf0e10cSrcweir 
1719cdf0e10cSrcweir 		//FillItemSet setzt den Anker nicht in den Set, wenn er mit dem
1720cdf0e10cSrcweir 		//Original uebereinstimmt. Fuer die anderen Pages brauchen wir aber
1721cdf0e10cSrcweir 		//den aktuellen Anker.
1722cdf0e10cSrcweir 		SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell()
1723cdf0e10cSrcweir 							: ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell();
1724cdf0e10cSrcweir 		RndStdIds eAnchorId = (RndStdIds)GetAnchor();
1725cdf0e10cSrcweir 		SwFmtAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() );
1726cdf0e10cSrcweir         _pSet->Put( aAnc );
1727cdf0e10cSrcweir 	}
1728cdf0e10cSrcweir 
1729cdf0e10cSrcweir 	return sal_True;
1730cdf0e10cSrcweir }
1731cdf0e10cSrcweir 
1732cdf0e10cSrcweir /*--------------------------------------------------------------------
1733cdf0e10cSrcweir 	Beschreibung: Links/rechts mit Innen/aussen tauschen
1734cdf0e10cSrcweir  --------------------------------------------------------------------*/
1735cdf0e10cSrcweir 
1736cdf0e10cSrcweir IMPL_LINK( SwFrmPage, MirrorHdl, CheckBox *, EMPTYARG )
1737cdf0e10cSrcweir {
1738cdf0e10cSrcweir     RndStdIds eId = GetAnchor();
1739cdf0e10cSrcweir     InitPos( eId, USHRT_MAX, 0, USHRT_MAX, 0, LONG_MAX, LONG_MAX);
1740cdf0e10cSrcweir 
1741cdf0e10cSrcweir 	return 0;
1742cdf0e10cSrcweir }
1743cdf0e10cSrcweir 
1744cdf0e10cSrcweir /*--------------------------------------------------------------------
1745cdf0e10cSrcweir 	Beschreibung:
1746cdf0e10cSrcweir  --------------------------------------------------------------------*/
1747cdf0e10cSrcweir 
1748cdf0e10cSrcweir IMPL_LINK( SwFrmPage, RelSizeClickHdl, CheckBox *, pBtn )
1749cdf0e10cSrcweir {
1750cdf0e10cSrcweir 	if (pBtn == &aRelWidthCB)
1751cdf0e10cSrcweir     {
1752cdf0e10cSrcweir 		aWidthED.ShowPercent(pBtn->IsChecked());
1753cdf0e10cSrcweir         if(pBtn->IsChecked())
1754cdf0e10cSrcweir             aWidthED.MetricField::SetMax(MAX_PERCENT_WIDTH);
1755cdf0e10cSrcweir     }
1756cdf0e10cSrcweir     else // pBtn == &aRelHeightCB
1757cdf0e10cSrcweir     {
1758cdf0e10cSrcweir 		aHeightED.ShowPercent(pBtn->IsChecked());
1759cdf0e10cSrcweir         if(pBtn->IsChecked())
1760cdf0e10cSrcweir             aHeightED.MetricField::SetMax(MAX_PERCENT_HEIGHT);
1761cdf0e10cSrcweir     }
1762cdf0e10cSrcweir 
1763cdf0e10cSrcweir 	if (pBtn)	// Nur wenn Handler durch Aenderung des Controllers gerufen wurde
1764cdf0e10cSrcweir 		RangeModifyHdl(&aWidthED);	// Werte wieder korrigieren
1765cdf0e10cSrcweir 
1766cdf0e10cSrcweir 	if (pBtn == &aRelWidthCB)
1767cdf0e10cSrcweir 		ModifyHdl(&aWidthED);
1768cdf0e10cSrcweir     else // pBtn == &aRelHeightCB
1769cdf0e10cSrcweir 		ModifyHdl(&aHeightED);
1770cdf0e10cSrcweir 
1771cdf0e10cSrcweir 	return 0;
1772cdf0e10cSrcweir }
1773cdf0e10cSrcweir 
1774cdf0e10cSrcweir /*--------------------------------------------------------------------
1775cdf0e10cSrcweir 	Beschreibung:	Bereichspruefung
1776cdf0e10cSrcweir  --------------------------------------------------------------------*/
1777cdf0e10cSrcweir 
1778cdf0e10cSrcweir IMPL_LINK( SwFrmPage, RangeModifyHdl, Edit *, EMPTYARG )
1779cdf0e10cSrcweir {
1780cdf0e10cSrcweir 	if (bNoModifyHdl)
1781cdf0e10cSrcweir 		return 0;
1782cdf0e10cSrcweir 
1783cdf0e10cSrcweir 	SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell()
1784cdf0e10cSrcweir 						:((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell();
1785cdf0e10cSrcweir 	ASSERT(pSh , "shell not found");
1786cdf0e10cSrcweir 	SwFlyFrmAttrMgr aMgr( bNew, pSh, (const SwAttrSet&)GetItemSet() );
1787cdf0e10cSrcweir     SvxSwFrameValidation        aVal;
1788cdf0e10cSrcweir 
1789cdf0e10cSrcweir     aVal.nAnchorType = static_cast< sal_uInt16 >(GetAnchor());
1790cdf0e10cSrcweir 	aVal.bAutoHeight = aAutoHeightCB.IsChecked();
1791cdf0e10cSrcweir 	aVal.bAutoWidth = aAutoWidthCB.IsChecked();
1792cdf0e10cSrcweir 	aVal.bMirror = aMirrorPagesCB.IsChecked();
1793cdf0e10cSrcweir     // OD 18.09.2003 #i18732#
1794cdf0e10cSrcweir     aVal.bFollowTextFlow = aFollowTextFlowCB.IsChecked();
1795cdf0e10cSrcweir 
1796cdf0e10cSrcweir 	if ( pHMap )
1797cdf0e10cSrcweir 	{
1798cdf0e10cSrcweir 		// Ausrichtung Horizontal
1799cdf0e10cSrcweir 		sal_uInt16 nMapPos = GetMapPos(pHMap, aHorizontalDLB);
1800cdf0e10cSrcweir         short nAlign = GetAlignment(pHMap, nMapPos, aHorizontalDLB, aHoriRelationLB);
1801cdf0e10cSrcweir         short nRel = GetRelation(pHMap, aHoriRelationLB);
1802cdf0e10cSrcweir 
1803cdf0e10cSrcweir         aVal.nHoriOrient = nAlign;
1804cdf0e10cSrcweir         aVal.nHRelOrient = nRel;
1805cdf0e10cSrcweir 	}
1806cdf0e10cSrcweir 	else
1807cdf0e10cSrcweir         aVal.nHoriOrient = text::HoriOrientation::NONE;
1808cdf0e10cSrcweir 
1809cdf0e10cSrcweir 	if ( pVMap )
1810cdf0e10cSrcweir 	{
1811cdf0e10cSrcweir 		// Ausrichtung Vertikal
1812cdf0e10cSrcweir 		sal_uInt16 nMapPos = GetMapPos(pVMap, aVerticalDLB);
1813cdf0e10cSrcweir         short nAlign = GetAlignment(pVMap, nMapPos, aVerticalDLB, aVertRelationLB);
1814cdf0e10cSrcweir         short nRel = GetRelation(pVMap, aVertRelationLB);
1815cdf0e10cSrcweir 
1816cdf0e10cSrcweir         aVal.nVertOrient = nAlign;
1817cdf0e10cSrcweir         aVal.nVRelOrient = nRel;
1818cdf0e10cSrcweir 	}
1819cdf0e10cSrcweir 	else
1820cdf0e10cSrcweir         aVal.nVertOrient = text::VertOrientation::NONE;
1821cdf0e10cSrcweir 
1822cdf0e10cSrcweir     const long nAtHorzPosVal = static_cast< long >(
1823cdf0e10cSrcweir                     aAtHorzPosED.Denormalize(aAtHorzPosED.GetValue(FUNIT_TWIP)) );
1824cdf0e10cSrcweir     const long nAtVertPosVal = static_cast< long >(
1825cdf0e10cSrcweir                     aAtVertPosED.Denormalize(aAtVertPosED.GetValue(FUNIT_TWIP)) );
1826cdf0e10cSrcweir 
1827cdf0e10cSrcweir 	aVal.nHPos = nAtHorzPosVal;
1828cdf0e10cSrcweir 	aVal.nVPos = nAtVertPosVal;
1829cdf0e10cSrcweir 
1830cdf0e10cSrcweir     aMgr.ValidateMetrics(aVal, mpToCharCntntPos, sal_True);   // Einmal, um Referenzwerte fuer prozentuale Werte zu erhalten
1831cdf0e10cSrcweir 
1832cdf0e10cSrcweir 	// Referenzwerte fuer fuer Prozentwerte setzen (100%) ...
1833cdf0e10cSrcweir 	aWidthED.SetRefValue(aVal.aPercentSize.Width());
1834cdf0e10cSrcweir 	aHeightED.SetRefValue(aVal.aPercentSize.Height());
1835cdf0e10cSrcweir 
1836cdf0e10cSrcweir 	// ... und damit Breite und Hoehe korrekt umrechnen
1837cdf0e10cSrcweir     SwTwips nWidth  = static_cast< SwTwips >(aWidthED. DenormalizePercent(aWidthED.GetValue(FUNIT_TWIP)));
1838cdf0e10cSrcweir     SwTwips nHeight = static_cast< SwTwips >(aHeightED.DenormalizePercent(aHeightED.GetValue(FUNIT_TWIP)));
1839cdf0e10cSrcweir 	aVal.nWidth  = nWidth;
1840cdf0e10cSrcweir 	aVal.nHeight = nHeight;
1841cdf0e10cSrcweir 
1842cdf0e10cSrcweir     aMgr.ValidateMetrics(aVal, mpToCharCntntPos);    // Nochmal um mit korrekter Breite und Hoehe alle restlichen Werte zu ermitteln
1843cdf0e10cSrcweir 
1844cdf0e10cSrcweir 	// alle Spalten muessen passen
1845cdf0e10cSrcweir 	if(GetTabDialog()->GetExampleSet() &&
1846cdf0e10cSrcweir 			SFX_ITEM_DEFAULT <= GetTabDialog()->GetExampleSet()->GetItemState(RES_COL))
1847cdf0e10cSrcweir 	{
1848cdf0e10cSrcweir 		const SwFmtCol& rCol = (const SwFmtCol&)GetTabDialog()->GetExampleSet()->Get(RES_COL);
1849cdf0e10cSrcweir 		if ( rCol.GetColumns().Count() > 1 )
1850cdf0e10cSrcweir 		{
1851cdf0e10cSrcweir 			for ( sal_uInt16 i = 0; i < rCol.GetColumns().Count(); ++i )
1852cdf0e10cSrcweir 			{
1853cdf0e10cSrcweir 				aVal.nMinWidth += rCol.GetColumns()[i]->GetLeft() +
1854cdf0e10cSrcweir 								  rCol.GetColumns()[i]->GetRight() +
1855cdf0e10cSrcweir 								  MINFLY;
1856cdf0e10cSrcweir 			}
1857cdf0e10cSrcweir 			aVal.nMinWidth -= MINFLY;//einen hatten wir schon mit drin!
1858cdf0e10cSrcweir 		}
1859cdf0e10cSrcweir 	}
1860cdf0e10cSrcweir 
1861cdf0e10cSrcweir 	nWidth = aVal.nWidth;
1862cdf0e10cSrcweir 	nHeight = aVal.nHeight;
1863cdf0e10cSrcweir 
1864cdf0e10cSrcweir 	// Mindestbreite auch fuer Vorlage
1865cdf0e10cSrcweir 	aHeightED.SetMin(aHeightED.NormalizePercent(aVal.nMinHeight), FUNIT_TWIP);
1866cdf0e10cSrcweir 	aWidthED. SetMin(aWidthED.NormalizePercent(aVal.nMinWidth), FUNIT_TWIP);
1867cdf0e10cSrcweir 
1868cdf0e10cSrcweir 	SwTwips nMaxWidth(aVal.nMaxWidth);
1869cdf0e10cSrcweir 	SwTwips nMaxHeight(aVal.nMaxHeight);
1870cdf0e10cSrcweir 
1871cdf0e10cSrcweir 	if (aVal.bAutoHeight && (nDlgType == DLG_FRM_GRF || nDlgType == DLG_FRM_OLE))
1872cdf0e10cSrcweir 	{
1873cdf0e10cSrcweir 		SwTwips nTmp = Min(nWidth * nMaxHeight / Max(nHeight, 1L), nMaxHeight);
1874cdf0e10cSrcweir 		aWidthED.SetMax(aWidthED.NormalizePercent(nTmp), FUNIT_TWIP);
1875cdf0e10cSrcweir 
1876cdf0e10cSrcweir 		nTmp = Min(nHeight * nMaxWidth / Max(nWidth, 1L), nMaxWidth);
1877cdf0e10cSrcweir 		aHeightED.SetMax(aWidthED.NormalizePercent(nTmp), FUNIT_TWIP);
1878cdf0e10cSrcweir 	}
1879cdf0e10cSrcweir 	else
1880cdf0e10cSrcweir 	{
1881cdf0e10cSrcweir         SwTwips nTmp = static_cast< SwTwips >(aHeightED.NormalizePercent(nMaxHeight));
1882cdf0e10cSrcweir 		aHeightED.SetMax(nTmp, FUNIT_TWIP);
1883cdf0e10cSrcweir 
1884cdf0e10cSrcweir         nTmp = static_cast< SwTwips >(aWidthED.NormalizePercent(nMaxWidth));
1885cdf0e10cSrcweir 		aWidthED.SetMax(nTmp, FUNIT_TWIP);
1886cdf0e10cSrcweir 	}
1887cdf0e10cSrcweir 
1888cdf0e10cSrcweir 	aAtHorzPosED.SetMin(aAtHorzPosED.Normalize(aVal.nMinHPos), FUNIT_TWIP);
1889cdf0e10cSrcweir 	aAtHorzPosED.SetMax(aAtHorzPosED.Normalize(aVal.nMaxHPos), FUNIT_TWIP);
1890cdf0e10cSrcweir 	if ( aVal.nHPos != nAtHorzPosVal )
1891cdf0e10cSrcweir 		aAtHorzPosED.SetValue(aAtHorzPosED.Normalize(aVal.nHPos), FUNIT_TWIP);
1892cdf0e10cSrcweir 
1893cdf0e10cSrcweir     const SwTwips nUpperOffset = (aVal.nAnchorType == FLY_AS_CHAR)
1894cdf0e10cSrcweir         ? nUpperBorder : 0;
1895cdf0e10cSrcweir     const SwTwips nLowerOffset = (aVal.nAnchorType == FLY_AS_CHAR)
1896cdf0e10cSrcweir         ? nLowerBorder : 0;
1897cdf0e10cSrcweir 
1898cdf0e10cSrcweir 	aAtVertPosED.SetMin(aAtVertPosED.Normalize(aVal.nMinVPos + nLowerOffset + nUpperOffset), FUNIT_TWIP);
1899cdf0e10cSrcweir 	aAtVertPosED.SetMax(aAtVertPosED.Normalize(aVal.nMaxVPos), FUNIT_TWIP);
1900cdf0e10cSrcweir 	if ( aVal.nVPos != nAtVertPosVal )
1901cdf0e10cSrcweir 		aAtVertPosED.SetValue(aAtVertPosED.Normalize(aVal.nVPos), FUNIT_TWIP);
1902cdf0e10cSrcweir 
1903cdf0e10cSrcweir 	return 0;
1904cdf0e10cSrcweir }
1905cdf0e10cSrcweir 
1906cdf0e10cSrcweir IMPL_LINK( SwFrmPage, AnchorTypeHdl, RadioButton *, EMPTYARG )
1907cdf0e10cSrcweir {
1908cdf0e10cSrcweir 	aMirrorPagesCB.Enable(!aAnchorAsCharRB.IsChecked());
1909cdf0e10cSrcweir 
1910cdf0e10cSrcweir     // OD 06.11.2003 #i18732# - enable check box 'Follow text flow' for anchor
1911cdf0e10cSrcweir     // type to-paragraph' and to-character
1912cdf0e10cSrcweir     // OD 10.11.2003 #i22305# - enable check box 'Follow text
1913cdf0e10cSrcweir     // flow' also for anchor type to-frame.
1914cdf0e10cSrcweir     aFollowTextFlowCB.Enable( aAnchorAtParaRB.IsChecked() ||
1915cdf0e10cSrcweir                               aAnchorAtCharRB.IsChecked() ||
1916cdf0e10cSrcweir                               aAnchorAtFrameRB.IsChecked() );
1917cdf0e10cSrcweir 
1918cdf0e10cSrcweir     RndStdIds eId = GetAnchor();
1919cdf0e10cSrcweir 
1920cdf0e10cSrcweir     InitPos( eId, USHRT_MAX, 0, USHRT_MAX, 0, LONG_MAX, LONG_MAX);
1921cdf0e10cSrcweir 	RangeModifyHdl(0);
1922cdf0e10cSrcweir 
1923cdf0e10cSrcweir 	if(bHtmlMode)
1924cdf0e10cSrcweir 	{
1925cdf0e10cSrcweir 		PosHdl(&aHorizontalDLB);
1926cdf0e10cSrcweir 		PosHdl(&aVerticalDLB);
1927cdf0e10cSrcweir 	}
1928cdf0e10cSrcweir 
1929cdf0e10cSrcweir     EnableVerticalPositioning( !(m_bIsMathOLE && m_bIsMathBaselineAlignment
1930cdf0e10cSrcweir             && FLY_AS_CHAR == eId) );
1931cdf0e10cSrcweir 
1932cdf0e10cSrcweir 	return 0;
1933cdf0e10cSrcweir }
1934cdf0e10cSrcweir 
1935cdf0e10cSrcweir /*--------------------------------------------------------------------
1936cdf0e10cSrcweir 	Beschreibung:
1937cdf0e10cSrcweir  --------------------------------------------------------------------*/
1938cdf0e10cSrcweir 
1939cdf0e10cSrcweir IMPL_LINK( SwFrmPage, PosHdl, ListBox *, pLB )
1940cdf0e10cSrcweir {
1941cdf0e10cSrcweir 	sal_Bool bHori = pLB == &aHorizontalDLB;
1942cdf0e10cSrcweir 	ListBox *pRelLB = bHori ? &aHoriRelationLB : &aVertRelationLB;
1943cdf0e10cSrcweir     FixedText *pRelFT = bHori ? &aHoriRelationFT : &aVertRelationFT;
1944cdf0e10cSrcweir 	FrmMap *pMap = bHori ? pHMap : pVMap;
1945cdf0e10cSrcweir 
1946cdf0e10cSrcweir 	sal_uInt16 nMapPos = GetMapPos(pMap, *pLB);
1947cdf0e10cSrcweir     short nAlign = GetAlignment(pMap, nMapPos, *pLB, *pRelLB);
1948cdf0e10cSrcweir 
1949cdf0e10cSrcweir 	if (bHori)
1950cdf0e10cSrcweir 	{
1951cdf0e10cSrcweir         sal_Bool bEnable = text::HoriOrientation::NONE == nAlign;
1952cdf0e10cSrcweir 		aAtHorzPosED.Enable( bEnable );
1953cdf0e10cSrcweir 		aAtHorzPosFT.Enable( bEnable );
1954cdf0e10cSrcweir 	}
1955cdf0e10cSrcweir 	else
1956cdf0e10cSrcweir 	{
1957cdf0e10cSrcweir         sal_Bool bEnable = text::VertOrientation::NONE == nAlign && m_bAllowVertPositioning;
1958cdf0e10cSrcweir 		aAtVertPosED.Enable( bEnable );
1959cdf0e10cSrcweir 		aAtVertPosFT.Enable( bEnable );
1960cdf0e10cSrcweir 	}
1961cdf0e10cSrcweir 
1962cdf0e10cSrcweir 	if (pLB)	// Nur wenn Handler durch Aenderung des Controllers gerufen wurde
1963cdf0e10cSrcweir 		RangeModifyHdl( 0 );
1964cdf0e10cSrcweir 
1965cdf0e10cSrcweir 	sal_uInt16 nRel = 0;
1966cdf0e10cSrcweir 	if (pLB->GetSelectEntryCount())
1967cdf0e10cSrcweir 	{
1968cdf0e10cSrcweir 
1969cdf0e10cSrcweir 		if (pRelLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND)
1970cdf0e10cSrcweir 			nRel = ((RelationMap *)pRelLB->GetEntryData(pRelLB->GetSelectEntryPos()))->nRelation;
1971cdf0e10cSrcweir 
1972cdf0e10cSrcweir         FillRelLB(pMap, nMapPos, nAlign, nRel, *pRelLB, *pRelFT);
1973cdf0e10cSrcweir 	}
1974cdf0e10cSrcweir 	else
1975cdf0e10cSrcweir 		pRelLB->Clear();
1976cdf0e10cSrcweir 
1977cdf0e10cSrcweir 	UpdateExample();
1978cdf0e10cSrcweir 
1979cdf0e10cSrcweir 	if (bHori)
1980cdf0e10cSrcweir 		bAtHorzPosModified = sal_True;
1981cdf0e10cSrcweir 	else
1982cdf0e10cSrcweir 		bAtVertPosModified = sal_True;
1983cdf0e10cSrcweir 
1984cdf0e10cSrcweir 	// Sonderbehandlung fuer HTML-Mode mit horz-vert-Abhaengigkeiten
1985cdf0e10cSrcweir 	if(bHtmlMode && nHtmlMode&HTMLMODE_SOME_ABS_POS &&
1986cdf0e10cSrcweir             (FLY_AT_CHAR == GetAnchor()))
1987cdf0e10cSrcweir 	{
1988cdf0e10cSrcweir 		sal_Bool bSet = sal_False;
1989cdf0e10cSrcweir 		if(bHori)
1990cdf0e10cSrcweir 		{
1991cdf0e10cSrcweir 			// rechts ist nur unterhalb erlaubt - von links nur oben
1992cdf0e10cSrcweir 			// von links am Zeichen -> unterhalb
1993cdf0e10cSrcweir             if((text::HoriOrientation::LEFT == nAlign || text::HoriOrientation::RIGHT == nAlign) &&
1994cdf0e10cSrcweir 					0 == aVerticalDLB.GetSelectEntryPos())
1995cdf0e10cSrcweir 			{
1996cdf0e10cSrcweir                 if(text::RelOrientation::FRAME == nRel)
1997cdf0e10cSrcweir 					aVerticalDLB.SelectEntryPos(1);
1998cdf0e10cSrcweir 				else
1999cdf0e10cSrcweir 					aVerticalDLB.SelectEntryPos(0);
2000cdf0e10cSrcweir 				bSet = sal_True;
2001cdf0e10cSrcweir 			}
2002cdf0e10cSrcweir             else if(text::HoriOrientation::LEFT == nAlign && 1 == aVerticalDLB.GetSelectEntryPos())
2003cdf0e10cSrcweir 			{
2004cdf0e10cSrcweir 				aVerticalDLB.SelectEntryPos(0);
2005cdf0e10cSrcweir 				bSet = sal_True;
2006cdf0e10cSrcweir 			}
2007cdf0e10cSrcweir             else if(text::HoriOrientation::NONE == nAlign && 1 == aVerticalDLB.GetSelectEntryPos())
2008cdf0e10cSrcweir 			{
2009cdf0e10cSrcweir 				aVerticalDLB.SelectEntryPos(0);
2010cdf0e10cSrcweir 				bSet = sal_True;
2011cdf0e10cSrcweir 			}
2012cdf0e10cSrcweir 			if(bSet)
2013cdf0e10cSrcweir 				PosHdl(&aVerticalDLB);
2014cdf0e10cSrcweir 		}
2015cdf0e10cSrcweir 		else
2016cdf0e10cSrcweir 		{
2017cdf0e10cSrcweir             if(text::VertOrientation::TOP == nAlign)
2018cdf0e10cSrcweir 			{
2019cdf0e10cSrcweir 				if(1 == aHorizontalDLB.GetSelectEntryPos())
2020cdf0e10cSrcweir 				{
2021cdf0e10cSrcweir 					aHorizontalDLB.SelectEntryPos(0);
2022cdf0e10cSrcweir 					bSet = sal_True;
2023cdf0e10cSrcweir 				}
2024cdf0e10cSrcweir 				aHoriRelationLB.SelectEntryPos(1);
2025cdf0e10cSrcweir 			}
2026cdf0e10cSrcweir             else if(text::VertOrientation::CHAR_BOTTOM == nAlign)
2027cdf0e10cSrcweir 			{
2028cdf0e10cSrcweir 				if(2 == aHorizontalDLB.GetSelectEntryPos())
2029cdf0e10cSrcweir 				{
2030cdf0e10cSrcweir 					aHorizontalDLB.SelectEntryPos(0);
2031cdf0e10cSrcweir 					bSet = sal_True;
2032cdf0e10cSrcweir 				}
2033cdf0e10cSrcweir 				aHoriRelationLB.SelectEntryPos(0) ;
2034cdf0e10cSrcweir 			}
2035cdf0e10cSrcweir 			if(bSet)
2036cdf0e10cSrcweir 				PosHdl(&aHorizontalDLB);
2037cdf0e10cSrcweir 		}
2038cdf0e10cSrcweir 
2039cdf0e10cSrcweir 	}
2040cdf0e10cSrcweir 	return 0;
2041cdf0e10cSrcweir }
2042cdf0e10cSrcweir 
2043cdf0e10cSrcweir /*--------------------------------------------------------------------
2044cdf0e10cSrcweir 	Beschreibung:	Horizontale Pos
2045cdf0e10cSrcweir  --------------------------------------------------------------------*/
2046cdf0e10cSrcweir 
2047cdf0e10cSrcweir IMPL_LINK( SwFrmPage, RelHdl, ListBox *, pLB )
2048cdf0e10cSrcweir {
2049cdf0e10cSrcweir 	sal_Bool bHori = pLB == &aHoriRelationLB;
2050cdf0e10cSrcweir 
2051cdf0e10cSrcweir 	UpdateExample();
2052cdf0e10cSrcweir 
2053cdf0e10cSrcweir 	if (bHori)
2054cdf0e10cSrcweir 		bAtHorzPosModified = sal_True;
2055cdf0e10cSrcweir 	else
2056cdf0e10cSrcweir 		bAtVertPosModified = sal_True;
2057cdf0e10cSrcweir 
2058cdf0e10cSrcweir     if (bHtmlMode && (FLY_AT_CHAR == GetAnchor()))
2059cdf0e10cSrcweir 	{
2060cdf0e10cSrcweir 		if(bHori)
2061cdf0e10cSrcweir 		{
2062cdf0e10cSrcweir 			sal_uInt16 nRel = GetRelation(pHMap, aHoriRelationLB);
2063cdf0e10cSrcweir             if(text::RelOrientation::PRINT_AREA == nRel && 0 == aVerticalDLB.GetSelectEntryPos())
2064cdf0e10cSrcweir 			{
2065cdf0e10cSrcweir 				aVerticalDLB.SelectEntryPos(1);
2066cdf0e10cSrcweir 			}
2067cdf0e10cSrcweir             else if(text::RelOrientation::CHAR == nRel && 1 == aVerticalDLB.GetSelectEntryPos())
2068cdf0e10cSrcweir 			{
2069cdf0e10cSrcweir 				aVerticalDLB.SelectEntryPos(0);
2070cdf0e10cSrcweir 			}
2071cdf0e10cSrcweir 		}
2072cdf0e10cSrcweir 	}
2073cdf0e10cSrcweir 	if (pLB)	// Nur wenn Handler durch Aenderung des Controllers gerufen wurde
2074cdf0e10cSrcweir 		RangeModifyHdl(0);
2075cdf0e10cSrcweir 
2076cdf0e10cSrcweir 	return 0;
2077cdf0e10cSrcweir }
2078cdf0e10cSrcweir 
2079cdf0e10cSrcweir 
2080cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwFrmPage, RealSizeHdl, Button *, EMPTYARG )
2081cdf0e10cSrcweir {
2082cdf0e10cSrcweir 	aWidthED.SetUserValue( aWidthED. NormalizePercent(aGrfSize.Width() ), FUNIT_TWIP);
2083cdf0e10cSrcweir 	aHeightED.SetUserValue(aHeightED.NormalizePercent(aGrfSize.Height()), FUNIT_TWIP);
2084cdf0e10cSrcweir     fWidthHeightRatio = aGrfSize.Height() ? double(aGrfSize.Width()) / double(aGrfSize.Height()) : 1.0;
2085cdf0e10cSrcweir 	UpdateExample();
2086cdf0e10cSrcweir 	return 0;
2087cdf0e10cSrcweir }
2088cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwFrmPage, RealSizeHdl, Button *, EMPTYARG )
2089cdf0e10cSrcweir 
2090cdf0e10cSrcweir 
2091cdf0e10cSrcweir IMPL_LINK( SwFrmPage, AutoWidthClickHdl, void*, EMPTYARG )
2092cdf0e10cSrcweir {
2093cdf0e10cSrcweir 	if( !IsInGraficMode() )
2094cdf0e10cSrcweir 		HandleAutoCB( aAutoWidthCB.IsChecked(), aWidthFT, aWidthAutoFT );
2095cdf0e10cSrcweir 	return 0;
2096cdf0e10cSrcweir }
2097cdf0e10cSrcweir 
2098cdf0e10cSrcweir IMPL_LINK( SwFrmPage, AutoHeightClickHdl, void*, EMPTYARG )
2099cdf0e10cSrcweir {
2100cdf0e10cSrcweir 	if( !IsInGraficMode() )
2101cdf0e10cSrcweir 		HandleAutoCB( aAutoHeightCB.IsChecked(), aHeightFT, aHeightAutoFT );
2102cdf0e10cSrcweir 	return 0;
2103cdf0e10cSrcweir }
2104cdf0e10cSrcweir 
2105cdf0e10cSrcweir IMPL_LINK( SwFrmPage, ModifyHdl, Edit *, pEdit )
2106cdf0e10cSrcweir {
2107cdf0e10cSrcweir     SwTwips nWidth  = static_cast< SwTwips >(aWidthED.DenormalizePercent(aWidthED.GetValue(FUNIT_TWIP)));
2108cdf0e10cSrcweir     SwTwips nHeight = static_cast< SwTwips >(aHeightED.DenormalizePercent(aHeightED.GetValue(FUNIT_TWIP)));
2109cdf0e10cSrcweir     if ( aFixedRatioCB.IsChecked() )
2110cdf0e10cSrcweir 	{
2111cdf0e10cSrcweir 		if ( pEdit == &aWidthED )
2112cdf0e10cSrcweir 		{
2113cdf0e10cSrcweir             nHeight = SwTwips((double)nWidth / fWidthHeightRatio);
2114cdf0e10cSrcweir             aHeightED.SetPrcntValue(aHeightED.NormalizePercent(nHeight), FUNIT_TWIP);
2115cdf0e10cSrcweir 		}
2116cdf0e10cSrcweir 		else if(pEdit == &aHeightED)
2117cdf0e10cSrcweir 		{
2118cdf0e10cSrcweir             nWidth = SwTwips((double)nHeight * fWidthHeightRatio);
2119cdf0e10cSrcweir             aWidthED.SetPrcntValue(aWidthED.NormalizePercent(nWidth), FUNIT_TWIP);
2120cdf0e10cSrcweir 		}
2121cdf0e10cSrcweir 	}
2122cdf0e10cSrcweir     fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0;
2123cdf0e10cSrcweir 	UpdateExample();
2124cdf0e10cSrcweir 	return 0;
2125cdf0e10cSrcweir }
2126cdf0e10cSrcweir 
2127cdf0e10cSrcweir /*--------------------------------------------------------------------
2128cdf0e10cSrcweir 	Beschreibung:
2129cdf0e10cSrcweir  --------------------------------------------------------------------*/
2130cdf0e10cSrcweir 
2131cdf0e10cSrcweir void SwFrmPage::UpdateExample()
2132cdf0e10cSrcweir {
2133cdf0e10cSrcweir 	sal_uInt16 nPos = aHorizontalDLB.GetSelectEntryPos();
2134cdf0e10cSrcweir 	if ( pHMap && nPos != LISTBOX_ENTRY_NOTFOUND )
2135cdf0e10cSrcweir 	{
2136cdf0e10cSrcweir 		sal_uInt16 nMapPos = GetMapPos(pHMap, aHorizontalDLB);
2137cdf0e10cSrcweir         short nAlign = GetAlignment(pHMap, nMapPos, aHorizontalDLB, aHoriRelationLB);
2138cdf0e10cSrcweir         short nRel = GetRelation(pHMap, aHoriRelationLB);
2139cdf0e10cSrcweir 
2140cdf0e10cSrcweir 		aExampleWN.SetHAlign(nAlign);
2141cdf0e10cSrcweir 		aExampleWN.SetHoriRel(nRel);
2142cdf0e10cSrcweir 	}
2143cdf0e10cSrcweir 
2144cdf0e10cSrcweir 	nPos = aVerticalDLB.GetSelectEntryPos();
2145cdf0e10cSrcweir 	if ( pVMap && nPos != LISTBOX_ENTRY_NOTFOUND )
2146cdf0e10cSrcweir 	{
2147cdf0e10cSrcweir 		sal_uInt16 nMapPos = GetMapPos(pVMap, aVerticalDLB);
2148cdf0e10cSrcweir         short nAlign = GetAlignment(pVMap, nMapPos, aVerticalDLB, aVertRelationLB);
2149cdf0e10cSrcweir         short nRel = GetRelation(pVMap, aVertRelationLB);
2150cdf0e10cSrcweir 
2151cdf0e10cSrcweir 		aExampleWN.SetVAlign(nAlign);
2152cdf0e10cSrcweir 		aExampleWN.SetVertRel(nRel);
2153cdf0e10cSrcweir 	}
2154cdf0e10cSrcweir 
2155cdf0e10cSrcweir 	// Size
2156cdf0e10cSrcweir     long nXPos = static_cast< long >(aAtHorzPosED.Denormalize(aAtHorzPosED.GetValue(FUNIT_TWIP)));
2157cdf0e10cSrcweir     long nYPos = static_cast< long >(aAtVertPosED.Denormalize(aAtVertPosED.GetValue(FUNIT_TWIP)));
2158cdf0e10cSrcweir 	aExampleWN.SetRelPos(Point(nXPos, nYPos));
2159cdf0e10cSrcweir 
2160cdf0e10cSrcweir     aExampleWN.SetAnchor( static_cast< sal_uInt16 >(GetAnchor()) );
2161cdf0e10cSrcweir 	aExampleWN.Invalidate();
2162cdf0e10cSrcweir }
2163cdf0e10cSrcweir 
2164cdf0e10cSrcweir void SwFrmPage::Init(const SfxItemSet& rSet, sal_Bool bReset)
2165cdf0e10cSrcweir {
2166cdf0e10cSrcweir 	if(!bFormat)
2167cdf0e10cSrcweir 	{
2168cdf0e10cSrcweir 		SwWrtShell* pSh = ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell();
2169cdf0e10cSrcweir 
2170cdf0e10cSrcweir 		// Size
2171cdf0e10cSrcweir 		const sal_Bool bSizeFixed = pSh->IsSelObjProtected( FLYPROTECT_FIXED );
2172cdf0e10cSrcweir 
2173cdf0e10cSrcweir 		aWidthED .Enable( !bSizeFixed );
2174cdf0e10cSrcweir 		aHeightED.Enable( !bSizeFixed );
2175cdf0e10cSrcweir 
2176cdf0e10cSrcweir         // size controls for math OLE objects
2177cdf0e10cSrcweir         if ( DLG_FRM_OLE == nDlgType && ! bNew )
2178cdf0e10cSrcweir         {
2179cdf0e10cSrcweir             // disable width and height for math objects
2180cdf0e10cSrcweir             const SvGlobalName& rFactNm( pSh->GetOLEObject()->getClassID() );
2181cdf0e10cSrcweir 
2182cdf0e10cSrcweir             struct _GlobalNameId {
2183cdf0e10cSrcweir                 sal_uInt32 n1;
2184cdf0e10cSrcweir                 sal_uInt16 n2, n3;
2185cdf0e10cSrcweir                 sal_uInt8 b8, b9, b10, b11, b12, b13, b14, b15;
2186cdf0e10cSrcweir             } aGlbNmIds[4] = { { SO3_SM_CLASSID_60 }, { SO3_SM_CLASSID_50 },
2187cdf0e10cSrcweir                                { SO3_SM_CLASSID_40 }, { SO3_SM_CLASSID_30 } };
2188cdf0e10cSrcweir 
2189cdf0e10cSrcweir             for ( int i = 0; i < 4; ++i ) {
2190cdf0e10cSrcweir                 const _GlobalNameId& rId = aGlbNmIds[ i ];
2191cdf0e10cSrcweir 
2192cdf0e10cSrcweir                 SvGlobalName aGlbNm( rId.n1, rId.n2, rId.n3,
2193cdf0e10cSrcweir                                      rId.b8, rId.b9, rId.b10, rId.b11,
2194cdf0e10cSrcweir                                      rId.b12, rId.b13, rId.b14, rId.b15 );
2195cdf0e10cSrcweir 
2196cdf0e10cSrcweir                 if( rFactNm == aGlbNm )
2197cdf0e10cSrcweir                 {
2198cdf0e10cSrcweir                     // disable size controls for math OLE objects
2199cdf0e10cSrcweir                     aWidthFT.Disable();
2200cdf0e10cSrcweir                     aWidthED.Disable();
2201cdf0e10cSrcweir                     aRelWidthCB.Disable();
2202cdf0e10cSrcweir                     aHeightFT.Disable();
2203cdf0e10cSrcweir                     aHeightED.Disable();
2204cdf0e10cSrcweir                     aRelHeightCB.Disable();
2205cdf0e10cSrcweir                     aFixedRatioCB.Disable();
2206cdf0e10cSrcweir                     aRealSizeBT.Disable();
2207cdf0e10cSrcweir                     break;
2208cdf0e10cSrcweir                 }
2209cdf0e10cSrcweir             }
2210cdf0e10cSrcweir 
2211cdf0e10cSrcweir             // TODO/LATER: get correct aspect
2212cdf0e10cSrcweir             if(0 != (pSh->GetOLEObject()->getStatus( embed::Aspects::MSOLE_CONTENT ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE ) )
2213cdf0e10cSrcweir                 aRealSizeBT.Disable();
2214cdf0e10cSrcweir         }
2215cdf0e10cSrcweir 	}
2216cdf0e10cSrcweir 
2217cdf0e10cSrcweir 	const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE);
2218cdf0e10cSrcweir     sal_Int64 nWidth  = aWidthED.NormalizePercent(rSize.GetWidth());
2219cdf0e10cSrcweir     sal_Int64 nHeight = aHeightED.NormalizePercent(rSize.GetHeight());
2220cdf0e10cSrcweir 
2221cdf0e10cSrcweir 	if (nWidth != aWidthED.GetValue(FUNIT_TWIP))
2222cdf0e10cSrcweir 	{
2223cdf0e10cSrcweir 		if(!bReset)
2224cdf0e10cSrcweir 		{
2225cdf0e10cSrcweir 			// Wert wurde von Umlauf-Tabpage geaendert und muss
2226cdf0e10cSrcweir 			// mit Modify-Flag gesetzt werden
2227cdf0e10cSrcweir 			aWidthED.SetUserValue(nWidth, FUNIT_TWIP);
2228cdf0e10cSrcweir 		}
2229cdf0e10cSrcweir 		else
2230cdf0e10cSrcweir             aWidthED.SetPrcntValue(nWidth, FUNIT_TWIP);
2231cdf0e10cSrcweir 	}
2232cdf0e10cSrcweir 
2233cdf0e10cSrcweir 	if (nHeight != aHeightED.GetValue(FUNIT_TWIP))
2234cdf0e10cSrcweir 	{
2235cdf0e10cSrcweir 		if (!bReset)
2236cdf0e10cSrcweir 		{
2237cdf0e10cSrcweir 			// Wert wurde von Umlauf-Tabpage geaendert und muss
2238cdf0e10cSrcweir 			// mit Modify-Flag gesetzt werden
2239cdf0e10cSrcweir 			aHeightED.SetUserValue(nHeight, FUNIT_TWIP);
2240cdf0e10cSrcweir 		}
2241cdf0e10cSrcweir 		else
2242cdf0e10cSrcweir             aHeightED.SetPrcntValue(nHeight, FUNIT_TWIP);
2243cdf0e10cSrcweir 	}
2244cdf0e10cSrcweir 
2245cdf0e10cSrcweir 	if (!IsInGraficMode())
2246cdf0e10cSrcweir 	{
2247cdf0e10cSrcweir 		SwFrmSize eSize = rSize.GetHeightSizeType();
2248cdf0e10cSrcweir 		sal_Bool bCheck = eSize != ATT_FIX_SIZE;
2249cdf0e10cSrcweir 		aAutoHeightCB.Check( bCheck );
2250cdf0e10cSrcweir 		HandleAutoCB( bCheck, aHeightFT, aHeightAutoFT );
2251cdf0e10cSrcweir 		if( eSize == ATT_VAR_SIZE )
2252cdf0e10cSrcweir 			aHeightED.SetValue( aHeightED.GetMin(), FUNIT_NONE );
2253cdf0e10cSrcweir 
2254cdf0e10cSrcweir 		eSize = rSize.GetWidthSizeType();
2255cdf0e10cSrcweir 		bCheck = eSize != ATT_FIX_SIZE;
2256cdf0e10cSrcweir 		aAutoWidthCB.Check( bCheck );
2257cdf0e10cSrcweir 		HandleAutoCB( bCheck, aWidthFT, aWidthAutoFT );
2258cdf0e10cSrcweir 		if( eSize == ATT_VAR_SIZE )
2259cdf0e10cSrcweir 			aWidthED.SetValue( aWidthED.GetMin(), FUNIT_NONE );
2260cdf0e10cSrcweir 
2261cdf0e10cSrcweir 		if ( !bFormat )
2262cdf0e10cSrcweir 		{
2263cdf0e10cSrcweir 			SwWrtShell* pSh = ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell();
2264cdf0e10cSrcweir 			const SwFrmFmt* pFmt = pSh->GetFlyFrmFmt();
2265cdf0e10cSrcweir 			if( pFmt && pFmt->GetChain().GetNext() )
2266cdf0e10cSrcweir 				aAutoHeightCB.Enable( sal_False );
2267cdf0e10cSrcweir 		}
2268cdf0e10cSrcweir 	}
2269cdf0e10cSrcweir 	else
2270cdf0e10cSrcweir 		aAutoHeightCB.Hide();
2271cdf0e10cSrcweir 
2272cdf0e10cSrcweir 	// Umlauf-Abstand fuer zeichengebundene Rahmen organisieren
2273cdf0e10cSrcweir 	const SvxULSpaceItem &rUL = (const SvxULSpaceItem &)rSet.Get(RES_UL_SPACE);
2274cdf0e10cSrcweir 	nUpperBorder = rUL.GetUpper();
2275cdf0e10cSrcweir 	nLowerBorder = rUL.GetLower();
2276cdf0e10cSrcweir 
2277cdf0e10cSrcweir 	if(SFX_ITEM_SET == rSet.GetItemState(FN_KEEP_ASPECT_RATIO))
2278cdf0e10cSrcweir 	{
2279cdf0e10cSrcweir 		aFixedRatioCB.Check(((const SfxBoolItem&)rSet.Get(FN_KEEP_ASPECT_RATIO)).GetValue());
2280cdf0e10cSrcweir 		aFixedRatioCB.SaveValue();
2281cdf0e10cSrcweir 	}
2282cdf0e10cSrcweir 
2283cdf0e10cSrcweir 	// Spalten
2284cdf0e10cSrcweir 	SwFmtCol aCol( (const SwFmtCol&)rSet.Get(RES_COL) );
2285cdf0e10cSrcweir 	::FitToActualSize( aCol, (sal_uInt16)rSize.GetWidth() );
2286cdf0e10cSrcweir 
2287cdf0e10cSrcweir 	RndStdIds eAnchorId = (RndStdIds)GetAnchor();
2288cdf0e10cSrcweir 
2289cdf0e10cSrcweir 	if ( bNew && !bFormat )
2290cdf0e10cSrcweir         InitPos(eAnchorId, USHRT_MAX, 0, USHRT_MAX, USHRT_MAX, LONG_MAX, LONG_MAX);
2291cdf0e10cSrcweir 	else
2292cdf0e10cSrcweir 	{
2293cdf0e10cSrcweir 		const SwFmtHoriOrient& rHori = (const SwFmtHoriOrient&)rSet.Get(RES_HORI_ORIENT);
2294cdf0e10cSrcweir 		const SwFmtVertOrient& rVert = (const SwFmtVertOrient&)rSet.Get(RES_VERT_ORIENT);
2295cdf0e10cSrcweir 		nOldH 	 = rHori.GetHoriOrient();
2296cdf0e10cSrcweir 		nOldHRel = rHori.GetRelationOrient();
2297cdf0e10cSrcweir 		nOldV 	 = rVert.GetVertOrient(),
2298cdf0e10cSrcweir 		nOldVRel = rVert.GetRelationOrient();
2299cdf0e10cSrcweir 
2300cdf0e10cSrcweir         if (eAnchorId == FLY_AT_PAGE)
2301cdf0e10cSrcweir         {
2302cdf0e10cSrcweir             if (nOldHRel == text::RelOrientation::FRAME)
2303cdf0e10cSrcweir                 nOldHRel = text::RelOrientation::PAGE_FRAME;
2304cdf0e10cSrcweir             else if (nOldHRel == text::RelOrientation::PRINT_AREA)
2305cdf0e10cSrcweir                 nOldHRel = text::RelOrientation::PAGE_PRINT_AREA;
2306cdf0e10cSrcweir             if (nOldVRel == text::RelOrientation::FRAME)
2307cdf0e10cSrcweir                 nOldVRel = text::RelOrientation::PAGE_FRAME;
2308cdf0e10cSrcweir             else if (nOldVRel == text::RelOrientation::PRINT_AREA)
2309cdf0e10cSrcweir                 nOldVRel = text::RelOrientation::PAGE_PRINT_AREA;
2310cdf0e10cSrcweir 		}
2311cdf0e10cSrcweir 
2312cdf0e10cSrcweir 		aMirrorPagesCB.Check(rHori.IsPosToggle());
2313cdf0e10cSrcweir 		aMirrorPagesCB.SaveValue();
2314cdf0e10cSrcweir 
2315cdf0e10cSrcweir 		InitPos(eAnchorId,
2316cdf0e10cSrcweir 				nOldH,
2317cdf0e10cSrcweir 				nOldHRel,
2318cdf0e10cSrcweir 				nOldV,
2319cdf0e10cSrcweir 				nOldVRel,
2320cdf0e10cSrcweir 				rHori.GetPos(),
2321cdf0e10cSrcweir 				rVert.GetPos());
2322cdf0e10cSrcweir 	}
2323cdf0e10cSrcweir 
2324cdf0e10cSrcweir 	// Transparent fuers Bsp
2325cdf0e10cSrcweir 	// Umlauf fuers Bsp
2326cdf0e10cSrcweir 	const SwFmtSurround& rSurround = (const SwFmtSurround&)rSet.Get(RES_SURROUND);
2327cdf0e10cSrcweir     aExampleWN.SetWrap ( static_cast< sal_uInt16 >(rSurround.GetSurround()) );
2328cdf0e10cSrcweir 
2329cdf0e10cSrcweir 	if ( rSurround.GetSurround() == SURROUND_THROUGHT )
2330cdf0e10cSrcweir 	{
2331cdf0e10cSrcweir 		const SvxOpaqueItem& rOpaque = (const SvxOpaqueItem&)rSet.Get(RES_OPAQUE);
2332cdf0e10cSrcweir 		aExampleWN.SetTransparent(!rOpaque.GetValue());
2333cdf0e10cSrcweir 	}
2334cdf0e10cSrcweir 
2335cdf0e10cSrcweir 	// ggf auf Prozent umschalten
2336cdf0e10cSrcweir 	RangeModifyHdl(&aWidthED);	// Referenzwerte setzen (fuer 100%)
2337cdf0e10cSrcweir 
2338cdf0e10cSrcweir 	if (rSize.GetWidthPercent() == 0xff || rSize.GetHeightPercent() == 0xff)
2339cdf0e10cSrcweir 		aFixedRatioCB.Check(sal_True);
2340cdf0e10cSrcweir 	if (rSize.GetWidthPercent() && rSize.GetWidthPercent() != 0xff &&
2341cdf0e10cSrcweir 		!aRelWidthCB.IsChecked())
2342cdf0e10cSrcweir 	{
2343cdf0e10cSrcweir 		aRelWidthCB.Check(sal_True);
2344cdf0e10cSrcweir 		RelSizeClickHdl(&aRelWidthCB);
2345cdf0e10cSrcweir         aWidthED.SetPrcntValue(rSize.GetWidthPercent(), FUNIT_CUSTOM);
2346cdf0e10cSrcweir 	}
2347cdf0e10cSrcweir 	if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != 0xff &&
2348cdf0e10cSrcweir 		!aRelHeightCB.IsChecked())
2349cdf0e10cSrcweir 	{
2350cdf0e10cSrcweir 		aRelHeightCB.Check(sal_True);
2351cdf0e10cSrcweir 		RelSizeClickHdl(&aRelHeightCB);
2352cdf0e10cSrcweir         aHeightED.SetPrcntValue(rSize.GetHeightPercent(), FUNIT_CUSTOM);
2353cdf0e10cSrcweir 	}
2354cdf0e10cSrcweir 	aRelWidthCB.SaveValue();
2355cdf0e10cSrcweir 	aRelHeightCB.SaveValue();
2356cdf0e10cSrcweir }
2357cdf0e10cSrcweir 
2358cdf0e10cSrcweir sal_uInt16* SwFrmPage::GetRanges()
2359cdf0e10cSrcweir {
2360cdf0e10cSrcweir 	return aPageRg;
2361cdf0e10cSrcweir }
2362cdf0e10cSrcweir /* -----------------------------03.11.00 10:52--------------------------------
2363cdf0e10cSrcweir 
2364cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
2365cdf0e10cSrcweir void SwFrmPage::SetFormatUsed(sal_Bool bFmt)
2366cdf0e10cSrcweir {
2367cdf0e10cSrcweir 	bFormat  	= bFmt;
2368cdf0e10cSrcweir 	if(bFormat)
2369cdf0e10cSrcweir 	{
2370cdf0e10cSrcweir         aAnchorAtPageRB.Hide();
2371cdf0e10cSrcweir         aAnchorAtParaRB.Hide();
2372cdf0e10cSrcweir         aAnchorAtCharRB.Hide();
2373cdf0e10cSrcweir         aAnchorAsCharRB.Hide();
2374cdf0e10cSrcweir         aAnchorAtFrameRB.Hide();
2375cdf0e10cSrcweir         aTypeFL.Hide();
2376cdf0e10cSrcweir         aTypeSepFL.Hide();
2377cdf0e10cSrcweir 
2378cdf0e10cSrcweir //        Point aSizePos = aSizeFL.GetPosPixel();
2379cdf0e10cSrcweir //        Size aSizeSize = aSizeFL.GetSizePixel();
2380cdf0e10cSrcweir //        aSizeSize.Width() = aTypeFL.GetPosPixel().X() +
2381cdf0e10cSrcweir //                    aTypeFL.GetSizePixel().Width() - aSizePos.X();
2382cdf0e10cSrcweir //        aSizeFL.SetSizePixel(aSizeSize);
2383cdf0e10cSrcweir 	}
2384cdf0e10cSrcweir }
2385cdf0e10cSrcweir 
2386cdf0e10cSrcweir 
2387cdf0e10cSrcweir void SwFrmPage::EnableVerticalPositioning( bool bEnable )
2388cdf0e10cSrcweir {
2389cdf0e10cSrcweir     m_bAllowVertPositioning = bEnable;
2390cdf0e10cSrcweir     aVerticalFT.Enable( bEnable );
2391cdf0e10cSrcweir     aVerticalDLB.Enable( bEnable );
2392cdf0e10cSrcweir     aAtVertPosFT.Enable( bEnable );
2393cdf0e10cSrcweir     aAtVertPosED.Enable( bEnable );
2394cdf0e10cSrcweir     aVertRelationFT.Enable( bEnable );
2395cdf0e10cSrcweir     aVertRelationLB.Enable( bEnable );
2396cdf0e10cSrcweir }
2397cdf0e10cSrcweir 
2398cdf0e10cSrcweir 
2399cdf0e10cSrcweir /*--------------------------------------------------------------------
2400cdf0e10cSrcweir 	Beschreibung:
2401cdf0e10cSrcweir  --------------------------------------------------------------------*/
2402cdf0e10cSrcweir 
2403cdf0e10cSrcweir SwGrfExtPage::SwGrfExtPage(Window *pParent, const SfxItemSet &rSet) :
2404cdf0e10cSrcweir 	SfxTabPage( pParent, SW_RES(TP_GRF_EXT), rSet ),
2405cdf0e10cSrcweir     aMirrorFL       (this, SW_RES( FL_MIRROR )),
2406cdf0e10cSrcweir     aMirrorVertBox  (this, SW_RES( CB_VERT )),
2407cdf0e10cSrcweir     aMirrorHorzBox  (this, SW_RES( CB_HOR )),
2408cdf0e10cSrcweir     aAllPagesRB     (this, SW_RES( RB_MIRROR_ALL_PAGES )),
2409cdf0e10cSrcweir     aLeftPagesRB    (this, SW_RES( RB_MIRROR_LEFT_PAGES )),
2410cdf0e10cSrcweir     aRightPagesRB   (this, SW_RES( RB_MIRROR_RIGHT_PAGES )),
2411cdf0e10cSrcweir     aBmpWin         (this, WN_BMP, Graphic(), BitmapEx(SW_RES(BMP_EXAMPLE)), BitmapEx(SW_RES(BMP_EXAMPLE_HC)) ),
2412cdf0e10cSrcweir     aConnectFL      (this, SW_RES( FL_CONNECT )),
2413cdf0e10cSrcweir     aConnectFT      (this, SW_RES( FT_CONNECT )),
2414cdf0e10cSrcweir     aConnectED      (this, SW_RES( ED_CONNECT )),
2415cdf0e10cSrcweir     aBrowseBT       (this, SW_RES( PB_BROWSE )),
2416cdf0e10cSrcweir     pGrfDlg         ( 0 )
2417cdf0e10cSrcweir {
2418cdf0e10cSrcweir 	FreeResource();
2419cdf0e10cSrcweir 
2420cdf0e10cSrcweir 	aBrowseBT.SetAccessibleRelationMemberOf(&aConnectFL);
2421cdf0e10cSrcweir 
2422cdf0e10cSrcweir     SetExchangeSupport();
2423cdf0e10cSrcweir 	aMirrorHorzBox.SetClickHdl( LINK(this, SwGrfExtPage, MirrorHdl));
2424cdf0e10cSrcweir 	aMirrorVertBox.SetClickHdl( LINK(this, SwGrfExtPage, MirrorHdl));
2425cdf0e10cSrcweir 	aBrowseBT.SetClickHdl	 ( LINK(this, SwGrfExtPage, BrowseHdl));
2426cdf0e10cSrcweir }
2427cdf0e10cSrcweir 
2428cdf0e10cSrcweir /*--------------------------------------------------------------------
2429cdf0e10cSrcweir 	Beschreibung:
2430cdf0e10cSrcweir  --------------------------------------------------------------------*/
2431cdf0e10cSrcweir 
2432cdf0e10cSrcweir SwGrfExtPage::~SwGrfExtPage()
2433cdf0e10cSrcweir {
2434cdf0e10cSrcweir 	delete pGrfDlg;
2435cdf0e10cSrcweir }
2436cdf0e10cSrcweir 
2437cdf0e10cSrcweir /*--------------------------------------------------------------------
2438cdf0e10cSrcweir 	Beschreibung:
2439cdf0e10cSrcweir  --------------------------------------------------------------------*/
2440cdf0e10cSrcweir 
2441cdf0e10cSrcweir SfxTabPage* SwGrfExtPage::Create( Window *pParent, const SfxItemSet &rSet )
2442cdf0e10cSrcweir {
2443cdf0e10cSrcweir 	return new SwGrfExtPage( pParent, rSet );
2444cdf0e10cSrcweir }
2445cdf0e10cSrcweir 
2446cdf0e10cSrcweir /*--------------------------------------------------------------------
2447cdf0e10cSrcweir 	Beschreibung:
2448cdf0e10cSrcweir  --------------------------------------------------------------------*/
2449cdf0e10cSrcweir 
2450cdf0e10cSrcweir void SwGrfExtPage::Reset(const SfxItemSet &rSet)
2451cdf0e10cSrcweir {
2452cdf0e10cSrcweir 	const SfxPoolItem* pItem;
2453cdf0e10cSrcweir 	sal_uInt16 nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current());
2454cdf0e10cSrcweir 	bHtmlMode = nHtmlMode & HTMLMODE_ON ? sal_True : sal_False;
2455cdf0e10cSrcweir 
2456cdf0e10cSrcweir 	if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_GRF_CONNECT, sal_True, &pItem)
2457cdf0e10cSrcweir 		&& ((const SfxBoolItem *)pItem)->GetValue() )
2458cdf0e10cSrcweir 	{
2459cdf0e10cSrcweir 		aBrowseBT.Enable();
2460cdf0e10cSrcweir 		aConnectED.SetReadOnly(sal_False);
2461cdf0e10cSrcweir 	}
2462cdf0e10cSrcweir 
2463cdf0e10cSrcweir 	ActivatePage(rSet);
2464cdf0e10cSrcweir }
2465cdf0e10cSrcweir 
2466cdf0e10cSrcweir /*--------------------------------------------------------------------
2467cdf0e10cSrcweir 	Beschreibung:
2468cdf0e10cSrcweir  --------------------------------------------------------------------*/
2469cdf0e10cSrcweir 
2470cdf0e10cSrcweir void SwGrfExtPage::ActivatePage(const SfxItemSet& rSet)
2471cdf0e10cSrcweir {
2472cdf0e10cSrcweir 	const SvxProtectItem& rProt = (const SvxProtectItem& )rSet.Get(RES_PROTECT);
2473cdf0e10cSrcweir     sal_Bool bProtCntnt = rProt.IsCntntProtected();
2474cdf0e10cSrcweir 
2475cdf0e10cSrcweir 	const SfxPoolItem* pItem = 0;
2476cdf0e10cSrcweir 	sal_Bool bEnable = sal_False;
2477cdf0e10cSrcweir 	sal_Bool bEnableMirrorRB = sal_False;
2478cdf0e10cSrcweir 
2479cdf0e10cSrcweir 	SfxItemState eState = rSet.GetItemState(RES_GRFATR_MIRRORGRF, sal_True, &pItem);
2480cdf0e10cSrcweir 	if( SFX_ITEM_UNKNOWN != eState && !bProtCntnt && !bHtmlMode )
2481cdf0e10cSrcweir 	{
2482cdf0e10cSrcweir 		if( SFX_ITEM_SET != eState )
2483cdf0e10cSrcweir 			pItem = &rSet.Get( RES_GRFATR_MIRRORGRF );
2484cdf0e10cSrcweir 
2485cdf0e10cSrcweir 		bEnable = sal_True;
2486cdf0e10cSrcweir 
2487cdf0e10cSrcweir         MirrorGraph eMirror = static_cast< MirrorGraph >(((const SwMirrorGrf* )pItem)->GetValue());
2488cdf0e10cSrcweir 		switch( eMirror )
2489cdf0e10cSrcweir 		{
2490cdf0e10cSrcweir         case RES_MIRROR_GRAPH_DONT: break;
2491cdf0e10cSrcweir         case RES_MIRROR_GRAPH_VERT: aMirrorHorzBox.Check(sal_True); break;
2492cdf0e10cSrcweir         case RES_MIRROR_GRAPH_HOR:  aMirrorVertBox.Check(sal_True); break;
2493cdf0e10cSrcweir         case RES_MIRROR_GRAPH_BOTH: aMirrorHorzBox.Check(sal_True);
2494cdf0e10cSrcweir 									aMirrorVertBox.Check(sal_True);
2495cdf0e10cSrcweir 									break;
2496cdf0e10cSrcweir         default:
2497cdf0e10cSrcweir             ;
2498cdf0e10cSrcweir         }
2499cdf0e10cSrcweir 
2500cdf0e10cSrcweir 		sal_uInt16 nPos = ((const SwMirrorGrf* )pItem)->IsGrfToggle() ? 1 : 0;
2501cdf0e10cSrcweir         nPos += (eMirror == RES_MIRROR_GRAPH_VERT || eMirror == RES_MIRROR_GRAPH_BOTH)
2502cdf0e10cSrcweir 				 ? 2 : 0;
2503cdf0e10cSrcweir 
2504cdf0e10cSrcweir 		bEnableMirrorRB = nPos != 0;
2505cdf0e10cSrcweir 
2506cdf0e10cSrcweir 		switch (nPos)
2507cdf0e10cSrcweir 		{
2508cdf0e10cSrcweir 			case 1:	// Auf linken bzw geraden Seiten spiegeln
2509cdf0e10cSrcweir 				aLeftPagesRB.Check();
2510cdf0e10cSrcweir 				aMirrorHorzBox.Check(sal_True);
2511cdf0e10cSrcweir 				break;
2512cdf0e10cSrcweir 			case 2:	// Auf allen Seiten spiegeln
2513cdf0e10cSrcweir 				aAllPagesRB.Check();
2514cdf0e10cSrcweir 				break;
2515cdf0e10cSrcweir 			case 3:	// Auf rechten bzw ungeraden Seiten spiegeln
2516cdf0e10cSrcweir 				aRightPagesRB.Check();
2517cdf0e10cSrcweir 				break;
2518cdf0e10cSrcweir 			default:
2519cdf0e10cSrcweir 				aAllPagesRB.Check();
2520cdf0e10cSrcweir 				break;
2521cdf0e10cSrcweir 		}
2522cdf0e10cSrcweir 	}
2523cdf0e10cSrcweir 
2524cdf0e10cSrcweir 	if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRAF_GRAPHIC, sal_False, &pItem ) )
2525cdf0e10cSrcweir 	{
2526cdf0e10cSrcweir 		const SvxBrushItem& rBrush = *(SvxBrushItem*)pItem;
2527cdf0e10cSrcweir 		if( rBrush.GetGraphicLink() )
2528cdf0e10cSrcweir 		{
2529cdf0e10cSrcweir 			aGrfName = aNewGrfName = *rBrush.GetGraphicLink();
2530cdf0e10cSrcweir 			aConnectED.SetText( aNewGrfName );
2531cdf0e10cSrcweir 		}
2532cdf0e10cSrcweir 		const Graphic* pGrf = rBrush.GetGraphic();
2533cdf0e10cSrcweir 		if( pGrf )
2534cdf0e10cSrcweir 			aBmpWin.SetGraphic( *pGrf );
2535cdf0e10cSrcweir 	}
2536cdf0e10cSrcweir 
2537cdf0e10cSrcweir 	aAllPagesRB .Enable(bEnableMirrorRB);
2538cdf0e10cSrcweir 	aLeftPagesRB.Enable(bEnableMirrorRB);
2539cdf0e10cSrcweir 	aRightPagesRB.Enable(bEnableMirrorRB);
2540cdf0e10cSrcweir 	aMirrorHorzBox.Enable(bEnable);
2541cdf0e10cSrcweir 	aMirrorVertBox.Enable(bEnable);
2542cdf0e10cSrcweir     aMirrorFL.Enable(bEnable);
2543cdf0e10cSrcweir 
2544cdf0e10cSrcweir 	aAllPagesRB .SaveValue();
2545cdf0e10cSrcweir 	aLeftPagesRB.SaveValue();
2546cdf0e10cSrcweir 	aRightPagesRB.SaveValue();
2547cdf0e10cSrcweir 	aMirrorHorzBox.SaveValue();
2548cdf0e10cSrcweir 	aMirrorVertBox.SaveValue();
2549cdf0e10cSrcweir 
2550cdf0e10cSrcweir 	aBmpWin.MirrorHorz( aMirrorVertBox.IsChecked() );
2551cdf0e10cSrcweir 	aBmpWin.MirrorVert( aMirrorHorzBox.IsChecked() );
2552cdf0e10cSrcweir 	aBmpWin.Invalidate();
2553cdf0e10cSrcweir }
2554cdf0e10cSrcweir 
2555cdf0e10cSrcweir /*--------------------------------------------------------------------
2556cdf0e10cSrcweir 	Beschreibung:
2557cdf0e10cSrcweir  --------------------------------------------------------------------*/
2558cdf0e10cSrcweir 
2559cdf0e10cSrcweir sal_Bool SwGrfExtPage::FillItemSet( SfxItemSet &rSet )
2560cdf0e10cSrcweir {
2561cdf0e10cSrcweir 	sal_Bool bModified = sal_False;
2562cdf0e10cSrcweir 	if ( aMirrorHorzBox.GetSavedValue() != aMirrorHorzBox.IsChecked() ||
2563cdf0e10cSrcweir 		 aMirrorVertBox.GetSavedValue() != aMirrorVertBox.IsChecked() ||
2564cdf0e10cSrcweir 		 aAllPagesRB .GetSavedValue() != aAllPagesRB .IsChecked() ||
2565cdf0e10cSrcweir 		 aLeftPagesRB.GetSavedValue() != aLeftPagesRB.IsChecked() ||
2566cdf0e10cSrcweir 		 aRightPagesRB.GetSavedValue() != aRightPagesRB.IsChecked())
2567cdf0e10cSrcweir 	{
2568cdf0e10cSrcweir 		bModified = sal_True;
2569cdf0e10cSrcweir 
2570cdf0e10cSrcweir 		sal_Bool bHori = sal_False;
2571cdf0e10cSrcweir 
2572cdf0e10cSrcweir 		if (aMirrorHorzBox.IsChecked() &&
2573cdf0e10cSrcweir 				!aLeftPagesRB.IsChecked())
2574cdf0e10cSrcweir 			bHori = sal_True;
2575cdf0e10cSrcweir 
2576cdf0e10cSrcweir         MirrorGraph eMirror;
2577cdf0e10cSrcweir 		eMirror = aMirrorVertBox.IsChecked() && bHori ?
2578cdf0e10cSrcweir                     RES_MIRROR_GRAPH_BOTH : bHori ?
2579cdf0e10cSrcweir                     RES_MIRROR_GRAPH_VERT : aMirrorVertBox.IsChecked() ?
2580cdf0e10cSrcweir                     RES_MIRROR_GRAPH_HOR  : RES_MIRROR_GRAPH_DONT;
2581cdf0e10cSrcweir 
2582cdf0e10cSrcweir 		sal_Bool bMirror = !aAllPagesRB.IsChecked();
2583cdf0e10cSrcweir 		SwMirrorGrf aMirror( eMirror );
2584cdf0e10cSrcweir 		aMirror.SetGrfToggle(bMirror );
2585cdf0e10cSrcweir 		rSet.Put( aMirror );
2586cdf0e10cSrcweir 	}
2587cdf0e10cSrcweir 
2588cdf0e10cSrcweir 	if( aGrfName != aNewGrfName || aConnectED.IsModified() )
2589cdf0e10cSrcweir 	{
2590cdf0e10cSrcweir 		bModified = sal_True;
2591cdf0e10cSrcweir 		aGrfName = aConnectED.GetText();
2592cdf0e10cSrcweir 		rSet.Put( SvxBrushItem( aGrfName, aFilterName, GPOS_LT,
2593cdf0e10cSrcweir 								SID_ATTR_GRAF_GRAPHIC ));
2594cdf0e10cSrcweir 	}
2595cdf0e10cSrcweir 	return bModified;
2596cdf0e10cSrcweir }
2597cdf0e10cSrcweir /*--------------------------------------------------------------------
2598cdf0e10cSrcweir 	Beschreibung:
2599cdf0e10cSrcweir  --------------------------------------------------------------------*/
2600cdf0e10cSrcweir 
2601cdf0e10cSrcweir int SwGrfExtPage::DeactivatePage(SfxItemSet *_pSet)
2602cdf0e10cSrcweir {
2603cdf0e10cSrcweir     if( _pSet )
2604cdf0e10cSrcweir         FillItemSet( *_pSet );
2605cdf0e10cSrcweir 	return sal_True;
2606cdf0e10cSrcweir }
2607cdf0e10cSrcweir 
2608cdf0e10cSrcweir /*--------------------------------------------------------------------
2609cdf0e10cSrcweir 	Beschreibung:
2610cdf0e10cSrcweir  --------------------------------------------------------------------*/
2611cdf0e10cSrcweir 
2612cdf0e10cSrcweir IMPL_LINK( SwGrfExtPage, BrowseHdl, Button *, EMPTYARG )
2613cdf0e10cSrcweir {
2614cdf0e10cSrcweir 	if(!pGrfDlg)
2615cdf0e10cSrcweir     {
2616cdf0e10cSrcweir         pGrfDlg = new FileDialogHelper( SFXWB_GRAPHIC );
2617cdf0e10cSrcweir         pGrfDlg->SetTitle(SW_RESSTR(STR_EDIT_GRF ));
2618cdf0e10cSrcweir     }
2619cdf0e10cSrcweir     pGrfDlg->SetDisplayDirectory( aConnectED.GetText() );
2620cdf0e10cSrcweir     uno::Reference < ui::dialogs::XFilePicker > xFP = pGrfDlg->GetFilePicker();
2621cdf0e10cSrcweir     uno::Reference < ui::dialogs::XFilePickerControlAccess > xCtrlAcc(xFP, uno::UNO_QUERY);
2622cdf0e10cSrcweir     sal_Bool bTrue = sal_True;
2623cdf0e10cSrcweir     uno::Any aVal(&bTrue, ::getBooleanCppuType());
2624cdf0e10cSrcweir     xCtrlAcc->setValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, aVal);
2625cdf0e10cSrcweir 
2626cdf0e10cSrcweir     if ( pGrfDlg->Execute() == ERRCODE_NONE )
2627cdf0e10cSrcweir 	{	// ausgewaehlten Filter merken
2628cdf0e10cSrcweir         aFilterName = pGrfDlg->GetCurrentFilter();
2629cdf0e10cSrcweir 		aNewGrfName = INetURLObject::decode( pGrfDlg->GetPath(),
2630cdf0e10cSrcweir 										INET_HEX_ESCAPE,
2631cdf0e10cSrcweir 						   				INetURLObject::DECODE_UNAMBIGUOUS,
2632cdf0e10cSrcweir 										RTL_TEXTENCODING_UTF8 );
2633cdf0e10cSrcweir 		aConnectED.SetModifyFlag();
2634cdf0e10cSrcweir 		aConnectED.SetText( aNewGrfName );
2635cdf0e10cSrcweir 		//Spiegeln zuruecksetzen, da u. U. eine Bitmap
2636cdf0e10cSrcweir 		//gegen eine andere Art von Grafik ausgetauscht worden ist,
2637cdf0e10cSrcweir 		//die nicht gespiegelt werden kann.
2638cdf0e10cSrcweir 		aMirrorVertBox.Check(sal_False);
2639cdf0e10cSrcweir 		aMirrorHorzBox.Check(sal_False);
2640cdf0e10cSrcweir 		aAllPagesRB .Enable(sal_False);
2641cdf0e10cSrcweir 		aLeftPagesRB.Enable(sal_False);
2642cdf0e10cSrcweir 		aRightPagesRB.Enable(sal_False);
2643cdf0e10cSrcweir 		aBmpWin.MirrorHorz(sal_False);
2644cdf0e10cSrcweir 		aBmpWin.MirrorVert(sal_False);
2645cdf0e10cSrcweir 
2646cdf0e10cSrcweir         Graphic aGraphic;
2647cdf0e10cSrcweir         GraphicFilter::LoadGraphic( pGrfDlg->GetPath(), aEmptyStr, aGraphic );
2648cdf0e10cSrcweir         aBmpWin.SetGraphic(aGraphic);
2649cdf0e10cSrcweir 
2650cdf0e10cSrcweir         sal_Bool bEnable = GRAPHIC_BITMAP      == aGraphic.GetType() ||
2651cdf0e10cSrcweir                             GRAPHIC_GDIMETAFILE == aGraphic.GetType();
2652cdf0e10cSrcweir 		aMirrorVertBox.Enable(bEnable);
2653cdf0e10cSrcweir 		aMirrorHorzBox.Enable(bEnable);
2654cdf0e10cSrcweir 		aAllPagesRB .Enable(bEnable);
2655cdf0e10cSrcweir 		aLeftPagesRB.Enable(bEnable);
2656cdf0e10cSrcweir 		aRightPagesRB.Enable(bEnable);
2657cdf0e10cSrcweir 	}
2658cdf0e10cSrcweir 	return 0;
2659cdf0e10cSrcweir }
2660cdf0e10cSrcweir /*--------------------------------------------------------------------
2661cdf0e10cSrcweir 	Beschreibung:
2662cdf0e10cSrcweir  --------------------------------------------------------------------*/
2663cdf0e10cSrcweir 
2664cdf0e10cSrcweir IMPL_LINK( SwGrfExtPage, MirrorHdl, CheckBox *, EMPTYARG )
2665cdf0e10cSrcweir {
2666cdf0e10cSrcweir 	sal_Bool bEnable = aMirrorHorzBox.IsChecked();
2667cdf0e10cSrcweir 
2668cdf0e10cSrcweir 	aBmpWin.MirrorHorz( aMirrorVertBox.IsChecked() );
2669cdf0e10cSrcweir 	aBmpWin.MirrorVert( bEnable );
2670cdf0e10cSrcweir 
2671cdf0e10cSrcweir 	aAllPagesRB .Enable(bEnable);
2672cdf0e10cSrcweir 	aLeftPagesRB.Enable(bEnable);
2673cdf0e10cSrcweir 	aRightPagesRB.Enable(bEnable);
2674cdf0e10cSrcweir 
2675cdf0e10cSrcweir 	if (!aAllPagesRB.IsChecked() && !aLeftPagesRB.IsChecked() && !aRightPagesRB.IsChecked())
2676cdf0e10cSrcweir 		aAllPagesRB.Check();
2677cdf0e10cSrcweir 
2678cdf0e10cSrcweir 	return 0;
2679cdf0e10cSrcweir }
2680cdf0e10cSrcweir 
2681cdf0e10cSrcweir /*--------------------------------------------------------------------
2682cdf0e10cSrcweir 	Beschreibung: BeispielWindow
2683cdf0e10cSrcweir  --------------------------------------------------------------------*/
2684cdf0e10cSrcweir 
2685cdf0e10cSrcweir BmpWindow::BmpWindow( Window* pPar, sal_uInt16 nId,
2686cdf0e10cSrcweir                         const Graphic& rGraphic, const BitmapEx& rBmp, const BitmapEx& rBmpHC ) :
2687cdf0e10cSrcweir 	Window(pPar, SW_RES(nId)),
2688cdf0e10cSrcweir 	aGraphic(rGraphic),
2689cdf0e10cSrcweir     aBmp(rBmp),
2690cdf0e10cSrcweir     aBmpHC(rBmpHC),
2691cdf0e10cSrcweir 	bHorz(sal_False),
2692cdf0e10cSrcweir 	bVert(sal_False),
2693cdf0e10cSrcweir 	bGraphic(sal_False),
2694cdf0e10cSrcweir 	bLeftAlign(sal_False)
2695cdf0e10cSrcweir {
2696cdf0e10cSrcweir     SetBackground();
2697cdf0e10cSrcweir }
2698cdf0e10cSrcweir 
2699cdf0e10cSrcweir void BmpWindow::Paint( const Rectangle& )
2700cdf0e10cSrcweir {
2701cdf0e10cSrcweir 	Point aPntPos;
2702cdf0e10cSrcweir 	Size  aPntSz( GetSizePixel() );
2703cdf0e10cSrcweir 	Size  aGrfSize;
2704cdf0e10cSrcweir 	if(bGraphic)
2705cdf0e10cSrcweir 		aGrfSize = ::GetGraphicSizeTwip(aGraphic, this);
2706cdf0e10cSrcweir     //it should show the default bitmap also if no graphic can be found
2707cdf0e10cSrcweir     if(!aGrfSize.Width() && !aGrfSize.Height())
2708cdf0e10cSrcweir         aGrfSize =  PixelToLogic(aBmp.GetSizePixel());
2709cdf0e10cSrcweir 
2710cdf0e10cSrcweir     long nRelGrf = aGrfSize.Width() * 100L / aGrfSize.Height();
2711cdf0e10cSrcweir     long nRelWin = aPntSz.Width() * 100L / aPntSz.Height();
2712cdf0e10cSrcweir     if(nRelGrf < nRelWin)
2713cdf0e10cSrcweir     {
2714cdf0e10cSrcweir         const long nWidth = aPntSz.Width();
2715cdf0e10cSrcweir         aPntSz.Width() = aPntSz.Height() * nRelGrf /100;
2716cdf0e10cSrcweir         if(!bLeftAlign)
2717cdf0e10cSrcweir             aPntPos.X() += nWidth - aPntSz.Width() ;
2718cdf0e10cSrcweir     }
2719cdf0e10cSrcweir 
2720cdf0e10cSrcweir     if ( bHorz )
2721cdf0e10cSrcweir     {
2722cdf0e10cSrcweir         aPntPos.Y()     += aPntSz.Height();
2723cdf0e10cSrcweir         aPntPos.Y() --;
2724cdf0e10cSrcweir         aPntSz.Height() *= -1;
2725cdf0e10cSrcweir     }
2726cdf0e10cSrcweir     if ( bVert )
2727cdf0e10cSrcweir     {
2728cdf0e10cSrcweir         aPntPos.X()     += aPntSz.Width();
2729cdf0e10cSrcweir         aPntPos.X()--;
2730cdf0e10cSrcweir         aPntSz.Width()  *= -1;
2731cdf0e10cSrcweir     }
2732cdf0e10cSrcweir 
2733cdf0e10cSrcweir     if ( bGraphic )
2734cdf0e10cSrcweir         aGraphic.Draw( this, aPntPos, aPntSz );
2735cdf0e10cSrcweir     else
2736cdf0e10cSrcweir     {
2737cdf0e10cSrcweir         bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
2738cdf0e10cSrcweir         DrawBitmapEx( aPntPos, aPntSz, bHC ? aBmpHC : aBmp );
2739cdf0e10cSrcweir     }
2740cdf0e10cSrcweir }
2741cdf0e10cSrcweir 
2742cdf0e10cSrcweir BmpWindow::~BmpWindow()
2743cdf0e10cSrcweir {
2744cdf0e10cSrcweir }
2745cdf0e10cSrcweir 
2746cdf0e10cSrcweir void BmpWindow::SetGraphic(const Graphic& rGrf)
2747cdf0e10cSrcweir {
2748cdf0e10cSrcweir     aGraphic = rGrf;
2749cdf0e10cSrcweir     Size aGrfSize = ::GetGraphicSizeTwip(aGraphic, this);
2750cdf0e10cSrcweir     bGraphic = aGrfSize.Width() && aGrfSize.Height();
2751cdf0e10cSrcweir     Invalidate();
2752cdf0e10cSrcweir }
2753cdf0e10cSrcweir 
2754cdf0e10cSrcweir /***************************************************************************
2755cdf0e10cSrcweir 	Beschreibung: 	URL und ImageMap an Rahmen einstellen
2756cdf0e10cSrcweir ***************************************************************************/
2757cdf0e10cSrcweir 
2758cdf0e10cSrcweir 
2759cdf0e10cSrcweir SwFrmURLPage::SwFrmURLPage( Window *pParent, const SfxItemSet &rSet ) :
2760cdf0e10cSrcweir 	SfxTabPage(pParent, 	SW_RES(TP_FRM_URL), rSet),
2761cdf0e10cSrcweir     aHyperLinkFL    (this, SW_RES( FL_HYPERLINK )),
2762cdf0e10cSrcweir 	aURLFT      	(this, SW_RES( FT_URL  	 )),
2763cdf0e10cSrcweir 	aURLED			(this, SW_RES( ED_URL 	 )),
2764cdf0e10cSrcweir     aSearchPB       (this, SW_RES( PB_SEARCH  )),
2765cdf0e10cSrcweir 	aNameFT      	(this, SW_RES( FT_NAME   )),
2766cdf0e10cSrcweir 	aNameED			(this, SW_RES( ED_NAME 	 )),
2767cdf0e10cSrcweir 	aFrameFT        (this, SW_RES( FT_FRAME   )),
2768cdf0e10cSrcweir 	aFrameCB        (this, SW_RES( CB_FRAME   )),
2769cdf0e10cSrcweir 
2770cdf0e10cSrcweir     aImageFL        (this, SW_RES( FL_IMAGE   )),
2771cdf0e10cSrcweir 	aServerCB       (this, SW_RES( CB_SERVER  )),
2772cdf0e10cSrcweir 	aClientCB       (this, SW_RES( CB_CLIENT  ))
2773cdf0e10cSrcweir {
2774cdf0e10cSrcweir 	FreeResource();
2775cdf0e10cSrcweir 	aSearchPB.SetClickHdl(LINK(this, SwFrmURLPage, InsertFileHdl));
2776cdf0e10cSrcweir }
2777cdf0e10cSrcweir 
2778cdf0e10cSrcweir /***************************************************************************
2779cdf0e10cSrcweir 	Beschreibung:
2780cdf0e10cSrcweir ***************************************************************************/
2781cdf0e10cSrcweir 
2782cdf0e10cSrcweir SwFrmURLPage::~SwFrmURLPage()
2783cdf0e10cSrcweir {
2784cdf0e10cSrcweir }
2785cdf0e10cSrcweir 
2786cdf0e10cSrcweir /***************************************************************************
2787cdf0e10cSrcweir 	Beschreibung:
2788cdf0e10cSrcweir ***************************************************************************/
2789cdf0e10cSrcweir 
2790cdf0e10cSrcweir void SwFrmURLPage::Reset( const SfxItemSet &rSet )
2791cdf0e10cSrcweir {
2792cdf0e10cSrcweir 	const SfxPoolItem* pItem;
2793cdf0e10cSrcweir 	if ( SFX_ITEM_SET == rSet.GetItemState( SID_DOCFRAME, sal_True, &pItem))
2794cdf0e10cSrcweir 	{
2795cdf0e10cSrcweir 		TargetList* pList = new TargetList;
2796cdf0e10cSrcweir 		((const SfxFrameItem*)pItem)->GetFrame()->GetTargetList(*pList);
2797cdf0e10cSrcweir 		sal_uInt16 nCount = (sal_uInt16)pList->Count();
2798cdf0e10cSrcweir 		if( nCount )
2799cdf0e10cSrcweir 		{
2800cdf0e10cSrcweir 			sal_uInt16 i;
2801cdf0e10cSrcweir 			for ( i = 0; i < nCount; i++ )
2802cdf0e10cSrcweir 			{
2803cdf0e10cSrcweir 				aFrameCB.InsertEntry(*pList->GetObject(i));
2804cdf0e10cSrcweir 			}
2805cdf0e10cSrcweir 			for ( i = nCount; i; i-- )
2806cdf0e10cSrcweir 			{
2807cdf0e10cSrcweir 				delete pList->GetObject( i - 1 );
2808cdf0e10cSrcweir 			}
2809cdf0e10cSrcweir 		}
2810cdf0e10cSrcweir 		delete pList;
2811cdf0e10cSrcweir 	}
2812cdf0e10cSrcweir 
2813cdf0e10cSrcweir 	if ( SFX_ITEM_SET == rSet.GetItemState( RES_URL, sal_True, &pItem ) )
2814cdf0e10cSrcweir 	{
2815cdf0e10cSrcweir 		const SwFmtURL* pFmtURL = (const SwFmtURL*)pItem;
2816cdf0e10cSrcweir 		aURLED.SetText( INetURLObject::decode( pFmtURL->GetURL(),
2817cdf0e10cSrcweir 										INET_HEX_ESCAPE,
2818cdf0e10cSrcweir 						   				INetURLObject::DECODE_UNAMBIGUOUS,
2819cdf0e10cSrcweir 										RTL_TEXTENCODING_UTF8 ));
2820cdf0e10cSrcweir 		aNameED.SetText( pFmtURL->GetName());
2821cdf0e10cSrcweir 
2822cdf0e10cSrcweir 		aClientCB.Enable( pFmtURL->GetMap() != 0 );
2823cdf0e10cSrcweir 		aClientCB.Check ( pFmtURL->GetMap() != 0 );
2824cdf0e10cSrcweir 		aServerCB.Check ( pFmtURL->IsServerMap() );
2825cdf0e10cSrcweir 
2826cdf0e10cSrcweir 		aFrameCB.SetText(pFmtURL->GetTargetFrameName());
2827cdf0e10cSrcweir 		aFrameCB.SaveValue();
2828cdf0e10cSrcweir 	}
2829cdf0e10cSrcweir 	else
2830cdf0e10cSrcweir 		aClientCB.Enable( sal_False );
2831cdf0e10cSrcweir 
2832cdf0e10cSrcweir 	aServerCB.SaveValue();
2833cdf0e10cSrcweir 	aClientCB.SaveValue();
2834cdf0e10cSrcweir }
2835cdf0e10cSrcweir 
2836cdf0e10cSrcweir 
2837cdf0e10cSrcweir 
2838cdf0e10cSrcweir /***************************************************************************
2839cdf0e10cSrcweir 	Beschreibung:
2840cdf0e10cSrcweir ***************************************************************************/
2841cdf0e10cSrcweir 
2842cdf0e10cSrcweir sal_Bool SwFrmURLPage::FillItemSet(SfxItemSet &rSet)
2843cdf0e10cSrcweir {
2844cdf0e10cSrcweir 	sal_Bool bModified = sal_False;
2845cdf0e10cSrcweir 	const SwFmtURL* pOldURL = (SwFmtURL*)GetOldItem(rSet, RES_URL);
2846cdf0e10cSrcweir 	SwFmtURL* pFmtURL;
2847cdf0e10cSrcweir 	if(pOldURL)
2848cdf0e10cSrcweir 		pFmtURL = (SwFmtURL*)pOldURL->Clone();
2849cdf0e10cSrcweir 	else
2850cdf0e10cSrcweir 		pFmtURL = new SwFmtURL();
2851cdf0e10cSrcweir 
2852cdf0e10cSrcweir 	{
2853cdf0e10cSrcweir 		String sText = aURLED.GetText();
2854cdf0e10cSrcweir 
2855cdf0e10cSrcweir 		if( pFmtURL->GetURL() != sText ||
2856cdf0e10cSrcweir 			pFmtURL->GetName() != aNameED.GetText() ||
2857cdf0e10cSrcweir 			aServerCB.IsChecked() != pFmtURL->IsServerMap() )
2858cdf0e10cSrcweir 		{
2859cdf0e10cSrcweir 			pFmtURL->SetURL( sText, aServerCB.IsChecked() );
2860cdf0e10cSrcweir 			pFmtURL->SetName( aNameED.GetText() );
2861cdf0e10cSrcweir 			bModified = sal_True;
2862cdf0e10cSrcweir 		}
2863cdf0e10cSrcweir 	}
2864cdf0e10cSrcweir 
2865cdf0e10cSrcweir 	if(!aClientCB.IsChecked() && pFmtURL->GetMap() != 0)
2866cdf0e10cSrcweir 	{
2867cdf0e10cSrcweir 		pFmtURL->SetMap(0);
2868cdf0e10cSrcweir 		bModified = sal_True;
2869cdf0e10cSrcweir 	}
2870cdf0e10cSrcweir 
2871cdf0e10cSrcweir 	if(pFmtURL->GetTargetFrameName() != aFrameCB.GetText())
2872cdf0e10cSrcweir 	{
2873cdf0e10cSrcweir 		pFmtURL->SetTargetFrameName(aFrameCB.GetText());
2874cdf0e10cSrcweir 		bModified = sal_True;
2875cdf0e10cSrcweir 	}
2876cdf0e10cSrcweir 	rSet.Put(*pFmtURL);
2877cdf0e10cSrcweir 	delete pFmtURL;
2878cdf0e10cSrcweir 	return bModified;
2879cdf0e10cSrcweir }
2880cdf0e10cSrcweir 
2881cdf0e10cSrcweir /***************************************************************************
2882cdf0e10cSrcweir 	Beschreibung:
2883cdf0e10cSrcweir ***************************************************************************/
2884cdf0e10cSrcweir 
2885cdf0e10cSrcweir SfxTabPage* SwFrmURLPage::Create(Window *pParent, const SfxItemSet &rSet)
2886cdf0e10cSrcweir {
2887cdf0e10cSrcweir 	return new SwFrmURLPage( pParent, rSet );
2888cdf0e10cSrcweir }
2889cdf0e10cSrcweir 
2890cdf0e10cSrcweir /***************************************************************************
2891cdf0e10cSrcweir 	Beschreibung:
2892cdf0e10cSrcweir ***************************************************************************/
2893cdf0e10cSrcweir 
2894cdf0e10cSrcweir IMPL_LINK( SwFrmURLPage, InsertFileHdl, PushButton *, EMPTYARG )
2895cdf0e10cSrcweir {
2896cdf0e10cSrcweir     FileDialogHelper aDlgHelper( ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
2897cdf0e10cSrcweir     uno::Reference < ui::dialogs::XFilePicker > xFP = aDlgHelper.GetFilePicker();
2898cdf0e10cSrcweir 
2899cdf0e10cSrcweir     try
2900cdf0e10cSrcweir     {
2901cdf0e10cSrcweir         String sTemp(aURLED.GetText());
2902cdf0e10cSrcweir         if(sTemp.Len())
2903cdf0e10cSrcweir             xFP->setDisplayDirectory(sTemp);
2904cdf0e10cSrcweir     }
2905cdf0e10cSrcweir     catch( const uno::Exception& rEx )
2906cdf0e10cSrcweir     {
2907cdf0e10cSrcweir         (void) rEx;
2908cdf0e10cSrcweir     }
2909cdf0e10cSrcweir     if( aDlgHelper.Execute() == ERRCODE_NONE )
2910cdf0e10cSrcweir     {
2911cdf0e10cSrcweir         aURLED.SetText( xFP->getFiles().getConstArray()[0] );
2912cdf0e10cSrcweir     }
2913cdf0e10cSrcweir 
2914cdf0e10cSrcweir 	return 0;
2915cdf0e10cSrcweir }
2916cdf0e10cSrcweir 
2917cdf0e10cSrcweir /* -----------------------------03.11.00 10:56--------------------------------
2918cdf0e10cSrcweir 
2919cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
2920cdf0e10cSrcweir void lcl_Move(Window& rWin, sal_Int32 nDiff)
2921cdf0e10cSrcweir {
2922cdf0e10cSrcweir 	Point aPos(rWin.GetPosPixel());
2923cdf0e10cSrcweir 	aPos.Y() -= nDiff;
2924cdf0e10cSrcweir 	rWin.SetPosPixel(aPos);
2925cdf0e10cSrcweir }
2926cdf0e10cSrcweir 
2927cdf0e10cSrcweir /*-----------------13.11.96 13.15-------------------
2928cdf0e10cSrcweir 
2929cdf0e10cSrcweir --------------------------------------------------*/
2930cdf0e10cSrcweir 
2931cdf0e10cSrcweir SwFrmAddPage::SwFrmAddPage(Window *pParent, const SfxItemSet &rSet ) :
2932cdf0e10cSrcweir 	SfxTabPage(pParent, 	SW_RES(TP_FRM_ADD), rSet),
2933cdf0e10cSrcweir 
2934cdf0e10cSrcweir     aNamesFL           (this, SW_RES(FL_NAME)),
2935cdf0e10cSrcweir     aNameFT            (this, SW_RES(FT_NAME)),
2936cdf0e10cSrcweir 	aNameED            (this, SW_RES(ED_NAME)),
2937cdf0e10cSrcweir 	aAltNameFT         (this, SW_RES(FT_ALT_NAME)),
2938cdf0e10cSrcweir 	aAltNameED         (this, SW_RES(ED_ALT_NAME)),
2939cdf0e10cSrcweir 	aPrevFT            (this, SW_RES(FT_PREV)),
2940cdf0e10cSrcweir     aPrevLB            (this, SW_RES(LB_PREV)),
2941cdf0e10cSrcweir 	aNextFT            (this, SW_RES(FT_NEXT)),
2942cdf0e10cSrcweir     aNextLB            (this, SW_RES(LB_NEXT)),
2943cdf0e10cSrcweir 
2944cdf0e10cSrcweir     aProtectFL         (this, SW_RES(FL_PROTECT)),
2945cdf0e10cSrcweir     aProtectContentCB  (this, SW_RES(CB_PROTECT_CONTENT)),
2946cdf0e10cSrcweir     aProtectFrameCB    (this, SW_RES(CB_PROTECT_FRAME)),
2947cdf0e10cSrcweir     aProtectSizeCB     (this, SW_RES(CB_PROTECT_SIZE)),
2948cdf0e10cSrcweir     aExtFL             (this, SW_RES(FL_EXT)),
2949cdf0e10cSrcweir 
2950cdf0e10cSrcweir     aEditInReadonlyCB  (this, SW_RES(CB_EDIT_IN_READONLY)),
2951cdf0e10cSrcweir     aPrintFrameCB      (this, SW_RES(CB_PRINT_FRAME)),
2952cdf0e10cSrcweir     aTextFlowFT        (this, SW_RES(FT_TEXTFLOW)),
2953cdf0e10cSrcweir 	aTextFlowLB		   (this, SW_RES(LB_TEXTFLOW)),
2954cdf0e10cSrcweir 
2955cdf0e10cSrcweir     pWrtSh(0),
2956cdf0e10cSrcweir 
2957cdf0e10cSrcweir     nDlgType(0),
2958cdf0e10cSrcweir     bHtmlMode(sal_False),
2959cdf0e10cSrcweir     bFormat(sal_False),
2960cdf0e10cSrcweir     bNew(sal_False)
2961cdf0e10cSrcweir {
2962cdf0e10cSrcweir 	FreeResource();
2963cdf0e10cSrcweir 
2964cdf0e10cSrcweir }
2965cdf0e10cSrcweir 
2966cdf0e10cSrcweir /*-----------------13.11.96 13.15-------------------
2967cdf0e10cSrcweir 
2968cdf0e10cSrcweir --------------------------------------------------*/
2969cdf0e10cSrcweir 
2970cdf0e10cSrcweir SwFrmAddPage::~SwFrmAddPage()
2971cdf0e10cSrcweir {
2972cdf0e10cSrcweir }
2973cdf0e10cSrcweir 
2974cdf0e10cSrcweir /*-----------------13.11.96 13.15-------------------
2975cdf0e10cSrcweir 
2976cdf0e10cSrcweir --------------------------------------------------*/
2977cdf0e10cSrcweir 
2978cdf0e10cSrcweir SfxTabPage* SwFrmAddPage::Create(Window *pParent, const SfxItemSet &rSet)
2979cdf0e10cSrcweir {
2980cdf0e10cSrcweir 	return new SwFrmAddPage(pParent, rSet);
2981cdf0e10cSrcweir }
2982cdf0e10cSrcweir 
2983cdf0e10cSrcweir /*-----------------13.11.96 13.14-------------------
2984cdf0e10cSrcweir 
2985cdf0e10cSrcweir --------------------------------------------------*/
2986cdf0e10cSrcweir 
2987cdf0e10cSrcweir void SwFrmAddPage::Reset(const SfxItemSet &rSet )
2988cdf0e10cSrcweir {
2989cdf0e10cSrcweir 	const SfxPoolItem* pItem;
2990cdf0e10cSrcweir 	sal_uInt16 nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current());
2991cdf0e10cSrcweir 	bHtmlMode = nHtmlMode & HTMLMODE_ON ? sal_True : sal_False;
2992cdf0e10cSrcweir 	if(bHtmlMode)
2993cdf0e10cSrcweir 	{
2994cdf0e10cSrcweir 		aProtectContentCB .Hide();
2995cdf0e10cSrcweir 		aProtectFrameCB   .Hide();
2996cdf0e10cSrcweir 		aProtectSizeCB    .Hide();
2997cdf0e10cSrcweir 		aEditInReadonlyCB .Hide();
2998cdf0e10cSrcweir 		aPrintFrameCB     .Hide();
2999cdf0e10cSrcweir         aExtFL            .Hide();
3000cdf0e10cSrcweir         aProtectFL.Hide();
3001cdf0e10cSrcweir 	}
3002cdf0e10cSrcweir 	if ( DLG_FRM_GRF == nDlgType || DLG_FRM_OLE == nDlgType )
3003cdf0e10cSrcweir 	{
3004cdf0e10cSrcweir 		aEditInReadonlyCB.Hide();
3005cdf0e10cSrcweir 		aPrintFrameCB.SetPosPixel(aEditInReadonlyCB.GetPosPixel());
3006cdf0e10cSrcweir 	}
3007cdf0e10cSrcweir 
3008cdf0e10cSrcweir 	if(SFX_ITEM_SET == rSet.GetItemState(FN_SET_FRM_ALT_NAME, sal_False, &pItem))
3009cdf0e10cSrcweir 	{
3010cdf0e10cSrcweir 		aAltNameED.SetText(((const SfxStringItem*)pItem)->GetValue());
3011cdf0e10cSrcweir 		aAltNameED.SaveValue();
3012cdf0e10cSrcweir 	}
3013cdf0e10cSrcweir 
3014cdf0e10cSrcweir 	if(!bFormat)
3015cdf0e10cSrcweir 	{
3016cdf0e10cSrcweir 		// Grafik einfuegen - Eigenschaften
3017cdf0e10cSrcweir 		// bNew ist nicht gesetzt, deswegen ueber Selektion erkennen
3018cdf0e10cSrcweir 		String aTmpName1;
3019cdf0e10cSrcweir 		if(SFX_ITEM_SET == rSet.GetItemState(FN_SET_FRM_NAME, sal_False, &pItem))
3020cdf0e10cSrcweir 		{
3021cdf0e10cSrcweir 			aTmpName1 = ((const SfxStringItem*)pItem)->GetValue();
3022cdf0e10cSrcweir 		}
3023cdf0e10cSrcweir 
3024cdf0e10cSrcweir 		DBG_ASSERT(pWrtSh, "keine Shell?");
3025cdf0e10cSrcweir 		if( bNew || !aTmpName1.Len() )
3026cdf0e10cSrcweir 
3027cdf0e10cSrcweir 			switch( nDlgType )
3028cdf0e10cSrcweir 			{
3029cdf0e10cSrcweir 				case DLG_FRM_GRF:
3030cdf0e10cSrcweir 					aTmpName1 = pWrtSh->GetUniqueGrfName();
3031cdf0e10cSrcweir 					break;
3032cdf0e10cSrcweir 				case DLG_FRM_OLE:
3033cdf0e10cSrcweir 					aTmpName1 = pWrtSh->GetUniqueOLEName();
3034cdf0e10cSrcweir 					break;
3035cdf0e10cSrcweir 				default:
3036cdf0e10cSrcweir 					aTmpName1 = pWrtSh->GetUniqueFrameName();
3037cdf0e10cSrcweir 					break;
3038cdf0e10cSrcweir 			}
3039cdf0e10cSrcweir 
3040cdf0e10cSrcweir 		aNameED.SetText( aTmpName1 );
3041cdf0e10cSrcweir 		aNameED.SaveValue();
3042cdf0e10cSrcweir 	}
3043cdf0e10cSrcweir 	else
3044cdf0e10cSrcweir 	{
3045cdf0e10cSrcweir 		aNameED.Enable( sal_False );
3046cdf0e10cSrcweir 		aAltNameED.Enable(sal_False);
3047cdf0e10cSrcweir 		aNameFT.Enable( sal_False );
3048cdf0e10cSrcweir 		aAltNameFT.Enable(sal_False);
3049cdf0e10cSrcweir         aNamesFL.Enable(sal_False);
3050cdf0e10cSrcweir 	}
3051cdf0e10cSrcweir     if(nDlgType == DLG_FRM_STD && aAltNameFT.IsVisible())
3052cdf0e10cSrcweir 	{
3053cdf0e10cSrcweir 		aAltNameFT.Hide();
3054cdf0e10cSrcweir 		aAltNameED.Hide();
3055cdf0e10cSrcweir         //move all controls one step up
3056cdf0e10cSrcweir         Window* aWindows[] =
3057cdf0e10cSrcweir         {
3058cdf0e10cSrcweir             &aPrevFT,
3059cdf0e10cSrcweir             &aPrevLB,
3060cdf0e10cSrcweir             &aNextFT,
3061cdf0e10cSrcweir             &aNextLB,
3062cdf0e10cSrcweir             &aNamesFL,
3063cdf0e10cSrcweir             &aProtectContentCB,
3064cdf0e10cSrcweir             &aProtectFrameCB,
3065cdf0e10cSrcweir             &aProtectSizeCB,
3066cdf0e10cSrcweir             &aProtectFL,
3067cdf0e10cSrcweir             &aEditInReadonlyCB,
3068cdf0e10cSrcweir             &aPrintFrameCB,
3069cdf0e10cSrcweir             &aTextFlowFT,
3070cdf0e10cSrcweir             &aTextFlowLB,
3071cdf0e10cSrcweir             &aExtFL,
3072cdf0e10cSrcweir             0
3073cdf0e10cSrcweir         };
3074cdf0e10cSrcweir         sal_Int32 nOffset = aAltNameED.GetPosPixel().Y() - aNameED.GetPosPixel().Y();
3075cdf0e10cSrcweir         sal_Int32 nIdx = 0;
3076cdf0e10cSrcweir         while(aWindows[nIdx])
3077cdf0e10cSrcweir         {
3078cdf0e10cSrcweir             lcl_Move(*aWindows[nIdx++], nOffset);
3079cdf0e10cSrcweir         }
3080cdf0e10cSrcweir 	}
3081cdf0e10cSrcweir 	else
3082cdf0e10cSrcweir 	{
3083cdf0e10cSrcweir 		aNameED.SetModifyHdl(LINK(this, SwFrmAddPage, EditModifyHdl));
3084cdf0e10cSrcweir 	}
3085cdf0e10cSrcweir 
3086cdf0e10cSrcweir 	if (!bNew)
3087cdf0e10cSrcweir 	{
3088cdf0e10cSrcweir 		SwFrmFmt* pFmt = pWrtSh->GetFlyFrmFmt();
3089cdf0e10cSrcweir 
3090cdf0e10cSrcweir 		if (pFmt)
3091cdf0e10cSrcweir 		{
3092cdf0e10cSrcweir 			const SwFmtChain &rChain = pFmt->GetChain();
3093cdf0e10cSrcweir 			const SwFlyFrmFmt* pFlyFmt;
3094cdf0e10cSrcweir             String sNextChain, sPrevChain;
3095cdf0e10cSrcweir 			if ((pFlyFmt = rChain.GetPrev()) != 0)
3096cdf0e10cSrcweir 			{
3097cdf0e10cSrcweir                 sPrevChain = pFlyFmt->GetName();
3098cdf0e10cSrcweir 			}
3099cdf0e10cSrcweir 
3100cdf0e10cSrcweir 			if ((pFlyFmt = rChain.GetNext()) != 0)
3101cdf0e10cSrcweir 			{
3102cdf0e10cSrcweir                 sNextChain = pFlyFmt->GetName();
3103cdf0e10cSrcweir 			}
3104cdf0e10cSrcweir             //determine chainable frames
3105cdf0e10cSrcweir             ::std::vector< String > aPrevPageFrames;
3106cdf0e10cSrcweir             ::std::vector< String > aThisPageFrames;
3107cdf0e10cSrcweir             ::std::vector< String > aNextPageFrames;
3108cdf0e10cSrcweir             ::std::vector< String > aRemainFrames;
3109cdf0e10cSrcweir             pWrtSh->GetConnectableFrmFmts(*pFmt, sNextChain, sal_False,
3110cdf0e10cSrcweir                             aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
3111cdf0e10cSrcweir             lcl_InsertVectors(aPrevLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
3112cdf0e10cSrcweir             if(sPrevChain.Len())
3113cdf0e10cSrcweir             {
3114cdf0e10cSrcweir                 if(LISTBOX_ENTRY_NOTFOUND == aPrevLB.GetEntryPos(sPrevChain))
3115cdf0e10cSrcweir                     aPrevLB.InsertEntry(sPrevChain, 1);
3116cdf0e10cSrcweir                 aPrevLB.SelectEntry(sPrevChain);
3117cdf0e10cSrcweir             }
3118cdf0e10cSrcweir             else
3119cdf0e10cSrcweir                 aPrevLB.SelectEntryPos(0);
3120cdf0e10cSrcweir             aPrevPageFrames.erase(aPrevPageFrames.begin(), aPrevPageFrames.end());
3121cdf0e10cSrcweir             aNextPageFrames.erase(aNextPageFrames.begin(), aNextPageFrames.end());
3122cdf0e10cSrcweir             aThisPageFrames.erase(aThisPageFrames.begin(), aThisPageFrames.end());
3123cdf0e10cSrcweir             aRemainFrames.erase(aRemainFrames.begin(), aRemainFrames.end());
3124cdf0e10cSrcweir 
3125cdf0e10cSrcweir 
3126cdf0e10cSrcweir             pWrtSh->GetConnectableFrmFmts(*pFmt, sPrevChain, sal_True,
3127cdf0e10cSrcweir                             aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
3128cdf0e10cSrcweir             lcl_InsertVectors(aNextLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
3129cdf0e10cSrcweir             if(sNextChain.Len())
3130cdf0e10cSrcweir             {
3131cdf0e10cSrcweir                 if(LISTBOX_ENTRY_NOTFOUND == aNextLB.GetEntryPos(sNextChain))
3132cdf0e10cSrcweir                     aNextLB.InsertEntry(sNextChain, 1);
3133cdf0e10cSrcweir                 aNextLB.SelectEntry(sNextChain);
3134cdf0e10cSrcweir             }
3135cdf0e10cSrcweir             else
3136cdf0e10cSrcweir                 aNextLB.SelectEntryPos(0);
3137cdf0e10cSrcweir             Link aLink(LINK(this, SwFrmAddPage, ChainModifyHdl));
3138cdf0e10cSrcweir             aPrevLB.SetSelectHdl(aLink);
3139cdf0e10cSrcweir             aNextLB.SetSelectHdl(aLink);
3140cdf0e10cSrcweir         }
3141cdf0e10cSrcweir 	}
3142cdf0e10cSrcweir 	// Pos Protected
3143cdf0e10cSrcweir 	const SvxProtectItem& rProt = (const SvxProtectItem& )rSet.Get(RES_PROTECT);
3144cdf0e10cSrcweir 	aProtectFrameCB.Check(rProt.IsPosProtected());
3145cdf0e10cSrcweir 	aProtectContentCB.Check(rProt.IsCntntProtected());
3146cdf0e10cSrcweir 	aProtectSizeCB.Check(rProt.IsSizeProtected());
3147cdf0e10cSrcweir 
3148cdf0e10cSrcweir 	const SwFmtEditInReadonly& rEdit = (const SwFmtEditInReadonly& )rSet.Get(RES_EDIT_IN_READONLY);
3149cdf0e10cSrcweir 	aEditInReadonlyCB.Check(rEdit.GetValue());			aEditInReadonlyCB.SaveValue();
3150cdf0e10cSrcweir 
3151cdf0e10cSrcweir 	// drucken
3152cdf0e10cSrcweir 	const SvxPrintItem& rPrt = (const SvxPrintItem&)rSet.Get(RES_PRINT);
3153cdf0e10cSrcweir 	aPrintFrameCB.Check(rPrt.GetValue());				aPrintFrameCB.SaveValue();
3154cdf0e10cSrcweir 
3155cdf0e10cSrcweir 	// textflow
3156cdf0e10cSrcweir 	SfxItemState eState;
3157cdf0e10cSrcweir     if( (!bHtmlMode || (0 != (nHtmlMode&HTMLMODE_SOME_STYLES)))
3158cdf0e10cSrcweir             && DLG_FRM_GRF != nDlgType && DLG_FRM_OLE != nDlgType &&
3159cdf0e10cSrcweir 		SFX_ITEM_UNKNOWN != ( eState = rSet.GetItemState(
3160cdf0e10cSrcweir                                         RES_FRAMEDIR, sal_True )) )
3161cdf0e10cSrcweir 	{
3162cdf0e10cSrcweir 		aTextFlowFT.Show();
3163cdf0e10cSrcweir 		aTextFlowLB.Show();
3164cdf0e10cSrcweir 
3165cdf0e10cSrcweir         //vertical text flow is not possible in HTML
3166cdf0e10cSrcweir         if(bHtmlMode)
3167cdf0e10cSrcweir         {
3168cdf0e10cSrcweir             sal_uLong nData = FRMDIR_VERT_TOP_RIGHT;
3169cdf0e10cSrcweir             aTextFlowLB.RemoveEntry(aTextFlowLB.GetEntryPos((void*)nData));
3170cdf0e10cSrcweir         }
3171cdf0e10cSrcweir         sal_uInt16 nPos, nVal = ((SvxFrameDirectionItem&)rSet.Get(RES_FRAMEDIR)).GetValue();
3172cdf0e10cSrcweir 		for( nPos = aTextFlowLB.GetEntryCount(); nPos; )
3173cdf0e10cSrcweir 			if( (sal_uInt16)(long)aTextFlowLB.GetEntryData( --nPos ) == nVal )
3174cdf0e10cSrcweir 				break;
3175cdf0e10cSrcweir 		aTextFlowLB.SelectEntryPos( nPos );
3176cdf0e10cSrcweir 		aTextFlowLB.SaveValue();
3177cdf0e10cSrcweir 	}
3178cdf0e10cSrcweir 	else
3179cdf0e10cSrcweir 	{
3180cdf0e10cSrcweir 		aTextFlowFT.Hide();
3181cdf0e10cSrcweir 		aTextFlowLB.Hide();
3182cdf0e10cSrcweir 	}
3183cdf0e10cSrcweir }
3184cdf0e10cSrcweir 
3185cdf0e10cSrcweir /*-----------------13.11.96 13.20-------------------
3186cdf0e10cSrcweir 
3187cdf0e10cSrcweir --------------------------------------------------*/
3188cdf0e10cSrcweir 
3189cdf0e10cSrcweir sal_Bool SwFrmAddPage::FillItemSet(SfxItemSet &rSet)
3190cdf0e10cSrcweir {
3191cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
3192cdf0e10cSrcweir 	if (aNameED.GetText() != aNameED.GetSavedValue())
3193cdf0e10cSrcweir 		bRet |= 0 != rSet.Put(SfxStringItem(FN_SET_FRM_NAME, aNameED.GetText()));
3194cdf0e10cSrcweir 	if (aAltNameED.GetText()  != aAltNameED.GetSavedValue())
3195cdf0e10cSrcweir 		bRet |= 0 != rSet.Put(SfxStringItem(FN_SET_FRM_ALT_NAME, aAltNameED.GetText()));
3196cdf0e10cSrcweir 
3197cdf0e10cSrcweir 	const SfxPoolItem* pOldItem;
3198cdf0e10cSrcweir 	SvxProtectItem aProt ( (const SvxProtectItem& )GetItemSet().Get(RES_PROTECT) );
3199cdf0e10cSrcweir 	aProt.SetCntntProtect( aProtectContentCB.IsChecked() );
3200cdf0e10cSrcweir 	aProt.SetSizeProtect ( aProtectSizeCB.IsChecked() );
3201cdf0e10cSrcweir 	aProt.SetPosProtect  ( aProtectFrameCB.IsChecked() );
3202cdf0e10cSrcweir 	if ( 0 == (pOldItem = GetOldItem(rSet, FN_SET_PROTECT)) ||
3203cdf0e10cSrcweir 				aProt != *pOldItem )
3204cdf0e10cSrcweir 		bRet |= 0 != rSet.Put( aProt);
3205cdf0e10cSrcweir 
3206cdf0e10cSrcweir 	sal_Bool bChecked;
3207cdf0e10cSrcweir 	if ( (bChecked = aEditInReadonlyCB.IsChecked()) != aEditInReadonlyCB.GetSavedValue() )
3208cdf0e10cSrcweir 		bRet |= 0 != rSet.Put( SwFmtEditInReadonly( RES_EDIT_IN_READONLY, bChecked));
3209cdf0e10cSrcweir 
3210cdf0e10cSrcweir 	if ( (bChecked = aPrintFrameCB.IsChecked()) != aPrintFrameCB.GetSavedValue() )
3211cdf0e10cSrcweir 		bRet |= 0 != rSet.Put( SvxPrintItem( RES_PRINT, bChecked));
3212cdf0e10cSrcweir 
3213cdf0e10cSrcweir 	// textflow
3214cdf0e10cSrcweir 	if( aTextFlowLB.IsVisible() )
3215cdf0e10cSrcweir 	{
3216cdf0e10cSrcweir 		sal_uInt16 nPos = aTextFlowLB.GetSelectEntryPos();
3217cdf0e10cSrcweir 		if( nPos != aTextFlowLB.GetSavedValue() )
3218cdf0e10cSrcweir 		{
3219cdf0e10cSrcweir 			nPos = (sal_uInt16)(long)aTextFlowLB.GetEntryData( nPos );
3220cdf0e10cSrcweir 			bRet |= 0 != rSet.Put( SvxFrameDirectionItem(
3221cdf0e10cSrcweir 									(SvxFrameDirection)nPos, RES_FRAMEDIR ));
3222cdf0e10cSrcweir 		}
3223cdf0e10cSrcweir 	}
3224cdf0e10cSrcweir     if(pWrtSh)
3225cdf0e10cSrcweir     {
3226cdf0e10cSrcweir         const SwFrmFmt* pFmt = pWrtSh->GetFlyFrmFmt();
3227cdf0e10cSrcweir 		if (pFmt)
3228cdf0e10cSrcweir 		{
3229cdf0e10cSrcweir             String sCurrentPrevChain, sCurrentNextChain;
3230cdf0e10cSrcweir             if(aPrevLB.GetSelectEntryPos())
3231cdf0e10cSrcweir                 sCurrentPrevChain = aPrevLB.GetSelectEntry();
3232cdf0e10cSrcweir             if(aNextLB.GetSelectEntryPos())
3233cdf0e10cSrcweir                 sCurrentNextChain = aNextLB.GetSelectEntry();
3234cdf0e10cSrcweir             const SwFmtChain &rChain = pFmt->GetChain();
3235cdf0e10cSrcweir 			const SwFlyFrmFmt* pFlyFmt;
3236cdf0e10cSrcweir             String sNextChain, sPrevChain;
3237cdf0e10cSrcweir 			if ((pFlyFmt = rChain.GetPrev()) != 0)
3238cdf0e10cSrcweir                 sPrevChain = pFlyFmt->GetName();
3239cdf0e10cSrcweir 
3240cdf0e10cSrcweir 			if ((pFlyFmt = rChain.GetNext()) != 0)
3241cdf0e10cSrcweir                 sNextChain = pFlyFmt->GetName();
3242cdf0e10cSrcweir             if(sPrevChain != sCurrentPrevChain)
3243cdf0e10cSrcweir                 bRet |= 0 != rSet.Put(SfxStringItem(FN_PARAM_CHAIN_PREVIOUS, sCurrentPrevChain));
3244cdf0e10cSrcweir             if(sNextChain != sCurrentNextChain)
3245cdf0e10cSrcweir                 bRet |= 0 != rSet.Put(SfxStringItem(FN_PARAM_CHAIN_NEXT, sCurrentNextChain));
3246cdf0e10cSrcweir         }
3247cdf0e10cSrcweir     }
3248cdf0e10cSrcweir     return bRet;
3249cdf0e10cSrcweir }
3250cdf0e10cSrcweir 
3251cdf0e10cSrcweir /*-----------------13.11.96 15.05-------------------
3252cdf0e10cSrcweir 
3253cdf0e10cSrcweir --------------------------------------------------*/
3254cdf0e10cSrcweir 
3255cdf0e10cSrcweir sal_uInt16* SwFrmAddPage::GetRanges()
3256cdf0e10cSrcweir {
3257cdf0e10cSrcweir 	return aAddPgRg;
3258cdf0e10cSrcweir }
3259cdf0e10cSrcweir 
3260cdf0e10cSrcweir /*-----------------13.11.96 16.12-------------------
3261cdf0e10cSrcweir 
3262cdf0e10cSrcweir --------------------------------------------------*/
3263cdf0e10cSrcweir 
3264cdf0e10cSrcweir IMPL_LINK(SwFrmAddPage, EditModifyHdl, Edit*, EMPTYARG)
3265cdf0e10cSrcweir {
3266cdf0e10cSrcweir 	sal_Bool bEnable = 0 != aNameED.GetText().Len();
3267cdf0e10cSrcweir 	aAltNameED.Enable(bEnable);
3268cdf0e10cSrcweir 	aAltNameFT.Enable(bEnable);
3269cdf0e10cSrcweir 
3270cdf0e10cSrcweir 	return 0;
3271cdf0e10cSrcweir }
3272cdf0e10cSrcweir //-----------------------------------------------------------------------------
3273cdf0e10cSrcweir void	SwFrmAddPage::SetFormatUsed(sal_Bool bFmt)
3274cdf0e10cSrcweir {
3275cdf0e10cSrcweir 	bFormat  = bFmt;
3276cdf0e10cSrcweir 	if(bFormat)
3277cdf0e10cSrcweir 	{
3278cdf0e10cSrcweir 		aNameFT.Show(sal_False);
3279cdf0e10cSrcweir 		aNameED.Show(sal_False);
3280cdf0e10cSrcweir 		aAltNameFT.Show(sal_False);
3281cdf0e10cSrcweir 		aAltNameED.Show(sal_False);
3282cdf0e10cSrcweir 		aPrevFT.Show(sal_False);
3283cdf0e10cSrcweir         aPrevLB.Show(sal_False);
3284cdf0e10cSrcweir 		aNextFT.Show(sal_False);
3285cdf0e10cSrcweir         aNextLB.Show(sal_False);
3286cdf0e10cSrcweir         aNamesFL.Show(sal_False);
3287cdf0e10cSrcweir 
3288cdf0e10cSrcweir         sal_Int32 nDiff = aExtFL.GetPosPixel().Y() - aNamesFL.GetPosPixel().Y();
3289cdf0e10cSrcweir         Window* aWindows[] =
3290cdf0e10cSrcweir         {
3291cdf0e10cSrcweir             &aProtectContentCB,
3292cdf0e10cSrcweir             &aProtectFrameCB,
3293cdf0e10cSrcweir             &aProtectSizeCB,
3294cdf0e10cSrcweir             &aProtectFL,
3295cdf0e10cSrcweir             &aEditInReadonlyCB,
3296cdf0e10cSrcweir             &aPrintFrameCB,
3297cdf0e10cSrcweir             &aExtFL,
3298cdf0e10cSrcweir             &aTextFlowFT,
3299cdf0e10cSrcweir             &aTextFlowLB,
3300cdf0e10cSrcweir             0
3301cdf0e10cSrcweir         };
3302cdf0e10cSrcweir         sal_Int32 nIdx = 0;
3303cdf0e10cSrcweir         while(aWindows[nIdx])
3304cdf0e10cSrcweir             lcl_Move(*aWindows[nIdx++], nDiff);
3305cdf0e10cSrcweir 	}
3306cdf0e10cSrcweir }
3307cdf0e10cSrcweir /* -----------------------------08.08.2002 16:24------------------------------
3308cdf0e10cSrcweir 
3309cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
3310cdf0e10cSrcweir IMPL_LINK(SwFrmAddPage, ChainModifyHdl, ListBox*, pBox)
3311cdf0e10cSrcweir {
3312cdf0e10cSrcweir     String sCurrentPrevChain, sCurrentNextChain;
3313cdf0e10cSrcweir     if(aPrevLB.GetSelectEntryPos())
3314cdf0e10cSrcweir         sCurrentPrevChain = aPrevLB.GetSelectEntry();
3315cdf0e10cSrcweir     if(aNextLB.GetSelectEntryPos())
3316cdf0e10cSrcweir         sCurrentNextChain = aNextLB.GetSelectEntry();
3317cdf0e10cSrcweir     SwFrmFmt* pFmt = pWrtSh->GetFlyFrmFmt();
3318cdf0e10cSrcweir     if (pFmt)
3319cdf0e10cSrcweir     {
3320cdf0e10cSrcweir         sal_Bool bNextBox = &aNextLB == pBox;
3321cdf0e10cSrcweir         ListBox& rChangeLB = bNextBox ? aPrevLB : aNextLB;
3322cdf0e10cSrcweir         for(sal_uInt16 nEntry = rChangeLB.GetEntryCount(); nEntry > 1; nEntry--)
3323cdf0e10cSrcweir             rChangeLB.RemoveEntry(nEntry - 1);
3324cdf0e10cSrcweir         //determine chainable frames
3325cdf0e10cSrcweir         ::std::vector< String > aPrevPageFrames;
3326cdf0e10cSrcweir         ::std::vector< String > aThisPageFrames;
3327cdf0e10cSrcweir         ::std::vector< String > aNextPageFrames;
3328cdf0e10cSrcweir         ::std::vector< String > aRemainFrames;
3329cdf0e10cSrcweir         pWrtSh->GetConnectableFrmFmts(*pFmt, bNextBox ? sCurrentNextChain : sCurrentPrevChain, !bNextBox,
3330cdf0e10cSrcweir                         aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
3331cdf0e10cSrcweir         lcl_InsertVectors(rChangeLB,
3332cdf0e10cSrcweir                 aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
3333cdf0e10cSrcweir         String sToSelect = bNextBox ? sCurrentPrevChain : sCurrentNextChain;
3334cdf0e10cSrcweir         if(rChangeLB.GetEntryPos(sToSelect) != LISTBOX_ENTRY_NOTFOUND)
3335cdf0e10cSrcweir             rChangeLB.SelectEntry(sToSelect);
3336cdf0e10cSrcweir         else
3337cdf0e10cSrcweir             rChangeLB.SelectEntryPos(0);
3338cdf0e10cSrcweir 
3339cdf0e10cSrcweir     }
3340cdf0e10cSrcweir     return 0;
3341cdf0e10cSrcweir }
3342